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_ */
stringlist的更多相关文章
- Delphi中stringlist分割字符串的用法
Delphi中stringlist分割字符串的用法 TStrings是一个抽象类,在实际开发中,是除了基本类型外,应用得最多的. 常规的用法大家都知道,现在来讨论它的一些高级的用法. 1.CommaT ...
- 利用StringList对象来管理这些动态生成的对象
如果程序需要动态创建大量的对象,那么我们可以利用StringList对象来管理这些动态生成的对象.1.创建StringList对象:OBJ := TStringList.Create; 2.保存动态生 ...
- StringList 自定义快速排序
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- Delphi TstringList Stringlist的特殊用法
procedure TForm1.btn1Click(Sender : TObject); var m : Integer; s : string; strlst ...
- Delphi Stringlist Delimiter如何区分TAB和空格
var st: TStrings; begin st := TStringList.Create; st.StrictDelimiter := True;//这个多少人用过? st.Delimiter ...
- delphi将字符串转换成stringlist
function StrToList(const sString, Token: string): TStringList;var sTmp: string; iPos: Integer; Tokle ...
- C#学习总结之集合
一.集合接口和类型 命名空间: 集合类型 命名空间 一般集合 System.Collections 泛型集合 System.Collections.Generic 特定类型集合 Syst ...
- Linux 平台静默安装 Oracle客户端
需求:Linux平台,安装完整版Oracle客户端 Tips:如果只是用到sqlldr,sqlplus功能,可以参考<Linux上oracle精简版客户端快速部署>快速部署精简版:如果需要 ...
- 基于trie树的具有联想功能的文本编辑器
之前的软件设计与开发实践课程中,自己构思的大作业题目.做的具有核心功能,但是还欠缺边边角角的小功能和持久化数据结构,先放出来,有机会一点点改.github:https://github.com/chu ...
随机推荐
- xe5 android listbox的 TMetropolisUIListBoxItem
listbox实现以下效果: 关键代码,采用数据集的方式 type PpatientData=^RpatientData; RpatientData= record patient_id:string ...
- asp结合ajax中文乱码问题
XMLHttpRequest 在w3c标准中这样提到: 如果响应包含了为响应体指定字符编码的头部,就使用该编码.否则,假定使用 Unicode UTF-8. 前端页面sele.asp <&quo ...
- linux 用户打开进程数和文件数调整
1 查看nproc(max user processes)命令 [root@vm-cdh4 ~]# ulimit -u 14866 2 修改nproc 临时修改, 重登录或重启后失效: [root@v ...
- VHDL操作运算符的优先级顺序
- jQuery异步分页插件
学校软件工程让写课程设计(其实就是自选语言做个项目),感觉都是重复的东西就没有很认真的去写内容,更加注意写一些之前没有用过的东西. 因为一直都使用TP框架来写PHP,TP又自带分页类,想到这里就想试试 ...
- javascript之基本包装类型(Boolean,Number,String)基础篇
前几天整理了javascript中Array方面的知识,但是String中的一些方法多多少少和Array里的方法有些类似容易混淆,就顺便连同String所在的包装类一起整理一下,希望可以帮助到初学者, ...
- JSLint notepad++使用
1.JSLint简介 JSLint定义了一组编码约定,这比ECMA定义的语言更为严格.这些编码约定汲取了多年来的丰富编码经验,并以一条年代久远的编程原则 作为宗旨:能做并不意味着应该做.JSLint会 ...
- JS学习笔记 -- 定时器,提示框的应用
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 使用notepad++编辑器
使用notepad++编辑器 在公司时经常要用到文本编辑器去写jsp文件,之前使用的是sublime text 3,但是觉得不太顺手,于是转用notepad++编辑器. 这个编辑器最吸引我的地方是层次 ...
- ubuntu 常用参数设置
在Linux下,对于参数的设置,一般来说,都遵循这个规律.每一个功能程序,一定对于一个对于名字的配置文件. 涉及到多用户的功能配置,一定有一个全局的配置文件,对所有用户都生效,而每个用 ...