Return to wqlcxx.h CVS log | Up to [OMI] / omi / deprecated / wqlcxx |
File: [OMI] / omi / deprecated / wqlcxx / wqlcxx.h
(download)
Revision: 1.1.1.1 (vendor branch), Wed May 30 21:47:49 2012 UTC (12 years, 1 month ago) by mike Branch: TOG CVS Tags: OMI_1_0_2_Branch, OMI_1_0_2, OMI_1_0_1_PRE, OMI_1_0_1, OMI_1_0_0 Changes since 1.1: +0 -0 lines Initial Import |
/* **============================================================================== ** ** Open Management Infrastructure (OMI) ** ** Copyright (c) Microsoft Corporation ** ** Licensed under the Apache License, Version 2.0 (the "License"); you may not ** use this file except in compliance with the License. You may obtain a copy ** of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, ** MERCHANTABLITY OR NON-INFRINGEMENT. ** ** See the Apache 2 License for the specific language governing permissions ** and limitations under the License. ** **============================================================================== */ #ifndef _omi_wqlcxx_h #define _omi_wqlcxx_h #include <cstddef> #include <string> #include <vector> #if defined(_MSC_VER) # define WQLCXX_EXPORT __declspec(dllexport) # define WQLCXX_IMPORT __declspec(dllimport) #elif defined(__GNUC__) # define WQLCXX_EXPORT __attribute__((visibility("default"))) # define WQLCXX_IMPORT /* empty */ #elif defined(sun) # define WQLCXX_EXPORT __global # define WQLCXX_IMPORT /* empty */ #else # define WQLCXX_EXPORT # define WQLCXX_IMPORT #endif #ifdef BUILDING_WQLCXX # define WQLCXX_LINKAGE WQLCXX_EXPORT #else # define WQLCXX_LINKAGE WQLCXX_IMPORT #endif #define WQLCXX_BEGIN namespace wqlcxx { #define WQLCXX_END } WQLCXX_BEGIN /* Represents the type of values produced by WQLValueSource::Lookup() */ enum WQLType { WQLTYPE_BOOLEAN, WQLTYPE_INTEGER, WQLTYPE_REAL, WQLTYPE_STRING }; /* Represents values produced by WQLValueSource::Lookup() */ class WQLValue { public: bool booleanValue; long long integerValue; double realValue; std::string stringValue; }; /* Instances of this class lookup values for properties. The user must derive * from this class and provide implementations for all pure virtual functions. * This instance is passed to WQL::Eval(), which in turn calls these virtual * functions. */ class WQLCXX_LINKAGE WQLValueSource { public: virtual ~WQLValueSource(); virtual bool LookupValue( const char* name, WQLType& type, WQLValue& value) = 0; }; class WQLCXX_LINKAGE WQL { public: /* Parse the given WQL text and return a new WQL instance. The caller * must eventually pass the instance to delete. */ static WQL* Parse(const char* text); /* Destroy instance of WQL (created by Parse) */ static void Destroy(WQL* wql); /* Get the classname given by the FROM clause */ const char* GetClassName() const; /* Get the number of properties given by the SELECT list. A zero property * count signifies 'SELECT *', where all properties are required. */ size_t GetPropertyCount() const; /* Get the name of the i-th property given by the SELECT list */ const char* GetPropertyName(size_t i) const; /* Evaluate this instance against the given value source */ bool Evaluate(const WQLValueSource* source) const; /* Dump the components of this instance to standard output */ void Dump() const; private: ~WQL(); WQL(); WQL(const WQL&); void* _rep; }; WQLCXX_END #endif /* _omi_wqlcxx_h */
ViewCVS 0.9.2 |