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
17namespace 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
Template class manages Reference::Able objects.
Definition ReferenceTo.h:25
std::string get_value() const
Get the value of the value.
Definition NestedTextInterface.h:41
void set_modifiers(const std::string &modifiers) const
Parse any modifiers that will alter the behaviour of the output stream.
Definition NestedTextInterface.h:53
bool matches(const std::string &name) const
Return true if the name argument matches.
Definition NestedTextInterface.h:49
Reference::To< Value > value
The parent value interface.
Definition NestedTextInterface.h:66
std::string get_description() const
Get the description of the value.
Definition NestedTextInterface.h:37
void set_value(const std::string &txt)
Set the value of the value.
Definition NestedTextInterface.h:45
std::string get_name() const
Get the name of the attribute.
Definition NestedTextInterface.h:33
std::string prefix
The name of the value.
Definition NestedTextInterface.h:69
void reset_modifiers() const
Reset any output stream modifiers.
Definition NestedTextInterface.h:57
NestedValue(const std::string &pre, Value *val)
Construct from a name and pointer to Value.
Definition NestedTextInterface.h:29
An array of Value interfaces.
Definition TextInterfaceParser.h:31
Text interface to a value of undefined type.
Definition TextInterfaceValue.h:31

Generated using doxygen 1.14.0