NestedTextInterface.h
1 //-*-C++-*-
2 
3 /***************************************************************************
4  *
5  * Copyright (C) 2013 by Willem van Straten
6  * Licensed under the Academic Free License version 2.1
7  *
8  ***************************************************************************/
9 
10 // psrchive/psrchive/Util/units/NestedTextInterface.h
11 
12 #ifndef __NestedTextInterface_h
13 #define __NestedTextInterface_h
14 
15 #include "TextInterface.h"
16 
17 namespace TextInterface {
18 
19  class Nested : public Value
20  {
21  };
22 
24  class NestedValue : public Nested
25  {
26  public:
27 
29  NestedValue (const std::string& pre, Value* val)
30  { prefix = pre; value = val; }
31 
33  std::string get_name () const
34  { return prefix + ":" + value->get_name(); }
35 
37  std::string get_description () const
38  { return value->get_description(); }
39 
41  std::string get_value () const
42  { return value->get_value (); }
43 
45  void set_value (const std::string& txt)
46  { value->set_value (txt); }
47 
49  bool matches (const std::string& name) const
50  { return TextInterface::matches (name, prefix, value); }
51 
53  void set_modifiers (const std::string& modifiers) const
54  { value->set_modifiers (modifiers); }
55 
57  void reset_modifiers () const
58  { value->reset_modifiers (); }
59 
60  void set_parent (Parser* p)
61  { Value::set_parent(p); value->set_parent(p); }
62 
63  protected:
64 
67 
69  std::string prefix;
70 
71  };
72 
73 }
74 
75 #endif
std::string get_name() const
Get the name of the attribute.
Definition: NestedTextInterface.h:38
void set_value(const std::string &txt)
Set the value of the value.
Definition: NestedTextInterface.h:50
void reset_modifiers() const
Reset any output stream modifiers.
Definition: NestedTextInterface.h:62
bool matches(const std::string &name) const
Return true if the name argument matches.
Definition: NestedTextInterface.h:54
An array of Value interfaces.
Definition: TextInterfaceParser.h:35
Template class manages Reference::Able objects.
Definition: Reference.h:74
std::string get_value() const
Get the value of the value.
Definition: NestedTextInterface.h:46
std::string get_description() const
Get the description of the value.
Definition: NestedTextInterface.h:42
Text interface to a value of undefined type.
Definition: TextInterfaceValue.h:35
void set_modifiers(const std::string &modifiers) const
Parse any modifiers that will alter the behaviour of the output stream.
Definition: NestedTextInterface.h:58
Reference::To< Value > value
The parent value interface.
Definition: NestedTextInterface.h:71
NestedValue(const std::string &pre, Value *val)
Construct from a name and pointer to Value.
Definition: NestedTextInterface.h:34
std::string prefix
The name of the value.
Definition: NestedTextInterface.h:74

Generated using doxygen 1.8.17