00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc 00008 * 123 Front Street West, Suite 1401 00009 * Toronto, Ontario 00010 * Canada M5J 2M2 00011 * 416-504-9876 00012 * 00013 * COMMENTS: 00014 * This file contains enums and helper functions related to expression 00015 * languages and meanings of strings in parameters. 00016 */ 00017 00018 #ifndef __CH_ExprLanguage_h__ 00019 #define __CH_ExprLanguage_h__ 00020 00021 #include "CH_API.h" 00022 00023 // These enum values are the languages we support in expressions. 00024 enum CH_ExprLanguage 00025 { 00026 CH_OLD_EXPR_LANGUAGE, 00027 CH_PYTHON 00028 }; 00029 00030 00031 // These enum values are the languages we support in chunks of script. 00032 enum CH_ScriptLanguage 00033 { 00034 CH_HSCRIPT, 00035 CH_PYTHON_SCRIPT, 00036 00037 CH_NUM_SCRIPT_LANGUAGES 00038 }; 00039 00040 00041 // These enum values are used when setting string values in parms. 00042 enum CH_StringMeaning 00043 { 00044 // A literal is not interpreted as an expression. 00045 CH_STRING_LITERAL, 00046 00047 // An old-style expression (called an hscript expressions in the UI) 00048 // is always made into an expression and set to use that language. 00049 CH_OLD_EXPRESSION, 00050 00051 // A python expression is always made into an expression and set 00052 // to use that language. 00053 CH_PYTHON_EXPRESSION, 00054 00055 // Autodetect will either set it to a string literal or an old-style 00056 // expression, depending on what's in the string. 00057 CH_AUTO_DETECT_OLD_EXPRESSION, 00058 00059 // This option will always set it to an expression, but it will use 00060 // the default language (either old-style expressions or python). 00061 CH_EXPRESSION_IN_DEFAULT_LANGUAGE 00062 }; 00063 00064 00065 // These functions return a string literal corresponding to the language. 00066 CH_API const char *CHexprLanguageAsString(CH_ExprLanguage language); 00067 CH_API const char *CHscriptLanguageAsString(CH_ScriptLanguage language); 00068 00069 // These functions return the language enum value corresponding to the string. 00070 // True is returned if the conversion succeeded. 00071 CH_API bool CHstringToExprLanguage(const char *str, CH_ExprLanguage &language); 00072 CH_API bool CHstringToScriptLanguage( 00073 const char *str, CH_ScriptLanguage &language); 00074 00075 // This function returns a string literal of the label for a language. 00076 CH_API const char *CHscriptLanguageAsLabel(CH_ScriptLanguage language); 00077 00078 00079 // This function returns the unique character corresponding to the language. 00080 CH_API char CHexprLanguageAsChar(CH_ExprLanguage language); 00081 00082 // This function returns the language corresponding to the unique character 00083 // by setting "language". True is returned if the conversion succeeded. 00084 CH_API bool CHcharToExprLanguage(char char_value, CH_ExprLanguage &language); 00085 00086 00087 // This function converts from an expression language to a meaning that says 00088 // the string is definitely an expression in that langauge. 00089 CH_API CH_StringMeaning CHexprLanguageToStringMeaning(CH_ExprLanguage language); 00090 00091 // This function converts from a string meaning that says it's definitely 00092 // an expressin in a some language to that language. 00093 CH_API CH_ExprLanguage CHstringMeaningToExprLanguage(CH_StringMeaning meaning); 00094 00095 00096 // This function returns a string literal corresponding to the meaning. 00097 CH_API const char *CHmeaningToString(CH_StringMeaning meaning); 00098 00099 // This function returns the meaning corresponding to the string. True is 00100 // returned if the conversion succeeded. 00101 CH_API bool CHstringToMeaning(const char *meaning_str, 00102 CH_StringMeaning &meaning); 00103 00104 #endif
1.5.9