fw4spl
fwAtoms/include/fwAtoms/String.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWATOMS_STRING_HPP__
8 #define __FWATOMS_STRING_HPP__
9 
10 #include "fwAtoms/Base.hpp"
11 #include "fwAtoms/config.hpp"
12 #include "fwAtoms/factory/new.hpp"
13 
14 #include <string>
15 
16 namespace fwAtoms
17 {
18 
23 class FWATOMS_CLASS_API String : public Base
24 {
25 public:
26  fwCoreClassDefinitionsWithFactoryMacro( (String)(::fwAtoms::Base), (()), ::fwAtoms::factory::New< String > );
27 
33  m_value("")
34  {
35  }
36 
40  virtual ~String()
41  {
42  }
43 
44  //------------------------------------------------------------------------------
45 
46  const std::string& getValue() const
47  {
48  return m_value;
49  }
50 
51  //------------------------------------------------------------------------------
52 
53  void setValue( const std::string& value )
54  {
55  m_value = value;
56  }
57 
58  //------------------------------------------------------------------------------
59 
60  std::string getString() const override
61  {
62  return m_value;
63  }
64 
70  FWATOMS_API static String::sptr New(std::string value);
71 
75  FWATOMS_API virtual Base::sptr clone() const override;
76 
80  ::fwAtoms::Base::AtomType type() const override
81  {
82  return ::fwAtoms::Base::STRING;
83  }
84 
85 protected:
86 
87  std::string m_value;
88 };
89 
90 }
91 
92 #endif /* __FWATOMS_STRING_HPP__ */
93 
::fwAtoms::Base::AtomType type() const override
returns Atom type
fwAtoms contains basic objects to represent any other kind of object
std::string getString() const override
Return the string representation of a value.
virtual ~String()
Destructor.
String(::fwAtoms::Base::Key key)
Constructor.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Class represented a String.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Base class for all Atom classes.