Katana Plug-in APIs 0.1

Path.h

00001 // Copyright (c) 2011 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 #ifndef INCLUDED_FNGEOLIBUTIL_PATH_H
00003 #define INCLUDED_FNGEOLIBUTIL_PATH_H
00004 
00005 #include <set>
00006 #include <string>
00007 #include <vector>
00008 
00009 #include <FnGeolib/FnGeolibAPI.h>
00010 #include <FnGeolib/util/ns.h>
00011 #include <FnPlatform/StringView.h>
00012 
00013 FNGEOLIBUTIL_NAMESPACE_ENTER
00014 {
00015 
00016 namespace Path
00017 {
00045     FNGEOLIB_API
00046     std::string NormalizeAbsPath(const std::string & locationPath);
00047 
00057     FNGEOLIB_API
00058     std::string GetLocationParent(FnPlatform::StringView locationPath);
00059 
00068     FNGEOLIB_API
00069     std::string GetLeafName(FnPlatform::StringView locationPath);
00070 
00071     FNGEOLIB_API
00072     void GetLeafAndParent(std::string& parent,
00073                           std::string& leaf,
00074                           FnPlatform::StringView locationPath);
00075 
00090     FNGEOLIB_API
00091     void GetLocationStack(std::vector<std::string> & returnStack,
00092         const std::string & locationPath, const std::string & rootPath=std::string());
00093 
00105     FNGEOLIB_API
00106     bool IsAncestorOrEqual(FnPlatform::StringView locA,
00107                            FnPlatform::StringView locB);
00108 
00121     FNGEOLIB_API
00122     bool IsAncestor(FnPlatform::StringView locA, FnPlatform::StringView locB);
00123 
00124     FNGEOLIB_API
00125     std::string Join(FnPlatform::StringView locA, FnPlatform::StringView locB);
00126 
00127     FNGEOLIB_API
00128     bool IsRelativePath(const std::string & path);
00129 
00139     FNGEOLIB_API
00140     std::string RelativeToAbsPath(const std::string & rootPath, const std::string & path);
00141 
00162     FNGEOLIB_API
00163     std::string NormalizedRelativePath(const std::string & rootpath,
00164         const std::string & path);
00165 
00183     FNGEOLIB_API
00184     std::string RelativePath(const std::string & rootPath,
00185         const std::string & path);
00186 
00187     // both
00188 
00189     struct FnMatchInfo
00190     {
00191         bool match;
00192         bool canMatchChildren;
00193     };
00194 
00203     FNGEOLIB_API
00204     void FnMatch(FnMatchInfo& matchInfo,
00205                  FnPlatform::StringView testpath,
00206                  FnPlatform::StringView pattern);
00207 
00216     FNGEOLIB_API
00217     void FnMatchIncludingAncestors(FnMatchInfo& matchInfo,
00218                                    FnPlatform::StringView testpath,
00219                                    FnPlatform::StringView pattern);
00220 
00229     FNGEOLIB_API
00230     void ExactMatch(FnMatchInfo& matchInfo,
00231                     FnPlatform::StringView testpath,
00232                     FnPlatform::StringView pattern);
00233 
00234     FNGEOLIB_API
00235     std::string MakeUniqueName(FnPlatform::StringView baseName,
00236                                const std::set<std::string>& existingNames);
00237 
00238     FNGEOLIB_API
00239     std::string MakeSafeIdentifier(FnPlatform::StringView identifier);
00240 
00255     FNGEOLIB_API
00256     int Compare(FnPlatform::StringView pathA, FnPlatform::StringView pathB);
00257 
00260 }  // namespace Path
00261 }
00262 FNGEOLIBUTIL_NAMESPACE_EXIT
00263 
00264 #endif // INCLUDED_FNGEOLIBUTIL_PATH_H
 All Classes Functions Variables Typedefs Enumerations Enumerator