⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncbistr.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    ///   Return "arr", the list of wrapped lines.    static list<string>& Wrap(const string& str, SIZE_TYPE width,                              list<string>& arr, TWrapFlags flags,                              const string& prefix, const string& prefix1);    /// Wrap the list using the specified criteria -- default prefix,     /// prefix1 version.    ///    /// WrapList() is similar to Wrap(), but tries to avoid splitting any    /// elements of the list to be wrapped. Also, the "delim" only applies    /// between elements on the same line; if you want everything to end with    /// commas or such, you should add them first.    ///    /// @param l    ///   The list to be wrapped.    /// @param width    ///   Width of each wrapped line.    /// @param delim    ///   Delimiters used to split elements on the same line.    /// @param arr    ///   List containing the wrapped list result.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0(default), do not add a prefix string to the    ///   wrapped lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0(default), do not add a prefix string to the    ///   first line.    /// @return    ///   Return "arr", the wrapped list.    static list<string>& WrapList(const list<string>& l, SIZE_TYPE width,                                  const string& delim, list<string>& arr,                                  TWrapFlags flags = 0,                                  const string* prefix = 0,                                  const string* prefix1 = 0);    /// Wrap the list using the specified criteria -- default prefix1 version.    ///    /// WrapList() is similar to Wrap(), but tries to avoid splitting any    /// elements of the list to be wrapped. Also, the "delim" only applies    /// between elements on the same line; if you want everything to end with    /// commas or such, you should add them first.    ///    /// @param l    ///   The list to be wrapped.    /// @param width    ///   Width of each wrapped line.    /// @param delim    ///   Delimiters used to split elements on the same line.    /// @param arr    ///   List containing the wrapped list result.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0, do not add a prefix string to the    ///   wrapped lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0(default), do not add a prefix string to the    ///   first line.    /// @return    ///   Return "arr", the wrappe list.    static list<string>& WrapList(const list<string>& l, SIZE_TYPE width,                                  const string& delim, list<string>& arr,                                  TWrapFlags flags, const string& prefix,                                  const string* prefix1 = 0);            /// Wrap the list using the specified criteria.    ///    /// WrapList() is similar to Wrap(), but tries to avoid splitting any    /// elements of the list to be wrapped. Also, the "delim" only applies    /// between elements on the same line; if you want everything to end with    /// commas or such, you should add them first.    ///    /// @param l    ///   The list to be wrapped.    /// @param width    ///   Width of each wrapped line.    /// @param delim    ///   Delimiters used to split elements on the same line.    /// @param arr    ///   List containing the wrapped list result.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0, do not add a prefix string to the    ///   wrapped lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0, do not add a prefix string to the    ///   first line.    /// @return    ///   Return "arr", the wrapped list.    static list<string>& WrapList(const list<string>& l, SIZE_TYPE width,                                  const string& delim, list<string>& arr,                                  TWrapFlags flags, const string& prefix,                                  const string& prefix1);}; // class NStr/////////////////////////////////////////////////////////////////////////////////// CStringUTF8 --////// Define a UTF-8 String class.////// UTF-8 stands for Unicode Transformation Format-8, and is an 8-bit/// lossless encoding of Unicode characters./// @sa///   RFC 2279class NCBI_XNCBI_EXPORT CStringUTF8 : public string{public:    /// Constructor.    CStringUTF8(void)    {    }    /// Destructor.    ~CStringUTF8(void)    {    }    /// Copy constructor.    CStringUTF8(const CStringUTF8& src)        : string(src)    {    }    /// Constructor from a string argument.    CStringUTF8(const string& src)        : string()    {        x_Append(src.c_str());    }    /// Constructor from a char* argument.    CStringUTF8(const char* src)        : string()    {        x_Append(src);    }#if defined(HAVE_WSTRING)    /// Constructor from a wstring argument.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8(const wstring& src)        : string()    {        x_Append( src.c_str());    }    /// Constructor from a whcar_t* argument.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8(const wchar_t* src)        : string()    {        x_Append(src);    }#endif // HAVE_WSTRING    /// Assignment operator -- rhs is a CStringUTF8.    CStringUTF8& operator= (const CStringUTF8& src)    {        string::operator= (src);        return *this;    }    /// Assignment operator -- rhs is a string.    CStringUTF8& operator= (const string& src)    {        erase();        x_Append(src.c_str());        return *this;    }    /// Assignment operator -- rhs is a char*.    CStringUTF8& operator= (const char* src)    {        erase();        x_Append(src);        return *this;    }#if defined(HAVE_WSTRING)    /// Assignment operator -- rhs is a wstring.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8& operator= (const wstring& src)    {        erase();        x_Append(src.c_str());        return *this;    }    /// Assignment operator -- rhs is a wchar_t*.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8& operator= (const wchar_t* src)    {        erase();        x_Append(src);        return *this;    }#endif // HAVE_WSTRING    /// Append to string operator+= -- rhs is CStringUTF8.    CStringUTF8& operator+= (const CStringUTF8& src)    {        string::operator+= (src);        return *this;    }    /// Append to string operator+= -- rhs is string.    CStringUTF8& operator+= (const string& src)    {        x_Append(src.c_str());        return *this;    }    /// Append to string operator+= -- rhs is char*.    CStringUTF8& operator+= (const char* src)    {        x_Append(src);        return *this;    }#if defined(HAVE_WSTRING)    /// Append to string operator+=  -- rhs is a wstring.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8& operator+= (const wstring& src)    {        x_Append(src.c_str());        return *this;    }    /// Append to string operator+=  -- rhs is a wchar_t*.    ///    /// Defined only if HAVE_STRING is defined.    CStringUTF8& operator+= (const wchar_t* src)    {        x_Append(src);        return *this;    }#endif // HAVE_WSTRING    /// Convert to ASCII.    ///    /// Can throw a StringException with error codes "eFormat" or "eConvert"    /// if string has a wrong UTF-8 format or cannot be converted to ASCII.    string AsAscii(void) const;#if defined(HAVE_WSTRING)    /// Convert to Unicode.    ///    /// Defined only if HAVE_STRING is defined.    /// Can throw a StringException with error code "eFormat" if string has    /// a wrong UTF-8 format.    wstring AsUnicode(void) const;#endif // HAVE_WSTRINGprivate:    /// Helper method to append necessary characters for UTF-8 format.    void x_Append(const char* src);#if defined(HAVE_WSTRING)    /// Helper method to append necessary characters for UTF-8 format.    ///    /// Defined only if HAVE_STRING is defined.    void x_Append(const wchar_t* src);#endif // HAVE_WSTRING};/////////////////////////////////////////////////////////////////////////////////// CParseTemplException --////// Define template class for parsing exception. This class is used to define/// exceptions for complex parsing tasks and includes an additional m_Pos/// data member. The constructor requires that an additional postional/// parameter be supplied along with the description message.template <class TBase>class CParseTemplException : EXCEPTION_VIRTUAL_BASE public TBase{public:    /// Error types that for exception class.    enum EErrCode {        eErr        ///< Generic error     };    /// Translate from the error code value to its string representation.    virtual const char* GetErrCodeString(void) const    {        switch (GetErrCode()) {        case eErr: return "eErr";        default:   return CException::GetErrCodeString();        }    }    /// Constructor.    ///    /// Report "pos" along with "what".    CParseTemplException(const char* file,int line,        const CException* prev_exception,        EErrCode err_code,const string& message,        string::size_type pos) throw()          : TBase(file, line,prev_exception,            (typename TBase::EErrCode)(CException::eInvalid),            message), m_Pos(pos)    {        this->x_Init(file, line,                     string("{") + NStr::UIntToString(m_Pos) + "} " + message,                     prev_exception);        this->x_InitErrCode((CException::EErrCode) err_code);    }    /// Constructor.    CParseTemplException(const CParseTemplException<TBase>& other) throw()        : TBase(other)    {        m_Pos = other.m_Pos;        x_Assign(other);    }    /// Destructor.    virtual ~CParseTemplException(void) throw() {}    /// Report error position.    virtual void ReportExtra(ostream& out) const    {        out << "m_Pos = " << m_Pos;    }    // Attributes.    /// Get exception class type.    virtual const char* GetType(void) const { return "CParseTemplException"; }    /// Get error code.  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -