]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/strutl.h
7e3e4734465174fbdd40d8c677e509b1d43a419d
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: strutl.h,v 1.8 1998/10/30 07:53:46 jgg Exp $
4 /* ######################################################################
6 String Util - These are some usefull string functions
8 _strstrip is a function to remove whitespace from the front and end
11 This source is placed in the Public Domain, do with it what you will
12 It was originally written by Jason Gunthorpe <jgg@gpu.srv.ualberta.ca>
14 ##################################################################### */
16 // This is a private header
25 char *_strstrip(char *String
);
26 char *_strtabexpand(char *String
,size_t Len
);
27 bool ParseQuoteWord(const char *&String
,string
&Res
);
28 bool ParseCWord(const char *String
,string
&Res
);
29 string
QuoteString(string Str
,const char *Bad
);
30 string
SizeToStr(double Bytes
);
31 string
TimeToStr(unsigned long Sec
);
32 string
SubstVar(string Str
,string Subst
,string Contents
);
33 string
Base64Encode(string Str
);
34 string
URItoFileName(string URI
);
35 string
TimeRFC1123(time_t Date
);
36 bool StrToTime(string Val
,time_t &Result
);
37 string
LookupTag(string Message
,const char *Tag
,const char *Default
= 0);
38 int StringToBool(string Text
,int Default
= -1);
39 bool ReadMessages(int Fd
, vector
<string
> &List
);
41 int stringcmp(const char *A
,const char *AEnd
,const char *B
,const char *BEnd
);
42 inline int stringcmp(const char *A
,const char *AEnd
,const char *B
) {return stringcmp(A
,AEnd
,B
,B
+strlen(B
));};
43 int stringcasecmp(const char *A
,const char *AEnd
,const char *B
,const char *BEnd
);
44 inline int stringcasecmp(const char *A
,const char *AEnd
,const char *B
) {return stringcasecmp(A
,AEnd
,B
,B
+strlen(B
));};