本文整理汇总了C++中rho::Vector类的典型用法代码示例。如果您正苦于以下问题:C++ Vector类的具体用法?C++ Vector怎么用?C++ Vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG
void CSensorImpl::getProperties(const rho::Vector<rho::String>& arrayofNames, rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "Received request for get properties : " + m_sensorId;
if (NULL == m_rawSensor)
{
oResult.setError("No sensor found. Cannot get properties");
} else
{
rho::Hashtable<rho::String, rho::String> propsHash;
for (rho::Vector<rho::String>::const_iterator namesIterator = arrayofNames.begin(); namesIterator != arrayofNames.end(); namesIterator++)
{
if (_stricmp((*namesIterator).c_str(), "minimumGap") == 0)
{
propsHash.put(*namesIterator, rho::common::convertToStringA<int>(this->m_rawSensor->getMinimumGap()));
} else if (_stricmp((*namesIterator).c_str(), "type") == 0)
{
propsHash.put(*namesIterator, this->m_rawSensor->getType());
} else if (_stricmp((*namesIterator).c_str(), "status") == 0)
{
propsHash.put(*namesIterator, this->m_rawSensor->getStatus());
} else
{
propsHash.put(*namesIterator, "Invalid attribute");
}
}
oResult.set(propsHash);
}
}
示例2: rho_sys_zip_files_with_path_array_ptr
int rho_sys_zip_files_with_path_array_ptr(const char* szZipFilePath, const char *base_path, const rho::Vector<rho::String>& arFiles, const char* psw)
{
ZRESULT res;
HZIP hz = 0;
#if defined(UNICODE) && defined(WIN32) && !defined(OS_WP8)
hz = CreateZip( convertToStringW(szZipFilePath).c_str(), psw);
#else
hz = CreateZip((TCHAR*)szZipFilePath, psw);
#endif
if ( !hz )
return -1;
for ( int i = 0; i < (int)arFiles.size(); i++ )
{
rho::String filePath = arFiles.elementAt(i);
bool isDir = CRhoFile::isDirectory(filePath.c_str());
rho::String zipPath = base_path ? filePath.substr(strlen(base_path)) : filePath;
if ( rho::String_startsWith( zipPath, "/") || rho::String_startsWith( zipPath, "\\") )
zipPath = zipPath.substr(1);
#if defined(UNICODE) && defined(WIN32) && !defined(OS_WP8)
if ( isDir )
res = ZipAddFolder( hz, convertToStringW(zipPath).c_str(), convertToStringW(filePath).c_str() );
else
res = ZipAdd( hz, convertToStringW(zipPath).c_str(), convertToStringW(filePath).c_str() );
#else
if ( isDir )
res = ZipAddFolder( hz, (TCHAR*)zipPath.c_str(), (TCHAR*)filePath.c_str() );
else
res = ZipAdd(hz, (TCHAR*)zipPath.c_str(), (TCHAR*)filePath.c_str() );
#endif
if (res != 0)
LOG(ERROR) + "Zip file failed: " + res + "; " + filePath;
}
res = CloseZip(hz);
return res;
}
示例3: RAWTRACE
jobject rho_cast_helper<jobject, rho::Vector<std::string> >::operator()(JNIEnv* env, const rho::Vector<std::string>& stringVector)
{
RAWTRACE("rho_cast<jobject, HStringVector>");
if (!initConvertor(env)) return 0;
jobject jArray = env->NewObject(clsArrayList, midArrayList);
if(!jArray) return 0;
for(std::vector<std::string>::const_iterator iter = stringVector.begin(); iter != stringVector.end(); ++iter)
{
jhstring jhItem = rho_cast<jstring>(env, *iter);
env->CallBooleanMethod(jArray, midArrayListAdd, jhItem.get());
}
return jArray;
}
示例4: setDestination
virtual void setDestination( const rho::Vector<rho::String>& ar, rho::apiGenerator::CMethodResult& oResult)
{
bool bLogToFile = false, bLogToOutput = false, bLogToURI = false;
for( int i = 0; i < (int)ar.size(); i++ )
{
if ( ar[i] == DEST_FILE )
bLogToFile = true;
else if ( ar[i] == DEST_OUTPUT )
bLogToOutput = true;
else if ( ar[i] == DEST_URI )
bLogToURI = true;
}
LOGCONF().setLogToFile(bLogToFile);
LOGCONF().setLogToOutput(bLogToOutput);
LOGCONF().setLogToSocket(bLogToURI);
}
示例5: getProperties
void CMegamoduleBase::getProperties( const rho::Vector<rho::String>& arrayofNames, CMethodResult& oResult)
{
rho::Hashtable<rho::String, rho::String> res;
oResult.setCollectionMode(true);
for ( int i = 0; i < (int)arrayofNames.size(); i++ )
{
getProperty(arrayofNames[i], oResult);
if ( oResult.isError() )
break;
res[arrayofNames[i]] = oResult.toString();
}
oResult.setCollectionMode(false);
if ( oResult.isError() )
oResult.callCallback();
else
oResult.set(res);
}
示例6: createTabbarEx
void CMainWindow::createTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
if (!rho_rhodesapp_check_mode())
return;
std::auto_ptr<QColor> background_color (NULL);
for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
{
const char *name = (it->first).c_str();
const char *value = (it->second).c_str();
if (strcasecmp(name, "backgroundColor") == 0)
background_color.reset(new QColor(getColorFromString(value)));
}
((QtMainWindow*)qtMainWindow)->tabbarInitialize();
for (int i = 0; i < (int)tabbarElements.size(); ++i)
{
const char *label = NULL;
const char *action = NULL;
const char *icon = NULL;
const char *reload = NULL;
const char *colored_icon = NULL;
std::auto_ptr<QColor> selected_color (NULL);
const char *disabled = NULL;
std::auto_ptr<QColor> web_bkg_color (NULL);
const char* use_current_view_for_tab = NULL;
CJSONEntry oEntry(tabbarElements[i].c_str());
if ( oEntry.hasName("label") )
label = oEntry.getString("label");
if ( oEntry.hasName("action") )
action = oEntry.getString("action");
if ( oEntry.hasName("icon") )
icon = oEntry.getString("icon");
if ( oEntry.hasName("coloredIcon") )
colored_icon = oEntry.getString("coloredIcon");
if ( oEntry.hasName("reload") )
reload = oEntry.getString("reload");
if ( oEntry.hasName("selectedColor") )
selected_color.reset(new QColor(getColorFromString(oEntry.getString("selectedColor"))));
if ( oEntry.hasName("disabled") )
disabled = oEntry.getString("disabled");
if ( oEntry.hasName("useCurrentViewForTab") )
{
use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
if (strcasecmp(use_current_view_for_tab, "true") == 0) {
action = "none";
}
}
if (oEntry.hasName("backgroundColor"))
web_bkg_color.reset(new QColor(getColorFromString(oEntry.getString("backgroundColor"))));
if (label == NULL)
label = "";
if ( label == NULL || action == NULL) {
RAWLOG_ERROR("Illegal argument for create_nativebar");
return;
}
QtMainWindow::QTabBarRuntimeParams tbrp;
tbrp["label"] = QString(label);
tbrp["action"] = QString(action);
tbrp["reload"] = charToBool(reload);
tbrp["use_current_view_for_tab"] = charToBool(use_current_view_for_tab);
tbrp["background_color"] = background_color.get() != NULL ? background_color->name() : QString("");
tbrp["selected_color"] = selected_color.get() != NULL ? selected_color->name() : QString("");
String strIconPath = icon ? CFilePath::join( RHODESAPP().getAppRootPath(), icon) : String();
((QtMainWindow*)qtMainWindow)->tabbarAddTab(QString(label), icon ? strIconPath.c_str() : NULL, charToBool(disabled), web_bkg_color.get(), tbrp);
}
if (oResult.hasCallback())
((QtMainWindow*)qtMainWindow)->tabbarSetSwitchCallback(oResult);
((QtMainWindow*)qtMainWindow)->tabbarShow();
m_started = true;
}
示例7: createToolbarEx
void CMainWindow::createToolbarEx( const rho::Vector<rho::String>& toolbarElements, const rho::Hashtable<rho::String, rho::String>& toolBarProperties)
{
if (!rho_rhodesapp_check_mode())
return;
std::auto_ptr<QColor> m_rgbBackColor (NULL);
std::auto_ptr<QColor> m_rgbMaskColor (NULL);
int m_nHeight = MIN_TOOLBAR_HEIGHT;
for ( Hashtable<rho::String, rho::String>::const_iterator it = toolBarProperties.begin(); it != toolBarProperties.end(); ++it )
{
const char *name = (it->first).c_str();
const char *value = (it->second).c_str();
if (strcasecmp(name, "backgroundColor") == 0)
m_rgbBackColor.reset(new QColor(getColorFromString(value)));
else if (strcasecmp(name, "maskColor") == 0)
m_rgbMaskColor.reset(new QColor(getColorFromString(value)));
else if (strcasecmp(name, "viewHeight") == 0)
m_nHeight = atoi(value);
}
if ( toolbarElements.size() == 0 )
{
removeToolbar();
return;
}
removeAllButtons();
int nSeparators = 0;
bool wasSeparator = false;
for (int ipass=0; ipass < 2; ++ipass)
{
for (int i = 0; i < (int)toolbarElements.size(); ++i)
{
const char *label = NULL;
const char *action = NULL;
const char *icon = NULL;
const char *colored_icon = NULL;
int nItemWidth = 0;
CJSONEntry oEntry(toolbarElements[i].c_str());
if ( oEntry.hasName("label") )
label = oEntry.getString("label");
if ( oEntry.hasName("action") )
action = oEntry.getString("action");
if ( oEntry.hasName("icon") )
icon = oEntry.getString("icon");
if ( oEntry.hasName("coloredIcon") )
colored_icon = oEntry.getString("coloredIcon");
if ( oEntry.hasName("width") )
nItemWidth = oEntry.getInt("width");
if (label == NULL)
label = "";
if ( label == NULL || action == NULL) {
LOG(ERROR) + "Illegal argument for create_nativebar";
return;
}
if ( strcasecmp(action, "forward") == 0 && rho_conf_getBool("jqtouch_mode") )
continue;
if (!action) action = "";
if (ipass==0) {
if (strcasecmp(action, "separator")==0)
++nSeparators;
} else {
LOG(INFO) + "addToolbarButton: Label: '"+label+"';Action: '"+action+"'";
if (strcasecmp(action, "separator")==0) {
if (nSeparators!=1)
((QtMainWindow*)qtMainWindow)->toolbarAddSeparator(nItemWidth);
else
wasSeparator = true;
} else {
String strImagePath;
if ( icon && *icon )
{
#ifndef RHODES_EMULATOR
strImagePath = rho::common::CFilePath::join( RHODESAPP().getRhoRootPath(), "/apps" );
strImagePath = rho::common::CFilePath::join( strImagePath, icon );
#else
strImagePath = rho::common::CFilePath::join( RHODESAPP().getRhoRootPath(), icon );
#endif
} else {
#if defined(RHODES_EMULATOR)
#define RHODES_EMULATOR_PLATFORM_STR ".win32"
#elif defined(RHO_SYMBIAN)
#define RHODES_EMULATOR_PLATFORM_STR ".sym"
#else
#define RHODES_EMULATOR_PLATFORM_STR
#endif
if ( strcasecmp(action, "options")==0 )
strImagePath = "res/options_btn" RHODES_EMULATOR_PLATFORM_STR ".png";
else if ( strcasecmp(action, "home")==0 )
strImagePath = "res/home_btn" RHODES_EMULATOR_PLATFORM_STR ".png";
else if ( strcasecmp(action, "refresh")==0 )
//.........这里部分代码省略.........
示例8: CreateTabbarEx
void CNativeTabbar::CreateTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
if (!rho_rhodesapp_check_mode() )
return;
RemoveTabbar();
COLORREF rgbBackColor;
bool bHiddenTabs = false, bCreateOnInit = false;
for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
{
const char *name = (it->first).c_str();
const char *value = (it->second).c_str();
if (strcasecmp(name, "backgroundColor") == 0)
rgbBackColor = getColorFromString(value);
if (strcasecmp(name, "hiddenTabs") == 0)
bHiddenTabs = strcasecmp(value, "true") == 0;
if (strcasecmp(name, "createOnInit") == 0)
bCreateOnInit = strcasecmp(value, "true") == 0;
}
if ( !bHiddenTabs )
{
LOG(WARNING) + "Illegal argument for create_nativebar: hiddenTabs should be true for Windows Mobile and Windows CE.";
bHiddenTabs = true;
}
int nStartTab = -1;
for (int i = 0; i < (int)tabbarElements.size(); ++i)
{
const char *label = NULL;
const char *action = NULL;
const char *icon = NULL;
const char *reload = NULL;
const char *colored_icon = NULL;
COLORREF selected_color;
const char *disabled = NULL;
COLORREF web_bkg_color;
const char* use_current_view_for_tab = NULL;
bool bUseCurrentViewForTab = false, bReloadPage = false, bPerishable = false, bCreateOnInitTab = false;
CJSONEntry oEntry(tabbarElements[i].c_str());
if ( oEntry.hasName("label") )
label = oEntry.getString("label");
if ( oEntry.hasName("action") )
action = oEntry.getString("action");
if ( oEntry.hasName("icon") )
icon = oEntry.getString("icon");
if ( oEntry.hasName("coloredIcon") )
colored_icon = oEntry.getString("coloredIcon");
if ( oEntry.hasName("reload") )
{
reload = oEntry.getString("reload");
if (strcasecmp(reload, "true") == 0)
bReloadPage = true;
}
if ( oEntry.hasName("perishable") )
{
const char* perishable = oEntry.getString("perishable");
if (strcasecmp(perishable, "true") == 0)
bPerishable = true;
}
if ( oEntry.hasName("createOnInit") )
{
const char* createOnInit = oEntry.getString("createOnInit");
if (strcasecmp(createOnInit, "true") == 0)
bCreateOnInitTab = true;
}
if ( oEntry.hasName("selectedColor") )
selected_color = getColorFromString(oEntry.getString("selectedColor"));
if ( oEntry.hasName("disabled") )
disabled = oEntry.getString("disabled");
if ( oEntry.hasName("useCurrentViewForTab") )
{
use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
if (strcasecmp(use_current_view_for_tab, "true") == 0)
bUseCurrentViewForTab = true;
}
if (oEntry.hasName("backgroundColor"))
web_bkg_color = getColorFromString(oEntry.getString("backgroundColor"));
if (label == NULL)
label = "";
if (action == NULL)
action = "";
m_arTabs.addElement(CTabBarItem(action, label, bUseCurrentViewForTab, bReloadPage, bPerishable, bCreateOnInitTab));
if (m_strStartTabName.length()>0 && m_strStartTabName == label)
nStartTab = i;
}
if ( oResult.hasCallback() )
m_oCallback = oResult;
//.........这里部分代码省略.........
示例9: writeData
virtual void writeData( const rho::Vector<rho::String>& data, rho::apiGenerator::CMethodResult& oResult) {
for(int i = 0; i < data.size(); i++){
BluetoothThread::getInstance()->sendMessage(connected_device_name, QString::fromStdString(data.elementAt(i)));
}
}