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