CMakeWriter.cpp
Go to the documentation of this file.
1#include "CMakeWriter.h"
2
3using namespace armarx;
4
6{
7 indent = 0;
8 indentChars = " ";
9 lastLineType = Empty;
10}
11
12void
13CMakeWriter::startBlock(const std::string& line)
14{
15 this->line(line);
16 // this->line("{");
17 indent++;
18 lastLineType = StartBlock;
19}
20
21void
22CMakeWriter::endBlock(const std::string& line)
23{
24 indent--;
25 this->line(std::string("}") + line);
26 lastLineType = EndBlock;
27}
28
29void
30CMakeWriter::endBlockComment(std::string comment)
31{
32 indent--;
33 this->line(std::string("# ") + comment);
34 lastLineType = EndBlock;
35}
36
37void
39{
40 lineInternal("", indent);
41}
42
43void
44CMakeWriter::line(const std::string& line)
45{
46 lineInternal(line, indent);
47}
48
49void
50CMakeWriter::line(const std::string& line, int indentDelta)
51{
52 lineInternal(line, indent + indentDelta);
53}
54
55std::string
57{
58 return ss.str();
59}
60
63{
64 return lastLineType;
65}
66
67void
68CMakeWriter::lineInternal(const std::string& line, int indent)
69{
70 for (int i = 0; i < indent; i++)
71 {
72 ss << indentChars;
73 }
74
75 ss << line << std::endl;
76 lastLineType = line.empty() ? Empty : Normal;
77}
void endBlock(const std::string &line)
LineType getLastLineType()
void endBlockComment(std::string comment)
void startBlock(const std::string &line)
std::string getString()
This file offers overloads of toIce() and fromIce() functions for STL container types.