source: tags/arb-6.0/CONVERTALN/wrap.h

Last change on this file was 7623, checked in by westram, 13 years ago
  • merge from dev [7450] [7452] [7456] [7457] [7458] [7459] [7460] [7461] [7464] [7465] [7466] [7467] [7468] [7469] [7482]
    • tweaked compiler options
      • activated -Weffc++
        • postfilter warnings where Scott Meyers' advices are too general.
          • base classes should not always have virtual destructors, since that renders tiny classes useless and
          • members should not always be initialized via initialization list, since that often violates the DRY principle
        • fix gcc's inability to detect that Noncopyable implements a private copy-ctor and op=
        • this slows down complete ARB recompilation by ~5%
    • added -Wold-style-cast (inactive)
    • removed -Wno-non-template-friend added in [7447]
  • postcompile.pl
    • added option —original to show unmodified compiler output
  • declared op= for classes which had a copy-ctor
  • moved op= macros to arbtools.h
  • derived classes containing pointers from Noncopyable (use Noncopyable virtually) or
  • made them copyable if needed (awt_mask_item, KnownDB, Code, AWT_registered_itemtype, GEN_gene, PosGene, PartialSequence, PlugIn, Range, Convaln_exception)
  • other related changes
    • user mask destruction working now
File size: 848 bytes
Line 
1#ifndef WRAP_H
2#define WRAP_H
3
4class 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
13public:
14    WrapMode(const char *separators_) : separators(nulldup(separators_)) {}
15    WrapMode(bool allowWrap) : separators(allowWrap ? 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.