标签:
#ifndef _STRINGLIST_HPP_
#define _STRINGLIST_HPP_
#include "../global.hpp"
#include <typeinfo>
#include "../hpasutils.hpp"
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <algorithm>
enum TSeekOffset {soFromBeginning = 0, soFromCurrent = 1, soFromEnd = 2};
class TPersistent
{
private:
void AssignError(TPersistent* Source);
protected:
virtual void AssignTo(TPersistent* Dest);
virtual TPersistent* GetOwner();
public:
virtual ~TPersistent();
virtual void Assign(TPersistent* Source);
virtual string GetNamePath();
};
class TMemoryStream:public TPersistent
{
public:
pByte Memory;
int Position;
int Size;
void Clear();
int Seek(const int step, TSeekOffset mode);
void WriteBuffer(void* src, int len);
void ReadBuffer(void* dst, int len);
TMemoryStream();
virtual ~TMemoryStream();
};
//{ TStrings class }
class TStringList:public TPersistent
{
protected:
list<string> buf;
public:
string seperator;
int Add(const string s);
void AddStrings(TStringList& AStrings);
int Insert(const string s);
int IndexOf(const string s);
bool Delete(const string s);
void Delete(const int index);
void Clear();
int Count();
string Values(const string name);
string Values(const string name,const string seperator);
void SetValue(const string name, const string value);
string ValueFromIndex(int index);
string ValueFromIndex(int index, const string seperator);
string Names(int index,const string seperator= "=");
string Lines(int index);
void SetLines(int index, const string s);
bool SetLines(const string des,const string str);
string ReadString(const string name, const string value);
bool SaveToFile(const string filename);
bool LoadFromFile(const string filename);
string TimeFormate(void);
string Text();
void SaveToStream(TMemoryStream& m);
void SetText(const string src, const string sep = "");
void AssignTo(TStringList* Dest);
TStringList();
virtual ~TStringList();
};
extern void GetNets(TStringList& Nets);
extern void GetMACs(TStringList& MACs);
extern void GetIPs(TStringList& IPs);
extern string GetIP(const string if_name);
extern string GetMAC(const string if_name);
extern void Split(const string big, const string sep, TStringList& sl);
#endif /* HCLASSES_HPP_ */
标签:
原文地址:http://www.cnblogs.com/oracleloyal/p/5054241.html