作者WolfLord (呆呆小狼)
看板CodeJob
標題Re: [討論] 修改CSV格式 請問這樣值多少錢?
時間Thu Dec 1 18:41:55 2011
※ 引述《deo2000 (800IM)》之銘言:
: 推 WolfLord:要是我報價大約5K左右,其實這個功能我自己寫的字串就有 12/01 17:35
: → WolfLord:對應功能了,大概需要花幾十分鐘做UI吧 12/01 17:37
: → WolfLord:朋友做交情的話,一瓶可樂或正妹撒嬌都可能....就醬 XDD 12/01 17:37
: UI 嘛...我有用 cout + while(1) + system("cls") 做 UI 算嗎XD
: 防錯,趕時間就沒弄了
除非對方要用來串SH不然這樣應該算不上UI,不管收不收錢以我無謂的User friendly
自我要求責任感下,我最少會一啟動先呼叫一個OpenFileDialog,然後有輸出最少會
叫一下SaveFileDialog(不使用winmain)。
: 不好意思,可能我功力不夠無法理解,為何說是自己寫的"字串"而不是"function"呢?
那就臭屁一下吧 :P (很長喔~ 不想看的直接END吧 :P )
//---------------------------------------------------------------------------
#ifndef wlsStringH
#define wlsStringH
//---------------------------------------------------------------------------
//----- Vars
//----- Definitions
#ifndef _stdLibWLS
#ifdef __BORLANDC__
#define _stdLibWLS __fastcall
#include <vcl.h>
#else
#define _stdLibWLS __stdcall
#define BYTE char
#define WORD short
#define DWORD long
#endif
#endif
#ifndef __BORLANDC__
extern "C" {void setmem(void *buf, int count, char ch);};
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
struct wlsGenPos{
int x1; int x2; int y1; int y2;
int z1; int z2; int t1; int t2;
int i; int c; int n; int p;
};
//---------------------------------------------------------------------------
#ifndef _wlsCRC16Defined
#define _wlsCRC16Defined
#ifndef __x86Only__
struct __wlsCRC16Byte{ //Big endian
BYTE high;
BYTE low;
};
#else
struct __wlsCRC16Byte{ //Little endian
BYTE low;
BYTE high;
};
#endif
//---------------------------------------------------------------------------
union _wlsCRC16{
__wlsCRC16Byte bytes;
WORD crc;
};
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
extern void _stdLibWLS BackwardCopy(char *s,char *d,int len);
extern void _autoDeleteWlsCString(void* v);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class wlsArray{
protected://----------------------------------------
void** vd;
int length;
void _stdLibWLS locate(int len);
public: //----------------------------------------
bool AUTOFREE;
void (*OnFree)(void *);
void _stdLibWLS clear(void);
void _stdLibWLS Insert(const void** v,int pos,int len);
void _stdLibWLS move(int dest,int src,int len);
void _stdLibWLS Push(const void* v);
void _stdLibWLS PushBack(const void* v);
void _stdLibWLS PushFront(const void* v);
void* _stdLibWLS PopBack(void);
void* _stdLibWLS PopFront(void);
void* _stdLibWLS Pop(void);
int _stdLibWLS Size(void)const;
void** _stdLibWLS Ary(void)const;
wlsArray();
wlsArray(const void* v);
~wlsArray();
void*& operator [](int v);
};
//---------------------------------------------------------------------------
class wlsCString{
protected://----------------------------------------
char* CSTR;
int length;
int sectors;
int realsize;
void _stdLibWLS _init(void);
void _stdLibWLS locate(int len);
void _stdLibWLS setObjs(int len,const void *c);
public: //----------------------------------------
char FieldSpliteChar;
wlsCString* Prior;
wlsCString* Next;
int SectorSize;
void* Attach;
void* AP0;
void* AP1;
void* AP2;
void* AP3;
wlsCString& _stdLibWLS Append(const char prm);
wlsCString& _stdLibWLS Append(const char* prm);
wlsCString& _stdLibWLS Append(const wlsCString &prm);
bool _stdLibWLS AppendToFile(const wlsCString &fn);
int _stdLibWLS AsInteger(void)const;
wlsCString _stdLibWLS Base64(void)const;
wlsCString _stdLibWLS Base64(int col)const;
wlsArray* _stdLibWLS Chain2Array(wlsArray* ay);
wlsArray* _stdLibWLS ChainDn2Array(wlsArray* ay);
wlsArray* _stdLibWLS ChainUp2Array(wlsArray* ay);
wlsCString* _stdLibWLS ChainTop(void);
wlsCString* _stdLibWLS ChainBottom(void);
char* _stdLibWLS c_str(void)const;
void _stdLibWLS clear(void);
int _stdLibWLS comp(const char prm)const;
int _stdLibWLS comp(const char *prm)const;
int _stdLibWLS comp(char *src,int slen,char *prm,int plen)const;
int _stdLibWLS comp(const void *prm)const;
int _stdLibWLS comp(const wlsCString &prm)const;
int _stdLibWLS comp(int pos,int len,const wlsCString &prm)const;
int _stdLibWLS Count(char prm)const;
int _stdLibWLS Count(const char *prm)const;
int _stdLibWLS Count(const wlsCString &prm)const;
_wlsCRC16 _stdLibWLS crc16(void)const;
WORD _stdLibWLS CRC16(void)const;
void _stdLibWLS CStr(const char* prmconst);
void _stdLibWLS CStr(const void* prm,int len);
void _stdLibWLS CStr(const wlsCString& prm);
void _stdLibWLS CStr(double prm);
void _stdLibWLS CStr(int prm);
char* _stdLibWLS CStr(void)const;
wlsCString _stdLibWLS Data(void)const;
wlsCString& _stdLibWLS DeBase64(const wlsCString &prm);
wlsCString& _stdLibWLS DeCrypto(const wlsCString &prm);
wlsCString& _stdLibWLS DeCrypto(int n);
wlsCString& _stdLibWLS DeCrypto32(const wlsCString &prm);
wlsCString& _stdLibWLS DeCrypto64(const wlsCString &prm);
wlsCString& _stdLibWLS DeDCrypto(const wlsCString &prm);
wlsCString& _stdLibWLS DeDCrypto(void);
wlsCString& _stdLibWLS DeDCrypto32(const wlsCString &prm);
wlsCString& _stdLibWLS DeDCrypto64(const wlsCString &prm);
wlsCString& _stdLibWLS DeE32(const wlsCString &prm);
wlsCString& _stdLibWLS DeE64(const wlsCString &prm);
wlsCString& _stdLibWLS DeE128(const wlsCString &prm);
wlsCString& _stdLibWLS Delete(int pos,int len);
wlsCString _stdLibWLS DrawHEX(void)const;
wlsCString _stdLibWLS DrawNum(void)const;
wlsCString _stdLibWLS DrawString(const wlsCString& Leadin,const wlsCString&
Leadout);
wlsCString _stdLibWLS EnE32(void)const;
wlsCString _stdLibWLS EnE64(void)const;
wlsCString _stdLibWLS EnE128(void)const;
wlsCString& _stdLibWLS fill(int len,char c);
wlsCString _stdLibWLS Fill(int len,char c)const;
wlsCString _stdLibWLS FillLeft(int len,char c)const;
wlsCString& _stdLibWLS Fillleft(int len,char c);
wlsCString _stdLibWLS FillRight(int len,char c)const;
wlsCString& _stdLibWLS Fillright(int len,char c);
wlsCString _stdLibWLS Field(void)const;
void _stdLibWLS FieltB64(void);
void _stdLibWLS FieltE32(void);
void _stdLibWLS FieltE64(void);
void _stdLibWLS FieltE128(void);
bool _stdLibWLS Field(const wlsCString &f)const;
bool _stdLibWLS Fieldx(const wlsCString &f)const;
wlsCString* _stdLibWLS FindKeyWordInChain(const wlsCString &k);
wlsGenPos _stdLibWLS FindPair(const wlsCString& Lin,const wlsCString&
Lout)const;
char _stdLibWLS FirstChar(void)const;
bool _stdLibWLS FirstCharIsNumber(void)const;
bool _stdLibWLS FirstCharIsAlpha(void)const;
int _stdLibWLS hex(void)const;
wlsCString& _stdLibWLS hex(int v);
// wlsCString& _stdLibWLS Insert(int pos,char *prm);
wlsCString& _stdLibWLS Insert(int pos,char prm);
wlsCString& _stdLibWLS Insert(int pos,const char *prm,int len);
wlsCString& _stdLibWLS Insert(int pos,const wlsCString &prm);
bool _stdLibWLS isASCII(const char *a)const;
bool _stdLibWLS isASCII(void)const;
bool _stdLibWLS isEmpty(void)const;
bool _stdLibWLS isHEX(const char *a)const;
bool _stdLibWLS isHEX(void)const;
bool _stdLibWLS isNumber(const char *a)const;
bool _stdLibWLS isNumber(void)const;
bool _stdLibWLS isincludedchar(char *ab,int lenab,char *cmp, int
lencmp) const;
bool _stdLibWLS isIncludedChar(char *cmp, int lencmp) const;
bool _stdLibWLS isIncludedChar(const wlsCString &cmp) const;
char _stdLibWLS LastChar(void)const;
bool _stdLibWLS LastCharIsNumber(void)const;
bool _stdLibWLS LastCharIsAlpha(void)const;
void _stdLibWLS Length(int len);
int _stdLibWLS Length(void)const;
bool _stdLibWLS LoadFromFile(const wlsCString &fn);
void _stdLibWLS lowcase(char *a,int l); //Working Function only
wlsCString& _stdLibWLS Lowcase(void); //Change & reyurn self
wlsCString _stdLibWLS LowCase(void)const; //Change & reyurn temp
int _stdLibWLS mPos(const wlsCString &sig)const;
int _stdLibWLS mPos(const char *sig)const;
int _stdLibWLS mPos(const wlsCString &sig,int count)const;
int _stdLibWLS mPos(const char *sig,int count)const;
wlsCString* _stdLibWLS NewPrior(void);
wlsCString* _stdLibWLS NewNext(void);
void _stdLibWLS pclear(void);
int _stdLibWLS Pos(char prm)const;
int _stdLibWLS Pos(char prm,int count)const;
int _stdLibWLS Pos(const char *prm)const;
int _stdLibWLS Pos(const char *prm,int count)const;
int _stdLibWLS Pos(const wlsCString &prm)const;
int _stdLibWLS Pos(const wlsCString &prm,int count)const;
int printf(const char *format, ...);
wlsCString _stdLibWLS Replace(const wlsCString &prm,const wlsCString
&rep)const;
wlsCString& _stdLibWLS replace(const wlsCString &prm,const wlsCString &rep);
wlsCString& _stdLibWLS replace(const char prm,const char rep);
void _stdLibWLS reset(void);
bool _stdLibWLS SaveToFile(const wlsCString &fn)const;
bool _stdLibWLS SaveToFileWithPath(const wlsCString &fn)const;
wlsCString& sprintf(const char *format, ...);
wlsCString _stdLibWLS Split(const char Mark);
wlsCString _stdLibWLS Split(const wlsCString &Mark);
wlsCString _stdLibWLS SplitNz(const char Mark);
wlsCString _stdLibWLS SplitNz(const wlsCString &Mark);
int sscanf(const char *format, ...)const;
void _stdLibWLS Strip(void);
void _stdLibWLS StripTheSlash(void);
void _stdLibWLS StripHtmlEntity(void);
wlsCString _stdLibWLS SubString(int beging, int len)const;
wlsCString _stdLibWLS TakeAlpha(int max);//from fornt
wlsCString _stdLibWLS TakeAlpha(void);//from fornt
wlsCString _stdLibWLS TakeBackAlpha(int max);//from fornt
wlsCString _stdLibWLS TakeBackAlpha(void);//from fornt
wlsCString _stdLibWLS TakeBackNumber(int max);//from fornt
wlsCString _stdLibWLS TakeBackNumber(void);//from fornt
wlsCString _stdLibWLS TakeBackWord(const wlsCString &sig);//from fornt
wlsCString _stdLibWLS TakeBackWord(int max);//from fornt
wlsCString _stdLibWLS TakeBackWord(void);//from fornt
wlsCString _stdLibWLS TakeCSWord(void);//from fornt to first ','
wlsCString _stdLibWLS TakeCSWordEnd(void);//from fornt to first ','
wlsCString _stdLibWLS TakeHexNumber(int max);//from fornt
wlsCString _stdLibWLS TakeHexNumber(void);//from fornt
wlsCString _stdLibWLS TakeNumber(int max);//from fornt
wlsCString _stdLibWLS TakeNumber(void);//from fornt
wlsCString _stdLibWLS TakeWord(const wlsCString &sig);
wlsCString _stdLibWLS TakeWord(int max);//from fornt
wlsCString _stdLibWLS TakeWord(void);//from fornt
wlsCString& _stdLibWLS trim(void);//Change content
wlsCString _stdLibWLS Trim(void)const;//return in new string
wlsCString& _stdLibWLS Trimleft(void);//Change content
wlsCString _stdLibWLS TrimLeft(void)const;//return in new string
wlsCString& _stdLibWLS Trimright(void);//Change content
wlsCString _stdLibWLS TrimRight(void)const;//return in new string
void _stdLibWLS upcase(char *a,int l); //Working Function only
wlsCString& _stdLibWLS Upcase(void); //Change & reyurn self
wlsCString _stdLibWLS UpCase(void)const; //Change & reyurn temp
wlsCString _stdLibWLS UrlEnc(void)const;
wlsCString& _stdLibWLS UrlDec(wlsCString& s);
wlsCString();
wlsCString(const char *prm);
wlsCString(const char *prm,int len);
wlsCString(const wlsCString& prm);
wlsCString(double prm);
wlsCString(int prm);
~wlsCString();
int _stdLibWLS xcomp(const char prm)const;
int _stdLibWLS xcomp(const char *prm)const;
int _stdLibWLS xcomp(char *src,int slen,char *prm,int plen)const;
int _stdLibWLS xcomp(const void *prm)const;
int _stdLibWLS xcomp(const wlsCString &prm)const;
int _stdLibWLS xcomp(int pos,int len,const wlsCString &prm)const;
wlsCString operator + (const char prm)const;
wlsCString operator + (const char* prm)const;
wlsCString operator + (const void* prm)const;
wlsCString operator + (const wlsCString& prm)const;
wlsCString& operator +=(char prm);
wlsCString& operator +=(const char* prm);
wlsCString& operator +=(const void* prm);
wlsCString& operator +=(const wlsCString& prm);
wlsCString operator - (const char prm)const;
wlsCString operator - (const char* prm)const;
wlsCString operator - (const void* prm)const;
wlsCString operator - (const wlsCString& prm)const;
wlsCString& operator -=(const char prm);
wlsCString& operator -=(const char* prm);
wlsCString& operator -=(const void* prm);
wlsCString& operator -=(const wlsCString& prm);
bool operator < (const void* prm)const;
bool operator < ( char prm)const;
bool operator < (const char* prm)const;
bool operator < (const wlsCString& prm)const;
bool operator <=(const void* prm)const;
bool operator <=( char prm)const;
bool operator <=(const char* prm)const;
bool operator <=(const wlsCString& prm)const;
wlsCString& operator = ( char prm);
wlsCString& operator = (const char* prm);
wlsCString& operator = (const double prm);
wlsCString& operator = (const int prm);
wlsCString& operator = (const wlsCString& prm);
bool operator ==(const void* prm)const;
bool operator ==( char prm)const;
bool operator ==(const char* prm)const;
bool operator ==(const wlsCString& prm)const;
bool operator !=(const void* prm)const;
bool operator !=( char prm)const;
bool operator !=(const char* prm)const;
bool operator !=(const wlsCString& prm)const;
bool operator > (const void* prm)const;
bool operator > ( char prm)const;
bool operator > (const char* prm)const;
bool operator > (const wlsCString& prm)const;
bool operator >=(const void* prm)const;
bool operator >= ( char prm)const;
bool operator >=(const char* prm)const;
bool operator >=(const wlsCString& prm)const;
char& operator [](int prm);
operator char*(void) const;
operator double(void) const;
operator int(void) const;
friend class wlsCCString;
friend class wlsMarkDef;
friend class wlsCStrings;
friend class wlsCStrAry;
friend class wlsCSSQLReslut;
#ifdef __BORLANDC__
wlsCString(const AnsiString& prm);
wlsCString& operator = (const AnsiString& prm);
wlsCString operator + (const AnsiString& prm)const;
wlsCString operator - (const AnsiString& prm)const;
wlsCString& operator +=(const AnsiString& prm);
wlsCString& operator -=(const AnsiString& prm);
operator AnsiString(void) const;
#endif
};
//---------------------------------------------------------------------------
class wlsCStrings{
protected://----------------------------------------
wlsCString* CSTRS;
int length;
void _stdLibWLS _init(void);
void _stdLibWLS locate(int len);
void _stdLibWLS setObjs(int len,const wlsCString* c);
public: //----------------------------------------
bool _StackFIFO;
bool TextFormat;
wlsMarkDef* Marks;
void _stdLibWLS Add(const char *prm);
void _stdLibWLS Add(const double prm);
void _stdLibWLS Add(const int prm);
void _stdLibWLS Add(const wlsCString &prm);
void _stdLibWLS Add(const wlsCString* &prm,int cnt);
void _stdLibWLS AddText(const wlsCString &prm);
void _stdLibWLS AddText(const char *prm);
wlsCString* _stdLibWLS c_strs(void)const;
void _stdLibWLS clear(void);
void _stdLibWLS CStrs(const wlsCString* prm,int len);
void _stdLibWLS CStrs(const wlsCStrings &prm);
wlsCString* _stdLibWLS CStrs(void)const;
void _stdLibWLS Delete(int pos);
void _stdLibWLS Delete(int pos,int cnt);
int _stdLibWLS Find(const wlsCString& x)const;
wlsCString _stdLibWLS FindField(const wlsCString& fie,char *def)const;
wlsCString _stdLibWLS FindField(const wlsCString& fie)const;
int _stdLibWLS FindFieldIx(const wlsCString& fie)const;
void _stdLibWLS FromCSV(const wlsCString& s);
void _stdLibWLS FromMSV(wlsCString s);
void _stdLibWLS FromSSV(char sig,wlsCString s);
void _stdLibWLS FromSSV(const wlsCString& sig,wlsCString s);
void _stdLibWLS FromString(const wlsCString& s);
void _stdLibWLS FromTSV(const wlsCString& s);
void _stdLibWLS Insert(int pos,const wlsCString &prm);
void _stdLibWLS Insert(int pos,const wlsCString* prm,int cnt);
bool _stdLibWLS isEmpty(void)const;
void _stdLibWLS Length(int len);
int _stdLibWLS Length(void)const;
bool _stdLibWLS LoadFromFile(const wlsCString &fn);
void _stdLibWLS pclear(void);
void _stdLibWLS Pop(void);
void _stdLibWLS Push(const wlsCString& prm);
void _stdLibWLS Push(const char *prm);
bool _stdLibWLS SaveToFile(const wlsCString &fn)const;
wlsCString _stdLibWLS ToCSV(void)const;//Comma-separated values
wlsCString _stdLibWLS ToMSV(void)const;
wlsCString _stdLibWLS ToSSV(char sig)const;//Signed-separated values
wlsCString _stdLibWLS ToTSV(void)const;//Tab-separated values
void _stdLibWLS UpdateField(wlsCString fie,wlsCString dat);
wlsCStrings();
wlsCStrings(const wlsCString& prm);
wlsCStrings(const wlsCString* prm,int len);
wlsCStrings(const wlsCStrings& prm);
~wlsCStrings();
wlsCString& operator = (const wlsCString& prm);
wlsCStrings& operator = (const wlsCStrings& prm);
wlsCString& operator [](const wlsCString& x);
wlsCString& operator [](int prm);
operator wlsCString(void);
friend class wlsCStrAry;
friend class wlsCSSQLReslut;
friend class wlsMarkDef;
#ifdef __BORLANDC__
wlsCStrings(const TStrings* prm);
wlsCStrings& operator =(const TStrings* prm);
operator TStrings*(void)const;
void _stdLibWLS Push(const AnsiString& prm);
#endif
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class wlsCStrAry{
protected://----------------------------------------
void _stdLibWLS locate(int len);
void _stdLibWLS setObjs(int len,const wlsCStrings* c);
void _stdLibWLS _init(void);
wlsCStrings* ARY;
int length;
public: //----------------------------------------
wlsMarkDef* Marks;
int defaultFindFromColOfRow;
wlsCStrAry();
wlsCStrAry(const wlsCStrings* prm,int len);
wlsCStrAry(const wlsCStrAry& prm);
~wlsCStrAry();
void _stdLibWLS Length(int len);
int _stdLibWLS Length(void)const;
void _stdLibWLS Ary(const wlsCStrings* prm,int len);
wlsCStrings* _stdLibWLS Ary(void)const;
wlsCString _stdLibWLS ToHTML(void)const;
void _stdLibWLS clear(void);
void _stdLibWLS Add(const wlsCStrings &prm);
void _stdLibWLS Add(const wlsCStrings* &prm,int cnt);
void _stdLibWLS Del(int prm);
void _stdLibWLS Del(int prm,unsigned cnt);
bool _stdLibWLS LoadFromFile(const wlsCString &fn);
bool _stdLibWLS SaveToFile(const wlsCString &fn)const;
void _stdLibWLS SyncMark(void);
int _stdLibWLS xFind(int row,const wlsCString &x)const;
int _stdLibWLS yFind(int col,const wlsCString &x)const;
wlsCStrAry& operator = (const wlsCStrAry& prm);
wlsCStrings& operator [](int prm);
int operator [](const wlsCString &x)const;
friend class wlsCSSQLReslut;
friend class wlsCSQLUnit;
friend class wlsMarkDef;
};
//---------------------------------------------------------------------------
class wlsCSSQLReslut:public wlsCStrAry{
public:
wlsCSSQLReslut();
int _stdLibWLS RowCount(void)const;
int _stdLibWLS ColCount(void)const;
int _stdLibWLS FieldIndexByName(const char *fe)const;
const char* _stdLibWLS FieldByName(int row,const char *fe)const;
wlsCStrings* _stdLibWLS Fields(void)const;
wlsCStrings* _stdLibWLS Rows(void)const;
wlsCString _stdLibWLS ToHTML(void)const;
friend class wlsMarkDef;
friend class wlsCSQLUnit;
};
//---------------------------------------------------------------------------
class wlsCSQLUnit{
public:
wlsCSSQLReslut Reslut;
void *db;
wlsCString ErrMsg;
wlsCString Host;
wlsCString User;
wlsCString Passwd;
wlsCString DataBase;
wlsCString SQL;
void _stdLibWLS close_db(void);
int _stdLibWLS open_db(void);
int _stdLibWLS open_db(const char *database);
int _stdLibWLS ExecSQL(const char *sql);
int _stdLibWLS ExecSQL(const char *database,const char *sql);
int _stdLibWLS ExecSQL(void);
wlsCSQLUnit();
wlsCSQLUnit(const wlsCString &database);
~wlsCSQLUnit();
void _stdLibWLS clear_reslut(void);
void _stdLibWLS clear(void);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class wlsMarkDef{
public:
//----- Vars
wlsCString FieldBeginMark;
wlsCString FieldEndMark;
wlsCString DataBeginMark;
wlsCString DataEndMark;
wlsCString RowBeginMark;
wlsCString RowEndMark;
wlsCString TableBeginMark;
wlsCString TableEndMark;
wlsCString MSV;
//----- Functions
wlsMarkDef();
wlsMarkDef(const wlsMarkDef &pas);
~wlsMarkDef(void);
wlsCString& _stdLibWLS BindDataMSV(const wlsCString& s);
wlsCString& _stdLibWLS BindFieldMSV(const wlsCString& s);
wlsCString _stdLibWLS BindTBL(const wlsCStrAry& msv);
wlsCString _stdLibWLS BindTBL(const wlsCSSQLReslut& res);
wlsCString _stdLibWLS DrawRowFromMSV(wlsCString& s);
wlsCString _stdLibWLS DrawDataFromMSV(wlsCString& s);
wlsCStrAry& _stdLibWLS DrawDataFromTBL(wlsCStrAry& dest,wlsCString s);
//----- Definitions
};
//---------------------------------------------------------------------------
class wlsMBCRC16{
protected:
public:
unsigned char low;
unsigned char high;
wlsMBCRC16(void);
wlsMBCRC16(const unsigned char l,const unsigned char h);
wlsMBCRC16(wlsMBCRC16 *v);
~wlsMBCRC16(void);
void _stdLibWLS Reset(void);
void _stdLibWLS Cacu(char b);
void _stdLibWLS Cacu(char *b, int len);
void _stdLibWLS Cacu(const wlsCString b);
void _stdLibWLS MakeCRC(char *b, int len);
void _stdLibWLS MakeCRC(const wlsCString b);
_stdLibWLS operator int(void) const;
_stdLibWLS operator short(void) const;
_stdLibWLS operator unsigned int(void) const;
_stdLibWLS operator unsigned short(void) const;
wlsMBCRC16& _stdLibWLS operator =(const wlsMBCRC16& b);
bool _stdLibWLS operator ==(const wlsMBCRC16& b)const;
wlsMBCRC16 _stdLibWLS operator +(char b);
wlsMBCRC16 _stdLibWLS operator +(const wlsCString& b);
wlsMBCRC16& _stdLibWLS operator +=(char b);
wlsMBCRC16& _stdLibWLS operator +=(const wlsCString& b);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
extern class wlsMarkDef ___wls_defMark;
extern class wlsCString gwlsCStringErr;
extern wlsCStrings gwlsCStringsErr;
extern void* __wlsErrorPointer;
extern int wlsCString_DefSecSize;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif
--
上帝完美無瑕
上帝造人,人有缺陷
人被造得有缺陷,人造之物必然漏洞百出
WolfLord
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.230.66.62
推 deo2000:我承認蠻多東西看不懂...GG了 12/01 18:48
推 waterdisney:不好意思 想請問一下版主,您這篇回文跟codejob版有何 12/01 22:00
→ waterdisney:關連嗎? 12/01 22:01
推 waterdisney:感覺這樣下去,等等是不是用C/php/python/java 的 每 12/01 22:03
→ waterdisney:個人都可以回一篇在版上..然後說 「現醜現醜」呢? 12/01 22:04
→ dryman:其實我不太懂為何要自已刻String..c++的不夠用還有boost.. 12/01 22:14
→ WPC001:其實我覺得這傢伙怪怪的耶... (有人認同嗎?) 12/01 22:47
→ WPC001:為了做這麼簡單的東西, 去刻個字串處理程式庫... 12/01 22:48
→ WPC001:然後還說可能不收錢... 這是來幹啥的? 12/01 22:49
推 ericinttu:每個人都有自己慣用的工具或寫法.可以看到別人喜歡用的 12/01 22:50
→ ericinttu:方式也不賴,欣賞一番也是好事. 12/01 22:50
→ x000032001:你們不懂版主的絕妙之處 一個簡單的東西搞得自己很忙 12/02 00:07
→ x000032001:才會受到客戶的重用(誤 12/02 00:08
推 LaPass:這應該是已經寫好備用,要用時剪下貼上就能跑的吧? 12/02 00:11
推 ericinttu:其實 x000032001 沒有誤. 12/02 00:16
→ WolfLord:字串物件當然不是為了做這種東西寫的,只是這個物件可以 12/02 00:24
→ WolfLord:拿來用。 12/02 00:25
→ WolfLord:另外,可以看得出來2-15樓統統不懂C++ ,這篇根本不是程 12/02 00:26
→ WolfLord:式,這只是物件的宣告,就跟說明書一樣的東西而已。 12/02 00:27
推 ericinttu:是啊,不懂. 12/02 00:35
推 waterdisney:不知道WolfLord的發言有沒有涉及人身攻擊呢? 12/02 02:10
→ waterdisney:希望WolfLord發言批評 2~15樓的時候,可以提出我們不會 12/02 02:10
→ waterdisney:C++的舉證~ 感謝! 12/02 02:11
→ WolfLord:我不是已經說了嗎? 這根本不算CODE,而是C++的物件宣告 12/02 02:16
→ WolfLord:可是上面每一個都說是CODE 我也只好推定各位真的不懂 12/02 02:17
我還是用EDIT來說明好了:
這篇最主要的目的在於說明、回答 "
為何說是自己寫的"字串"而不是"function"呢?"
因為C++中 字串 是一個物件,他是由上面宣告中的那麼多FUNCTION組再同一個資料結
構中互相連動運作的一群自動程式(C中以NAMESPACE封裝的群組FUNCTION與DATA)
上面的 "宣告" 之所以說他不是程式碼,因為其中沒有任何一行是用來作功的敘述。
完完全全只有物件的內容宣告(虛碼)。而指著宣告大喊:好臭好長的程式,那我怎
麼去認定會這樣反應的人真的懂得什麼叫做OOP,真的懂得什麼是C++ ?
以這個字串物件要達成原PO的要求程式碼只要:
void main(int argc, char *argv[]){
if(argc > 2){
class wlsCString b,o;b.LoadFromfile(argv[1]);
while(!b.isEmpty()){o+=(b.TakeNumber()+"\n");}
o.SaveToFile(argv[2]);
}else{ cout<<"fielters.exe in_file out_file";}
}
--
我從沒禁止討論與JOB有關的程式,只是希望大家討論歸討論不要掀筆戰就好。另外
,希望討論的內容盡量與標題相符。不要標題下岔題又岔題。(道德勸說)
對了,想到一點要提醒:討論發文酸人開玩笑只要不翻臉都可以默許(沒人檢舉為
前提),但是推文仍然嚴禁未經許可的噓文。
※ 編輯: WolfLord 來自: 125.230.66.62 (12/02 02:53)
推 dryman:我是知道這只是header不是程式,所以才問為何要自己刻 12/02 06:57
→ dryman:string....:P 12/02 06:58
→ dryman:而且幾乎所有能overload的東西都overload了orz 12/02 06:59
→ x000032001:看到#define wlsStringH就知道這是header了阿 12/02 09:11
→ x000032001:可以把我去掉嗎 被當成不會我覺得有點無奈耶 12/02 09:13
推 dryman:我也覺得被當成不會很無奈..XD 12/02 09:57
→ WolfLord:DRYMAN:原本是因為要跨平台,然後每次做案子就加一點... 12/02 17:09
→ WolfLord:另外,STL的字串記憶體處理有問題,拿來做SERVER長時間 12/02 17:10
→ WolfLord:在SOC下RUN會出毛病(不能沒有OS) 12/02 17:11
推 pichubaby:這樣看來案子也比較不會被別人搶走... 12/03 05:21
推 pingsky:第一次聽說[不懂C++]可以扯到人身攻擊 @@ 12/03 11:28