Example #1
0
// Open the boxfile based on the given image filename.
FILE* OpenBoxFile(const STRING& fname) {
  STRING filename = BoxFileName(fname);
  FILE* box_file = NULL;
  if (!(box_file = fopen(filename.string(), "rb"))) {
    CANTOPENFILE.error("read_next_box", TESSEXIT,
                       "Cant open box file %s",
                       filename.string());
  }
  return box_file;
}
Example #2
0
TEST_F(lv_LV_PhoneNumber, Operator) {
  cxxfaker::providers::lv_LV::PhoneNumber phonenumber;
  phonenumber.Seed(::testing::UnitTest::GetInstance()->random_seed());
  STRING number = phonenumber;
  for (STRING::const_iterator iter = number.begin(); iter != number.end(); ++iter) {
    if (isdigit(*iter) || *iter == '-' || *iter == '+' || *iter == ' ')
      continue;
    ADD_FAILURE() << "What is this \"" << *iter << "\" doing in here..";
  };
};
void dump_words(WERD_RES_LIST &perm, inT16 score, inT16 mode, BOOL8 improved) {
  WERD_RES_IT word_res_it(&perm);
  static STRING initial_str;

  if (debug_fix_space_level > 0) {
    if (mode == 1) {
      initial_str = "";
      for (word_res_it.mark_cycle_pt ();
      !word_res_it.cycled_list (); word_res_it.forward ()) {
        if (!word_res_it.data ()->part_of_combo) {
          initial_str += word_res_it.data ()->best_choice->string ();
          initial_str += ' ';
        }
      }
    }

    #ifndef SECURE_NAMES
    if (debug_fix_space_level > 1) {
      switch (mode) {
        case 1:
          tprintf ("EXTRACTED (%d): \"", score);
          break;
        case 2:
          tprintf ("TESTED (%d): \"", score);
          break;
        case 3:
          tprintf ("RETURNED (%d): \"", score);
          break;
      }

      for (word_res_it.mark_cycle_pt ();
      !word_res_it.cycled_list (); word_res_it.forward ()) {
        if (!word_res_it.data ()->part_of_combo)
          tprintf("%s/%1d ",
            word_res_it.data ()->best_choice->string ().
            string (),
            (int) word_res_it.data ()->best_choice->permuter ());
      }
      tprintf ("\"\n");
    }
    else if (improved) {
      tprintf ("FIX SPACING \"%s\" => \"", initial_str.string ());
      for (word_res_it.mark_cycle_pt ();
      !word_res_it.cycled_list (); word_res_it.forward ()) {
        if (!word_res_it.data ()->part_of_combo)
          tprintf ("%s/%1d ",
            word_res_it.data ()->best_choice->string ().
            string (),
            (int) word_res_it.data ()->best_choice->permuter ());
      }
      tprintf ("\"\n");
    }
    #endif
  }
}
Example #4
0
bool TessdataManager::CombineDataFiles(
    const char *language_data_path_prefix,
    const char *output_filename) {
  int i;
  inT64 offset_table[TESSDATA_NUM_ENTRIES];
  for (i = 0; i < TESSDATA_NUM_ENTRIES; ++i) offset_table[i] = -1;
  FILE *output_file = fopen(output_filename, "wb");
  if (output_file == NULL) {
    tprintf("Error opening %s for writing\n", output_filename);
    return false;
  }
  // Leave some space for recording the offset_table.
  if (fseek(output_file,
            sizeof(inT32) + sizeof(inT64) * TESSDATA_NUM_ENTRIES, SEEK_SET)) {
    tprintf("Error seeking %s\n", output_filename);
    fclose(output_file);
    return false;
  }

  TessdataType type = TESSDATA_NUM_ENTRIES;
  bool text_file = false;
  FILE *file_ptr[TESSDATA_NUM_ENTRIES];

  // Load individual tessdata components from files.
  for (i = 0; i < TESSDATA_NUM_ENTRIES; ++i) {
    ASSERT_HOST(TessdataTypeFromFileSuffix(
        kTessdataFileSuffixes[i], &type, &text_file));
    STRING filename = language_data_path_prefix;
    filename += kTessdataFileSuffixes[i];
    file_ptr[i] =  fopen(filename.string(), "rb");
    if (file_ptr[i] != NULL) {
      offset_table[type] = ftell(output_file);
      CopyFile(file_ptr[i], output_file, text_file, -1);
      fclose(file_ptr[i]);
    }
  }

  // Make sure that the required components are present.
  if (file_ptr[TESSDATA_UNICHARSET] == NULL) {
    tprintf("Error opening %sunicharset file\n", language_data_path_prefix);
    fclose(output_file);
    return false;
  }
  if (file_ptr[TESSDATA_INTTEMP] != NULL &&
      (file_ptr[TESSDATA_PFFMTABLE] == NULL ||
       file_ptr[TESSDATA_NORMPROTO] == NULL)) {
    tprintf("Error opening %spffmtable and/or %snormproto files"
            " while %sinttemp file was present\n", language_data_path_prefix,
            language_data_path_prefix, language_data_path_prefix);
    fclose(output_file);
    return false;
  }

  return WriteMetadata(offset_table, language_data_path_prefix, output_file);
}
Example #5
0
void HttpSocket::SendGetInet(const STRING &url, const STRING &host, const int &port, std::vector<char> *data)
{
	char d[4096];
	DWORD len;
	stringstream lss;
	INTERNET_BUFFERS BufferIn = {0};

	BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );

	HINTERNET hNet = InternetOpen(_T("peelClient"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
	if(!hNet)
		throw SocketException(_T("Could not open internet"), GetError());
	
	HINTERNET hCon = InternetConnect(hNet, host.c_str(), port , 0, 0, INTERNET_SERVICE_HTTP, 0, 0);
	if(!hCon)
	{
		InternetCloseHandle(hNet);
		throw SocketException(_T("Could not connect to server"), GetError());
	}

	HINTERNET hReq = HttpOpenRequest(hCon, _T("GET"), url.c_str(), 0, 0, 0, INTERNET_FLAG_RELOAD, 0);
	if(!hReq)
	{
		InternetCloseHandle(hNet);
		InternetCloseHandle(hCon);
		throw SocketException(_T("Could not open request to server"), GetError());
	}

	if(!HttpSendRequest(hReq, NULL, NULL, NULL, NULL))
	{
		InternetCloseHandle(hNet);
		InternetCloseHandle(hCon);
		throw SocketException(_T("Could not send request to server"), GetError());
	}



	if(data != NULL)
	{
		lss.str("");

		while(1)
		{
			if(!InternetReadFile(hReq, d, 4095, &len))
				break;
			if(len==0) break;
			d[len]='\0';
            std::copy( d, d+len, (*data).begin());
		}
	}

	InternetCloseHandle(hNet);
	InternetCloseHandle(hCon);

}
Example #6
0
BOOL8 STRING::operator!=(const STRING& str) const {
  FixHeader();
  str.FixHeader();
  const STRING_HEADER* str_header = str.GetHeader();
  const STRING_HEADER* this_header = GetHeader();
  int this_used = this_header->used_;
  int str_used  = str_header->used_;

  return (this_used != str_used)
         || (memcmp(GetCStr(), str.GetCStr(), this_used) != 0);
}
Example #7
0
void JustRenderIt::NotImplemented(bool halt, STRING msg)
{
  STRING str = msg + " Not implemented!";

  if(!halt)
    LOG_WARNING1(str.c_str());
  else
  {
    LOG_FATAL1(str.c_str());
  }
}
Example #8
0
TEST_F(is_IS_PhoneNumber, PhoneNumber) {
  cxxfaker::providers::is_IS::PhoneNumber* phonenumber = new cxxfaker::providers::is_IS::PhoneNumber();
  phonenumber->Seed(::testing::UnitTest::GetInstance()->random_seed());
  STRING number = phonenumber->phoneNumber();
  for (STRING::const_iterator iter = number.begin(); iter != number.end(); ++iter) {
    if (isdigit(*iter) || *iter == '+' || *iter == ' ')
      continue;
    ADD_FAILURE() << "What is this \"" << *iter << "\" doing in here..";
  };
  delete phonenumber;
};
bool Ini_UpdaterLists::saveRollbackInfo(const FileVector &rollbackList)
{
    STRING section_name = SS_KEY_RollbackTree;
    long k = 0;
    
    STRING rollbackFileAndPath;
    if(!getProductFolder(m_useCurrentFolder, rollbackFileAndPath, pLog))
    {
        TRACE_MESSAGE("Unable to save rollback information, because failed to get product folder");
        return false;
    }
    rollbackFileAndPath += UPDATER_LISTS_FILENEME;
    
    TRACE_MESSAGE2("Saving rollback list to '%s'", rollbackFileAndPath.to_string().c_str());

    removeRollbackSection();

    // for output saved entries in rows and save space in trace file
    std::string savedEntries;
    unsigned long logLineSplitIndex = 0;

    for(FileVector::const_iterator iter = rollbackList.begin(); iter != rollbackList.end(); ++iter)
    {
        if(iter->m_rollbackChange == STRING(SS_KEY_RecentStatusAdded)
            || iter->m_rollbackChange == STRING(SS_KEY_RecentStatusModified)
            || iter->m_rollbackChange == STRING(SS_KEY_RecentStatusDeleted))
        {
            STRING newSectionName;
            const long order_number = k++;
            makeNewSectionName(order_number, iter->m_filename, newSectionName);
            
            if(!saveRollbackListEntry(rollbackFileAndPath.c_str(), section_name.c_str(), order_number, newSectionName, *iter))
            {
                TRACE_MESSAGE2("Unable to save rollback information for file entry '%s'", (iter->m_localPath + iter->m_filename).to_string().c_str());
                return false;
            }


            // append comma before all items, but the very first one
            if(logLineSplitIndex++)
                savedEntries += ", ";
            // split line each 3 elements, but not before last element
            if(iter + 1 != rollbackList.end())
            {
                if(!(logLineSplitIndex % 3))
                    savedEntries += "\n\t";
            }
            savedEntries += (iter->m_localPath + iter->m_filename).to_string();
        }
    }

    TRACE_MESSAGE3("Rollback information saved successfully to %s, entries: %s", rollbackFileAndPath.to_string().c_str(), savedEntries.c_str());
    return true;
}
Example #10
0
// clears the tile cache for the given map
void MgdTileCache::Clear(MgMapBase* map)
{
    if (map != NULL)
    {
        STRING basePath = GetBasePath(map);

        // delete main map directory
        if (!basePath.empty())
            MgFileUtil::DeleteDirectory(basePath, true, false);
    }
}
Example #11
0
// Load level information
int Level::LoadLevel(const STRING & path)
{
	STRING file;
	file.assign(path.c_str());
	STRING name = Port::FileName(file);
	file.append(Port::ReplacePath(STR("\\level.dat")));
	NBT_Reader read = NBT_Reader();
	read.Load(file);

	bool valid = false;

	NBTTag tag = read.ReadData(); // Read first compound
	while ((tag = read.ReadData()) != TAG_Unknown)
	{
		const NBTData * data = read.GetData();
		if (!data)
			continue;
		if (!valid)
		{
			if (data->tag != TAG_Compound)
				continue;
			if (!data->name)
				continue;
			if (!StringCheck(data->name, "Data"))
				continue;
			valid = true;
		}
		switch (data->tag)
		{
			case TAG_Int:
				if (StringCheck(data->name, "version"))
				{
					info.version = data->i;
				}
				break;
			case TAG_Long:
				if (StringCheck(data->name, "RandomSeed"))
				{
					info.seed = data->l;
				}
				break;
			case TAG_String:
				if (StringCheck(data->name, "LevelName"))
				{
					info.name.assign((char *)data->bas, (char *)data->bas+data->size);
				}
				break;
		}
	}
	// Alpha
	if (info.name.empty())
		info.name = name;
	return valid;
}
Example #12
0
// Sets up the network for training using the given weight_range.
void LSTM::DebugWeights() {
  for (int w = 0; w < WT_COUNT; ++w) {
    if (w == GFS && !Is2D()) continue;
    STRING msg = name_;
    msg.add_str_int(" Gate weights ", w);
    gate_weights_[w].Debug2D(msg.string());
  }
  if (softmax_ != NULL) {
    softmax_->DebugWeights();
  }
}
Example #13
0
bool XmlTagEntity::getArg(STRING name, int &ivalue)
{
	STRING tmp;
	if(!getArg(name, tmp)) return false;
#ifdef _WIN32
	ivalue = _tstoi(tmp.c_str());
#else
	ivalue = atoi(tmp.c_str());
#endif
	return true;
}
Example #14
0
//从文件中读取变量
VOID CVariableSystem::LoadVariable(LPCTSTR szFileName, VARIABLE_MAP& mapBuf)
{
	KLAssert(szFileName);
	//	mapBuf.clear();

	//-----------------------------------------------------------
	//取得配置文件的大小
	HANDLE hFile = CreateFile(szFileName,
		GENERIC_READ,
		FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL,
		OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,
		NULL);

	if(INVALID_HANDLE_VALUE == hFile) return;

	DWORD dwHigh;
	DWORD dwFileSize = GetFileSize(hFile, &dwHigh);
	CloseHandle(hFile); hFile = NULL;
	if(0==dwFileSize) return;

	//-----------------------------------------------------------
	//分配足够的内存
	CHAR* pTempBuf = new CHAR[dwFileSize+32];
	if(!pTempBuf) return;

	//-----------------------------------------------------------
	//从配置文件中读取"Variable"节
	::GetPrivateProfileSection("Variable", pTempBuf, dwFileSize, szFileName);
	//分解
	std::vector< STRING > vRet;
	ConvertSectionInVector(pTempBuf, dwFileSize, vRet);

	delete[] pTempBuf; pTempBuf=NULL;

	//加入变量定义
	for(INT i=0; i<(INT)vRet.size(); i++)
	{
		STRING& strLine = vRet[i];

		STRING::size_type tEqu = strLine.find_first_of("= \t");
		if(tEqu == STRING::npos) continue;

		STRING strName = strLine.substr(0, tEqu);

		CHAR szTemp[1024];
		::GetPrivateProfileString("Variable", strName.c_str(), "", szTemp, 1024, szFileName);

		SetVariable(strName.c_str(), szTemp, FALSE);
	}

}
Example #15
0
void calcToScalar(ObjectHandler::property_t &ret, const ANY &value) {
    STRING t = value.getValueTypeName();
    //std::cout << "calcToScalar ANY to property_t called" << std::endl;
    if (t.equalsIgnoreAsciiCase(STRFROMANSI("VOID"))) {
        //std::cout << "ANY value type VOID" << std::endl;
        ret = ObjectHandler::property_t();
    } else if (t.equalsIgnoreAsciiCase(STRFROMANSI("LONG"))) {
        //std::cout << "ANY value type LONG" << std::endl;
        long temp;
        value >>= temp;
        ret = ObjectHandler::property_t(temp);
    } else if (t.equalsIgnoreAsciiCase(STRFROMANSI("DOUBLE"))) {
Example #16
0
/*----------------------------------------------------------------------------*/
void WriteNormProtos (
     const char  *Directory,
     LIST  LabeledProtoList,
   CLUSTERER *Clusterer)

/*
**  Parameters:
**    Directory  directory to place sample files into
**  Operation:
**    This routine writes the specified samples into files which
**    are organized according to the font name and character name
**    of the samples.
**  Return: none
**  Exceptions: none
**  History: Fri Aug 18 16:17:06 1989, DSJ, Created.
*/

{
  FILE    *File;
  STRING Filename;
  LABELEDLIST LabeledProto;
  int N;

  Filename = "";
  if (Directory != NULL && Directory[0] != '\0')
  {
    Filename += Directory;
    Filename += "/";
  }
  Filename += "normproto";
  printf ("\nWriting %s ...", Filename.string());
  File = Efopen (Filename.string(), "wb");
  fprintf(File,"%0d\n",Clusterer->SampleSize);
  WriteParamDesc(File,Clusterer->SampleSize,Clusterer->ParamDesc);
  iterate(LabeledProtoList)
  {
    LabeledProto = (LABELEDLIST) first_node (LabeledProtoList);
    N = NumberOfProtos(LabeledProto->List, true, false);
    if (N < 1) {
      printf ("\nError! Not enough protos for %s: %d protos"
              " (%d significant protos"
              ", %d insignificant protos)\n",
              LabeledProto->Label, N,
              NumberOfProtos(LabeledProto->List, 1, 0),
              NumberOfProtos(LabeledProto->List, 0, 1));
      exit(1);
    }
    fprintf(File, "\n%s %d\n", LabeledProto->Label, N);
    WriteProtos(File, Clusterer->SampleSize, LabeledProto->List, true, false);
  }
  fclose (File);

}  // WriteNormProtos
Example #17
0
void testEmptyConst()
{
    char desc[] = "Empty Constructor";
    printTestHeader(desc);

    STRING s;
    cout << "STRING contains '"; STRdisplay(s); cout << "'.\n"
        << "STRING length is " << s.length() << ".\n"
        << "isEmpty returns " << (s.isEmpty() ? "True" : "False") << ".\n";

    printTestFooter(desc);
}
Example #18
0
SNORTRULEHDR void CRuleOption::FormatPattern(CDllString &out)
{
	m_nFlags = CRuleOption::NOFLAG;
	STRING str = out.Data();
	STRING_ITER iBeg = str.begin(), iEnd = str.end();
	if (*std::find_if_not(iBeg, iEnd, ISSPACE()) == '!')
	{
		m_nFlags |= CRuleOption::HASNOT;
	}
	QuotedContext(iBeg, iEnd);
	out.Assign(STRING(iBeg, iEnd).c_str());
}
Example #19
0
// clears the tile cache for the given map
void MgdTileCache::Clear(MgResourceIdentifier* mapDef)
{
    // the resource must be a map definition
    if (mapDef != NULL && mapDef->GetResourceType() == MgResourceType::MapDefinition)
    {
        STRING basePath = GetBasePath(mapDef);

        // delete main map directory
        if (!basePath.empty())
            MgFileUtil::DeleteDirectory(basePath, true, false);
    }
}
Example #20
0
VOID CStringFilter::ReplaceToSign_Normal(const STRING& strIn, STRING& strOut)
{
	static STRING strSign		= "?";
	static BYTE byANSIBegin		= 0X20;
	static BYTE byANSIEnd		= 0X80;
	strOut = strIn;

	STRING::size_type allsize = m_vIncluce.size();
	//包含替换
	for(STRING::size_type i = 0; i < m_vIncluce.size(); ++i)
	{
		STRING::size_type pos = strIn.find(m_vIncluce[i]);

		while(STRING::npos != pos)
		{
			STRING strReplace = "";
			STRING::size_type len = m_vIncluce[i].size();
			//如果包含替换的是1个字节的ANSI字节,替换前,
			//需要确认前一个字节一定不是双字节字符集的前一个字节
			BOOL bSkip = FALSE;
			if(1 == len && pos > 0)
			{
				BYTE byChar = strIn[pos-1];
#if 0
				char dbgmsg[256];
				_snprintf(dbgmsg, 255, "strIn[pos-1]:0x%X(0x%X)\n", strIn[pos-1],byChar);
				::OutputDebugString(dbgmsg);
#endif
				//不是标准ANSI英文字符
				if(!(byChar >= byANSIBegin && byChar <= byANSIEnd || byChar == '\r' || byChar == '\n' || byChar == '\t'))
				{
					bSkip = TRUE;
				}
			}

			if(!bSkip)
			{
				for(STRING::size_type k = 0; k < len; ++k, strReplace += strSign);
				strOut.replace(pos, len, strReplace);
			}

			pos = strIn.find(m_vIncluce[i], pos+len);
		}
	}

	//完全匹配替换
	if(IsFullCmp(strIn))
	{
		STRING::size_type len = strIn.size();
		strOut.clear();
		for(STRING::size_type i = 0; i < len; ++i, strOut += strSign);
	}
}
Example #21
0
BOOL EditDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
    COMBOBOXEXITEMW Item;
    ZeroMemory(&Item, sizeof(Item));
    Item.mask = CBEIF_TEXT;

    FONTNAMESET::iterator it, end = g_Names.end();
    for (it = g_Names.begin(); it != end; ++it)
    {
        Item.pszText = const_cast<LPWSTR>(it->c_str());
        Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb2));
        SendDlgItemMessageW(hwnd, cmb2, CBEM_INSERTITEM, 0, (LPARAM)&Item);
    }
    SetDlgItemTextW(hwnd, edt1, g_strFontName.c_str());
    SetDlgItemTextW(hwnd, cmb2, g_strSubstitute.c_str());

    const INT Count = _countof(g_CharSetList);
    for (INT i = 0; i < Count; ++i)
    {
        Item.pszText = const_cast<LPWSTR>(g_CharSetList[i].DisplayName);
        Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb3));
        SendDlgItemMessageW(hwnd, cmb3, CBEM_INSERTITEM, 0, (LPARAM)&Item);
        Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb4));
        SendDlgItemMessageW(hwnd, cmb4, CBEM_INSERTITEM, 0, (LPARAM)&Item);
    }

    SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, 0, 0);
    SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, 0, 0);
    for (INT i = 0; i < Count; ++i)
    {
        if (g_CharSet1 == g_CharSetList[i].CharSet)
        {
            SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, i, 0);
        }
        if (g_CharSet2 == g_CharSetList[i].CharSet)
        {
            SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, i, 0);
        }
    }

    SIZE siz;
    HDC hDC = CreateCompatibleDC(NULL);
    SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
    GetTextExtentPoint32W(hDC, g_LongestName, lstrlenW(g_LongestName), &siz);
    DeleteDC(hDC);

    SendDlgItemMessageW(hwnd, cmb3, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0);
    SendDlgItemMessageW(hwnd, cmb4, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0);

    EnableWindow(GetDlgItem(hwnd, cmb3), FALSE);

    return TRUE;
}
static inline int okBase( const STRING& aField )
{
    int offset = int( aField.find_first_of( ":/" ) );
    if( offset != -1 )
        return offset;

    // cannot be empty
    if( !aField.size() )
        return 0;

    return offset;  // ie. -1
}
Example #23
0
/*
 * Remove the path from a file name, perserving folders.
 * preserveFrom should carry a trailing \.
 */
STRING removePath(const STRING str, const STRING preserveFrom)
{
	const int pos = str.find(preserveFrom);
	if (pos != str.npos)
	{
		return str.substr(pos + preserveFrom.length());
	}
	// Return the path unaltered, since it didn't contain the
	// default folder and any other folders should be subfolders
	// (although a different default folder may be present).
	return str;
}
	//宠物改名字
	INT	Pet::Change_Name(LuaPlus::LuaState* state)
	{
		LuaStack args(state);

		if ( !(args[2].IsInteger()) || !(args[3].IsString()) )
		{
			KLThrow("LUA:Pet Change_Name parameter error");
		}

		INT nPetNum = args[2].GetInteger();
		LPCTSTR szName = args[3].GetString();
		STRING szTemp="";

		SDATA_PET* My_Pet= CDataPool::GetMe()->Pet_GetPet(nPetNum);
		if( (!My_Pet) || ( !My_Pet->m_pModelData ) ) 
		{
			KLThrow("LUA:Pet Change_Name parameter error");
			return 0;
		}
		if(CGameProcedure::s_pUISystem->CheckStringFilter(szName, FT_NAME) == FALSE)
		{
			
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_Talk_Info_InvalidContent");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,strTemp.c_str());
			return 0;

		}
		else if(CGameProcedure::s_pUISystem->CheckStringCode(szName,szTemp) == FALSE)
		{

			return 0;

		}
		else if(KLU_CheckStringValid(szName) == FALSE)
		{
			STRING strTemp = "";
			strTemp = NOCOLORMSGFUNC("ERRORSpecialString");
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,strTemp.c_str());
			return 0;
		}
		//向服务器发送
		CGSetPetAttrib Msg;
		if(strcmp(szName, My_Pet->m_szName.c_str()) != 0)
		{
			Msg.SetGUID(My_Pet->m_GUID);
//			Msg.SetIndex(nPetNum);		
			Msg.SetName((CHAR*)szName);
			CNetManager::GetMe()->SendPacket(&Msg);
		}
		return 0;
	}
	INT CGameProduce_Login::GetLastLoginAreaAndServerIndex(LuaPlus::LuaState* state)
	{
		INT area =0, server = 0;
		STRING name;
		if((CGameProcedure::s_pProcLogIn))
		{
			CGameProcedure::s_pProcLogIn->GetLastLoginAreaAndServerIndex(area, server,name);
		}
		state->PushInteger(area);
		state->PushInteger(server);
		state->PushString(name.c_str());
		return 3;
	}
Example #26
0
// NOTE : the value of MapType must be matched with ResourceID of ResourceFile(MapResourceFile)
STRING GooRoomClient::GetCloudMapFilePath(StageLevel stageLevel)
{
    std::ostringstream mapFileName;
    
    const STRING fileName = this->GetGooRoomResourceVersionManager().GetResourceFileName(static_cast<ResourceID>(stageLevel));
    if( fileName.compare("")==0 )
    {
        ASSERT_DEBUG(fileName.compare("")!=0);
        return "";
    }
    
    return this->GetWritableFilePath(fileName.c_str());
}
Example #27
0
bool MgWmsLayerDefinitions::SkipElement(CPSZ pszElementName)
{
    STRING sName;
    if(pszElementName == NULL && m_xmlParser->Current().Type() == keBeginElement) {
        MgXmlBeginElement& Begin = (MgXmlBeginElement&)m_xmlParser->Current();
        sName = Begin.Name();
        pszElementName = sName.c_str();
    }

    MgXmlSynchronizeOnElement Whatever(*m_xmlParser,pszElementName);

    return Whatever.AtBegin();
}
Example #28
0
  // special form of exception for CeeFIT system failures
  void ceefit_call_spec FIXTURE::Failure(PTR<PARSE>& cell, FAILURE* f)
  {
    STRING message;

    message = STRING("A failure occurred:  ") + (f != null ? f->GetReason() : STRING("<unknown reason>"));
#   ifdef _DEBUG
      printf("%S\n", message.GetBuffer());
#   endif

    Error(cell, message);

    delete f;
  }
Example #29
0
  void ceefit_call_spec FIXTURE::Exception(PTR<PARSE>& cell, EXCEPTION* e)
  {
    STRING message;

    message = STRING("An unhandled exception occurred:  ") + (e != null ? e->GetReason() : STRING("<unknown reason>"));
#   ifdef _DEBUG
      printf("%S\n", message.GetBuffer());
#   endif

    Error(cell, message);

    delete e;
  }
	// 询问是否退到帐号输入界面
	INT CGameProduce_Login::ExitToAccountInput_YesNo(LuaPlus::LuaState* state)
	{
		std::vector< STRING > strParamInfo;
		STRING strTemp = "";
		strTemp = NOCOLORMSGFUNC("GMGameInterface_Script_GameLogin_Info_Exit_To_Account_Input_YesNo");
		strParamInfo.push_back(strTemp.c_str());

		//strParamInfo.push_back("确定退到帐号输入界面吗?");
		strParamInfo.push_back("2");
		// 
		((CEventSystem*)CGameProcedure::s_pEventSystem)->PushEvent( GE_GAMELOGIN_SYSTEM_INFO_YESNO, strParamInfo);
		return 0;
	}