Chameleon Applications

Chameleon Applications Commit Details

Date:2010-01-22 19:55:43 (14 years 3 months ago)
Author:Rekursor
Commit:39
Parents: 38
Message:Added str_util.h c++ header for string utilities. Started it by implementing trimming left right both string trim spaces...
Changes:
A/trunk/ChameleonPrefPane/string_util.h
M/trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj

File differences

trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj
2020
2121
2222
23
2324
2425
2526
......
5758
5859
5960
61
6062
6163
6264
......
155157
156158
157159
160
158161
159162
160163
......
216219
217220
218221
222
219223
220224
221225
019930FF110A0E6F003B056E /* PeripheralsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 019930FD110A0E6F003B056E /* PeripheralsController.mm */; };
01993115110A0EB9003B056E /* AdvancedSetupController.h in Headers */ = {isa = PBXBuildFile; fileRef = 01993113110A0EB9003B056E /* AdvancedSetupController.h */; };
01993116110A0EB9003B056E /* AdvancedSetupController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 01993114110A0EB9003B056E /* AdvancedSetupController.mm */; };
01993197110A2B71003B056E /* string_util.h in Headers */ = {isa = PBXBuildFile; fileRef = 01993196110A2B71003B056E /* string_util.h */; };
01A40F75110550F4002A74CD /* CHANGES in Resources */ = {isa = PBXBuildFile; fileRef = 01A40F74110550F4002A74CD /* CHANGES */; };
01B0E8141108B85A00ACF21B /* ChameleonPrefPane.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B0E80E1108B85A00ACF21B /* ChameleonPrefPane.h */; };
01B0E8151108B85A00ACF21B /* ChameleonPrefPane.mm in Sources */ = {isa = PBXBuildFile; fileRef = 01B0E80F1108B85A00ACF21B /* ChameleonPrefPane.mm */; };
019930FD110A0E6F003B056E /* PeripheralsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PeripheralsController.mm; path = Sources/PeripheralsController.mm; sourceTree = "<group>"; };
01993113110A0EB9003B056E /* AdvancedSetupController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AdvancedSetupController.h; path = Sources/AdvancedSetupController.h; sourceTree = "<group>"; };
01993114110A0EB9003B056E /* AdvancedSetupController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AdvancedSetupController.mm; path = Sources/AdvancedSetupController.mm; sourceTree = "<group>"; };
01993196110A2B71003B056E /* string_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_util.h; sourceTree = "<group>"; };
01A40F74110550F4002A74CD /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGES; sourceTree = "<group>"; };
01B0E80E1108B85A00ACF21B /* ChameleonPrefPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChameleonPrefPane.h; path = Sources/ChameleonPrefPane.h; sourceTree = "<group>"; };
01B0E80F1108B85A00ACF21B /* ChameleonPrefPane.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ChameleonPrefPane.mm; path = Sources/ChameleonPrefPane.mm; sourceTree = "<group>"; };
01B0E8101108B85A00ACF21B /* process.cpp */,
01B0E8131108B85A00ACF21B /* property_list.h */,
01B0E8121108B85A00ACF21B /* property_list.cpp */,
01993196110A2B71003B056E /* string_util.h */,
);
name = Classes;
sourceTree = "<group>";
019930E8110A0D80003B056E /* BootFlagsController.h in Headers */,
019930FE110A0E6F003B056E /* PeripheralsController.h in Headers */,
01993115110A0EB9003B056E /* AdvancedSetupController.h in Headers */,
01993197110A2B71003B056E /* string_util.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
trunk/ChameleonPrefPane/string_util.h
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
/*
* string_util.h
* ChameleonPrefPane
*
* Created by Rekursor on 1/22/10.
*
*/
/**
* trim the space chars on the right of a sring
*/
inline std::string trim_right(const std::string &source , const std::string& t = " ")
{
std::string str = source;
return str.erase( str.find_last_not_of(t) + 1);
}
/**
* trim the space chars on the left of a sring
*/
inline std::string trim_left( const std::string& source, const std::string& t = " ")
{
std::string str = source;
return str.erase(0 , source.find_first_not_of(t) );
}
/**
* trim the space chars on the left and the right of a string
*/
inline std::string trim(const std::string& source, const std::string& t = " ")
{
std::string str = source;
return trim_left( trim_right( str , t) , t );
}

Archive Download the corresponding diff file

Revision: 39