1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>log4cpp: StringUtil.hh Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">src</a></div>
<h1>StringUtil.hh</h1><a href="StringUtil_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * StringUtil.hh</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Copyright 2002, Log4cpp Project. All rights reserved.</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> * See the COPYING file for the terms of usage and distribution.</span>
00007 <span class="comment"> */</span>
00008
00009 <span class="preprocessor">#ifndef _LOG4CPP_STRINGUTIL_HH</span>
00010 <span class="preprocessor"></span><span class="preprocessor">#define _LOG4CPP_STRINGUTIL_HH</span>
00011 <span class="preprocessor"></span>
00012 <span class="preprocessor">#include "<a class="code" href="PortabilityImpl_8hh.html">PortabilityImpl.hh</a>"</span>
00013 <span class="preprocessor">#include <string></span>
00014 <span class="preprocessor">#include <vector></span>
00015 <span class="preprocessor">#include <climits></span>
00016 <span class="preprocessor">#include <stdarg.h></span>
00017
00018 <span class="keyword">namespace </span>log4cpp {
00019
<a name="l00020"></a><a class="code" href="classlog4cpp_1_1StringUtil.html">00020</a> <span class="keyword">class </span><a class="code" href="classlog4cpp_1_1StringUtil.html">StringUtil</a> {
00021 <span class="keyword">public</span>:
00022
00029 <span class="keyword">static</span> std::string <a class="code" href="classlog4cpp_1_1StringUtil.html#e0">vform</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* format, va_list args);
00030
00035 <span class="keyword">static</span> std::string <a class="code" href="classlog4cpp_1_1StringUtil.html#e1">trim</a>(<span class="keyword">const</span> std::string& s);
00036
00050 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classlog4cpp_1_1StringUtil.html#e2">split</a>(std::vector<std::string>& v,
00051 <span class="keyword">const</span> std::string& s, <span class="keywordtype">char</span> delimiter,
00052 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxSegments = INT_MAX);
<a name="l00063"></a><a class="code" href="classlog4cpp_1_1StringUtil.html#e3">00063</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classlog4cpp_1_1StringUtil.html#e2">split</a>(T& output,
00064 <span class="keyword">const</span> std::string& s, <span class="keywordtype">char</span> delimiter,
00065 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxSegments = INT_MAX) {
00066 std::string::size_type <a class="code" href="namespacelog4cpp.html#a6">left</a> = 0;
00067 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
00068 <span class="keywordflow">for</span>(i = 1; i < maxSegments; i++) {
00069 std::string::size_type right = s.find(delimiter, left);
00070 <span class="keywordflow">if</span> (right == std::string::npos) {
00071 <span class="keywordflow">break</span>;
00072 }
00073 *output++ = s.substr(left, right - left);
00074 left = right + 1;
00075 }
00076
00077 *output++ = s.substr(left);
00078 <span class="keywordflow">return</span> i;
00079 }
00080 };
00081 }
00082
00083 <span class="preprocessor">#endif // _LOG4CPP_STRINGUTIL_HH</span>
00084 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jul 29 14:07:33 2005 for log4cpp by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|