File indexing completed on 2023-03-17 11:03:19
0001 #ifndef FWCore_ParameterSet_DocFormatHelper_h
0002 #define FWCore_ParameterSet_DocFormatHelper_h
0003
0004
0005
0006
0007
0008 #include <string>
0009 #include <iosfwd>
0010
0011 namespace edm {
0012
0013 class ParameterDescriptionNode;
0014
0015 class DocFormatHelper {
0016 public:
0017 enum DescriptionParent { TOP, OR, XOR, AND, OTHER };
0018
0019 DocFormatHelper()
0020 : brief_(false),
0021 lineWidth_(80),
0022 indentation_(4),
0023 startColumn2_(24U),
0024 section_(),
0025 pass_(0),
0026 column1_(0),
0027 column2_(0),
0028 column3_(0),
0029 counter_(0),
0030 parent_(OTHER) {}
0031
0032 void init();
0033
0034 bool brief() const { return brief_; }
0035 size_t lineWidth() const { return lineWidth_; }
0036 int indentation() const { return indentation_; }
0037 int startColumn2() const { return startColumn2_; }
0038
0039 void setBrief(bool value) { brief_ = value; }
0040 void setLineWidth(size_t value) { lineWidth_ = value; }
0041 void setIndentation(int value) { indentation_ = value; }
0042
0043 std::string const& section() const { return section_; }
0044 void setSection(std::string const& value) { section_ = value; }
0045
0046 int pass() const { return pass_; }
0047 void setPass(int value) { pass_ = value; }
0048
0049 size_t column1() const { return column1_; }
0050 size_t column2() const { return column2_; }
0051 size_t column3() const { return column3_; }
0052
0053 void setAtLeast1(size_t width) {
0054 if (width > column1_)
0055 column1_ = width;
0056 }
0057 void setAtLeast2(size_t width) {
0058 if (width > column2_)
0059 column2_ = width;
0060 }
0061 void setAtLeast3(size_t width) {
0062 if (width > column3_)
0063 column3_ = width;
0064 }
0065
0066 int counter() const { return counter_; }
0067 void setCounter(int value) { counter_ = value; }
0068 void incrementCounter() { ++counter_; }
0069 void decrementCounter() { --counter_; }
0070
0071 DescriptionParent parent() const { return parent_; }
0072 void setParent(DescriptionParent value) { parent_ = value; }
0073
0074 size_t commentWidth() const;
0075
0076 static void wrapAndPrintText(std::ostream& os, std::string const& text, size_t indent, size_t suggestedWidth);
0077
0078 void indent(std::ostream& os) const;
0079 void indent2(std::ostream& os) const;
0080
0081 static int offsetModuleLabel() { return 2; }
0082 static int offsetTopLevelPSet() { return 2; }
0083 static int offsetSectionContent() { return 4; }
0084
0085 private:
0086 bool brief_;
0087 size_t lineWidth_;
0088 int indentation_;
0089 size_t startColumn2_;
0090
0091 std::string section_;
0092
0093 int pass_;
0094
0095 size_t column1_;
0096 size_t column2_;
0097 size_t column3_;
0098
0099 int counter_;
0100
0101 DescriptionParent parent_;
0102 };
0103 }
0104 #endif