Matrix Science header

ms_customproperty.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_customproperty.hpp                                                #
00004 # 'msparser' toolkit                                                         #
00005 # Represents a custom property with unknown structure. It is useful for new  # 
00006 # properties or for properties with variable structure that can be explored  #
00007 # at run-time                                                                #
00008 ##############################################################################
00009 # COPYRIGHT NOTICE                                                           #
00010 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00011 #                                                                            #
00012 ##############################################################################
00013 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_customproperty.hpp      $ #
00014 #     $Author: francoisr $ #
00015 #       $Date: 2016/05/17 12:49:19 $ #
00016 #   $Revision: 1.9 $ #
00017 # $NoKeywords::                                                            $ #
00018 ##############################################################################
00019 */
00020 
00021 #ifndef MS_CUSTOMPROPERTY_HPP
00022 #define MS_CUSTOMPROPERTY_HPP
00023 
00024 #ifdef _WIN32
00025 #pragma warning(disable:4251)   // Don't want all classes to be exported
00026 #pragma warning(disable:4786)   // Debug symbols too long
00027 #   ifndef _MATRIX_USE_STATIC_LIB
00028 #       ifdef MS_MASCOTRESFILE_EXPORTS
00029 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00030 #       else
00031 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00032 #       endif
00033 #   else
00034 #       define MS_MASCOTRESFILE_API
00035 #   endif
00036 #else
00037 #   define MS_MASCOTRESFILE_API
00038 #endif
00039 
00040 // for the sake of #include <string>
00041 #ifdef __ALPHA_UNIX__
00042 #include <ctype.h>
00043 #endif
00044 #include <string>
00045 #include <vector>
00046 
00047 #include "msparser_lim.hpp"
00048 
00049 namespace matrix_science {
00050 
00052 
00109     class MS_MASCOTRESFILE_API ms_customproperty
00110     {
00111     public:
00113         ms_customproperty();
00114 
00116         ~ms_customproperty();
00117 
00119         void defaultValues();
00120 
00122         void copyFrom(const ms_customproperty* src);
00123 
00125         int getNumberOfProperties() const;
00126 
00128         std::string getPropertyName(const int index) const;
00129 
00131         void setPropertyName(const int index, const char* name);
00132 
00134         int findProperty(const char* name, const int startFrom = 0) const;
00135 
00137         int findPropertyBeginning(const char* nameBeginning, const int startFrom = 0) const;
00138 
00140         std::string getPropValStringByName(const char* name) const;
00141 
00143         std::string getPropValStringByNumber(const int index) const;
00144 
00146         std::string getDelimiterByNumber(const int index) const;
00147 
00149         void appendProperty
00150             ( const char* name
00151             , const char* value 
00152             , const char* delimiter
00153             , const bool bFirstPlace = false
00154             );
00155 
00157         void appendText
00158             ( const char* line
00159             , const bool bFirstPlace = false
00160             );
00161 
00163         void setPropValStringByName
00164             ( const char* name
00165             , const char* value
00166             , const bool bFirstPlace = false
00167             );
00168 
00170         void setPropValCharByName
00171             ( const char* name
00172             , const char value
00173             , const bool bFirstPlace = false
00174             );
00175 
00177         void setPropValIntByName
00178             ( const char* name
00179             , const int value
00180             , const bool bFirstPlace = false
00181             );
00182 
00184         void setPropValInt64ByName
00185             ( const char* name
00186             , const INT64 value
00187             , const bool bFirstPlace = false
00188             );
00189 
00191         void setPropValBoolByName
00192             ( const char* name
00193             , const bool value
00194             , const bool bFirstPlace = false
00195             );
00196 
00198         void setPropValFloatByName
00199             ( const char* name
00200             , const double value
00201             , const bool bFirstPlace = false
00202             );
00203 
00205         void setPropValStringByNumber
00206             ( const int index
00207             , const char* value
00208             );
00209 
00210 
00212         std::string getDefaultDelimiter() const;
00213 
00215         void setDefaultDelimiter(const char* delim);
00216 
00218         void delProp(const char* name);
00219 
00221         void delPropStart(const char* nameBeginning);
00222 
00224         void delNonEmpty();
00225 
00227         void delPropByNumber(const int index);
00228 
00230         bool uncommentProp(const int index, const char * delimeter = 0);
00231 
00233         std::string getPreceedingComments() const;
00234 
00236         void setPreceedingComments(const std::string & comments);
00237 
00238     private:
00239         std::vector< std::string > names_;
00240         std::vector< std::string > values_;
00241         std::vector< std::string > delimiters_;
00242         std::string                defaultDelimiter_;
00243         std::string                preceedingComments_;
00244     }; // class ms_customproperty
00245 } // namespace matrix_science
00246 
00247 #endif // MS_CUSTOMPROPERTY_HPP
00248 
00249 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50