本文整理汇总了C++中TString::GetAsChar方法的典型用法代码示例。如果您正苦于以下问题:C++ TString::GetAsChar方法的具体用法?C++ TString::GetAsChar怎么用?C++ TString::GetAsChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TString
的用法示例。
在下文中一共展示了TString::GetAsChar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static enum v7_err jsBotLoadFile(struct v7* v7, v7_val_t* res) {
v7_val_t file = v7_arg(v7, 0);
if (!v7_is_string(file)) {
return V7_OK;
}
TString fullPath = _activeBot->getWorkDir();
TString fileName = v7_to_cstring(v7, &file);
fullPath += fileName.GetAsWChar();
if (!fexists(fullPath)) {
return V7_OK;
}
v7_val_t result;
enum v7_err ress = V7_OK;
ress = v7_exec_file(v7, fullPath.GetAsChar(), &result);
//v7_val_t* v7Obj = _activeBot->getV7Obj();
//*v7Obj = v7_mk_object(v7);
if (ress != V7_OK) {
if (result == V7_SYNTAX_ERROR) MessageBox(NULL, "script fail syntax error", "Nooo", 0);
else if (result == V7_EXEC_EXCEPTION) MessageBox(NULL, "script fail, exception", "Nooo", 0);
else if (result == V7_EXEC_EXCEPTION) MessageBox(NULL, "script fail, exception", "Nooo", 0);
else if (result == V7_AST_TOO_LARGE) MessageBox(NULL, "script fail, ast too large", "Nooo", 0);
}
return V7_OK;
}
示例2: onIm
void Bot::onIm(TString& nick, TString& text) {
v7_val_t theNick = v7_mk_string(v7, nick.GetAsChar(), ~0, 1);
v7_val_t theText = v7_mk_string(v7, text.GetAsChar(), ~0, 1);
v7_val_t* func;
v7_val_t args;
long i;
long l = _onMotd.GetLength();
for (i = 0; i < l; i++) {
func = (v7_val_t*)_onIm.GetAt(i);
args = v7_mk_array(v7);
v7_array_push(v7, args, theNick);
v7_array_push(v7, args, theText);
v7_apply(v7, *func, *v7Obj, args, NULL);
}
}
示例3: EnsureDirExists
inline bool EnsureDirExists(const wchar_t* fullDirPath)
{
HWND hwnd = NULL;
const SECURITY_ATTRIBUTES *psa = NULL;
TString dir = fullDirPath;
int retval = SHCreateDirectoryEx(hwnd, dir.GetAsChar(), psa);
if (retval == ERROR_SUCCESS || retval == ERROR_FILE_EXISTS || retval == ERROR_ALREADY_EXISTS) return true;
return false;
}
示例4: say
void Bot::say(TString& text, TString& font, unsigned char fontSize, TString& color) {
if (font.IsEQ(L"")) font = _charset.font;
if (fontSize < 10) fontSize = _charset.size;
COLORREF coll = _charset.color;
if (!color.IsEQ(L"")) coll = GetCol(color.GetAsWChar());
bot_exchange_format p(PLUGIN_EVENT_ROOM_TEXT);
p << bot_value(1, text.GetAsChar());
p << bot_value(2, _charset.attributes);
p << bot_value(3, fontSize);
p << bot_value(4, coll);
p << bot_value(5, _charset.effect);
p << bot_value(6, _charset.charset);
p << bot_value(7, _charset.pitch);
p << bot_value(8, font.GetAsChar());
std::string d = p.data();
_mgr->deliver_event(_name.GetAsChar(), d.c_str(), (int)d.size());
}
示例5: onMotd
void Bot::onMotd(TString& motd) {
v7_val_t theMotd = v7_mk_string(v7, motd.GetAsChar(), ~0, 1);
v7_val_t* func;
v7_val_t args;
long i;
long l = _onMotd.GetLength();
for (i = 0; i < l; i++) {
func = (v7_val_t*)_onMotd.GetAt(i);
args = v7_mk_array(v7);
v7_array_push(v7, args, theMotd);
v7_apply(v7, *func, *v7Obj, args, NULL);
}
}
示例6: onLeft
void Bot::onLeft(TString& nick) {
long l = _onLeft.GetLength();
if (l == 0) return;
long i;
v7_val_t* func;
v7_val_t args;
v7_val_t userName = v7_mk_string(v7, nick.GetAsChar(), ~0, 1);
for (i = 0; i < l; i++) {
func = (v7_val_t*)_onLeft.GetAt(i);
args = v7_mk_array(v7);
v7_array_push(v7, args, userName);
v7_apply(v7, *func, *v7Obj, args, NULL);
}
}
示例7: onTalk
void Bot::onTalk(TString& nick, unsigned char flag) {
long l = _onTalk.GetLength();
if (l == 0) return;
long i;
v7_val_t* func;
v7_val_t args;
v7_val_t userName = v7_mk_string(v7, nick.GetAsChar(), ~0, 1);
v7_val_t theFlag = v7_mk_number(flag);
for (i = 0; i < l; i++) {
func = (v7_val_t*)_onTalk.GetAt(i);
args = v7_mk_array(v7);
v7_array_push(v7, args, userName);
v7_array_push(v7, args, theFlag);
v7_apply(v7, *func, *v7Obj, args, NULL);
}
}
示例8: setFontStyle
void Bot::setFontStyle(TString& fontName, int fontSize, COLORREF fontColor) {
if (!fontName.IsEQ(L"")) memcpy(_charset.font, fontName.GetAsChar(), fontName.GetLength() * sizeof(char));
if (fontSize != NULL) _charset.size = fontSize;
if (fontColor != NULL) _charset.color = fontColor;
}
示例9: fexists
bool fexists(TString& fileName) {
std::ifstream ifile(fileName.GetAsChar());
return (bool)ifile;
}