54 auto ret =
fMap.emplace(make_pair(name, move(upget)));
55 if (ret.second ==
false)
57 string(
"Bad args: duplicate name: '") + name +
"'");
75 Tcl_Interp* interp = args.
Interp();
77 if (!args.
GetArg(
"??pname", pname))
return TCL_ERROR;
78 if (!args.
AllDone())
return TCL_ERROR;
81 RtclOPtr rlist(Tcl_NewListObj(0,
nullptr));
82 for (
const auto& kv :
fMap) {
83 RtclOPtr pele(Tcl_NewStringObj(kv.first.c_str(), -1));
84 Tcl_ListObjAppendElement(
nullptr, rlist, pele);
86 Tcl_SetObjResult(interp, rlist);
89 }
else if (pname ==
"*") {
90 RtclOPtr rlist(Tcl_NewListObj(0,
nullptr));
91 for (
const auto& kv :
fMap) {
92 RtclOPtr pele(Tcl_NewStringObj(kv.first.c_str(), -1));
93 Tcl_ListObjAppendElement(
nullptr, rlist, pele);
94 Tcl_ListObjAppendElement(
nullptr, rlist, kv.second->operator()());
96 Tcl_SetObjResult(interp, rlist);
100 auto it =
fMap.lower_bound(pname);
103 if (it ==
fMap.end() || pname != it->first.substr(0,pname.length())) {
104 Tcl_AppendResult(interp,
"-E: unknown property '", pname.c_str(),
105 "': must be ",
nullptr);
106 const char* delim =
"";
107 for (
auto& o:
fMap) {
108 Tcl_AppendResult(interp, delim, o.first.c_str(),
nullptr);
117 if (it1!=
fMap.end() && pname==it1->first.substr(0,pname.length())) {
118 Tcl_AppendResult(interp,
"-E: ambiguous property name '", pname.c_str(),
119 "': must be ",
nullptr);
120 const char* delim =
"";
121 for (it1=it; it1!=
fMap.end() &&
122 pname==it1->first.substr(0,pname.length()); it1++) {
123 Tcl_AppendResult(interp, delim, it1->first.c_str(),
nullptr);
130 args.
SetResult((it->second)->operator()());
bool GetArg(const char *name, Tcl_Obj *&pval)
FIXME_docs.
void SetResult(const std::string &str)
FIXME_docs.
Tcl_Interp * Interp() const
FIXME_docs.
bool AllDone()
FIXME_docs.
virtual ~RtclGetList()
FIXME_docs.
int M_get(RtclArgs &args)
FIXME_docs.
std::unique_ptr< RtclGetBase > get_uptr_t
void Add(const std::string &name, get_uptr_t &&upget)
FIXME_docs.
Implemenation (inline) of RtclOPtr.
Declaration of class ReventLoop.