Line 1... |
Line 1... |
// $Id: RtclGetList.cpp 516 2013-05-05 21:24:52Z mueller $
|
// $Id: RtclGetList.cpp 584 2014-08-22 19:38:12Z mueller $
|
//
|
//
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2013-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation, either version 2, or at your option any later version.
|
// Software Foundation, either version 2, or at your option any later version.
|
//
|
//
|
Line 11... |
Line 11... |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for complete details.
|
// for complete details.
|
//
|
//
|
// Revision History:
|
// Revision History:
|
// Date Rev Version Comment
|
// Date Rev Version Comment
|
|
// 2014-08-22 584 1.0.1 use nullptr
|
// 2013-02-12 487 1.0 Initial version
|
// 2013-02-12 487 1.0 Initial version
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RtclGetList.cpp 516 2013-05-05 21:24:52Z mueller $
|
\version $Id: RtclGetList.cpp 584 2014-08-22 19:38:12Z mueller $
|
\brief Implemenation of class RtclGetList.
|
\brief Implemenation of class RtclGetList.
|
*/
|
*/
|
|
|
#include <iostream>
|
#include <iostream>
|
|
|
Line 81... |
Line 82... |
map_cit_t it = fMap.lower_bound(pname);
|
map_cit_t it = fMap.lower_bound(pname);
|
|
|
// complain if not found
|
// complain if not found
|
if (it == fMap.end() || pname != it->first.substr(0,pname.length())) {
|
if (it == fMap.end() || pname != it->first.substr(0,pname.length())) {
|
Tcl_AppendResult(interp, "-E: unknown property '", pname.c_str(),
|
Tcl_AppendResult(interp, "-E: unknown property '", pname.c_str(),
|
"': must be ", NULL);
|
"': must be ", nullptr);
|
const char* delim = "";
|
const char* delim = "";
|
for (map_cit_t it1=fMap.begin(); it1!=fMap.end(); it1++) {
|
for (map_cit_t it1=fMap.begin(); it1!=fMap.end(); it1++) {
|
Tcl_AppendResult(interp, delim, it1->first.c_str(), NULL);
|
Tcl_AppendResult(interp, delim, it1->first.c_str(), nullptr);
|
delim = ",";
|
delim = ",";
|
}
|
}
|
return TCL_ERROR;
|
return TCL_ERROR;
|
}
|
}
|
|
|
// check for ambiguous substring match
|
// check for ambiguous substring match
|
map_cit_t it1 = it;
|
map_cit_t it1 = it;
|
it1++;
|
it1++;
|
if (it1!=fMap.end() && pname==it1->first.substr(0,pname.length())) {
|
if (it1!=fMap.end() && pname==it1->first.substr(0,pname.length())) {
|
Tcl_AppendResult(interp, "-E: ambiguous property name '", pname.c_str(),
|
Tcl_AppendResult(interp, "-E: ambiguous property name '", pname.c_str(),
|
"': must be ", NULL);
|
"': must be ", nullptr);
|
const char* delim = "";
|
const char* delim = "";
|
for (it1=it; it1!=fMap.end() &&
|
for (it1=it; it1!=fMap.end() &&
|
pname==it1->first.substr(0,pname.length()); it1++) {
|
pname==it1->first.substr(0,pname.length()); it1++) {
|
Tcl_AppendResult(interp, delim, it1->first.c_str(), NULL);
|
Tcl_AppendResult(interp, delim, it1->first.c_str(), nullptr);
|
delim = ",";
|
delim = ",";
|
}
|
}
|
|
|
return TCL_ERROR;
|
return TCL_ERROR;
|
}
|
}
|