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

📄 sysstring.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 3 页
字号:
// file: $isip/class/system/SysString/SysString.h// version: $Id: SysString.h,v 1.92 2001/06/11 03:08:00 hamaker Exp $//// make sure definitions are only made once//#ifndef ISIP_SYS_STRING#define ISIP_SYS_STRING// include the configure output://  this has to be done here since wchar.h is possibly included before//  File.h (which in turn includes Integral.h and IntegralConfigure.h)//#ifndef ISIP_INTEGRAL_CONFIGURE#define ISIP_INTERNAL_USE_ONLY#include <IntegralConfigure.h>#undef ISIP_INTERNAL_USE_ONLY#endif// include definition for the SysComplex type//#ifndef ISIP_SYS_COMPLEX#include <SysComplex.h>#endif// system include files needed for non Solaris systems//#if ISIP_WCHAR_MODE == ISIP_WCHAR_REDHAT#include <wchar.h>#endif// isip include files://  though we could get by with a forward class definition, it is very//  convenient to include SysChar here, since virtually all methods//  use it. File is needed so we can convert the File::MODE//  enumeration into a string. a benefit of having SysChar in the//  header file is so we can convert the SysChar::ENCODING enumeration//  into a string, as well//#ifndef ISIP_SYS_CHAR#include <SysChar.h>#endif#ifndef ISIP_FILE#include <File.h>#endif// SysString: a class that manages a string of unicode characters. this is// needed at a low-level in the system so that other low-level classes,// such as Sof, can operate on unicode characters. most users will// interact with a higher-level version of this class in math/scalar// called String.//class SysString {      //---------------------------------------------------------------------------  //  // public constants  //  //---------------------------------------------------------------------------public:  // define the class name  //  static const SysString CLASS_NAME;    //---------------------------------------  //  // other important constants  //  //---------------------------------------  // miscellaneous constants  //  static const long MAX_LENGTH = 1024;  static const long BIG_BUFFER_LENGTH = 8192;  static const long STATIC_BUFFER_SIZE = 16;  // define special strings  //  static const unichar NULL_STRING[];  static const SysString NULL_PTR;    // text corresponding to boolean values  //  static const SysString BOOL_TRUE;  static const SysString BOOL_FALSE;  // text corresponding to debug values  //  static const SysString DBG_NONE;  static const SysString DBG_BRIEF;  static const SysString DBG_DETAILED;  static const SysString DBG_ALL;    // text corresponding to compare values  //  static const SysString CMP_EQUAL;  static const SysString CMP_LESSER;  static const SysString CMP_GREATER;  // text corresponding to file mode values  //  static const SysString MODE_READ_ONLY;  static const SysString MODE_READ_PLUS;  static const SysString MODE_WRITE_ONLY;  static const SysString MODE_WRITE_PLUS;  static const SysString MODE_APPEND_ONLY;  static const SysString MODE_APPEND_PLUS;  // text corresponding to file type values  //  static const SysString TYPE_TEXT;  static const SysString TYPE_BINARY;    // text corresponding to file binary mode values  //  static const SysString BMODE_NATIVE;  static const SysString BMODE_SWAP;  static const SysString BMODE_BIG_ENDIAN;  static const SysString BMODE_LITTLE_ENDIAN;    // text corresponding to SysChar encode values  //  static const SysString ENCODE_ASCII;  static const SysString ENCODE_UTF8;  static const SysString ENCODE_UTF16;    // text corresponding to MemoryManager modes  //  static const SysString MMGR_MODE_OPTIMIZE;  static const SysString MMGR_MODE_TRACK;    // small state machine for symbolPad  //  static const long STATE_PAD_NOSPACE = 0;  static const long STATE_PAD_SPACE = 1;    // format for the debug method output  //  static const SysString DBG_FORMAT_0;  static const SysString DBG_FORMAT_1;  static const SysString DBG_FORMAT_2;  static const SysString DBG_FORMAT_3;  // format for the debugStr output  //  static const SysString DBGS_FORMAT_0;  static const SysString DBGS_FORMAT_1;  static const SysString DBGS_FORMAT_2;  static const SysString DBGS_FORMAT_3;  // 8-bit version of the default format strings (for efficiency)  //  static const char DEF_FMT_VOIDP_8BIT[];  static const char DEF_FMT_ULONG_8BIT[];  static const char DEF_FMT_ULLONG_8BIT[];  static const char DEF_FMT_LONG_8BIT[];  static const char DEF_FMT_LLONG_8BIT[];  static const char DEF_RFMT_FLOAT_8BIT[];  static const char DEF_WFMT_FLOAT_8BIT[];  static const char DEF_RFMT_DOUBLE_8BIT[];  static const char DEF_WFMT_DOUBLE_8BIT[];  //----------------------------------------  //  // default values and arguments  //  //----------------------------------------    // define the default value(s) of the class data  //  static const long DEF_CAPACITY = 0;  static const SysString DEF_VALUE;  // default arguments to methods  //  static const unichar DEF_TERM = (unichar)NULL;  static const byte DEF_TERM_BYTE = (byte)NULL;  static const long DEF_POS = Integral::NO_POS;  //----------------------------------------  //  // error codes  //  //----------------------------------------    static const long ERR = 1300;    //---------------------------------------------------------------------------  //  // protected data  //  //---------------------------------------------------------------------------protected:  // internal data - be careful not to add anything that isn't absolutely  // necessary, so that higher level classes (e.g., vector) do not waste space  //  unichar* value_d;  long capacity_d;  // declare a static debug level for all class instantiations  //  static Integral::DEBUG debug_level_d;    //---------------------------------------------------------------------------  //  // required public methods  //  //---------------------------------------------------------------------------public:  // method: name  //  static const SysString& name() {    return CLASS_NAME;  }    // other static methods  //  static boolean diagnose(Integral::DEBUG debug_level);  // method: setDebug  //  the setDebug method for this class is static because the debug_level is  //  shared across all objects of this class type  //  static boolean setDebug(Integral::DEBUG level) {    debug_level_d = level;    return true;  }  // other debug methods  //  boolean debug(const unichar* msg) const;    // destructor/constructor(s)  //  // method: destructor  //  ~SysString() {    freeMem();  }  // method: default constructor  //  SysString(long capacity = DEF_CAPACITY);  // method: copy constructor  //  SysString(const SysString& arg);    // assign methods  //  boolean assign(const SysString& arg);  // method: operator=  //  SysString& operator=(const SysString& arg) {    assign(arg);    return *this;  }  // i/o methods:  //  these methods are omitted because SysString can not write itself to an  //  sof file  //  // equality methods  //  boolean eq(const SysString& value, boolean case_sensitive = true) const;  // memory management methods:  //  the new and delete methods are omitted because only classes at the  //  math library level and above are required to override new and delete  //  boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  extensions to required methods  //  //---------------------------------------------------------------------------  // constructors  //  SysString(const unichar* data);  SysString(const byte* data, SysChar::ENCODE encoding = SysChar::DEF_ENCODE);  // assign methods  //  boolean assign(const unichar* data);  boolean assign(const byte* data, long max_size = BIG_BUFFER_LENGTH,		 SysChar::ENCODE encoding = SysChar::DEF_ENCODE);  // numeric conversion assignment methods:  //  boolean assign(const void* arg);  boolean assign(boolean arg);  boolean assign(const byte arg);  boolean assign(unichar arg);  boolean assign(const ushort arg);  boolean assign(const ulong arg);  boolean assign(const ullong arg);  boolean assign(const short arg);  boolean assign(const long arg);  boolean assign(const llong arg);  boolean assign(const float arg);  boolean assign(const double arg);  template <class TIntegral>  boolean assign(const SysComplex<TIntegral>& arg);  // define versions of the assign methods that take format strings  //  boolean assign(const SysString& arg, const unichar* fmt);  boolean assign(const unichar* data, const unichar* fmt);  boolean assign(const byte* data, const unichar* fmt,		 long max_size = BIG_BUFFER_LENGTH,		 SysChar::ENCODE encoding = SysChar::DEF_ENCODE);  // numeric conversion assignment methods:  //  these methods are similar to sprintf() in C  //  boolean assign(const void* arg, const unichar* fmt);  boolean assign(const boolean arg, const unichar* fmt);  boolean assign(const byte arg, const unichar* fmt);  boolean assign(const unichar arg, const unichar* fmt);  boolean assign(const ushort arg, const unichar* fmt);  boolean assign(const ulong arg, const unichar* fmt);  boolean assign(const ullong arg, const unichar* fmt);  boolean assign(const short arg, const unichar* fmt);  boolean assign(const long arg, const unichar* fmt);  boolean assign(const llong arg, const unichar* fmt);  boolean assign(const float arg, const unichar* fmt);  boolean assign(const double arg, const unichar* fmt);  template <class TIntegral>  boolean assign(const SysComplex<TIntegral>& arg, const unichar* fmt);  // enum assignment methods  //  boolean assign(Integral::DEBUG arg);  boolean assign(Integral::COMPARE arg);  boolean assign(File::MODE arg);  boolean assign(File::BMODE arg);  boolean assign(File::TYPE arg);  boolean assign(SysChar::ENCODE arg);  boolean assign(MemoryManager::MODE arg);    // special assignment methods:  //  swaps pointers and is meant to be very fast  //  boolean swap(SysString& arg);  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  relational and logical methods  //  //---------------------------------------------------------------------------    // method: compare  //  Integral::COMPARE compare(const SysString& str) const {    return compare(*this, str);  }    // other generic compare methods  //  Integral::COMPARE compare(const SysString& arg1,			    const SysString& arg2) const;  Integral::COMPARE compare(const unichar* str) const;  Integral::COMPARE comparePartial(const SysString& arg,				   long arg_offset,				   long num_elements, long offset) const;  Integral::COMPARE comparePartial(const unichar* arg,				   long arg_offset,				   long num_elements, long offset) const;  // method: ne  //  boolean ne(const SysString& vector, boolean case_sensitive = true) const {    return !eq(vector, case_sensitive);  }  // other equality methods:  //  boolean eq(const unichar* value, boolean case_sensitive = true) const;  boolean ne(const unichar* value, boolean case_sensitive = true) const;  // method: gt  //  boolean gt(const SysString& vector) const {    return (compare(vector) == Integral::GREATER);  }  // other greater than methods  //  boolean gt(const unichar* value) const;  // method: lt  //  boolean lt(const SysString& vector) const {    return (compare(vector) == Integral::LESSER);  }  // other less than methods  //  boolean lt(const unichar* value) const;  // method: ge  //

⌨️ 快捷键说明

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