C++ (Cpp) init Examples

C++ (Cpp) init - 30 examples found. These are the top rated real world C++ (Cpp) examples of init extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
ItemText::ItemText(const QString &text, bool isRichText, QWidget *parent)
    : QTextEdit(parent)
    , ItemWidget(this)
    , m_textDocument()
    , m_searchTextDocument()
    , m_textFormat(isRichText ? Qt::RichText : Qt::PlainText)
{
    init(m_textDocument, font());
    init(m_searchTextDocument, font());

    setUndoRedoEnabled(false);

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFrameStyle(QFrame::NoFrame);

    // Selecting text copies it to clipboard.
    connect( this, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()) );

    setReadOnly(true);

    if (isRichText)
        m_textDocument.setHtml( text.left(defaultMaxBytes) );
    else
        m_textDocument.setPlainText( text.left(defaultMaxBytes) );
    setDocument(&m_textDocument);
    updateSize();
}
Example #2
0
void init(node_t * root)
{
    if (root) {
        if (root->lc) {
            root->lc->data.parent = root;
            init(root->lc);
        }
        if (root->rc) {
            root->rc->data.parent = root;
            init(root->rc);
        }
    }
}
Example #3
0
void BTMainScreen::loadModule(std::string moduleFile, BTModule &module)
{
    init();
    XMLSerializer parser;
    module.serialize(&parser);
    if (!PHYSFS_exists(moduleFile.c_str()))
    {
        fprintf(stderr, "Module file '%s' does not exist\n", moduleFile.c_str());
        exit(0);
    }
    parser.parse(moduleFile.c_str(), true);
    std::string moduleName(fs::path(moduleFile).stem().string());
    PHYSFS_deinit();
    init(moduleName, module.content);
}
Example #4
0
joystick_manager::joystick_manager()
    : joysticks_()
    , joystick_area_(0)
    , counter_(0)
{
    init();
}
Example #5
0
SamiSearchFilter::SamiSearchFilter(String* json) {
    init();
    String str(json->GetPointer());
    int length = str.GetLength();

    ByteBuffer buffer;
    buffer.Construct(length);

    for (int i = 0; i < length; ++i) {
        byte b = str[i];
        buffer.SetByte(b);
    }

    IJsonValue* pJson = JsonParser::ParseN(buffer);
    fromJsonObject(pJson);
    if (pJson->GetType() == JSON_TYPE_OBJECT) {
        JsonObject* pObject = static_cast< JsonObject* >(pJson);
        pObject->RemoveAll(true);
    }
    else if (pJson->GetType() == JSON_TYPE_ARRAY) {
        JsonArray* pArray = static_cast< JsonArray* >(pJson);
        pArray->RemoveAll(true);
    }
    delete pJson;
}
void SinglePlayerMenu::OnCampaign()
{
    int player;

    HouseChoiceMenu* pHouseChoiceMenu = new HouseChoiceMenu();
    if(pHouseChoiceMenu == NULL) {
        perror("SinglePlayerMenu::OnCampaign()");
        exit(EXIT_FAILURE);
    }
    player = pHouseChoiceMenu->showMenu();
    delete pHouseChoiceMenu;

    if(player < 0) {
        return;
    }

    GameInitSettings init((HOUSETYPE) player, settings.General.ConcreteRequired, settings.General.FogOfWar);

    for(int houseID = 0; houseID < NUM_HOUSES; houseID++) {
        if(houseID == player) {
            GameInitSettings::HouseInfo humanHouseInfo((HOUSETYPE) player, 1);
            humanHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(settings.General.PlayerName, "HumanPlayer") );
            init.addHouseInfo(humanHouseInfo);
        } else {
            GameInitSettings::HouseInfo aiHouseInfo((HOUSETYPE) houseID, 2);
            aiHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(getHouseNameByNumber( (HOUSETYPE) houseID), "AIPlayer", stringify(settings.playerDifficulty)) );
            init.addHouseInfo(aiHouseInfo);
        }
    }

    startSinglePlayerGame(init);

    quit();
}