#include "Utils.h" #include "ApplicationInterface.h" /* WCHAR CharToUchar(const char in){ WCHAR result; mbstowcs(&result,&in,1); return result; } char UcharToChar(const WCHAR in){ char result; wcstombs(&result,&in,1); return result; } UString toUString(int i) { TCHAR buffer[12]; return UString(_itow(i, buffer, 10)); } String toCString(int i) { char buffer[12]; return String(_itoa(i, buffer, 10)); } UString *toUString(UString& dst,const std::string src) { dst.resize(src.length()); for(unsigned int i = 0; i < dst.length(); i++){ dst[i] = CharToUchar(src[i]); } return &dst; } std::string toCString(UString s) { std::string result(s.length(),' '); for(int i = 0; i < result.length(); i++){ result[i] = UcharToChar(s[i]); } return result; } UString noMarkup(UString in) { bool inTag=false; bool inEntity=false; UString::iterator pos; UString result; for(pos=in.begin();pos!=in.end();pos++) { if ((inTag)&&(*pos==L'>')) inTag=false; else if ((!inTag)&&(*pos==L'<')) inTag=true; else if ((!inEntity)&&(*pos==L'&')) inEntity=true; else if ((inEntity)&&(*pos==L';')) { inEntity=false; result+=L' '; } //probably   else if ((!inTag)&&(!inEntity)&&(*pos!=L'\n')) result+=*pos; } return result; } */ bool inPortraitMode(){ return GetSystemMetrics(SM_CXSCREEN) <= GetSystemMetrics(SM_CYSCREEN); } void LOGIT(const char *msg) { #ifdef __DEBUG__ FILE *fp2 = fopen("\\Storage Card\\Program Files\\sword\\init_log.txt", "a"); fprintf(fp2, msg); fclose(fp2); #endif // __DEBUG__ } void LOGIT(const char *msg, int i) { #ifdef __DEBUG__ FILE *fp2 = fopen("\\Storage Card\\Program Files\\sword\\init_log.txt", "a"); fprintf(fp2, msg, i); fclose(fp2); #endif // __DEBUG__ }