00001 /* 00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico 00003 00004 This file is part of MeRMaID. 00005 00006 MeRMaID is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 MeRMaID is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with MeRMaID. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 00021 00022 /** 00023 * @Filename String.hpp 00024 * @Description String class definition. 00025 * @Status Implementing 00026 * @Version $Id: String.hpp 1 2011-03-04 18:13:18Z jreis $ 00027 * @Maintainer Marco Barbosa + Nelson Ramos 00028 */ 00029 00030 #ifndef __DATASTRUCTURE_STRING_H_ 00031 #define __DATASTRUCTURE_STRING_H_ 00032 00033 00034 #include "DataValue.hpp" 00035 #include <string> 00036 00037 namespace mermaid 00038 { 00039 namespace support 00040 { 00041 namespace data 00042 { 00043 /** 00044 * @Class String String.hpp "String.hpp" 00045 * @Description Class representing a string data value 00046 * @Author Marco Barbosa + Nelson Ramos 00047 */ 00048 00049 class String : public DataValue 00050 { 00051 00052 friend class Data; 00053 friend class DataFactory; //because buildString(Data * data, std::string valueString) 00054 00055 public: 00056 00057 00058 /** 00059 * @Description copy method 00060 */ 00061 00062 String * clone(); 00063 00064 00065 /** 00066 * @Description Value setter 00067 * @Argument value Value to which the String instance should be set 00068 */ 00069 void setValue (std::string value); 00070 00071 /** 00072 * @Description Value getter 00073 * @Returns Current String value 00074 */ 00075 std::string getValue() const; 00076 00077 /** 00078 * @Description Method to convert value to string 00079 */ 00080 virtual operator std::string() const; 00081 00082 /** 00083 * @Description Atribution operator. This is equivalent to String::setValue 00084 * @Argument value Value to which the String instance should be set 00085 */ 00086 void operator= (std::string value); 00087 00088 00089 private: 00090 00091 /** 00092 * @Description Default constructor 00093 */ 00094 String(); 00095 00096 /** 00097 * @Description String constructor 00098 * @Argument value Initial string value 00099 */ 00100 String (std::string value); 00101 00102 00103 std::string stringValue_; //< String value 00104 }; // class String 00105 } // namespace data 00106 } // namespace support 00107 } // namespace mermaid 00108 00109 #endif // __DATASTRUCTURE_STRING_H_