int NotebookManager::compare_notebooks_sort_func(const Gtk::TreeIter &a, const Gtk::TreeIter &b) { Notebook::Ptr notebook_a; a->get_value (0, notebook_a); Notebook::Ptr notebook_b; b->get_value (0, notebook_b); if (!notebook_a || !notebook_b) return 0; SpecialNotebook::Ptr spec_a = dynamic_pointer_cast<SpecialNotebook>(notebook_a); SpecialNotebook::Ptr spec_b = dynamic_pointer_cast<SpecialNotebook>(notebook_b); if(spec_a != 0 && spec_b != 0) { return strcmp(spec_a->get_normalized_name().c_str(), spec_b->get_normalized_name().c_str()); } else if(spec_a != 0) { return -1; } else if(spec_b != 0) { return 1; } Glib::ustring a_name(notebook_a->get_name()); a_name = a_name.lowercase(); Glib::ustring b_name(notebook_b->get_name()); b_name = b_name.lowercase(); return a_name.compare(b_name); }
int ACE_Name_Handler::resolve (void) { ACE_TRACE (ACE_TEXT ("ACE_Name_Handler::resolve")); #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for RESOLVE\n"))); #endif /* 0 */ ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); // The following will deliver our reply back to client we // pre-suppose success (indicated by type RESOLVE). ACE_NS_WString avalue; char *atype; if (this->naming_context ()->resolve (a_name, avalue, atype) == 0) { ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> avalue_urep (avalue.rep ()); ACE_Name_Request nrq (ACE_Name_Request::RESOLVE, 0, 0, avalue_urep.get (), avalue.length () * sizeof (ACE_WCHAR_T), atype, ACE_OS::strlen (atype)); delete[] atype; return this->send_request (nrq); } ACE_Name_Request nrq (ACE_Name_Request::BIND, 0, 0, 0, 0, 0, 0); this->send_request (nrq); return 0; }
int ACE_Name_Handler::unbind (void) { ACE_TRACE (ACE_TEXT ("ACE_Name_Handler::unbind")); #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for UNBIND\n"))); #endif /* 0 */ ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); if (this->naming_context ()->unbind (a_name) == 0) return this->send_reply (0); else return this->send_reply (-1); }
void Resource::logNewType(){ // if we haven't yet, define the table if ( !resource_type_table->defined() ) Resource::define_type_table(); // make a row // declare data data a_type( (int)this->type() ), a_name( this->type_name() ), a_unit( this->units() ); // declare entries entry type("Type",a_type), name("Name", a_name), units("Units", a_unit); // declare row row aRow; aRow.push_back(type), aRow.push_back(name), aRow.push_back(units); // add the row resource_type_table->addRow(aRow); // record this primary key type_pkref_.push_back(type); }
bool find_arg ( int argc, char* argv[], const char * arg_name ) { // we use find below so we have to convert arg_name to string string a_name (arg_name); bool result = false; typedef vector<string>::iterator ptr; vector <string> args ( argv, argv + argc ); ptr Iter = std::find (args.begin(), args.end(), a_name); if ( Iter != args.end() ) result = true; else result = false; return result; }
int ACE_Name_Handler::shared_bind (int rebind) { ACE_TRACE (ACE_TEXT ("ACE_Name_Handler::shared_bind")); ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); ACE_NS_WString a_value (this->name_request_.value (), this->name_request_.value_len () / sizeof (ACE_WCHAR_T)); int result; if (rebind == 0) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for BIND\n"))); #endif /* 0 */ result = this->naming_context ()->bind (a_name, a_value, this->name_request_.type ()); } else { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for REBIND\n"))); #endif /* 0 */ result = this->naming_context ()->rebind (a_name, a_value, this->name_request_.type ()); if (result == 1) result = 0; } if (result == 0) return this->send_reply (0); else return this->send_reply (-1); }