bool TagEntry::IsConstructor() const { if(GetKind() != wxT("function") && GetKind() != wxT("prototype")) return false; return GetName() == GetScope(); }
bool TagEntry::IsDestructor() const { if(GetKind() != wxT("function") && GetKind() != wxT("prototype")) return false; return GetName().StartsWith(wxT("~")); }
bool ExprTree:: Evaluate( EvalState &state, Value &val, ExprTree *&sig ) const { double diff = 0; #ifndef WIN32 struct timeval begin, end; if (state.debug) { gettimeofday(&begin, NULL); } #endif bool eval = _Evaluate( state, val, sig ); #ifndef WIN32 if (state.debug) { gettimeofday(&end, NULL); diff = (end.tv_sec + (end.tv_usec * 0.000001)) - (begin.tv_sec + (begin.tv_usec * 0.000001)); } #endif if(state.debug && GetKind() != ExprTree::LITERAL_NODE && GetKind() != ExprTree::OP_NODE) { debug_format_value(val, diff); } return eval; }
const bool TagEntry::IsContainer() const { return GetKind() == wxT("class") || GetKind() == wxT("struct") || GetKind() == wxT("union") || GetKind() == wxT("namespace") || GetKind() == wxT("project"); }
wxString TagEntry::Key() const { wxString key; if(GetKind() == wxT("prototype") || GetKind() == wxT("macro")) { key << GetKind() << wxT(": "); } key << GetPath() << GetSignature(); return key; }
bool ExprTree:: Evaluate( EvalState &state, Value &val, ExprTree *&sig ) const { bool eval = _Evaluate( state, val, sig ); if(state.debug && GetKind() != ExprTree::LITERAL_NODE && GetKind() != ExprTree::OP_NODE) { debug_format_value(val); } return eval; }
void pgaStep::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("ID"), GetRecId()); properties->AppendYesNoItem(_("Enabled"), GetEnabled()); properties->AppendItem(_("Kind"), GetKind()); if (GetConnStr().IsEmpty()) properties->AppendItem(_("Database"), GetDbname()); else properties->AppendItem(_("Connection String"), GetConnStr()); properties->AppendItem(_("Code"), GetCode()); properties->AppendItem(_("On error"), GetOnError()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); } }
void pgOperator::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Kind"), GetKind()); if (!leftType.IsNull()) properties->AppendItem(_("Left type"), GetLeftType()); if (!rightType.IsNull()) properties->AppendItem(_("Right type"), GetRightType()); properties->AppendItem(_("Result type"), GetResultType()); properties->AppendItem(_("Operator function"), GetOperatorFunction()); properties->AppendItem(_("Commutator"), GetCommutator()); properties->AppendItem(_("Negator"), GetNegator()); properties->AppendItem(_("Join function"), GetJoinFunction()); properties->AppendItem(_("Restrict function"), GetRestrictFunction()); if (!GetDatabase()->BackendMinimumVersion(8, 3)) { properties->AppendItem(_("Left Sort operator"), GetLeftSortOperator()); properties->AppendItem(_("Right Sort operator"), GetRightSortOperator()); properties->AppendItem(_("Less Than operator"), GetLessOperator()); properties->AppendItem(_("Greater than operator"), GetGreaterOperator()); } properties->AppendYesNoItem(_("Supports hash?"), GetHashJoins()); properties->AppendYesNoItem(_("Supports merge?"), GetMergeJoins()); properties->AppendYesNoItem(_("System operator?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); } }
int TagEntry::Store(wxSQLite3Statement& insertPerepareStmnt) { // If this node is a dummy, (IsOk() == false) we dont insert it to database if( !IsOk() ) return TagOk; try { // see TagsDatabase::GetInsertOneStatement() for the order of binding insertPerepareStmnt.Bind(1, GetParentId()); insertPerepareStmnt.Bind(2, GetName()); insertPerepareStmnt.Bind(3, GetFile()); insertPerepareStmnt.Bind(4, GetLine()); insertPerepareStmnt.Bind(5, GetKind()); insertPerepareStmnt.Bind(6, GetAccess()); insertPerepareStmnt.Bind(7, GetSignature()); insertPerepareStmnt.Bind(8, GetPattern()); insertPerepareStmnt.Bind(9, GetParent()); insertPerepareStmnt.Bind(10, GetInherits()); insertPerepareStmnt.Bind(11, GetPath()); insertPerepareStmnt.Bind(12, GetTyperef()); insertPerepareStmnt.Bind(13, GetScope()); insertPerepareStmnt.ExecuteUpdate(); insertPerepareStmnt.Reset(); } catch(wxSQLite3Exception& exc) { if(exc.ErrorCodeAsString(exc.GetErrorCode()) == wxT("SQLITE_CONSTRAINT")) return TagExist; wxLogMessage(exc.GetMessage()); return TagError; } return TagOk; }
size_t Cursor::GetOffsetOfField() const { assert(GetKind() == CXCursor_FieldDecl); // strange, clang returns the offset in bits instead of bytes... return clang_Cursor_getOffsetOfField(cursor_) / 8; }
int TagEntry::Update(wxSQLite3Statement& updatePerepareStmnt) { // If this node is a dummy, (IsOk() == false) we dont update it to database if( !IsOk() ) return TagOk; try { // see TagsDatabase::GetUpdateOneStatement() function for the order of binding updatePerepareStmnt.Bind(1, GetParentId()); updatePerepareStmnt.Bind(2, GetName()); updatePerepareStmnt.Bind(3, GetFile()); updatePerepareStmnt.Bind(4, GetLine()); updatePerepareStmnt.Bind(5, GetAccess()); updatePerepareStmnt.Bind(6, GetPattern()); updatePerepareStmnt.Bind(7, GetParent()); updatePerepareStmnt.Bind(8, GetInherits()); updatePerepareStmnt.Bind(9, GetTyperef()); updatePerepareStmnt.Bind(10, GetScope()); updatePerepareStmnt.Bind(11, GetKind()); updatePerepareStmnt.Bind(12, GetSignature()); updatePerepareStmnt.Bind(13, GetPath()); updatePerepareStmnt.ExecuteUpdate(); updatePerepareStmnt.Reset(); } catch(wxSQLite3Exception& exc) { wxLogMessage(exc.GetMessage()); return TagError; } return TagOk; }
void ASTNode::NFASTPrint(int l, int max, int prefix) const { //**************************************** // stop //**************************************** if (l > max) { return; } //**************************************** // print //**************************************** printf("[%10d]", 0); for (int i = 0; i < prefix; i++) { printf(" "); } cout << GetKind(); printf("\n"); //**************************************** // recurse //**************************************** const ASTVec &children = GetChildren(); ASTVec::const_iterator it = children.begin(); for (; it != children.end(); it++) { it->NFASTPrint(l + 1, max, prefix + 1); } } //End of NFASTPrint()
wxString TagEntry::Key() const { wxString key; if( GetKind() == wxT("prototype")) key << wxT("[prototype] "); key << GetPath() << GetSignature(); return key; }
wxString TagEntry::GetDisplayName() const { wxString name; name << GetName() << GetSignature(); if(GetKind() == wxT("prototype")) { name << wxT(": [prototype]"); } return name; }
bool CTypeStrings::CanBeKey(void) const { switch ( GetKind() ) { case eKindStd: case eKindEnum: case eKindString: return true; default: return false; } }
bool CTypeStrings::NeedSetFlag(void) const { switch ( GetKind() ) { case eKindPointer: case eKindRef: // case eKindContainer: return false; default: return true; } }
string CTypeStrings::NewInstance(const string& init, const string& place) const { CNcbiOstrstream s; s << "new"; if ( GetKind() == eKindObject ) { s << place; } s << ' ' << GetCType(CNamespace::KEmptyNamespace) << '(' << init << ')'; return CNcbiOstrstreamToString(s); }
void wxMenuItem::Check(bool bDoCheck) { wxCHECK_RET( IsCheckable() && !IsSeparator(), wxT("only checkable items may be checked") ); if ( m_isChecked != bDoCheck ) { if ( GetKind() == wxITEM_RADIO ) { if ( bDoCheck ) { wxMenuItemBase::Check( bDoCheck ) ; UpdateItemStatus() ; // get the index of this item in the menu const wxMenuItemList& items = m_parentMenu->GetMenuItems(); int pos = items.IndexOf(this); wxCHECK_RET( pos != wxNOT_FOUND, wxT("menuitem not found in the menu items list?") ); // get the radio group range int start, end; if ( m_isRadioGroupStart ) { // we already have all information we need start = pos; end = m_radioGroup.end; } else // next radio group item { // get the radio group end from the start item start = m_radioGroup.start; end = items.Item(start)->GetData()->m_radioGroup.end; } // also uncheck all the other items in this radio group wxMenuItemList::compatibility_iterator node = items.Item(start); for ( int n = start; n <= end && node; n++ ) { if ( n != pos ) ((wxMenuItem*)node->GetData())->UncheckRadio(); node = node->GetNext(); } } } else { wxMenuItemBase::Check( bDoCheck ) ; UpdateItemStatus() ; } } }
bool CTypeStrings::CanBeCopied(void) const { switch ( GetKind() ) { case eKindStd: case eKindEnum: case eKindString: case eKindPointer: case eKindRef: return true; default: return false; } }
wxString TagEntry::NameFromTyperef(wxString& templateInitList, bool nameIncludeTemplate) { wxString typeref = GetTyperef(); if(typeref.IsEmpty() == false) { wxString name = typeref.AfterFirst(wxT(':')); return name; } // incase our entry is a typedef, and it is not marked as typeref, // try to get the real name from the pattern if(GetKind() == wxT("typedef")) { wxString pat(GetPattern()); if(!GetPattern().Contains(wxT("typedef"))) { // The pattern does not contain 'typedef' however this *is* a typedef // try to see if this is a macro pat.StartsWith(wxT("/^"), &pat); pat.Trim().Trim(false); // we take the first token CppScanner scanner; scanner.SetText(pat.To8BitData()); int type = scanner.yylex(); if(type == IDENTIFIER) { wxString token = wxString::From8BitData(scanner.YYText()); PPToken tok = TagsManagerST::Get()->GetDatabase()->GetMacro(token); if(tok.flags & PPToken::IsValid) { // we found a match! if(tok.flags & PPToken::IsFunctionLike) { wxArrayString argList; if(GetMacroArgList(scanner, argList)) { tok.expandOnce(argList); } } pat = tok.replacement; pat << wxT(";"); // Remove double spaces while(pat.Replace(wxT(" "), wxT(" "))) { } } } } wxString name; if(TypedefFromPattern(pat, GetName(), name, templateInitList, nameIncludeTemplate)) return name; } return wxEmptyString; }
void TagEntry::Print() { std::cout << "======================================" << std::endl; std::cout << "Name:\t\t" << GetName() << std::endl; std::cout << "File:\t\t" << GetFile() << std::endl; std::cout << "Line:\t\t" << GetLine() << std::endl; std::cout << "Pattern\t\t" << GetPattern() << std::endl; std::cout << "Kind:\t\t" << GetKind() << std::endl; std::cout << "Parent:\t\t" << GetParent() << std::endl; std::cout << " ---- Ext fields: ---- " << std::endl; std::map<wxString, wxString>::const_iterator iter = m_extFields.begin(); for(; iter != m_extFields.end(); iter++) std::cout << iter->first << ":\t\t" << iter->second << std::endl; std::cout << "======================================" << std::endl; }
bool ExprTree::isClassad(ClassAd ** ptr) { bool bRet = false; if ( CLASSAD_NODE == GetKind() ) { if (ptr){ *ptr = (ClassAd *) this; } bRet = true; } return (bRet); }
// flush bool wxFile::Flush() { #ifdef HAVE_FSYNC // fsync() only works on disk files and returns errors for pipes, don't // call it then if ( IsOpened() && GetKind() == wxFILE_KIND_DISK ) { if ( CheckForError(wxFsync(m_fd)) ) { wxLogSysError(_("can't flush file descriptor %d"), m_fd); return false; } } #endif // HAVE_FSYNC return true; }
wxString TagEntry::NameFromTyperef(wxString &templateInitList) { wxString typeref = GetTyperef(); if ( typeref.IsEmpty() == false ) { wxString name = typeref.AfterFirst(wxT(':')); return name; } // incase our entry is a typedef, and it is not marked as typeref, // try to get the real name from the pattern if ( GetKind() == wxT("typedef")) { wxString name; if (TypedefFromPattern(GetPattern(), GetName(),name, templateInitList)) return name; } return wxEmptyString; }
// this is only called for the normal buttons, i.e. not separators nor // controls GtkToolbarChildType GetGtkChildType() const { switch ( GetKind() ) { case wxITEM_CHECK: return GTK_TOOLBAR_CHILD_TOGGLEBUTTON; case wxITEM_RADIO: return GTK_TOOLBAR_CHILD_RADIOBUTTON; default: wxFAIL_MSG( _T("unknown toolbar child type") ); // fall through case wxITEM_NORMAL: return GTK_TOOLBAR_CHILD_BUTTON; } }
void SymtabBuilder::VisitNamedSortExpr(const NamedSortExpr* Sort) { // Check that the named sort actually resolves to something auto STE = TheSymbolTable->LookupSort(Sort->GetName()); if(STE == NULL || STE->GetKind() != STENTRY_SORT) { throw SynthLib2ParserException((string)"Sort name \"" + Sort->GetName() + "\" could not " + "be resolved to anything meaningful.\n" + Sort->GetLocation().ToString()); } auto SortE = STE->GetSort(); if (TheSymbolTable->ResolveSort(SortE) == NULL) { throw SynthLib2ParserException((string)"Sort name \"" + Sort->GetName() + "\" could not " + "be resolved to anything meaningful.\n" + Sort->GetLocation().ToString()); } // Do nothing otherwise return; }
int TagEntry::Delete(wxSQLite3Statement &deletePreparedStmnt) { // Delete this record from database. // Delete is done using the index try { deletePreparedStmnt.Bind(1, GetKind()); // Kind deletePreparedStmnt.Bind(2, GetSignature()); // Signature deletePreparedStmnt.Bind(3, GetPath()); // Path deletePreparedStmnt.ExecuteUpdate(); deletePreparedStmnt.Reset(); } catch(wxSQLite3Exception& exc) { wxLogMessage(exc.GetMessage()); return TagError; } return TagOk; }
void wxMenuItem::Check( bool check ) { wxCHECK_RET( m_menuItem, wxT("invalid menu item") ); if (check == m_isChecked) return; wxMenuItemBase::Check( check ); switch ( GetKind() ) { case wxITEM_CHECK: case wxITEM_RADIO: gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); break; default: wxFAIL_MSG( wxT("can't check this item") ); } }
void wxMenuItem::Check( bool bCheck ) { bool bOk; wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") ); if (m_isChecked == bCheck) return; HMENU hMenu = GetHmenuOf(m_parentMenu); if (GetKind() == wxITEM_RADIO) { // // It doesn't make sense to uncheck a radio item - what would this do? // if (!bCheck) return; // // Get the index of this item in the menu // const wxMenuItemList& rItems = m_parentMenu->GetMenuItems(); int nPos = rItems.IndexOf(this); wxCHECK_RET( nPos != wxNOT_FOUND ,wxT("menuitem not found in the menu items list?") ); // // Get the radio group range // int nStart; int nEnd; if (m_bIsRadioGroupStart) { // // We already have all information we need // nStart = nPos; nEnd = m_vRadioGroup.m_nEnd; } else // next radio group item { // // Get the radio group end from the start item // nStart = m_vRadioGroup.m_nStart; nEnd = rItems.Item(nStart)->GetData()->m_vRadioGroup.m_nEnd; } // // Also uncheck all the other items in this radio group // wxMenuItemList::compatibility_iterator node = rItems.Item(nStart); for (int n = nStart; n <= nEnd && node; n++) { if (n == nPos) { ::WinSendMsg( hMenu ,MM_SETITEMATTR ,MPFROM2SHORT(n, TRUE) ,MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED) ); } if (n != nPos) { node->GetData()->m_isChecked = FALSE; ::WinSendMsg( hMenu ,MM_SETITEMATTR ,MPFROM2SHORT(n, TRUE) ,MPFROM2SHORT(MIA_CHECKED, FALSE) ); } node = node->GetNext(); } } else // check item { if (bCheck) bOk = (bool)::WinSendMsg( hMenu ,MM_SETITEMATTR ,MPFROM2SHORT(GetRealId(), TRUE) ,MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED) ); else bOk = (bool)::WinSendMsg( hMenu ,MM_SETITEMATTR ,MPFROM2SHORT(GetRealId(), TRUE) ,MPFROM2SHORT(MIA_CHECKED, FALSE) ); } if (!bOk) { wxLogLastError(wxT("CheckMenuItem")); } wxMenuItemBase::Check(bCheck); } // end of wxMenuItem::Check
wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id, const wxString& t, const wxString& strHelp, wxItemKind kind, wxMenu *pSubMenu) :wxMenuItemBase(pParentMenu, id, t, strHelp, kind, pSubMenu) { wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ; // In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines // therefore these item must not be translated if (pParentMenu != NULL && !pParentMenu->GetNoEventsMode()) if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") ) m_text = wxT("Quit\tCtrl+Q") ; m_radioGroup.start = -1; m_isRadioGroupStart = false; wxString text = wxStripMenuCodes(m_text, (pParentMenu != NULL && pParentMenu->GetNoEventsMode()) ? wxStrip_Accel : wxStrip_All); if (text.IsEmpty() && !IsSeparator()) { wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?")); text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC); } wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ; // use accessors for ID and Kind because they might have been changed in the base constructor m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu ); delete entry; }