123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- #ifndef cmOutputConverter_h
- #define cmOutputConverter_h
- #include "cmConfigure.h"
- #include <string>
- #include "cmStateSnapshot.h"
- class cmState;
- class cmStateDirectory;
- class cmOutputConverter
- {
- public:
- cmOutputConverter(cmStateSnapshot const& snapshot);
- enum OutputFormat
- {
- SHELL,
- WATCOMQUOTE,
- RESPONSE
- };
- std::string ConvertToOutputFormat(const std::string& source,
- OutputFormat output) const;
- std::string ConvertDirectorySeparatorsForShell(
- const std::string& source) const;
-
- std::string ConvertToOutputForExisting(const std::string& remote,
- OutputFormat format = SHELL) const;
- void SetLinkScriptShell(bool linkScriptShell);
-
- enum Shell_Flag_e
- {
-
- Shell_Flag_Make = (1 << 0),
-
- Shell_Flag_VSIDE = (1 << 1),
-
- Shell_Flag_EchoWindows = (1 << 2),
-
- Shell_Flag_WatcomWMake = (1 << 3),
-
- Shell_Flag_MinGWMake = (1 << 4),
-
- Shell_Flag_NMake = (1 << 5),
-
- Shell_Flag_AllowMakeVariables = (1 << 6),
-
- Shell_Flag_WatcomQuote = (1 << 7),
- Shell_Flag_IsUnix = (1 << 8)
- };
- std::string EscapeForShell(const std::string& str, bool makeVars = false,
- bool forEcho = false,
- bool useWatcomQuote = false) const;
- static std::string EscapeForCMake(const std::string& str);
-
- static std::string EscapeWindowsShellArgument(const char* arg,
- int shell_flags);
- enum FortranFormat
- {
- FortranFormatNone,
- FortranFormatFixed,
- FortranFormatFree
- };
- static FortranFormat GetFortranFormat(const char* value);
- static bool ContainedInDirectory(std::string const& local_path,
- std::string const& remote_path,
- cmStateDirectory const& directory);
-
- std::string ConvertToRelativePath(std::string const& local_path,
- std::string const& remote_path) const;
-
- static std::string ForceToRelativePath(std::string const& local_path,
- std::string const& remote_path);
- private:
- cmState* GetState() const;
- static int Shell__CharIsWhitespace(char c);
- static int Shell__CharNeedsQuotesOnUnix(char c);
- static int Shell__CharNeedsQuotesOnWindows(char c);
- static int Shell__CharNeedsQuotes(char c, int flags);
- static int Shell__CharIsMakeVariableName(char c);
- static const char* Shell__SkipMakeVariables(const char* c);
- static int Shell__ArgumentNeedsQuotes(const char* in, int flags);
- static std::string Shell__GetArgument(const char* in, int flags);
- private:
- cmStateSnapshot StateSnapshot;
- bool LinkScriptShell;
- };
- #endif
|