1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* 3 * This file is part of the libqxp project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 */ 9 10 #include "QXPHeader.h" 11 12 #include "libqxp_utils.h" 13 14 namespace libqxp 15 { 16 QXPHeader(const boost::optional<QXPDocument::Type> & fileType)17QXPHeader::QXPHeader(const boost::optional<QXPDocument::Type> &fileType) 18 : m_proc(0) 19 , m_version(QXPVersion::UNKNOWN) 20 , m_language(0) 21 , m_fileType(fileType) 22 { 23 } 24 isLittleEndian() const25bool QXPHeader::isLittleEndian() const 26 { 27 return m_proc == 'I'; 28 } 29 isBigEndian() const30bool QXPHeader::isBigEndian() const 31 { 32 return !isLittleEndian(); 33 } 34 version() const35unsigned QXPHeader::version() const 36 { 37 return m_version; 38 } 39 encoding() const40const char *QXPHeader::encoding() const 41 { 42 switch (m_language) 43 { 44 default: 45 QXP_DEBUG_MSG(("Unknown language %u\n", m_language)); 46 QXP_FALLTHROUGH; // pick a default 47 case 0x33: 48 return isLittleEndian() ? "cp1252" : "macroman"; 49 } 50 } 51 52 } 53 54 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 55