Property.h
Go to the documentation of this file.
1 // $Id:$
2 #ifndef JOBOPTIONSVC_PROPERTY_H_
3 #define JOBOPTIONSVC_PROPERTY_H_
4 // ============================================================================
5 // Includes:
6 // ============================================================================
7 // STD & STL:
8 // ============================================================================
9 #include <string>
10 // ============================================================================
11 #include "Position.h"
12 #include "PropertyName.h"
13 #include "PropertyValue.h"
14 // ============================================================================
15 namespace Gaudi { namespace Parsers {
16 // ============================================================================
17 class Property {
18 // ----------------------------------------------------------------------------
19  public:
20 // ----------------------------------------------------------------------------
21  struct LessThen : std::binary_function<Property, Property, bool> {
22  bool operator()(const Property& first, const Property& second) const {
23  return first.FullName() < second.FullName();
24  }
25  };
26 
27  class Equal : std::unary_function<Property, bool> {
28  public:
29  Equal(const std::string& short_name): short_name_(short_name){}
30  bool operator()(const Property& property) const {
31  return short_name_ == property.NameInClient();
32  }
33  private:
34  std::string short_name_;
35  };
36 // ----------------------------------------------------------------------------
39  property_name_(property_name), property_value_(property_value) {}
40 // ----------------------------------------------------------------------------
41  const PropertyName& property_name() const {
42  return property_name_;
43  }
45  return property_value_;
46  }
47 // ----------------------------------------------------------------------------
50  return *this;
51  }
54  return *this;
55  }
56 // ----------------------------------------------------------------------------
57  const Position& DefinedPosition() const;
58  bool HasDefinedPosition() const { return DefinedPosition().Exists();}
59 // ----------------------------------------------------------------------------
60  const Position& ValuePosition() const;
61  bool HasValuePosition() const { return ValuePosition().Exists();}
62 // ----------------------------------------------------------------------------
63  std::string ClientName() const;
64  std::string NameInClient() const;
65  std::string FullName() const;
66  std::string ValueAsString() const;
67  std::string ToString() const;
68  bool IsSimple() const;
69  bool IsVector() const;
70  bool IsMap() const;
71  bool IsReference() const { return property_value_.IsReference();}
72 // ----------------------------------------------------------------------------
73  private:
74 // ----------------------------------------------------------------------------
77 };
78 // ============================================================================
79 } /* Gaudi */ } /* Parsers */
80 // ============================================================================
81 #endif // JOBOPTIONSVC_PROPERTY_H_
PropertyName property_name_
Definition: Property.h:75
PropertyValue property_value_
Definition: Property.h:76
Property & operator+=(const PropertyValue &value)
Definition: Property.h:48
Property & operator-=(const PropertyValue &value)
Definition: Property.h:52
std::string NameInClient() const
Definition: Property.cpp:35
bool HasValuePosition() const
Definition: Property.h:61
Property(const PropertyName &property_name, const PropertyValue &property_value)
Definition: Property.h:37
bool IsReference() const
Definition: Property.h:71
std::string ClientName() const
Definition: Property.cpp:31
constexpr double second
bool IsSimple() const
Definition: Property.cpp:51
std::string FullName() const
Definition: Property.cpp:39
std::string ValueAsString() const
Definition: Property.cpp:43
bool operator()(const Property &property) const
Definition: Property.h:30
PropertyValue & property_value()
Definition: Property.h:44
const PropertyName & property_name() const
Definition: Property.h:41
bool HasDefinedPosition() const
Definition: Property.h:58
const Position & DefinedPosition() const
Definition: Property.cpp:23
bool IsVector() const
Definition: Property.cpp:55
bool Exists() const
Definition: Position.h:23
std::string ToString() const
Definition: Property.cpp:47
bool IsMap() const
Definition: Property.cpp:59
Equal(const std::string &short_name)
Definition: Property.h:29
bool operator()(const Property &first, const Property &second) const
Definition: Property.h:22
const Position & ValuePosition() const
Definition: Property.cpp:27
Helper functions to set/get the application return code.
Definition: __init__.py:1