cfgfile 0.2.11
Loading...
Searching...
No Matches
tag_scalar.hpp
Go to the documentation of this file.
1
31#ifndef CFGFILE__TAG_SCALAR_HPP__INCLUDED
32#define CFGFILE__TAG_SCALAR_HPP__INCLUDED
33
34//cfgfile include.
35#include "tag.hpp"
36#include "constraint.hpp"
37#include "format.hpp"
38#include "string_format.hpp"
39#include "exceptions.hpp"
40#include "const.hpp"
41
42#if defined( CFGFILE_QT_SUPPORT ) && defined( CFGFILE_XML_SUPPORT )
43// Qt include.
44#include <QDomDocument>
45#include <QDomElement>
46#include <QDomText>
47#endif
48
49
50namespace cfgfile {
51
52//
53// tag_scalar_t
54//
55
57template< class T, class Trait = string_trait_t >
59 : public tag_t< Trait >
60{
61public:
63 explicit tag_scalar_t( const typename Trait::string_t & name,
64 bool is_mandatory = false )
66 , m_value( T() )
67 , m_constraint( nullptr )
68 {
69 }
70
72 tag_scalar_t( tag_t< Trait > & owner, const typename Trait::string_t & name,
73 bool is_mandatory = false )
75 , m_value( T() )
76 , m_constraint( nullptr )
77 {
78 }
79
81 {
82 }
83
85 const T &
86 value() const
87 {
88 return m_value;
89 }
90
92 void
93 set_value( const T & v )
94 {
95 if( m_constraint )
96 {
97 if( !m_constraint->check( v ) )
99 Trait::from_ascii( "Invalid value: \"" ) +
100 typename Trait::string_t(
102 Trait::from_ascii( "\". Value must match to "
103 "the constraint in tag \"" ) +
104 this->name() + Trait::from_ascii( "\"." ) );
105 }
106
107 m_value = v;
108
109 this->set_defined();
110 }
111
119 void
121 {
122 if( this->is_defined() )
123 receiver = m_value;
124 }
125
127 void
129 {
130 m_constraint = c;
131 }
132
134 typename Trait::string_t print( int indent = 0 ) const override
135 {
136 typename Trait::string_t result;
137
138 if( this->is_defined() )
139 {
140 result.append( typename Trait::string_t( indent,
142
144 result.append( this->name() );
145 result.push_back( const_t< Trait >::c_space );
146
147 typename Trait::string_t value =
150
151 result.append( value );
152
153 if( !this->children().empty() )
154 {
156
157 for( const tag_t< Trait > * tag : this->children() )
158 result.append( tag->print( indent + 1 ) );
159
160 result.append( typename Trait::string_t( indent,
162 }
163
166 }
167
168 return result;
169 }
170
171#if defined( CFGFILE_QT_SUPPORT ) && defined( CFGFILE_XML_SUPPORT )
173 void print( QDomDocument & doc, QDomElement * parent = 0 ) const override
174 {
175 if( this->is_defined() )
176 {
177 QDomElement this_element = doc.createElement( this->name() );
178
179 if( !parent )
180 doc.appendChild( this_element );
181 else
182 parent->appendChild( this_element );
183
186
187 QDomText data = doc.createTextNode( value );
188
189 this_element.appendChild( data );
190
191 if( !this->children().empty() )
192 {
193 for( const tag_t< Trait > * tag : this->children() )
194 tag->print( doc, &this_element );
195 }
196 }
197 }
198#endif
199
201 void on_finish( const parser_info_t< Trait > & info ) override
202 {
203 if( !this->is_defined_member_value() )
205 Trait::from_ascii( "Undefined value of tag: \"" ) +
206 this->name() + Trait::from_ascii( "\". In file \"" ) +
207 info.file_name() +
208 Trait::from_ascii( "\" on line " ) +
209 Trait::to_string( info.line_number() ) +
210 Trait::from_ascii( "." ) );
211
212 for( const tag_t< Trait > * tag : this->children() )
213 {
214 if( tag->is_mandatory() && !tag->is_defined() )
216 Trait::from_ascii( "Undefined child mandatory tag: \"" ) +
217 tag->name() + Trait::from_ascii( "\". Where parent is: \"" ) +
218 this->name() + Trait::from_ascii( "\". In file \"" ) +
219 info.file_name() +
220 Trait::from_ascii( "\" on line " ) +
221 Trait::to_string( info.line_number() ) +
222 Trait::from_ascii( "." ) );
223 }
224 }
225
228 const typename Trait::string_t & str ) override
229 {
230 if( !this->is_defined_member_value() )
231 {
232 if( this->is_any_child_defined() )
234 Trait::from_ascii( "Value \"" ) + str +
235 Trait::from_ascii( "\" for tag \"" ) + this->name() +
236 Trait::from_ascii( "\" must be defined before any "
237 "child tag. In file \"" ) +
238 info.file_name() + Trait::from_ascii( "\" on line " ) +
239 Trait::to_string( info.line_number() ) +
240 Trait::from_ascii( "." ) );
241
243
244 if( m_constraint )
245 {
246 if( !m_constraint->check( value ) )
248 Trait::from_ascii( "Invalid value: \"" ) +
249 str +
250 Trait::from_ascii( "\". Value must match to the "
251 "constraint in tag \"" ) +
252 this->name() + Trait::from_ascii( "\". In file \"" ) +
253 info.file_name() +
254 Trait::from_ascii( "\" on line " ) +
255 Trait::to_string( info.line_number() ) +
256 Trait::from_ascii( "." ) );
257 }
258
259 m_value = value;
260
261 this->set_defined();
262 }
263 else
265 Trait::from_ascii( "Value for the tag \"" ) +
266 this->name() +
267 Trait::from_ascii( "\" already defined. In file \"" ) +
268 info.file_name() + Trait::from_ascii( "\" on line " ) +
269 Trait::to_string( info.line_number() ) +
270 Trait::from_ascii( "." ) );
271 }
272
273private:
275 T m_value;
277 constraint_t< T > * m_constraint;
278}; // class tag_scalar_t
279
280
281//
282// tag_scalar_t< bool >
283//
284
286template< typename Trait >
288 : public tag_t< Trait >
289{
290public:
292 explicit tag_scalar_t( const typename Trait::string_t & name,
293 bool is_mandatory = false )
295 , m_value( false )
296 {
297 }
298
300 tag_scalar_t( tag_t< Trait > & owner, const typename Trait::string_t & name,
301 bool is_mandatory = false )
303 , m_value( false )
304 {
305 }
306
308 {
309 }
310
312 const bool &
313 value() const
314 {
315 return m_value;
316 }
317
319 void
320 set_value( const bool & v )
321 {
322 m_value = v;
323
324 this->set_defined();
325 }
326
334 void
336 {
337 if( this->is_defined() )
338 receiver = m_value;
339 }
340
342 typename Trait::string_t print( int indent = 0 ) const override
343 {
344 typename Trait::string_t result;
345
346 if( this->is_defined() )
347 {
348 result.append( typename Trait::string_t( indent,
350
352 result.append( this->name() );
353 result.push_back( const_t< Trait >::c_space );
354
355 typename Trait::string_t value =
358
359 result.append( value );
360
361 if( !this->children().empty() )
362 {
364
365 for( const tag_t< Trait > * tag : this->children() )
366 result.append( tag->print( indent + 1 ) );
367
368 result.append( typename Trait::string_t( indent,
370 }
371
374 }
375
376 return result;
377 }
378
379#if defined( CFGFILE_QT_SUPPORT ) && defined( CFGFILE_XML_SUPPORT )
381 void print( QDomDocument & doc, QDomElement * parent = 0 ) const override
382 {
383 if( this->is_defined() )
384 {
385 QDomElement this_element = doc.createElement( this->name() );
386
387 if( !parent )
388 doc.appendChild( this_element );
389 else
390 parent->appendChild( this_element );
391
392 typename Trait::string_t value =
395
396 QDomText data = doc.createTextNode( value );
397
398 this_element.appendChild( data );
399
400 if( !this->children().empty() )
401 {
402 for( const tag_t< Trait > * tag : this->children() )
403 tag->print( doc, &this_element );
404 }
405 }
406 }
407#endif
408
410 void on_finish( const parser_info_t< Trait > & info ) override
411 {
412 if( !this->is_defined_member_value() )
414 Trait::from_ascii( "Undefined value of tag: \"" ) +
415 this->name() + Trait::from_ascii( "\". In file \"" ) +
416 info.file_name() +
417 Trait::from_ascii( "\" on line " ) +
418 Trait::to_string( info.line_number() ) +
419 Trait::from_ascii( "." ) );
420
421 for( const tag_t< Trait > * tag : this->children() )
422 {
423 if( tag->is_mandatory() && !tag->is_defined() )
425 Trait::from_ascii( "Undefined child mandatory tag: \"" ) +
426 tag->name() +
427 Trait::from_ascii( "\". Where parent is: \"" ) +
428 this->name() + Trait::from_ascii( "\". In file \"" ) +
429 info.file_name() +
430 Trait::from_ascii( "\" on line " ) +
431 Trait::to_string( info.line_number() ) +
432 Trait::from_ascii( "." ) );
433 }
434 }
435
438 const typename Trait::string_t & str ) override
439 {
440 if( !this->is_defined_member_value() )
441 {
442 if( this->is_any_child_defined() )
444 Trait::from_ascii( "Value \"" ) + str +
445 Trait::from_ascii( "\" for tag \"" ) + this->name() +
446 Trait::from_ascii( "\" must be defined before any child "
447 "tag. In file \"" ) +
448 info.file_name() + Trait::from_ascii( "\" on line " ) +
449 Trait::to_string( info.line_number() ) +
450 Trait::from_ascii( "." ) );
451
453
454 this->set_defined();
455 }
456 else
458 Trait::from_ascii( "Value for the tag \"" ) +
459 this->name() +
460 Trait::from_ascii( "\" already defined. In file \"" ) +
461 info.file_name() + Trait::from_ascii( "\" on line " ) +
462 Trait::to_string( info.line_number() ) +
463 Trait::from_ascii( "." ) );
464 }
465
466private:
468 bool m_value;
469}; // class tag_scalar_t
470
471
472//
473// tag_scalar_t< Trait::string_t >
474//
475
477template< typename Trait >
478class tag_scalar_t< typename Trait::string_t, Trait >
479 : public tag_t< Trait >
480{
481 static const typename Trait::pos_t c_max_string_length = 80;
482
483public:
485 explicit tag_scalar_t( const typename Trait::string_t & name,
486 bool is_mandatory = false )
488 , m_value( typename Trait::string_t() )
489 , m_constraint( nullptr )
490 {
491 }
492
494 tag_scalar_t( tag_t< Trait > & owner, const typename Trait::string_t & name,
495 bool is_mandatory = false )
497 , m_value( typename Trait::string_t() )
498 , m_constraint( nullptr )
499 {
500 }
501
503 {
504 }
505
507 const typename Trait::string_t &
508 value() const
509 {
510 return m_value;
511 }
512
514 void
515 set_value( const typename Trait::string_t & v )
516 {
517 if( m_constraint )
518 {
519 if( !m_constraint->check( v ) )
521 Trait::from_ascii( "Invalid value: \"" ) +
523 Trait::from_ascii( "\". Value must match to the "
524 "constraint in tag \"" ) +
525 this->name() + Trait::from_ascii( "\"." ) );
526 }
527
528 m_value = v;
529
530 this->set_defined();
531 }
532
540 void
541 query_opt_value( typename Trait::string_t & receiver )
542 {
543 if( this->is_defined() )
544 receiver = m_value;
545 }
546
548 void
550 {
551 m_constraint = c;
552 }
553
555 typename Trait::string_t print( int indent = 0 ) const override
556 {
557 typename Trait::string_t result;
558
559 if( this->is_defined() )
560 {
561 result.append( typename Trait::string_t( indent,
563
565 result.append( this->name() );
566 result.push_back( const_t< Trait >::c_space );
567
568 typename Trait::string_t value =
570
571 const typename Trait::pos_t sections =
572 ( value.length() / c_max_string_length +
573 ( value.length() % c_max_string_length > 0 ? 1 : 0 ) );
574
575 if( sections )
576 {
577 const typename Trait::string_t spaces =
578 typename Trait::string_t( this->name().length() + 2,
580
581 for( typename Trait::pos_t i = 0; i < sections; ++i )
582 {
583 if( i > 0 )
584 {
586
587 result.append( typename Trait::string_t( indent,
589
590 result.append( spaces );
591 }
592
593 const typename Trait::string_t tmp =
595 value.substr( i * c_max_string_length,
596 c_max_string_length ) );
597
598 result.append( tmp );
599 }
600 }
601 else
602 {
605 }
606
607 if( !this->children().empty() )
608 {
610
611 for( const tag_t< Trait > * tag : this->children() )
612 result.append( tag->print( indent + 1 ) );
613
614 result.append( typename Trait::string_t( indent,
616 }
617
620 }
621
622 return result;
623 }
624
625#if defined( CFGFILE_QT_SUPPORT ) && defined( CFGFILE_XML_SUPPORT )
627 void print( QDomDocument & doc, QDomElement * parent = 0 ) const override
628 {
629 if( this->is_defined() )
630 {
631 QDomElement this_element = doc.createElement( this->name() );
632
633 if( !parent )
634 doc.appendChild( this_element );
635 else
636 parent->appendChild( this_element );
637
638 typename Trait::string_t value =
641
642 QDomText data = doc.createTextNode( value );
643
644 this_element.appendChild( data );
645
646 if( !this->children().empty() )
647 {
648 for( const tag_t< Trait > * tag : this->children() )
649 tag->print( doc, &this_element );
650 }
651 }
652 }
653#endif
654
656 void on_finish( const parser_info_t< Trait > & info ) override
657 {
658 if( !this->is_defined_member_value() )
660 Trait::from_ascii( "Undefined value of tag: \"" ) +
661 this->name() + Trait::from_ascii( "\". In file \"" ) +
662 info.file_name() + Trait::from_ascii( "\" on line " ) +
663 Trait::to_string( info.line_number() ) +
664 Trait::from_ascii( "." ) );
665
666 if( m_constraint )
667 {
668 if( !m_constraint->check( m_value ) )
670 Trait::from_ascii( "Invalid value: \"" ) +
671 m_value +
672 Trait::from_ascii( "\". Value must match to the "
673 "constraint in tag \"" ) +
674 this->name() + Trait::from_ascii( "\". In file \"" ) +
675 info.file_name() + Trait::from_ascii( "\" on line " ) +
676 Trait::to_string( info.line_number() ) +
677 Trait::from_ascii( "." ) );
678 }
679
680 for( const tag_t< Trait > * tag : this->children() )
681 {
682 if( tag->is_mandatory() && !tag->is_defined() )
684 Trait::from_ascii( "Undefined child mandatory tag: \"" ) +
685 tag->name() +
686 Trait::from_ascii( "\". Where parent is: \"" ) +
687 this->name() + Trait::from_ascii( "\". In file \"" ) +
688 info.file_name() + Trait::from_ascii( "\" on line " ) +
689 Trait::to_string( info.line_number() ) +
690 Trait::from_ascii( "." ) );
691 }
692 }
693
696 const typename Trait::string_t & str ) override
697 {
698 if( this->is_any_child_defined() )
700 Trait::from_ascii( "Value \"" ) + str +
701 Trait::from_ascii( "\" for tag \"" ) + this->name() +
702 Trait::from_ascii( "\" must be defined before any child "
703 "tag. In file \"" ) +
704 info.file_name() + Trait::from_ascii( "\" on line " ) +
705 Trait::to_string( info.line_number() ) +
706 Trait::from_ascii( "." ) );
707
708 const typename Trait::string_t value =
710
711 m_value.append( value );
712
713 this->set_defined();
714 }
715
716private:
718 typename Trait::string_t m_value;
721}; // class tag_scalar_t
722
723
724#ifdef CFGFILE_QT_SUPPORT
725
726//
727// tag_scalar_t< QString >
728//
729
731template< typename Trait >
733 : public tag_t< Trait >
734{
735 static const typename Trait::pos_t c_max_string_length = 80;
736
737public:
739 explicit tag_scalar_t( const typename Trait::string_t & name,
740 bool is_mandatory = false )
742 , m_value( QString() )
743 , m_constraint( nullptr )
744 {
745 }
746
748 tag_scalar_t( tag_t< Trait > & owner, const typename Trait::string_t & name,
749 bool is_mandatory = false )
751 , m_value( QString() )
752 , m_constraint( nullptr )
753 {
754 }
755
757 {
758 }
759
761 const QString &
762 value() const
763 {
764 return m_value;
765 }
766
768 void
769 set_value( const QString & v )
770 {
771 if( m_constraint )
772 {
773 if( !m_constraint->check( v ) )
775 Trait::from_ascii( "Invalid value: \"" ) +
776 typename Trait::string_t(
778 Trait::from_ascii( "\". Value must match to the constraint "
779 "in tag \"" ) +
780 this->name() + Trait::from_ascii( "\"." ) );
781 }
782
783 m_value = v;
784
785 this->set_defined();
786 }
787
795 void
797 {
798 if( this->is_defined() )
799 receiver = m_value;
800 }
801
803 void
805 {
806 m_constraint = c;
807 }
808
810 typename Trait::string_t print( int indent = 0 ) const override
811 {
812 typename Trait::string_t result;
813
814 if( this->is_defined() )
815 {
816 result.append( typename Trait::string_t( indent,
818
820 result.append( this->name() );
821 result.push_back( const_t< Trait >::c_space );
822
824
825 const typename Trait::pos_t sections =
826 ( value.length() / c_max_string_length +
827 ( value.length() % c_max_string_length > 0 ? 1 : 0 ) );
828
829 if( sections )
830 {
831 const typename Trait::string_t spaces = typename Trait::string_t(
832 this->name().length() + 2, const_t< Trait >::c_space );
833
834 for( typename Trait::pos_t i = 0; i < sections; ++i )
835 {
836 if( i > 0 )
837 {
839
840 result.append( typename Trait::string_t( indent,
842
843 result.append( spaces );
844 }
845
846 const typename Trait::string_t tmp =
848 value.mid( i * c_max_string_length,
849 c_max_string_length ) );
850
851 result.append( tmp );
852 }
853 }
854 else
855 {
858 }
859
860 if( !this->children().empty() )
861 {
863
864 for( const tag_t< Trait > * tag : this->children() )
865 result.append( tag->print( indent + 1 ) );
866
867 result.append( typename Trait::string_t( indent,
869 }
870
873 }
874
875 return result;
876 }
877
878#ifdef CFGFILE_XML_SUPPORT
880 void print( QDomDocument & doc, QDomElement * parent = 0 ) const override
881 {
882 if( this->is_defined() )
883 {
884 QDomElement this_element = doc.createElement( this->name() );
885
886 if( !parent )
887 doc.appendChild( this_element );
888 else
889 parent->appendChild( this_element );
890
891 typename Trait::string_t value =
894
895 QDomText data = doc.createTextNode( value );
896
897 this_element.appendChild( data );
898
899 if( !this->children().empty() )
900 {
901 for( const tag_t< Trait > * tag : this->children() )
902 tag->print( doc, &this_element );
903 }
904 }
905 }
906#endif // CFGFILE_XML_SUPPORT
907
909 void on_finish( const parser_info_t< Trait > & info ) override
910 {
911 if( m_constraint )
912 {
913 if( !m_constraint->check( m_value ) )
915 Trait::from_ascii( "Invalid value: \"" ) +
916 typename Trait::string_t( m_value ) +
917 Trait::from_ascii( "\". Value must match to the "
918 "constraint in tag \"" ) +
919 this->name() + Trait::from_ascii( "\". In file \"" ) +
920 info.file_name() + Trait::from_ascii( "\" on line " ) +
921 Trait::to_string( info.line_number() ) +
922 Trait::from_ascii( "." ) );
923 }
924
925 if( !this->is_defined_member_value() )
927 Trait::from_ascii( "Undefined value of tag: \"" ) +
928 this->name() + Trait::from_ascii( "\". In file \"" ) +
929 info.file_name() + Trait::from_ascii( "\" on line " ) +
930 Trait::to_string( info.line_number() ) +
931 Trait::from_ascii( "." ) );
932
933 for( const tag_t< Trait > * tag : this->children() )
934 {
935 if( tag->is_mandatory() && !tag->is_defined() )
937 Trait::from_ascii( "Undefined child mandatory tag: \"" ) +
938 tag->name() + Trait::from_ascii( "\". Where parent is: \"" ) +
939 this->name() + Trait::from_ascii( "\". In file \"" ) +
940 info.file_name() + Trait::from_ascii( "\" on line " ) +
941 Trait::to_string( info.line_number() ) +
942 Trait::from_ascii( "." ) );
943 }
944 }
945
948 const typename Trait::string_t & str ) override
949 {
950 if( this->is_any_child_defined() )
952 Trait::from_ascii( "Value \"" ) + str +
953 Trait::from_ascii( "\" for tag \"" ) + this->name() +
954 Trait::from_ascii( "\" must be defined before any "
955 "child tag. In file \"" ) +
956 info.file_name() + Trait::from_ascii( "\" on line " ) +
957 Trait::to_string( info.line_number() ) +
958 Trait::from_ascii( "." ) );
959
961
962 m_value.append( value );
963
964 this->set_defined();
965 }
966
967private:
969 QString m_value;
971 constraint_t< QString > * m_constraint;
972}; // class tag_scalar_t< QString >
973
974#endif // CFGFILE_QT_SUPPORT
975
976} /* namespace cfgfile */
977
978#endif // CFGFILE__TAG_SCALAR_HPP__INCLUDED
Exception in the library.
Definition exceptions.hpp:51
Format template value to the string and back.
Definition format.hpp:57
static T from_string(const parser_info_t< Trait > &, const typename Trait::string_t &)
Format value from string.
static Trait::string_t to_string(const T &)
Format value to string.
Trait::string_t print(int indent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:810
tag_scalar_t(const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:739
void on_string(const parser_info_t< Trait > &info, const typename Trait::string_t &str) override
Called when string found.
Definition tag_scalar.hpp:947
void print(QDomDocument &doc, QDomElement *parent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:880
void query_opt_value(QString &receiver)
Query optional value.
Definition tag_scalar.hpp:796
~tag_scalar_t()
Definition tag_scalar.hpp:756
void on_finish(const parser_info_t< Trait > &info) override
Called when tag parsing finished.
Definition tag_scalar.hpp:909
const QString & value() const
Definition tag_scalar.hpp:762
void set_value(const QString &v)
Set value.
Definition tag_scalar.hpp:769
tag_scalar_t(tag_t< Trait > &owner, const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:748
void set_constraint(constraint_t< QString > *c)
Set constraint for the tag's value.
Definition tag_scalar.hpp:804
Trait::string_t print(int indent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:342
tag_scalar_t(const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:292
void on_string(const parser_info_t< Trait > &info, const typename Trait::string_t &str) override
Called when string found.
Definition tag_scalar.hpp:437
~tag_scalar_t()
Definition tag_scalar.hpp:307
tag_scalar_t(tag_t< Trait > &owner, const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:300
void on_finish(const parser_info_t< Trait > &info) override
Called when tag parsing finished.
Definition tag_scalar.hpp:410
void set_value(const bool &v)
Set value.
Definition tag_scalar.hpp:320
void query_opt_value(bool &receiver)
Query optional value.
Definition tag_scalar.hpp:335
const bool & value() const
Definition tag_scalar.hpp:313
void print(QDomDocument &doc, QDomElement *parent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:381
tag_scalar_t(const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:485
void print(QDomDocument &doc, QDomElement *parent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:627
void set_constraint(constraint_t< typename Trait::string_t > *c)
Set constraint for the tag's value.
Definition tag_scalar.hpp:549
const Trait::string_t & value() const
Definition tag_scalar.hpp:508
void query_opt_value(typename Trait::string_t &receiver)
Query optional value.
Definition tag_scalar.hpp:541
void on_string(const parser_info_t< Trait > &info, const typename Trait::string_t &str) override
Called when string found.
Definition tag_scalar.hpp:695
tag_scalar_t(tag_t< Trait > &owner, const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:494
void on_finish(const parser_info_t< Trait > &info) override
Called when tag parsing finished.
Definition tag_scalar.hpp:656
void set_value(const typename Trait::string_t &v)
Set value.
Definition tag_scalar.hpp:515
Trait::string_t print(int indent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:555
Tag with scalar value.
Definition tag_scalar.hpp:60
tag_scalar_t(tag_t< Trait > &owner, const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:72
void on_finish(const parser_info_t< Trait > &info) override
Called when tag parsing finished.
Definition tag_scalar.hpp:201
Trait::string_t print(int indent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:134
void on_string(const parser_info_t< Trait > &info, const typename Trait::string_t &str) override
Called when string found.
Definition tag_scalar.hpp:227
void query_opt_value(T &receiver)
Query optional value.
Definition tag_scalar.hpp:120
~tag_scalar_t()
Definition tag_scalar.hpp:80
void set_value(const T &v)
Set value.
Definition tag_scalar.hpp:93
void set_constraint(constraint_t< T > *c)
Set constraint for the tag's value.
Definition tag_scalar.hpp:128
void print(QDomDocument &doc, QDomElement *parent=0) const override
Print tag to the output.
Definition tag_scalar.hpp:173
const T & value() const
Definition tag_scalar.hpp:86
tag_scalar_t(const typename Trait::string_t &name, bool is_mandatory=false)
Construct tag.
Definition tag_scalar.hpp:63
Base class for the tags in the configuration file.
Definition tag.hpp:58
bool is_defined_member_value() const
Definition tag.hpp:227
void set_defined(bool on=true)
Set "defined" property.
Definition tag.hpp:164
bool is_mandatory() const
Definition tag.hpp:146
bool is_any_child_defined() const
Definition tag.hpp:220
bool is_defined() const
Definition tag.hpp:152
const tag_t< Trait > * parent() const
Definition tag.hpp:134
virtual const child_tags_list_t & children() const
Definition tag.hpp:182
const Trait::string_t & name() const
Definition tag.hpp:140
Definition const.hpp:38
Definition const.hpp:45