00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035 #ifndef OW_MOF_COMPILER_HPP_INCLUDE_GUARD_
00036 #define OW_MOF_COMPILER_HPP_INCLUDE_GUARD_
00037 #include "OW_config.h"
00038 #include "OW_CIMOMHandleIFC.hpp"
00039 #include "OW_String.hpp"
00040 #include "OW_MOFParserErrorHandlerIFC.hpp"
00041 #include "OW_Exception.hpp"
00042 #include "OW_Array.hpp"
00043 #include "OW_MOFLineInfo.hpp"
00044 #include "OW_MOFGrammar.hpp"
00045 #include "OW_CIMFwd.hpp"
00046 #include "OW_Logger.hpp"
00047
00048 #ifdef OW_WIN32
00049 #pragma warning (push)
00050 #pragma warning (disable: 4251)
00051 #endif
00052
00053
00054 struct owmof_buffer_state;
00055 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00056
00057 namespace OW_NAMESPACE
00058 {
00059
00060 OW_DECLARE_APIEXCEPTION(MOFCompiler, OW_MOF_API);
00061
00062 namespace MOF
00063 {
00064
00065 class OW_MOF_API Compiler
00066 {
00067 public:
00068 struct Options
00069 {
00070 Options()
00071 : m_createNamespaces(false)
00072 , m_checkSyntaxOnly(false)
00073 , m_remove(false)
00074 , m_preserve(false)
00075 , m_upgrade(true)
00076 , m_ignoreDoubleIncludes(false)
00077 , m_removeDescriptions(false)
00078 , m_removeObjects(false)
00079 {}
00080 Options(const String& namespace_,
00081 bool createNamespaces, bool checkSyntaxOnly, const String& dumpXmlFile,
00082 bool remove, bool preserve, bool upgrade, const StringArray& includeDirs,
00083 bool ignoreDoubleIncludes, bool removeDescriptions, bool removeObjects,
00084 const String& depSearchDir = "")
00085 : m_namespace(namespace_)
00086 , m_createNamespaces(createNamespaces)
00087 , m_checkSyntaxOnly(checkSyntaxOnly)
00088 , m_dumpXmlFile(dumpXmlFile)
00089 , m_remove(remove)
00090 , m_preserve(preserve)
00091 , m_upgrade(upgrade)
00092 , m_includeDirs(includeDirs)
00093 , m_ignoreDoubleIncludes(ignoreDoubleIncludes)
00094 , m_removeDescriptions(removeDescriptions)
00095 , m_removeObjects(removeObjects)
00096 , m_depSearchDir(depSearchDir)
00097 {
00098 }
00099
00100 String m_namespace;
00101 bool m_createNamespaces;
00102 bool m_checkSyntaxOnly;
00103 String m_dumpXmlFile;
00104 bool m_remove;
00105 bool m_preserve;
00106 bool m_upgrade;
00107 StringArray m_includeDirs;
00108 bool m_ignoreDoubleIncludes;
00109 bool m_removeDescriptions;
00110 bool m_removeObjects;
00111 String m_depSearchDir;
00112 };
00113
00114 Compiler( const CIMOMHandleIFCRef& ch, const Options& opts, const ParserErrorHandlerIFCRef& mpeh );
00115 ~Compiler();
00116 long compile( const String& filename );
00117 long compileString( const String& mof );
00118 static String fixParsedString(const String& s);
00119
00120 ParserErrorHandlerIFCRef theErrorHandler;
00121 AutoPtr<MOFSpecification> mofSpecification;
00122 String basepath;
00123
00124
00125
00126
00127 LineInfo theLineInfo;
00128
00129
00130 enum
00131 {
00132 E_MAX_INCLUDE_DEPTH = 100
00133 };
00134
00135 struct include_t
00136 {
00137 YY_BUFFER_STATE owmofBufferState;
00138 LineInfo theLineInfo;
00139 };
00140
00141 include_t include_stack[E_MAX_INCLUDE_DEPTH];
00142 int include_stack_ptr;
00143
00144 private:
00145 CIMOMHandleIFCRef m_ch;
00146 Options m_opts;
00147
00148 Compiler(const Compiler& x);
00149 Compiler& operator=(const Compiler& x);
00150
00151 };
00152
00153
00154 OW_MOF_API CIMInstance compileInstanceFromMOF(const String& instMOF, const LoggerRef& logger = LoggerRef()) OW_DEPRECATED;
00155 OW_MOF_API CIMInstanceArray compileInstancesFromMOF(const String& instMOF, const LoggerRef& logger = LoggerRef()) OW_DEPRECATED;
00156 OW_MOF_API CIMInstanceArray compileInstancesFromMOF(const String& instMOF, const CIMOMHandleIFCRef& realhdl, const String& ns, const LoggerRef& logger = LoggerRef()) OW_DEPRECATED;
00157
00161 OW_MOF_API void compileMOF(const String& mof, const CIMOMHandleIFCRef& realhdl, const String& ns,
00162 CIMInstanceArray& instances, CIMClassArray& classes, CIMQualifierTypeArray& qualifierTypes, const LoggerRef& logger = LoggerRef());
00163
00164
00165
00166 }
00167 }
00168
00169 #ifdef OW_WIN32
00170 #pragma warning (pop)
00171 #endif
00172
00173 #endif // MOF_COMPILER_HPP_