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: villek@matrixscience.com $ #
00015 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00016 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00017 # $NoKeywords::                                                            $ #
00018 ##############################################################################
00019 */
00020 
00021 #ifndef MS_CUSTOMPROPERTY_HPP
00022 #define MS_CUSTOMPROPERTY_HPP
00023 
00024 
00025 #include <string>
00026 #include <vector>
00027 
00028 #include "msparser_lim.hpp"
00029 
00030 namespace matrix_science {
00031 
00033 
00090     class MS_MASCOTRESFILE_API ms_customproperty
00091     {
00092     public:
00094         ms_customproperty();
00095 
00097         ~ms_customproperty();
00098 
00100         void defaultValues();
00101 
00103         void copyFrom(const ms_customproperty* src);
00104 
00106         int getNumberOfProperties() const;
00107 
00109         std::string getPropertyName(const int index) const;
00110 
00112         void setPropertyName(const int index, const char* name);
00113 
00115         int findProperty(const char* name, const int startFrom = 0) const;
00116 
00118         int findPropertyBeginning(const char* nameBeginning, const int startFrom = 0) const;
00119 
00121         std::string getPropValStringByName(const char* name) const;
00122 
00124         std::string getPropValStringByNumber(const int index) const;
00125 
00127         std::string getDelimiterByNumber(const int index) const;
00128 
00130         void appendProperty
00131             ( const char* name
00132             , const char* value 
00133             , const char* delimiter
00134             , const bool bFirstPlace = false
00135             );
00136 
00138         void appendText
00139             ( const char* line
00140             , const bool bFirstPlace = false
00141             );
00142 
00144         void setPropValStringByName
00145             ( const char* name
00146             , const char* value
00147             , const bool bFirstPlace = false
00148             );
00149 
00151         void setPropValCharByName
00152             ( const char* name
00153             , const char value
00154             , const bool bFirstPlace = false
00155             );
00156 
00158         void setPropValIntByName
00159             ( const char* name
00160             , const int value
00161             , const bool bFirstPlace = false
00162             );
00163 
00165         void setPropValInt64ByName
00166             ( const char* name
00167             , const INT64 value
00168             , const bool bFirstPlace = false
00169             );
00170 
00172         void setPropValBoolByName
00173             ( const char* name
00174             , const bool value
00175             , const bool bFirstPlace = false
00176             );
00177 
00179         void setPropValFloatByName
00180             ( const char* name
00181             , const double value
00182             , const bool bFirstPlace = false
00183             );
00184 
00186         void setPropValStringByNumber
00187             ( const int index
00188             , const char* value
00189             );
00190 
00191 
00193         std::string getDefaultDelimiter() const;
00194 
00196         void setDefaultDelimiter(const char* delim);
00197 
00199         void delProp(const char* name);
00200 
00202         void delPropStart(const char* nameBeginning);
00203 
00205         void delNonEmpty();
00206 
00208         void delPropByNumber(const int index);
00209 
00211         bool uncommentProp(const int index, const char * delimeter = 0);
00212 
00214         std::string getPreceedingComments() const;
00215 
00217         void setPreceedingComments(const std::string & comments);
00218 
00219     private:
00220         std::vector< std::string > names_;
00221         std::vector< std::string > values_;
00222         std::vector< std::string > delimiters_;
00223         std::string                defaultDelimiter_;
00224         std::string                preceedingComments_;
00225     }; // class ms_customproperty
00226 } // namespace matrix_science
00227 
00228 #endif // MS_CUSTOMPROPERTY_HPP
00229 
00230 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29