Line | |
---|
1 | #ifndef WRAP_H |
---|
2 | #define WRAP_H |
---|
3 | |
---|
4 | class WrapMode : virtual Noncopyable { |
---|
5 | char *separators; |
---|
6 | |
---|
7 | bool allowed_to_wrap() const { return separators; } |
---|
8 | const char *get_seps() const { ca_assert(allowed_to_wrap()); return separators; } |
---|
9 | int wrap_pos(const char *str, int wrapCol) const; |
---|
10 | |
---|
11 | const char *print_return_wrapped(Writer& write, const char * const content, const int len, const int rest_width) const; |
---|
12 | |
---|
13 | public: |
---|
14 | WrapMode(const char *separators_) : separators(nulldup(separators_)) {} |
---|
15 | WrapMode(bool allowWrap) : separators(allowWrap ? ARB_strdup(WORD_SEP) : NULL) {} // true->wrap words, false->wrapping forbidden |
---|
16 | ~WrapMode() { free(separators); } |
---|
17 | |
---|
18 | void print(Writer& write, const char *first_prefix, const char *other_prefix, const char *content, int max_width) const; |
---|
19 | }; |
---|
20 | |
---|
21 | #else |
---|
22 | #error wrap.h included twice |
---|
23 | #endif // WRAP_H |
---|
Note: See
TracBrowser
for help on using the repository browser.