substr.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 51 行

H
51
字号
#ifndef _substr_h
#define _substr_h


//Revision 1.1  1994/04/08  15:27:59  peter
//Initial revision
//

#include <iostream.h>
#include "basics.h"

class SubStr {
public:
    char		*str;
    uint		len;
public:
    friend bool operator==(const SubStr, const SubStr);
    SubStr(uchar*, uint);
    SubStr(char*, uint);
    SubStr(const SubStr&);
    void out(ostream&) const;
};

class Str: public SubStr {
public:
    Str(const SubStr&);
    Str(Str&);
    Str();
    ~Str();
};

inline ostream& operator<<(ostream& o, const SubStr s){
    s.out(o);
    return o;
}

inline ostream& operator<<(ostream& o, const SubStr* s){
    return o << *s;
}

inline SubStr::SubStr(uchar *s, uint l)
    : str((char*) s), len(l) { }

inline SubStr::SubStr(char *s, uint l)
    : str(s), len(l) { }

inline SubStr::SubStr(const SubStr &s)
    : str(s.str), len(s.len) { }

#endif

⌨️ 快捷键说明

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