/* * This method returns the DCE formatted encoded string value * along with the hashed class name of the CKUUID in a format * that's easily transported and then used to re-create the CKUUID * with the generator methods. */ CKString CKUUID::getStringValueInDCEFormatWithClassHash() const { CKString retval; // see if we have anything to do if (!isGenerated()) { throw CKException(__FILE__, __LINE__, "CKUUID::getStringValueInDCEFormat()" " - this UUID has not yet been generated, and therefore there is " "nothing to return. Please make sure to properly generate the UUIDs " "with one of the class (static) generators for best success."); } else { // generate the string representation appropriately char buff[128]; bzero(buff, 128); snprintf(buff, 127, "%08x %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x %08x", getHash(), mUUID.dce.time_low, mUUID.dce.time_mid, mUUID.dce.time_hi_and_version, mUUID.dce.clock_seq_hi_and_reserved, mUUID.dce.clock_seq_low, mUUID.dce.node[0], mUUID.dce.node[1], mUUID.dce.node[2], mUUID.dce.node[3], mUUID.dce.node[4], mUUID.dce.node[5], getHashedClassName()); retval = buff; } return retval; }
~Program() { if (isGenerated()) { destroy(); m_id = 0u; } }
/* * For those rare times when a user actually needs access to the * structure of the UUID, this accessor method is available. * Typically, this should not be used as it represents a data * structure, and not a simple numerical, or string, ID number. */ CKUUID_struct CKUUID::getUUID() const { if (!isGenerated()) { throw CKException(__FILE__, __LINE__, "CKUUID::getUUID() - the UUID for " "this instance has not yet been generated. This means that it's " "not 'safe' to view. Please make sure to generate it before calling " "this method."); } return mUUID; }
void Transformable::joinParent() { if (isGenerated()) return; Matrix4d matrix; if (Transformable* p = dynamic_cast<Transformable*>(parent())) { matrix = p->globalTransform().inverted(); } setMatrix(matrix * localTransform()); }
/// grabs the next basic block start from _todoQueue that has not been generated yet /// once found, setupBBStartContext is called to ensure everything is ready to start translating bytecodes at that index /// if nothing left to translate, returns _maxByteCode + 8 as a number bigger than the exit test for the simulation loop int32_t findNextByteCodeToGen() { // find and setup the next bbStart context // TodoIndex * ti; while (ti = _todoQueue.pop()) { if (!isGenerated(ti->_index)) return setupBBStartContext(ti->_index); } return this->maxByteCodeIndex() + 8; // indicate that we're done }
/* * To make sure that there are no accesses to the UUID instance * variable outside of our controlled environment, we have this * 'setter' method. If someone tries to set a UUID that is already * set, send an exception so they know it isn't possible. */ void CKUUID::setUUID( const CKUUID_struct & aUUID ) { if (isGenerated()) { throw CKException(__FILE__, __LINE__, "CKUUID::getUUID() - the UUID for " "this instance has already been generated. This means that it's " "not 'safe' to set another value on top of this one. Please make " "sure to generate it only once and then not set it again."); } // set the components of the UUID from the source for (int i = 0; i < 4; i++) { mUUID.words[i] = aUUID.words[i]; } }
void Field::onCellOpened(int x, int y) { if (!isGenerated()) { generate(x, y); } if(cellAt(x,y)->haveMine() == true) { lose(); } if(m_numberOfOpenedCells == m_cells.count() - m_numberOfMines){ win(); } m_numberOfOpenedCells++; }
QString Q3SqlCursor::toString(const QString& prefix, const QString& sep) const { QString pflist; QString pfix = prefix.isEmpty() ? prefix : prefix + QLatin1Char('.'); bool comma = false; for (int i = 0; i < count(); ++i) { const QString fname = fieldName(i); if (isGenerated(i)) { if(comma) pflist += sep + QLatin1Char(' '); pflist += pfix + driver()->escapeIdentifier(fname, QSqlDriver::FieldName); comma = true; } } return pflist; }
QString QSqlCursor::toString( const QString& prefix, const QString& sep ) const { QString pflist; QString pfix = prefix.isEmpty() ? QString::null : prefix + "."; bool comma = FALSE; for ( uint i = 0; i < count(); ++i ) { const QString fname = fieldName( i ); if ( isGenerated( i ) ) { if( comma ) pflist += sep + " "; pflist += pfix + fname; comma = TRUE; } } return pflist; }
/* * This method returns the date of the CKUUID's creation in * the format YYYYMMDD.HHMMSS so that it's easily * understood and though not easy to use, at least usable. */ double CKUUID::getDateCreated() const { double retval = 0.0; // see if we have anything to do if (!isGenerated()) { throw CKException(__FILE__, __LINE__, "CKUUID::getDateCreated()" " - this UUID has not yet been generated, and therefore there is " "nothing to return. Please make sure to properly generate the UUIDs " "with one of the class (static) generators for best success."); } else { struct tm *d = localtime(&mUUID.ns.timestamp); retval = (d->tm_year + 1900)*10000.0 + (d->tm_mon + 1)*100.0 + d->tm_mday*1.0 + d->tm_hour/100.0 + d->tm_min/10000.0 + d->tm_sec/1000000.0; } return retval; }
/* * This method returns the encoded string value of the CKUUID * in a format that's easily transported and then used to * re-create the CKUUID with the generator methods. */ CKString CKUUID::getStringValue() const { CKString retval; // see if we have anything to do if (!isGenerated()) { throw CKException(__FILE__, __LINE__, "CKUUID::getStringValue() - this " "UUID has not yet been generated, and therefore there is nothing " "to return. Please make sure to properly generate the UUIDs with " "one of the class (static) generators for best success."); } else { // generate the string representation appropriately char buff[64]; bzero(buff, 64); snprintf(buff, 63, "%08x%08x%08x%08x%08x", mUUID.words[0], mUUID.words[1], mUUID.words[2], mUUID.words[3], getHashedClassName()); retval = buff; } return retval; }
/* * This is our shared initializer. It checks to see that our * instance hasn't been initialized before, and also that we have * the necessary information (the IP address of the host) to generate * a new UUID. If everything is in order, it returns true if * successful, otherwise false to signify an error. */ bool CKUUID::init() { bool error = false; if (!error) { /* * Check to see that this CKUUID hasn't been generated/initialized * before. */ if (isGenerated()) { error = true; throw CKException(__FILE__, __LINE__, "CKUUID::init() - the UUID for " "this instance has already been generated. This means that it's " "not 'safe' to set another value on top of this one. Please make " "sure to generate it only once and then not set it again."); } // Check to see if we have an IP address, if not, flag it as an error. if (!getHostIPAddress()) { error = true; throw CKException(__FILE__, __LINE__, "CKUUID::init() - the IP " "Address for this machine cannot be obtained and that means " "that we can't generate the UUID as it's based, in part, on the " "IP address. Please look into this as soon as possible."); } } // now clear out the instance variables if (!error) { for (int i = 0; i < 4; i++) { mUUID.words[i] = 0; } mHashedClassName = 0; } return !error; }
void Chunk::draw(Env &env, const glm::vec4 &playerPos, const glm::vec3 &playerLookVec, bool isHeadlightOn, bool exploding, GLclampf explosionTime) { if (!isGenerated()) return; //Update environment stats const unsigned VOXELS_PER_CHUNK = Units::chunkToVoxel(1); debug_stats &stats = env.getStats(); stats.vertices += m_vertexCount; stats.voxels += VOXELS_PER_CHUNK * VOXELS_PER_CHUNK * VOXELS_PER_CHUNK; stats.active_voxels += m_activeVoxels; stats.drawn_voxels += m_drawnVoxels; MatrixStack &mv = env.getMV(); ShaderSet &shaders = env.getShaders(); TextureSet &textures = env.getTextures(); GLfloat offset = VOXELS_PER_CHUNK * Units::voxelToGl(1); mv.pushMatrix(); { mv.translate(m_chunkIndex.x * offset, 0.f, m_chunkIndex.z * offset); glm::vec4 groundColor = m_containsPlayer ? glm::vec4(0.0f, 0.0f, 0.3f, 1.f) : GL::color(51, 102, 51); textures.use(TextureType::Stone); shaders.prepareHemisphereAO(env, glm::vec4(.8f, .8f, .8f, 1.f), groundColor, exploding, explosionTime); getVertexBuffer()->draw(GL_TRIANGLES); } mv.popMatrix(); }
/*! Returns true if the record has a field called \a name and this field is to be generated (the default); otherwise returns false. \sa setGenerated() */ bool QSqlRecord::isGenerated(const QString& name) const { return isGenerated(indexOf(name)); }
inline void generate() { assert(!isGenerated()); m_id=glCreateProgram(); }
void Transformable::leaveParent() { if (isGenerated()) return; setMatrix(globalTransform()); }
//------------------------------------------------------------------ LRESULT CALLBACK WndMainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int i, notif; Tsquare *t; switch(message){ case WM_PAINT: { static PAINTSTRUCT ps; BeginPaint(hWnd, &ps); paint(ps.hdc, &ps.rcPaint); EndPaint(hWnd, &ps); } break; case WM_LBUTTONDOWN: lbutton(lParam); break; case WM_RBUTTONDOWN: rbutton(lParam); break; case WM_LBUTTONUP: if(inserting){ ReleaseCapture(); inserting=false; insertGroup(); resetSolution(); } break; case WM_MOUSEMOVE: if(inserting){ t= hitTest(lParam); if(t && t!=insSquares[insLen-1] && insLen<Nsymbol){ insSquares[insLen++]=t; } } #ifdef _DEBUGM mousemove(lParam); #endif break; case WM_TIMER: if(!IsIconic(hWin)){ playtime++; statusTime(); checkShowErr(false); } break; case WM_KEYDOWN: key(wParam); break; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmm = (LPMINMAXINFO)lParam; lpmm->ptMinTrackSize.x = 250; lpmm->ptMinTrackSize.y = 200+toolH; break; } case WM_SIZE: width=LOWORD(lParam); height=HIWORD(lParam); SendMessage(toolbar, TB_AUTOSIZE, 0, 0); SendMessage(statusbar, WM_SIZE, 0, 0); onMoved(); invalidate(); break; case WM_MOVE: onMoved(); break; case WM_CLOSE: SendMessage(hWin, WM_COMMAND, ID_EXIT, 0); break; case WM_QUERYENDSESSION: writeini(); return TRUE; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: notif=HIWORD(wParam); wParam=LOWORD(wParam); if(setLang(wParam)) break; if(wParam>=ID_SYMBOL && wParam<unsigned(ID_SYMBOL+size)){ select(wParam-ID_SYMBOL); break; } if(wParam>=ID_SIZE+4 && wParam<=ID_SIZE+Msize){ if(askNew()) break; size=wParam-ID_SIZE; newGameFormat(); numButtons(); break; } if(wParam>=ID_MULTI && wParam<ID_MULTI+sizeA(gameTypeA)-1){ if(askNew()) break; gameType=wParam-ID_MULTI; newGameFormat(); break; } switch(wParam){ case ID_CLEAR: noScore=true; init(false); invalidate(); break; case ID_CLEAR_ALL: noScore=true; initSquare(false); invalidate(); break; case ID_EDITOR: if(!editor){ if((undoPos==0 || done==Nsquare) && isGenerated()){ initSquare(false); } editor=true; playtime=0; noScore=true; editorChanged(); } break; case ID_EDITOR_END: if(editor){ endEditor(); editor=false; editorChanged(); } break; case ID_SOLVE: case ID_SOLVE1: if(testTotal()) break; noScore=true; if(done<Nsquare){ waitOn(); #ifdef _DEBUG DWORD time=getTickCount(); #endif Nsolution=0; curSolution=-1; //find all solutions (up to Msolution) undoAllPos=undoPos; if(wParam==ID_SOLVE1) resolve1(); else resolve(); freeGroups(); #ifdef _DEBUG status(4, _T("%d ms"), getTickCount()-time); #endif waitOff(); } if(Nsolution>0){ i=curSolution; curSolution++; if(curSolution>=Nsolution) curSolution=0; if(Nsolution>1){ if(i<0){ status(4, _T("%d %s"), Nsolution, lng(662, "solutions")); } else{ status(4, _T("%d/%d"), curSolution+1, Nsolution); } } rdSolution(); } else{ //easy solution (without recurse) or not solvable curSolution=0; status(4, _T("")); } checkErr(); invalidate(); break; case ID_CHEAT: noScore=true; if(errTime<0){ waitOn(); hint(); waitOff(); } checkShowErr(true); break; case ID_UNDO: undo(); checkErr(); break; case ID_REDO: redo(); checkErr(); break; case ID_UNDO_SYMBOL: undoSymbol(); checkErr(); break; case ID_REDO_SYMBOL: redoSymbol(); checkErr(); break; case ID_UNDO_ALL: undoAll(); checkErr(); break; case ID_REDO_ALL: while(redo()); checkErr(); break; case ID_DEL: select(-1); break; case ID_INS: select(-2); break; case ID_SIGN: select(-3); break; case ID_CONS: select(-4); break; case ID_EVEN: select(-5); break; case ID_EXIT: writeini(); DestroyWindow(hWin); break; case ID_DIAGONAL: if(askNew()) break; diag=!diag; newGameFormat(); break; case ID_SYMETRIC: if(askNew()) break; symetric=!symetric; newGameFormat(); break; case ID_LEVEL: if(DialogBox(inst, MAKEINTRESOURCE(IDD_LEVEL), hWnd, (DLGPROC)LevelProc)){ if(!editor) newGame(); } break; case ID_SHOWERR: DialogBox(inst, MAKEINTRESOURCE(IDD_ERRTIME), hWnd, (DLGPROC)ShowErrProc); break; case ID_KILLER: if(askNew()) break; killer=!killer; newGameFormat(); numButtons(); break; case ID_GREATER: if(askNew()) break; greater=!greater; newGameFormat(); break; case ID_CONSECUTIVE: if(askNew()) break; consecutive=!consecutive; newGameFormat(); if(selectedNum==-4 && !consecutive) select(-1); break; case ID_ODDEVEN: if(askNew()) break; oddeven=!oddeven; newGameFormat(); if(selectedNum==-5 && !oddeven) select(-1); break; case ID_DIGITS: case ID_LETTERS: case ID_COLORS: symbol0=wParam-350; checkMenus(); invalidate(); numButtons(); break; case ID_NEWGAME: if(editor) SendMessage(hWnd, WM_COMMAND, ID_EDITOR_END, 0); else newGame(); break; case ID_DELINI: delreg=true; break; case ID_DELHISCORE: if(MessageBox(hWnd, lng(799, "Do you really want to delete all hiscores ?"), title, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDYES){ for(TscoreTab *tab=score; tab;){ TscoreTab *t1= tab->next; delete tab; tab=t1; } score=0; writeScore(); } break; case ID_BEST_SCORES: DialogBox(inst, MAKEINTRESOURCE(IDD_HISCORE), hWnd, (DLGPROC)ScoreProc); break; case ID_COLORDLG: DialogBox(inst, MAKEINTRESOURCE(IDD_COLORS), hWin, (DLGPROC)ColorProc); break; case ID_ABOUT: DialogBox(inst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)AboutProc); break; case ID_HELP_README: { TCHAR *buf=(TCHAR*)_alloca(2*MAX_PATH); getExeDir(buf, lng(13, "readme.txt")); if(ShellExecute(0, _T("open"), buf, 0, 0, SW_SHOWNORMAL)==(HINSTANCE)ERROR_FILE_NOT_FOUND){ msglng(730, "Cannot open %s", buf); } } break; case ID_WRBMP: if(saveFileDlg(&bmpOfn, hWnd, 0)){ wrBmp(bmpFn, bmpOfn.nFilterIndex); } break; case ID_SAVE: if(saveFileDlg(&gameOfn, hWnd, OFN_OVERWRITEPROMPT)){ save(gameFn); } break; case ID_OPEN: if(openFileDlg(&gameOfn, hWnd, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY)){ open(gameFn); checkErr(); } break; case ID_CLEAR_GRP: resetSolution(); for(i=0; i<Ngroup; i++){ delGroup(&group[i]); } invalidate(); break; case ID_CLEAR_SGN: case ID_CLEAR_CONS: resetSolution(); for(i=0; i<Nboard; i++){ if(wParam==ID_CLEAR_SGN){ putSign(0, &board[i], 0); putSign(0, &board[i], 1); } if(wParam==ID_CLEAR_CONS){ putCons(false, &board[i], 0); putCons(false, &board[i], 1); } } invalidate(); break; case ID_MARKS: noScore=true; showMarks(); break; case ID_DELMARKS: delAllMarks(); break; case ID_PDF: if(askNew()) break; DialogBox(inst, MAKEINTRESOURCE(IDD_PDF), hWnd, (DLGPROC)PdfProc); numButtons(); break; } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }