本文整理汇总了C++中Searchable类的典型用法代码示例。如果您正苦于以下问题:C++ Searchable类的具体用法?C++ Searchable怎么用?C++ Searchable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Searchable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAvailableSearchable
void FindReplace::SetUpFindText()
{
Searchable* searchable = GetAvailableSearchable();
if ( searchable )
{
QString selected_text = searchable->GetSelectedText();
if ( !selected_text.isEmpty() )
{
if ( m_RegexOptionAutoTokenise && GetSearchMode() == FindReplace::SearchMode_Regex ) {
selected_text = TokeniseForRegex( selected_text, false );
}
// We want to make the text selected in the editor
// as the default search text, but only if it's not "too long"
if ( selected_text.length() < MAXIMUM_SELECTED_TEXT_LIMIT ) {
ui.cbFind->setEditText( selected_text );
}
}
}
// Find text should be selected by default
ui.cbFind->lineEdit()->selectAll();
SetFocus();
}
示例2: yError
bool realsense2Driver::open(Searchable& config)
{
std::vector<RGBDSensorParamParser::RGBDParam*> params;
for (auto& p:params_map)
{
params.push_back(&(p.second));
}
m_verbose = config.check("verbose");
if (config.check("stereoMode")) {
m_stereoMode = config.find("stereoMode").asBool();
}
if (!m_paramParser->parseParam(config, params))
{
yError()<<"realsense2Driver: failed to parse the parameters";
return false;
}
if (!initializeRealsenseDevice())
{
yError()<<"realsense2Driver: failed to initialize the realsense device";
return false;
}
// setting Parameters
if (!setParams())
{
return false;
}
return true;
}
示例3: openAndAttachSubDevice
bool JoypadControlServer::openAndAttachSubDevice(Searchable& prop)
{
Property p;
m_subDeviceOwned = new PolyDriver;
p.fromString(prop.toString().c_str());
p.setMonitor(prop.getMonitor(), "subdevice"); // pass on any monitoring
p.unput("device");
p.put("device",prop.find("subdevice").asString()); // subdevice was already checked before
// if error occour during open, quit here.
m_subDeviceOwned->open(p);
if (!m_subDeviceOwned->isValid())
{
yError("JoypadControlServer: opening subdevice... FAILED\n");
return false;
}
m_isSubdeviceOwned = true;
if(!attach(m_subDeviceOwned))
return false;
if(!m_parser.configure(m_device) )
{
yError() << "JoypadControlServer: error configuring interfaces for parsers";
return false;
}
openPorts();
PeriodicThread::setPeriod(m_period);
return PeriodicThread::start();
}
示例4: open
bool open(Searchable& p) {
bool dev = true;
if (p.check("nodevice")) {
dev = false;
}
if (dev) {
poly.open(p);
if (!poly.isValid()) {
printf("cannot open driver\n");
return false;
}
if (!p.check("mute")) {
// Make sure we can write sound
poly.view(put);
if (put==NULL) {
printf("cannot open interface\n");
return false;
}
}
}
port.setStrict(true);
if (!port.open(p.check("name",Value("/yarphear")).asString())) {
printf("Communication problem\n");
return false;
}
if (p.check("remote")) {
Network::connect(p.check("remote",Value("/remote")).asString(),
port.getName());
}
return true;
}
示例5: openAndAttachSubDevice
bool RGBDSensorWrapper::openAndAttachSubDevice(Searchable& prop)
{
Property p;
subDeviceOwned = new PolyDriver;
p.fromString(prop.toString().c_str());
p.setMonitor(prop.getMonitor(), "subdevice"); // pass on any monitoring
p.unput("device");
p.put("device",prop.find("subdevice").asString()); // subdevice was already checked before
// if error occour during open, quit here.
yDebug("opening IRGBDSensor subdevice\n");
subDeviceOwned->open(p);
if (!subDeviceOwned->isValid())
{
yError("opening controlBoardWrapper2 subdevice... FAILED\n");
return false;
}
isSubdeviceOwned = true;
if(!attach(subDeviceOwned))
return false;
RateThread::setRate(rate);
RateThread::start();
return true;
}
示例6: open
bool fakeMotorDeviceClient::open(Searchable &config)
{
printf("Opening Fake Motor Device Client ...\n");
string remote=config.check("remote",Value("/fakeyServer")).asString().c_str();
string local=config.check("local",Value("/fakeyClient")).asString().c_str();
statePort.open((local+"/state:i").c_str());
cmdPort.open((local+"/cmd:o").c_str());
rpcPort.open((local+"/rpc").c_str());
bool ok=true;
ok&=Network::connect((remote+"/state:o").c_str(),statePort.getName().c_str(),"udp");
ok&=Network::connect(cmdPort.getName().c_str(),(remote+"/cmd:i").c_str(),"udp");
ok&=Network::connect(rpcPort.getName().c_str(),(remote+"/rpc").c_str(),"tcp");
if (ok)
{
configured=true;
printf("Fake Motor Device Client successfully open\n");
return true;
}
else
{
statePort.close();
cmdPort.close();
rpcPort.close();
printf("Fake Motor Device Client failed to open\n");
return false;
}
}
示例7: byConfig
Contact Contact::byConfig(Searchable& config) {
Contact result;
result.port = config.check("port_number",Value(-1)).asInt();
result.hostName = config.check("ip",Value("")).asString().c_str();
result.regName = config.check("name",Value("")).asString().c_str();
result.carrier = config.check("carrier",Value("tcp")).asString().c_str();
return result;
}
示例8:
ResourceFinder::ResourceFinder(Searchable& data, void *implementation) {
this->implementation = implementation;
if (!data.isNull()) {
config.fromString(data.toString());
}
nullConfig = data.isNull();
owned = false;
isConfiguredFlag = true;
}
示例9: fromConfig
Contact Contact::fromConfig(const Searchable& config)
{
Contact result;
result.mPriv->port = config.check("port_number",Value(-1)).asInt();
result.mPriv->hostname = config.check("ip",Value("")).asString().c_str();
result.mPriv->regName = config.check("name",Value("")).asString().c_str();
result.mPriv->carrier = config.check("carrier",Value("tcp")).asString().c_str();
return result;
}
示例10: GetValueFromConfig
Value ReachManager::GetValueFromConfig(Searchable& config, string valueName)
{
if(!config.check(valueName.c_str()))
{
cout << "ERROR with config file : couldn't find value : \"" << valueName << "\"." << endl;
return false;
}
return config.find(valueName.c_str());
}
示例11: open
bool TextureInput::open(Searchable& config) {
textureIndex = config.check("textureIndex",Value(-1),
"texture index").asInt();
string texturePort = config.check("port",Value("/texture"),"local port name").asString();
string portStr = this->moduleName + texturePort.c_str();
port.open( portStr.c_str() );
return true;
}
示例12: checkForCarrier
static bool checkForCarrier(const Bytes *header, Searchable& group) {
Bottle code = group.findGroup("code").tail();
if (code.size()==0) return false;
if (matchCarrier(header,code)) {
ConstString name = group.find("name").asString();
if (NetworkBase::registerCarrier(name.c_str(),NULL)) {
return true;
}
}
return false;
}
示例13: clearMessage
// Replaces the user's search term with the user's
// replacement text in the entire document.
int FindReplace::ReplaceAll()
{
m_MainWindow.GetCurrentContentTab().SaveTabContent();
clearMessage();
if ( !IsValidFindText() )
{
return 0;
}
SetCodeViewIfNeeded( true );
int count = 0;
if ( GetLookWhere() == FindReplace::LookWhere_CurrentFile || m_LookWhereCurrentFile)
{
Searchable *searchable = GetAvailableSearchable();
if ( !searchable )
{
return 0;
}
count = searchable->ReplaceAll( GetSearchRegex(), ui.cbReplace->lineEdit()->text() );
}
else
{
count = ReplaceInAllFiles();
}
if ( count == 0 )
{
ShowMessage( tr( "No replacements made" ) );
}
else
{
QString message = tr( "%1 replacements made", 0, count );
ShowMessage( message.arg( count ) );
}
if ( count > 0 )
{
// Signal that the contents have changed and update the view
m_MainWindow.GetCurrentBook()->SetModified( true );
m_MainWindow.GetCurrentContentTab().ContentChangedExternally();
}
UpdatePreviousFindStrings();
UpdatePreviousReplaceStrings();
return count;
}
示例14: openAndAttachSubDevice
bool RGBDSensorWrapper::openAndAttachSubDevice(Searchable& prop)
{
Property p;
subDeviceOwned = new PolyDriver;
p.fromString(prop.toString().c_str());
p.setMonitor(prop.getMonitor(), "subdevice"); // pass on any monitoring
p.unput("device");
p.put("device",prop.find("subdevice").asString()); // subdevice was already checked before
// if error occour during open, quit here.
yDebug("opening IRGBDSensor subdevice\n");
subDeviceOwned->open(p);
if (!subDeviceOwned->isValid())
{
yError("opening controlBoardWrapper2 subdevice... FAILED\n");
return false;
}
isSubdeviceOwned = true;
if(!attach(subDeviceOwned))
return false;
// Configuring parsers
IRgbVisualParams * rgbVis_p;
IDepthVisualParams * depthVis_p;
subDeviceOwned->view(rgbVis_p);
subDeviceOwned->view(depthVis_p);
if(!parser.configure(sensor_p) )
{
yError() << "RGBD wrapper: error configuring interfaces for parsers";
return false;
}
/*
bool conf = rgbParser.configure(rgbVis_p);
conf &= depthParser.configure(depthVis_p);
if(!conf)
{
yError() << "RGBD wrapper: error configuring interfaces for parsers";
return false;
}
*/
RateThread::setRate(rate);
RateThread::start();
return true;
}
示例15: open
bool HapticDeviceWrapper::open(Searchable &config)
{
portStemName=config.check("name",
Value(HAPTICDEVICE_WRAPPER_DEFAULT_NAME)).asString().c_str();
verbosity=config.check("verbosity",Value(0)).asInt();
int period=config.check("period",
Value(HAPTICDEVICE_WRAPPER_DEFAULT_PERIOD)).asInt();
setRate(period);
if (config.check("subdevice"))
{
Property p(config.toString().c_str());
p.setMonitor(config.getMonitor(),"subdevice");
p.unput("device");
p.put("device",config.find("subdevice").asString());
if (driver.open(p))
{
IHapticDevice *d;
driver.view(d);
attach(d);
}
else
{
yError("*** Haptic Device Wrapper: failed to open the driver!");
return false;
}
}
if (verbosity>0)
yInfo("*** Haptic Device Wrapper: opened");
return true;
}