Exemplo n.º 1
0
void peano::applications::latticeboltzmann::blocklatticeboltzmann::RegularGridBlockState::
setVTKFilename(std::string filename){
  if (filename.length() > 128){
    logError("setFilename()", "Filename too long!");
    assertion(false);
  }
  tarch::la::Vector<128,signed char> charName;
  for (unsigned int i = 0; i < filename.length(); i++){
    charName(i) = filename[i];
  }
  Base::_stateData.setVtkFilename(charName);
}
Exemplo n.º 2
0
void peano::applications::faxen::lbf::RegularGridBlockState::
setVTKFilename(std::string filename){
	if (filename.length() > 128){
		logError("setFilename()", "Filename too long!");
		exit(EXIT_FAILURE);
	}
	tarch::la::Vector<128,signed char> charName;
	for (unsigned int i = 0; i < filename.length(); i++){
		charName(i) = filename[i];
	}
	Base::_stateData.setVtkFilename(charName);
}
QVariant StringCharacterListModel::data(const QModelIndex &index, int role) const
{
	if (!index.isValid())
		return QVariant();

	QString charName((*dataSource)[index.row()]);
	switch(role)
	{
	case Qt::EditRole:
	case Qt::DisplayRole:
		return QVariant(charName);
	default:
		return QVariant();
	}
}
ANTLR_USE_NAMESPACE(std)string MismatchedCharException::getMessage() const
{
	ANTLR_USE_NAMESPACE(std)string s;

	switch (mismatchType) {
	case CHAR :
		s += "expecting '" + charName(expecting) + "', found '" + charName(foundChar) + "'";
		break;
	case NOT_CHAR :
		s += "expecting anything but '" + charName(expecting) + "'; got it anyway";
		break;
	case RANGE :
		s += "expecting token in range: '" + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'";
		break;
	case NOT_RANGE :
		s += "expecting token NOT in range: " + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'";
		break;
	case SET :
	case NOT_SET :
		{
			s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of (";
			ANTLR_USE_NAMESPACE(std)vector<unsigned int> elems = set.toArray();
			for ( unsigned int i = 0; i < elems.size(); i++ )
			{
				s += " '";
				s += charName(elems[i]);
				s += "'";
			}
			s += "), found '" + charName(foundChar) + "'";
		}
		break;
	default :
		s += RecognitionException::getMessage();
		break;
	}

	return s;
}
Exemplo n.º 5
0
bool pawsCharacterPickerWindow::OnButtonPressed( int mouseButton, int keyModifer, pawsWidget* widget )
{
    if(!widget)
        return false;

    switch ( widget->GetID() )
    {
        case YES_DELETE_CHARACTER:
        {
            PawsManager::GetSingleton().SetModalWidget(NULL);
            widget->GetParent()->Hide();

            pawsStringPromptWindow::Create("Please enter your account password to confirm:", csString(""),false, 220, 20, this, "DeletionConfirm", 0, true); 
            pawsEditTextBox* passbox =  dynamic_cast<pawsEditTextBox*>
                                        (PawsManager::GetSingleton().FindWidget("stringPromptEntry"));

            if (passbox)
            {
               passbox->SetPassword(true);
            }
            return true;
        }

        case NO_DELETE_CHARACTER:
        {
            return true;
        }

        case CHARACTER_DELETE_BUTTON:
        {
            csString name;
            name.Format("SelectCharacter%i", selectedCharacter);
            csString confirm;
            // Catch empty selection.
            if(selectedCharacter < 0)
            {
                confirm.Format( "You must select a character to delete!" );
                PawsManager::GetSingleton().CreateWarningBox( confirm, this );
                return false;
            }
            csString charName(((pawsButton*)FindWidget(name))->GetText());
            // Catch invalid selection.
            if(charName == "New Character")
                return false;

            csString msg("Warning! this will PERMANENTLY DELETE your character.  Are you sure you want to continue?");
            pawsYesNoBox::Create(this, msg, YES_DELETE_CHARACTER, NO_DELETE_CHARACTER);

            return true;
        }

        case BACK_BUTTON:
        {
            ReturnToLoginWindow();
            return true;
        }

        case CONFIRM_YES:
        {
            //Delete the selected character
            csString name;
            name.Format("SelectCharacter%i", selectedCharacter);

            // Get Full name.
            psString charFullName( ((pawsButton*)FindWidget(name))->GetText() );
            psString charFirstName;
            charFullName.GetWord( 0, charFirstName );

            psCharDeleteMessage msg(charFirstName, 0);
            msg.SendMessage();

            return true;
        }

        case CONFIRM_NO:
        {
            PawsManager::GetSingleton().SetModalWidget(NULL);
            widget->GetParent()->Hide();
            return true;
        }

        case CHARACTER_BUTTON_0:
        case CHARACTER_BUTTON_1:
        case CHARACTER_BUTTON_2:
        case CHARACTER_BUTTON_3:
        {
            if(!connecting)
            {
                SelectCharacter(widget->GetID(),widget);
            }
            break;    
        }
        
        case CHARACTER_ACTION_BUTTON:
        {
            // if we have a character then we play as that one.
            if ( selectedCharacter != -1 && !connecting )
            {
                // Disable the button so that we don't send 2 picker message
                connecting = true;

                csString name;
                name.Format("SelectCharacter%i", selectedCharacter);
                
                // Send the name of the character to the server. 
                csString charname( ((pawsButton*)FindWidget(name))->GetText() );
                                
                psCharacterPickerMessage msg(charname);
                msg.SendMessage();
            }
            
            return true;
        }
        
        case QUIT_BUTTON:
        {
            psengine->QuitClient();
            return true;
        }
       
    }
    return false;
}
string NoViableAltForCharException::getMessage() const
{
	return string("unexpected char: ")+charName(foundChar);
}
Exemplo n.º 7
0
bool pawsCharacterPickerWindow::OnButtonPressed(int /*mouseButton*/, int /*keyModifer*/, pawsWidget* widget)
{
    if(!widget)
        return false;

    switch ( widget->GetID() )
    {
        case CHARACTER_DELETE_BUTTON:
        {
            csString name;
            name.Format("SelectCharacter%i", selectedCharacter);
            csString confirm;
            // Catch empty selection.
            if(selectedCharacter < 0)
            {
                confirm.Format( "You must select a character to delete!" );
                PawsManager::GetSingleton().CreateWarningBox( confirm, this );
                return false;
            }
            csString charName(((pawsButton*)FindWidget(name))->GetText());
            // Catch invalid selection.
            if(charName == "New Character")
                return false;

            csString msg("Warning! this will PERMANENTLY DELETE your character.  Are you sure you want to continue?");
            pawsYesNoBox::Create(this, msg, YES_DELETE_CHARACTER, NO_DELETE_CHARACTER);

            return true;
        }

        case BACK_BUTTON:
        {
            ReturnToLoginWindow();
            return true;
        }

        case CHARACTER_BUTTON_0:
        case CHARACTER_BUTTON_1:
        case CHARACTER_BUTTON_2:
        case CHARACTER_BUTTON_3:
        {
            if(!connecting)
            {
                SelectCharacter(widget->GetID(),widget);
            }
            break;    
        }
        
        case CHARACTER_ACTION_BUTTON:
        {
            // if we have a character then we play as that one.
            if ( selectedCharacter != -1 && !connecting )
            {
                // Disable the button so that we don't send 2 picker message
                connecting = true;

                csString name;
                name.Format("SelectCharacter%i", selectedCharacter);
                
                // Send the name of the character to the server. 
                csString charname( ((pawsButton*)FindWidget(name))->GetText() );
                                
                psCharacterPickerMessage msg(charname);
                msg.SendMessage();

                //save the selected charname to the configuration file
                csString cnf_name;
                cnf_name.Format(CNF_LAST_CHAR,serverName.GetData());
                csRef<iConfigManager> cfg =  csQueryRegistry<iConfigManager> (PawsManager::GetSingleton().GetObjectRegistry());
                cfg->SetStr(cnf_name, charname);
            }
            
            return true;
        }
        
        case QUIT_BUTTON:
        {
            psengine->QuitClient();
            return true;
        }
       
    }
    return false;
}