• stringlist



    #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_ */

  • 相关阅读:
    学习九-python 异常处理
    验证基于逻辑回归的隐马尔可夫模型的心音信号切分算法(literature study)
    字典的内置方法比较
    学习六
    Ubuntu 16.04 LTS 搜狗输入法安装
    集合经验模态分解(EEMD)在语音中的应用举例
    SwfUpload及imgareaselect使用方法
    Uploadify插件使用方法
    Ueditor使用方法
    PartialView 加载Js
  • 原文地址:https://www.cnblogs.com/oracleloyal/p/5054241.html
Copyright © 2020-2023  润新知