LRESULT COXMaskedEdit::OnSetText(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); if(m_listData.GetCount()==0 || GetStyle()&ES_READONLY) { return CEdit::Default(); } CString csNewString=(LPCTSTR)lParam; if(m_nSetTextSemaphor>0) { LRESULT result=CEdit::Default(); NotifyParent(EN_UPDATE); if(m_bNotifyParent) NotifyParent(EN_CHANGE); return result; } else { ASSERT(m_nSetTextSemaphor==0); m_bNotifyParent=FALSE; csNewString=GetInputData(csNewString); SetInputData(csNewString,0,TRUE); m_bNotifyParent=TRUE; return TRUE; } }
void CppUpdateFieldDumper::DumpDynamicFlags(std::ofstream& file, std::string const& varName, std::vector<std::vector<DynamicUpdateField>*> const& fields) { file << "uint32 " << varName << " =" << std::endl; file << "{" << std::endl; for (std::size_t i = 0; i < fields.size(); ++i) { std::vector<DynamicUpdateField> const& fieldDefs = *fields[i]; std::uint32_t j = 0; while (j < fieldDefs.size()) { std::string flagName = GetUpdateFieldFlagFullName(fieldDefs[j].Flags); std::string pad(PaddingSize - flagName.length(), ' '); std::string fieldName = GetInputData()->GetString(fieldDefs[j].NameAddress); std::string oldName = GetOldName(fieldName.c_str()); if (!oldName.empty()) fieldName = oldName; file << Tab << flagName << pad << " // " << fieldName << std::endl; ++j; } } file << "};" << std::endl << std::endl; }
void UpdateFieldDumper::BuildUpdateFieldEnum(Enum& enumData, std::string const& name, std::vector<UpdateField> const& data, std::string const& end, std::string const& fieldBase) { enumData.SetName(name); std::uint32_t i = 0; while (i < data.size()) { UpdateField const* field = &data[i]; std::string name = GetInputData()->GetString(data[i].NameAddress); if (name == "CGUnitData::npcFlags[UMNW0]") { name = "CGUnitData::npcFlags"; field = &data[i + 1]; } std::string oldName = GetOldName(name.c_str()); if (!oldName.empty()) name = oldName; enumData.AddMember(Enum::Member(i, FormatValue(i, fieldBase), name, static_cast<std::ostringstream&>(std::ostringstream() << "Size: " << field->Size << ", Flags: " << GetUpdateFieldFlagName(field->Flags)).str())); i += field->Size; } enumData.AddMember(Enum::Member(i, FormatValue(i, fieldBase), end, "")); }
void wxMaskController::SetValue(wxString& value) { if(m_listData.GetCount() == 0) SetTextValue(value); else SetInputData(GetInputData(value), 0, true); }
bool HClusterDlg::CheckAllInputs() { n_cluster = 0; wxString str_ncluster = combo_n->GetValue(); long value_ncluster; if (str_ncluster.ToLong(&value_ncluster)) { n_cluster = value_ncluster; } if (n_cluster < 2 || n_cluster > num_obs) { wxString err_msg = _("Please enter a valid number of clusters."); wxMessageDialog dlg(NULL, err_msg, _("Error"), wxOK | wxICON_ERROR); dlg.ShowModal(); return false; } int transform = combo_tranform->GetSelection(); if(GetInputData(transform,1) == false) return false; method = 's'; int method_sel = m_method->GetSelection(); char method_choices[] = {'s','w', 'm','a'}; method = method_choices[method_sel]; dist = 'e'; int dist_sel = m_distance->GetSelection(); char dist_choices[] = {'e','b'}; dist = dist_choices[dist_sel]; return true; }
void UpdateFieldDumper::BuildDynamicUpdateFieldEnum(Enum& enumData, std::string const& name, std::vector<DynamicUpdateField> const& data, std::string const& end, std::string const& fieldBase) { enumData.SetName(name); std::uint32_t i = 0; while (i < data.size()) { DynamicUpdateField const* field = &data[i]; std::string name = GetInputData()->GetString(data[i].NameAddress); std::string oldName = GetOldName(name.c_str()); if (!oldName.empty()) name = oldName; enumData.AddMember(Enum::Member(i, FormatValue(i, fieldBase), name, static_cast<std::ostringstream&>(std::ostringstream() << "Flags: " << GetUpdateFieldFlagName(field->Flags)).str())); ++i; } enumData.AddMember(Enum::Member(i, FormatValue(i, fieldBase), end, "")); }
int COXMaskedEdit::InsertAt(int nSelectionStart, TCHAR chNewChar) { // Although we could have some complex, yet efficient, routine // that would error if inserting pushed an existing character // into an invalid region. Instead, just save the current // state and restore it on error. CString csPreviousInput=GetInputData(); int nCharIndex=0; int nInsertionPoint=-1; CString csInputData; CMaskData* pobjData=NULL; for(POSITION pos=m_listData.GetHeadPosition(); pos; nCharIndex++) { pobjData=m_listData.GetNext(pos); // Ignore everything that is not data. // This is just like we do in GetInputData except that we // will ignore the input data within the selection range. if(pobjData->IsInputData()) { // Wait until a valid insertion point and // only make sure to insert once. if((nInsertionPoint < 0) && (nCharIndex >= nSelectionStart)) { csInputData += chNewChar; nInsertionPoint=nCharIndex; } csInputData += pobjData->m_chValue; } } // Now apply the filtered data stream and check if it was successful. if(!SetInputData(csInputData)) { // If not successful, then restore the previous input and return -1. SetInputData(csPreviousInput); return -1; } return nInsertionPoint; }
int wxMaskController::InsertAt(int nSelectionStart, wxChar chNewChar) { // Although we could have some complex, yet efficient, routine // that would error if inserting pushed an existing character // into an invalid region. Instead, just save the current // state and restore it on error. wxString csPreviousInput=GetInputData(); int nCharIndex = 0; int nInsertionPoint = -1; wxString csInputData; wxFieldMaskData* pobjData = NULL; for(unsigned long pos = 0;pos < m_listData.GetCount(); pos++,nCharIndex++) { pobjData = (wxFieldMaskData *) (m_listData.Item(pos))->GetData(); // Ignore everything that is not data. // This is just like we do in GetInputData except that we // will ignore the input data within the selection range. if(pobjData->IsInputData()) { // Wait until a valid insertion point and // only make sure to insert once. if((nInsertionPoint < 0) && (nCharIndex >= nSelectionStart)) { csInputData += chNewChar; nInsertionPoint=nCharIndex; } csInputData += pobjData->m_chValue; } } // Now apply the filtered data stream and check if it was successful. if(!SetInputData(csInputData)) { // If not successful, then restore the previous input and return -1. SetInputData(csPreviousInput); return -1; } return nInsertionPoint; }
BOOL COXMaskedEdit::SetInputData(LPCTSTR pszInputData, int nBeginPos/*=0*/, BOOL bAllowPrompt/*=TRUE*/) { CString csFullInput; // Start with existing data and append the new data. csFullInput=GetInputData(); csFullInput=csFullInput.Left(nBeginPos); if(bAllowPrompt) { csFullInput+=pszInputData; } else { // If the prompt symbol is not valid, then // add the data one-by-one ignoring any prompt symbols. for(; *pszInputData; pszInputData++) { if(*pszInputData!=m_chPromptSymbol) csFullInput+=*pszInputData; } } BOOL bCompleteSuccess=TRUE; LPCTSTR pszReplaceData=csFullInput; CMaskData* pobjData=NULL; for(POSITION pos=m_listData.GetHeadPosition(); pos;) { pobjData=m_listData.GetNext(pos); // Ignore everything that is not data. if(pobjData->IsInputData()) { // If we run out of replacement data, then use the prompt symbol. // Make sure we iterate through the entire list so that the // prompt symbol is applied to any empty areas. if(*pszReplaceData) { // This inner while loop is so that we can re-apply input data // after an error. This will allow us to skip over invalid // input data and try the next character. while(*pszReplaceData) { TCHAR chReplace=*pszReplaceData; pszReplaceData++; // Make sure to follow the input validation. // The prompt symbol is always valid at this level. // This allows the user to erase a string by overtyping a space. // On error, just skip the character being inserted. // This will allow the DeleteRange() function to have the remaining // characters validated. if((chReplace==m_chPromptSymbol) || pobjData->IsValidInput(chReplace)) { pobjData->m_chValue=pobjData->PreProcessChar(chReplace); break; } else bCompleteSuccess=FALSE; } } else { pobjData->m_chValue=m_chPromptSymbol; } } } Update(); return bCompleteSuccess; }
void CppUpdateFieldDumper::Dump() { BuildUpdateFields(ObjectFields, "ObjectFields", GetInputData()->ObjectFields, "OBJECT_END", ""); BuildDynamicUpdateFields(ObjectDynamicFields, "ObjectDynamicFields", std::vector<DynamicUpdateField>(), "OBJECT_DYNAMIC_END", ""); BuildUpdateFields(ItemFields, "ItemFields", GetInputData()->ItemFields, "ITEM_END", "OBJECT_END"); BuildDynamicUpdateFields(ItemDynamicFields, "ItemDynamicFields", GetInputData()->ItemDynamicFields, "ITEM_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(ContainerFields, "ContainerFields", GetInputData()->ContainerFields, "CONTAINER_END", "ITEM_END"); BuildDynamicUpdateFields(ContainerDynamicFields, "ContainerDynamicFields", std::vector<DynamicUpdateField>(), "CONTAINER_DYNAMIC_END", "ITEM_DYNAMIC_END"); BuildUpdateFields(UnitFields, "UnitFields", GetInputData()->UnitFields, "UNIT_END", "OBJECT_END"); BuildDynamicUpdateFields(UnitDynamicFields, "UnitDynamicFields", GetInputData()->UnitDynamicFields, "UNIT_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(PlayerFields, "PlayerFields", GetInputData()->PlayerFields, "PLAYER_END", "UNIT_END"); Enum::Member head = *(PlayerFields.E.GetMember("PLAYER_FIELD_INV_SLOT_HEAD")); head.ValueName = "PLAYER_FIELD_END_NOT_SELF"; head.Comment = ""; PlayerFields.E.AddMemberSorted(std::move(head)); BuildDynamicUpdateFields(PlayerDynamicFields, "PlayerDynamicFields", GetInputData()->PlayerDynamicFields, "PLAYER_DYNAMIC_END", "UNIT_DYNAMIC_END"); BuildUpdateFields(GameObjectFields, "GameObjectFields", GetInputData()->GameObjectFields, "GAMEOBJECT_END", "OBJECT_END"); BuildDynamicUpdateFields(GameObjectDynamicFields, "GameObjectDynamicFields", GetInputData()->GameObjectDynamicFields, "GAMEOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(DynamicObjectFields, "DynamicObjectFields", GetInputData()->DynamicObjectFields, "DYNAMICOBJECT_END", "OBJECT_END"); BuildDynamicUpdateFields(DynamicObjectDynamicFields, "DynamicObjectDynamicFields", std::vector<DynamicUpdateField>(), "DYNAMICOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(CorpseFields, "CorpseFields", GetInputData()->CorpseFields, "CORPSE_END", "OBJECT_END"); BuildDynamicUpdateFields(CorpseDynamicFields, "CorpseDynamicFields", std::vector<DynamicUpdateField>(), "CORPSE_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(AreaTriggerFields, "AreaTriggerFields", GetInputData()->AreaTriggerFields, "AREATRIGGER_END", "OBJECT_END"); BuildDynamicUpdateFields(AreaTriggerDynamicFields, "AreaTriggerDynamicFields", std::vector<DynamicUpdateField>(), "AREATRIGGER_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(SceneObjectFields, "SceneObjectFields", GetInputData()->SceneObjectFields, "SCENEOBJECT_END", "OBJECT_END"); BuildDynamicUpdateFields(SceneObjectDynamicFields, "SceneObjectDynamicFields", std::vector<DynamicUpdateField>(), "SCENEOBJECT_DYNAMIC_END", "OBJECT_DYNAMIC_END"); BuildUpdateFields(ConversationFields, "ConversationFields", GetInputData()->ConversationFields, "CONVERSATION_END", "OBJECT_END"); BuildDynamicUpdateFields(ConversationDynamicFields, "ConversationDynamicFields", GetInputData()->ConversationDynamicFields, "CONVERSATION_DYNAMIC_END", "OBJECT_DYNAMIC_END"); time_t now = time(nullptr); tm date; localtime_s(&date, &now); date.tm_year += 1900; std::ofstream updateFieldsDump("UpdateFields.h"); updateFieldsDump << "/*" << std::endl; updateFieldsDump << " * Copyright (C) 2008-" << date.tm_year << " TrinityCore <http://www.trinitycore.org/>" << std::endl; updateFieldsDump << " * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>" << std::endl; updateFieldsDump << " *" << std::endl; updateFieldsDump << " * This program is free software; you can redistribute it and/or modify it" << std::endl; updateFieldsDump << " * under the terms of the GNU General Public License as published by the" << std::endl; updateFieldsDump << " * Free Software Foundation; either version 2 of the License, or (at your" << std::endl; updateFieldsDump << " * option) any later version." << std::endl; updateFieldsDump << " *" << std::endl; updateFieldsDump << " * This program is distributed in the hope that it will be useful, but WITHOUT" << std::endl; updateFieldsDump << " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or" << std::endl; updateFieldsDump << " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for" << std::endl; updateFieldsDump << " * more details." << std::endl; updateFieldsDump << " *" << std::endl; updateFieldsDump << " * You should have received a copy of the GNU General Public License along" << std::endl; updateFieldsDump << " * with this program. If not, see <http://www.gnu.org/licenses/>." << std::endl; updateFieldsDump << " */" << std::endl; updateFieldsDump << std::endl; updateFieldsDump << "#ifndef _UPDATEFIELDS_H" << std::endl; updateFieldsDump << "#define _UPDATEFIELDS_H" << std::endl; updateFieldsDump << std::endl; updateFieldsDump << "// Auto generated for version " << FormatVersion(", ") << std::endl; updateFieldsDump << std::endl; DumpEnums(updateFieldsDump); updateFieldsDump << "#endif // _UPDATEFIELDS_H" << std::endl; updateFieldsDump.close(); std::ofstream updateFieldFlags("UpdateFieldFlags.cpp"); updateFieldFlags << "/*" << std::endl; updateFieldFlags << " * Copyright (C) 2008-" << date.tm_year << " TrinityCore <http://www.trinitycore.org/>" << std::endl; updateFieldFlags << " *" << std::endl; updateFieldFlags << " * This program is free software; you can redistribute it and/or modify it" << std::endl; updateFieldFlags << " * under the terms of the GNU General Public License as published by the" << std::endl; updateFieldFlags << " * Free Software Foundation; either version 2 of the License, or (at your" << std::endl; updateFieldFlags << " * option) any later version." << std::endl; updateFieldFlags << " *" << std::endl; updateFieldFlags << " * This program is distributed in the hope that it will be useful, but WITHOUT" << std::endl; updateFieldFlags << " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or" << std::endl; updateFieldFlags << " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for" << std::endl; updateFieldFlags << " * more details." << std::endl; updateFieldFlags << " *" << std::endl; updateFieldFlags << " * You should have received a copy of the GNU General Public License along" << std::endl; updateFieldFlags << " * with this program. If not, see <http://www.gnu.org/licenses/>." << std::endl; updateFieldFlags << " */" << std::endl; updateFieldFlags << std::endl; updateFieldFlags << "#include \"UpdateFieldFlags.h\"" << std::endl; updateFieldFlags << std::endl; DumpFlags(updateFieldFlags, "ItemUpdateFieldFlags[CONTAINER_END]", { &GetInputData()->ObjectFields, &GetInputData()->ItemFields, &GetInputData()->ContainerFields }); DumpDynamicFlags(updateFieldFlags, "ItemDynamicUpdateFieldFlags[CONTAINER_DYNAMIC_END]", { &GetInputData()->ItemDynamicFields }); DumpFlags(updateFieldFlags, "UnitUpdateFieldFlags[PLAYER_END]", { &GetInputData()->ObjectFields, &GetInputData()->UnitFields, &GetInputData()->PlayerFields }); DumpDynamicFlags(updateFieldFlags, "UnitDynamicUpdateFieldFlags[PLAYER_DYNAMIC_END]", { &GetInputData()->UnitDynamicFields, &GetInputData()->PlayerDynamicFields }); DumpFlags(updateFieldFlags, "GameObjectUpdateFieldFlags[GAMEOBJECT_END]", { &GetInputData()->ObjectFields, &GetInputData()->GameObjectFields }); DumpDynamicFlags(updateFieldFlags, "GameObjectDynamicUpdateFieldFlags[GAMEOBJECT_DYNAMIC_END]", { &GetInputData()->GameObjectDynamicFields }); DumpFlags(updateFieldFlags, "DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END]", { &GetInputData()->ObjectFields, &GetInputData()->DynamicObjectFields }); DumpFlags(updateFieldFlags, "CorpseUpdateFieldFlags[CORPSE_END]", { &GetInputData()->ObjectFields, &GetInputData()->CorpseFields }); DumpFlags(updateFieldFlags, "AreaTriggerUpdateFieldFlags[AREATRIGGER_END]", { &GetInputData()->ObjectFields, &GetInputData()->AreaTriggerFields }); DumpFlags(updateFieldFlags, "SceneObjectUpdateFieldFlags[SCENEOBJECT_END]", { &GetInputData()->ObjectFields, &GetInputData()->SceneObjectFields }); DumpFlags(updateFieldFlags, "ConversationUpdateFieldFlags[CONVERSATION_END]", { &GetInputData()->ObjectFields, &GetInputData()->ConversationFields }); DumpDynamicFlags(updateFieldFlags, "ConversationDynamicUpdateFieldFlags[CONVERSATION_DYNAMIC_END]", { &GetInputData()->ConversationDynamicFields }); updateFieldFlags.close(); }
void CsUpdateFieldDumper::Dump() { BuildUpdateFields(ObjectFields, "ObjectField", GetInputData()->ObjectFields, "OBJECT_END", ""); BuildDynamicUpdateFields(ObjectDynamicFields, "ObjectDynamicField", std::vector<DynamicUpdateField>(), "OBJECT_DYNAMIC_END", ""); BuildUpdateFields(ItemFields, "ItemField", GetInputData()->ItemFields, "ITEM_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(ItemDynamicFields, "ItemDynamicField", GetInputData()->ItemDynamicFields, "ITEM_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(ContainerFields, "ContainerField", GetInputData()->ContainerFields, "CONTAINER_END", "ItemField.ITEM_END"); BuildDynamicUpdateFields(ContainerDynamicFields, "ContainerDynamicField", std::vector<DynamicUpdateField>(), "CONTAINER_DYNAMIC_END", "ItemDynamicField.ITEM_DYNAMIC_END"); BuildUpdateFields(UnitFields, "UnitField", GetInputData()->UnitFields, "UNIT_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(UnitDynamicFields, "UnitDynamicField", GetInputData()->UnitDynamicFields, "UNIT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(PlayerFields, "PlayerField", GetInputData()->PlayerFields, "PLAYER_END", "UnitField.UNIT_END"); BuildDynamicUpdateFields(PlayerDynamicFields, "PlayerDynamicField", GetInputData()->PlayerDynamicFields, "PLAYER_DYNAMIC_END", "UnitDynamicField.UNIT_DYNAMIC_END"); BuildUpdateFields(GameObjectFields, "GameObjectField", GetInputData()->GameObjectFields, "GAMEOBJECT_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(GameObjectDynamicFields, "GameObjectDynamicField", GetInputData()->GameObjectDynamicFields, "GAMEOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(DynamicObjectFields, "DynamicObjectField", GetInputData()->DynamicObjectFields, "DYNAMICOBJECT_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(DynamicObjectDynamicFields, "DynamicObjectDynamicField", std::vector<DynamicUpdateField>(), "DYNAMICOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(CorpseFields, "CorpseField", GetInputData()->CorpseFields, "CORPSE_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(CorpseDynamicFields, "CorpseDynamicField", std::vector<DynamicUpdateField>(), "CORPSE_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(AreaTriggerFields, "AreaTriggerField", GetInputData()->AreaTriggerFields, "AREATRIGGER_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(AreaTriggerDynamicFields, "AreaTriggerDynamicField", std::vector<DynamicUpdateField>(), "AREATRIGGER_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(SceneObjectFields, "SceneObjectField", GetInputData()->SceneObjectFields, "SCENEOBJECT_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(SceneObjectDynamicFields, "SceneObjectDynamicField", std::vector<DynamicUpdateField>(), "SCENEOBJECT_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); BuildUpdateFields(ConversationFields, "ConversationField", GetInputData()->ConversationFields, "CONVERSATION_END", "ObjectField.OBJECT_END"); BuildDynamicUpdateFields(ConversationDynamicFields, "ConversationDynamicField", GetInputData()->ConversationDynamicFields, "CONVERSATION_DYNAMIC_END", "ObjectDynamicField.OBJECT_DYNAMIC_END"); std::ofstream updateFieldsDump("UpdateFields.cs"); updateFieldsDump << "namespace WowPacketParserModule.V" << FormatVersion("_") << ".Enums" << std::endl; updateFieldsDump << "{" << std::endl; updateFieldsDump << Tab << "// ReSharper disable InconsistentNaming" << std::endl; updateFieldsDump << Tab << "// " << FormatVersion(".") << std::endl; DumpEnums(updateFieldsDump); updateFieldsDump << Tab << "// ReSharper restore InconsistentNaming" << std::endl; updateFieldsDump << "}" << std::endl; updateFieldsDump.close(); }
bool wxMaskController::SetInputData(wxString value, int nBeginPos/*=0*/, bool bAllowPrompt/*=TRUE*/) { wxString csFullInput; m_bNeedValidation = TRUE; m_bValidation = FALSE; // Start with existing data and append the new data. csFullInput = GetInputData(); csFullInput = csFullInput.Left(nBeginPos); if(bAllowPrompt) csFullInput += value; else { // If the prompt symbol is not valid, then // add the data one-by-one ignoring any prompt symbols. for(unsigned int i = 0;i < value.Length();i++) { if(value[i] != m_chPromptSymbol) csFullInput += value[i]; } } bool bCompleteSuccess=TRUE; wxString pszReplaceData=csFullInput; wxFieldMaskData* pobjData=NULL; unsigned int posReplaceData=0; for(unsigned long pos = 0; pos < m_listData.GetCount();pos++) { pobjData = (wxFieldMaskData *) (m_listData.Item(pos))->GetData(); // Ignore everything that is not data. if(pobjData->IsInputData()) { // If we run out of replacement data, then use the prompt symbol. // Make sure we iterate through the entire list so that the // prompt symbol is applied to any empty areas. if(posReplaceData < pszReplaceData.Length()) { // This inner while loop is so that we can re-apply input data // after an error. This will allow us to skip over invalid // input data and try the next character. while(posReplaceData< pszReplaceData.Length()) { wxChar chReplace = pszReplaceData[posReplaceData++]; // Make sure to follow the input validation. // The prompt symbol is always valid at this level. // This allows the user to erase a string by overtyping a space. // On error, just skip the character being inserted. // This will allow the DeleteRange() function to have the remaining // characters validated. if((chReplace == m_chPromptSymbol) || pobjData->IsValidInput(chReplace)) { pobjData->m_chValue = pobjData->PreProcessChar(chReplace); break; } else bCompleteSuccess = FALSE; } } else pobjData->m_chValue = m_chPromptSymbol; } } Update(); return bCompleteSuccess; }
int CPROC CMD_GETLINE( PSENTIENT ps, PTEXT parameters ) { return GetInputData( FALSE, ps, parameters ); }
int CPROC CMD_GETWORD( PSENTIENT ps, PTEXT parameters ) { return GetInputData( TRUE, ps, parameters ); }