/// Constructs a property option with a long name only. /// /// \param long_name_ The long name for the option. /// \param description_ A user-friendly description for the option. /// \param arg_name_ The name of the mandatory argument, for documentation /// purposes. Must include the '=' delimiter. cmdline::property_option::property_option(const char* long_name_, const char* description_, const char* arg_name_) : base_option(long_name_, description_, arg_name_) { PRE(arg_name().find('=') != std::string::npos); }
void Function::print(std::ostream& os) const { if (name!=NULL) os << name << ":"; os << "("; for (int i=0; i<nb_arg(); i++) { os << arg_name(i); if (i<nb_arg()-1) os << ","; } os << ")->" << expr(); }
/// Formats the long name of the option for documentation purposes. /// /// \return A string describing the option's long name. std::string cmdline::base_option::format_long_name(void) const { if (needs_arg()) { return F("--%s=%s") % long_name() % arg_name(); } else { return F("--%s") % long_name(); } }
/// Formats the short name of the option for documentation purposes. /// /// \return A string describing the option's short name. std::string cmdline::base_option::format_short_name(void) const { PRE(has_short_name()); if (needs_arg()) { return F("-%s %s") % short_name() % arg_name(); } else { return F("-%s") % short_name(); } }
/// Validates the argument to a property option. /// /// \param raw_value The argument provided by the user. void cmdline::property_option::validate(const std::string& raw_value) const { const std::string::size_type pos = raw_value.find('='); if (pos == std::string::npos) throw cmdline::option_argument_value_error( F("--%s") % long_name(), raw_value, F("Argument does not have the form '%s'") % arg_name()); const std::string key = raw_value.substr(0, pos); if (key.empty()) throw cmdline::option_argument_value_error( F("--%s") % long_name(), raw_value, "Empty property name"); const std::string value = raw_value.substr(pos + 1); if (value.empty()) throw cmdline::option_argument_value_error( F("--%s") % long_name(), raw_value, "Empty value"); }
void be_visitor_valuetype::gen_obv_init_constructor_args (be_valuetype *node, unsigned long &index) { TAO_OutStream *os = this->ctx_->stream (); AST_Type *parent = node->inherits_concrete (); // Generate for inherited members first. if (parent != 0) { be_valuetype *be_parent = be_valuetype::narrow_from_decl (parent); this->gen_obv_init_constructor_args (be_parent, index); } be_visitor_context ctx (*this->ctx_); be_visitor_args_arglist visitor (&ctx); for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); !si.is_done (); si.next()) { // be_attribute inherits from be_field // so we have to also screen out attributes be_field *f = be_field::narrow_from_decl (si.item ()); be_attribute *attr = be_attribute::narrow_from_decl (si.item ()); if (f == 0 || attr != 0) { continue; } *os << (index++ != 0 ? "," : "") << be_nl; ACE_CString arg_name ("_tao_init_"); arg_name += f->local_name ()->get_string (); Identifier id (arg_name.c_str ()); UTL_ScopedName sn (&id, 0); be_type *ft = be_type::narrow_from_decl (f->field_type ()); bool seen = ft->seen_in_operation (); // This sets ft->seen_in_operation (true), so we have to // restore the original value below. be_argument arg (AST_Argument::dir_IN, ft, &sn); ft->seen_in_operation (seen); if (visitor.visit_argument (&arg) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("be_visitor_valuetype::") ACE_TEXT ("gen_obv_init_constructor_args - ") ACE_TEXT ("codegen for argument failed\n"))); } // AST_Argument inherits from AST_Field, which will destroy // its field type if it is anonymous - we don't want that. arg.be_decl::destroy (); arg.AST_Decl::destroy (); id.destroy (); } }