MetaWriter.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package
19
* @author
20
* @date
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
#pragma once
25
26
#include <memory>
27
#include <sstream>
28
#include <string>
29
#include <vector>
30
31
// Simox
32
#include <SimoxUtility/algorithm/string.h>
33
34
namespace
armarx
35
{
36
class
MetaWriter;
37
using
MetaWriterPtr
= std::shared_ptr<MetaWriter>;
38
39
class
Lines
40
{
41
public
:
42
enum class
LineType
43
{
44
StartBlock
,
45
EndBlock
,
46
Normal
,
47
Empty
48
};
49
50
std::string
name
;
51
std::stringstream
ss
;
52
std::vector<std::string>
lines
;
53
int
indent
= 0;
54
55
Lines
() =
delete
;
56
Lines
(
const
std::string&,
const
std::string& =
" "
,
const
LineType
=
LineType::Empty
);
57
58
void
startBlock
();
59
void
startBlock
(
const
std::string&
line
);
60
void
endBlock
();
61
void
endBlock
(
const
std::string&
line
);
62
void
endBlockComment
(std::string comment);
63
64
void
line
();
65
void
line
(
const
std::string&
line
,
int
indentDelta = 0);
66
void
lineCheckDuplicate
(
const
std::string&
line
,
int
indentDelta = 0);
67
void
enforceEmptyLine
();
68
69
Lines::LineType
getLastLineType
();
70
71
private
:
72
void
lineInternal(
const
std::string&
line
,
int
indent
);
73
74
private
:
75
std::string indentChars;
76
LineType
lastLineType;
77
};
78
79
class
MetaWriter
80
{
81
public
:
82
MetaWriter
(
const
std::string& doc);
83
virtual
~MetaWriter
() =
default
;
84
85
void
lineHeader
();
86
void
lineFooter
();
87
88
std::string
getString
();
89
90
static
void
ConvertToTextWithMaxWidth
(
unsigned
int
maxTextWidth,
91
const
std::vector<std::string>& docLines,
92
std::vector<std::string>& linesOut);
93
94
public
:
95
Lines
header
;
96
Lines
body
;
97
Lines
footer
;
98
99
protected
:
100
std::string
fileDoc
;
101
};
102
}
// namespace armarx
armarx::MetaWriter::header
Lines header
Definition:
MetaWriter.h:95
armarx::Lines::startBlock
void startBlock()
Definition:
MetaWriter.cpp:34
armarx::Lines::endBlockComment
void endBlockComment(std::string comment)
Definition:
MetaWriter.cpp:67
armarx::MetaWriter::~MetaWriter
virtual ~MetaWriter()=default
armarx::MetaWriter::MetaWriter
MetaWriter(const std::string &doc)
Definition:
MetaWriter.cpp:158
armarx::Lines::LineType
LineType
Definition:
MetaWriter.h:42
armarx::Lines::LineType::Normal
@ Normal
armarx::Lines::LineType::Empty
@ Empty
armarx::Lines::ss
std::stringstream ss
Definition:
MetaWriter.h:51
armarx::Lines::lineCheckDuplicate
void lineCheckDuplicate(const std::string &line, int indentDelta=0)
Definition:
MetaWriter.cpp:96
armarx::Lines::Lines
Lines()=delete
armarx::Lines
Definition:
MetaWriter.h:39
armarx::Lines::line
void line()
Definition:
MetaWriter.cpp:124
armarx::Lines::LineType::StartBlock
@ StartBlock
armarx::Lines::indent
int indent
Definition:
MetaWriter.h:53
armarx::MetaWriter::footer
Lines footer
Definition:
MetaWriter.h:97
armarx::MetaWriter::ConvertToTextWithMaxWidth
static void ConvertToTextWithMaxWidth(unsigned int maxTextWidth, const std::vector< std::string > &docLines, std::vector< std::string > &linesOut)
Definition:
MetaWriter.cpp:164
armarx::MetaWriter::fileDoc
std::string fileDoc
Definition:
MetaWriter.h:100
armarx::Lines::enforceEmptyLine
void enforceEmptyLine()
Definition:
MetaWriter.cpp:118
armarx::Lines::endBlock
void endBlock()
Definition:
MetaWriter.cpp:51
armarx::MetaWriterPtr
std::shared_ptr< MetaWriter > MetaWriterPtr
Definition:
MetaWriter.h:37
armarx::MetaWriter::lineFooter
void lineFooter()
armarx::Lines::LineType::EndBlock
@ EndBlock
armarx::MetaWriter::body
Lines body
Definition:
MetaWriter.h:96
armarx::Lines::lines
std::vector< std::string > lines
Definition:
MetaWriter.h:52
armarx::MetaWriter::getString
std::string getString()
Definition:
MetaWriter.cpp:182
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:27
armarx::Lines::getLastLineType
Lines::LineType getLastLineType()
Definition:
MetaWriter.cpp:141
armarx::MetaWriter::lineHeader
void lineHeader()
armarx::MetaWriter
Definition:
MetaWriter.h:79
armarx::Lines::name
std::string name
Definition:
MetaWriter.h:50
ArmarXCore
libraries
cppgen
MetaWriter.h
Generated on Sat Mar 29 2025 09:17:21 for armarx_documentation by
1.8.17