# a_osloader.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       a_osloader.h
    00003 ///             OS files parser (multi ALX files parser)
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2010, Nicolas VIVIEN
    00008     Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00009
    00010     This program is free software; you can redistribute it and/or modify
    00011     it under the terms of the GNU General Public License as published by
    00012     the Free Software Foundation; either version 2 of the License, or
    00013     (at your option) any later version.
    00014
    00015     This program is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00018
    00019     See the GNU General Public License in the COPYING file at the
    00020     root directory of this project for more details.
    00021 */
    00022
    00023 #ifndef __BARRY_A_OSLOADER_H__
    00024 #define __BARRY_A_OSLOADER_H__
    00025
    00026 #include <iostream>
    00027 #include <vector>
    00028 #include <map>
    00029
    00030 #include "dll.h"
    00031 #include "a_application.h"
    00032 #include "a_library.h"
    00033 #include <tr1/memory>
    00034
    00035
    00036 #define OS_LANG_ENGLISH                 ""
    00037 #define OS_LANG_ARABIC                  "0x0001"
    00038 #define OS_LANG_CATALAN                 "0x0003"
    00039 #define OS_LANG_CZECH                   "0x0005"
    00040 #define OS_LANG_GERMAN                  "0x0007"
    00041 #define OS_LANG_SPANISH                 "0x000a"
    00042 #define OS_LANG_FRENCH                  "0x000c"
    00043 #define OS_LANG_HEBREW                  "0x000d"
    00044 #define OS_LANG_HUNGARIAN               "0x000e"
    00045 #define OS_LANG_ITALIAN                 "0x0010"
    00046 #define OS_LANG_JAPANESE                "0x0011"
    00047 #define OS_LANG_KOREAN                  "0x0012"
    00048
    00049
    00050 namespace Barry {
    00051
    00052 namespace ALX {
    00053
    00054 class BXEXPORT OSLoader
    00055 {
    00056 public:
    00057         typedef std::tr1::shared_ptr<CODSection>        CODSectionPtr;
    00058         typedef std::vector<CODSectionPtr>              CODSectionList;
    00059         typedef std::map<std::string, std::string>      PropertyMap;
    00060
    00061 private:
    00062         std::string sfifile;
    00063         CODSectionList applications;
    00064         CODSectionList libraries;
    00065         PropertyMap properties;
    00066
    00067 public:
    00068         OSLoader(void);
    00069         ~OSLoader(void);
    00070
    00071         void Load(const std::string& path);
    00072         /// Load ALX file, and if enable is true, register the applications
    00073         /// and libraries found inside it with this OSLoader class.
    00074         void LoadALXFile(const std::string& alxfile, const bool enable=true);
    00075
    00076         void Dump(std::ostream &os) const;
    00077
    00078         void AddProperties(const std::string& property, const std::string& value);
    00079         void AddProperties(const xmlpp::SaxParser::AttributeList& attrs);
    00080         void SetSFIFile(const std::string& name);
    00081         bool IsSupported(const xmlpp::SaxParser::AttributeList& attrs);
    00082         void AddApplication(CODSectionPtr app);
    00083         void AddLibrary(CODSectionPtr lib);
    00084 };
    00085
    00086
    00087 inline std::ostream& operator<<(std::ostream& os, const OSLoader& osloader)
    00088 {
    00089         osloader.Dump(os);
    00090         return os;
    00091 }
    00092
    00093
    00094 } // namespace ALX
    00095
    00096 } // namespace Barry
    00097
    00098 #endif
    00099