当前位置: 首页>>代码示例>>C++>>正文


C++ JArray::size方法代码示例

本文整理汇总了C++中JArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ JArray::size方法的具体用法?C++ JArray::size怎么用?C++ JArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JArray的用法示例。


在下文中一共展示了JArray::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeDir

void removeDir(JFile dir) {
  int attr = JFile::LA_DIRECTORY | JFile::LA_SORT;
  JArray fa = dir.list(attr, "*.*");
  if (*(JString*)fa[0] == dotdot) fa.del(0);
  int i, sz = fa.size();
  for (i=0; i<sz; i++) {
    JString fn = *(JString*)fa[i];
    JFile tf = JFile(dir, fn(1, fn.length()-1));
    removeDir(tf);
  }
  attr = JFile::LA_FILE | JFile::LA_SORT;
  fa = dir.list(attr, "*.*");
  sz = fa.size();
  for (i=0; i<sz; i++) {
    JFile tf = JFile(dir, *(JString*)fa[i]);
    printf("Delete File %s\n", (char*)tf.getPath());
    tf.remove();
  }
  printf("Remove Directory %s\n", (char*)dir.getPath());
  dir.removeDir();
}
开发者ID:neattools,项目名称:neattools,代码行数:21,代码来源:backup.cpp

示例2: DoGetProperties

void DoGetProperties(const JObject* obj, void** arg) {
  JArray properties = ((JViewObj*)obj)->getProperties();
  JArray &collection = *(JArray*)arg[0];
  JDictionary &dict = *(JDictionary*)arg[1];
  int sz = properties.size();
  for (int i=0; i<sz; i++) {
    JProperty &prop = *(JProperty*)properties[i];
    if (!dict[prop.getName()]) {
      dict.add(prop.getName(), prop);
      collection.append(prop);
    }
  }
}
开发者ID:neattools,项目名称:neattools,代码行数:13,代码来源:JViewSet.cpp

示例3: globalInit

void JavaUpload::globalInit()
{
	if (!JVM::JVMAvailable())
		return;
	
	// locate Java plugins
	try
	{
		JUploadPlugin::registerNatives();

		JClass helper("info.dolezel.fatrat.plugins.helpers.NativeHelpers");
		JClass annotation("info.dolezel.fatrat.plugins.annotations.UploadPluginInfo");
		JClass annConfigDialog("info.dolezel.fatrat.plugins.annotations.ConfigDialog");
		QList<QVariant> args;

		args << "info.dolezel.fatrat.plugins" << annotation.toVariant();

		JArray arr = helper.callStatic("findAnnotatedClasses",
						  JSignature().addString().add("java.lang.Class").retA("java.lang.Class"),
						  args).value<JArray>();
		qDebug() << "Found" << arr.size() << "annotated classes (UploadPluginInfo)";

		int classes = arr.size();
		for (int i = 0; i < classes; i++)
		{
			try
			{
				JClass obj = (jobject) arr.getObject(i);
				JObject ann = obj.getAnnotation(annotation);
				QString name = ann.call("name", JSignature().retString()).toString();
				QString clsName = obj.getClassName();
				JObject instance(obj, JSignature());

				qDebug() << "Class name:" << clsName;
				qDebug() << "Name:" << name;

				JObject cfgDlg = obj.getAnnotation(annConfigDialog);

				JavaEngine e = { "EXT - " + name.toStdString(), clsName.toStdString() };

				if (!cfgDlg.isNull())
					e.configDialog = cfgDlg.call("value", JSignature().retString()).toString();

				if (instance.instanceOf("info.dolezel.fatrat.plugins.extra.URLAcceptableFilter"))
					e.ownAcceptable = instance;
				if (instance.instanceOf("info.dolezel.fatrat.plugins.listeners.ConfigListener"))
					g_configListeners << instance;
				m_engines[clsName] = e;

				qDebug() << "createInstance of " << clsName;

				EngineEntry entry;
				entry.longName = m_engines[clsName].name.c_str();
				entry.shortName = m_engines[clsName].shortName.c_str();
				entry.lpfnAcceptable2 = JavaUpload::acceptable;
				entry.lpfnCreate2 = JavaUpload::createInstance;
				entry.lpfnInit = 0;
				entry.lpfnExit = 0;
				entry.lpfnMultiOptions = 0;

				addTransferClass(entry, Transfer::Upload);
			}
			catch (const RuntimeException& e)
			{
				qDebug() << e.what();
			}
		}
	}
	catch (const RuntimeException& e)
	{
		qDebug() << e.what();
	}
}
开发者ID:LubosD,项目名称:fatrat,代码行数:73,代码来源:JavaUpload.cpp

示例4: globalInit

void JavaExtractor::globalInit()
{
	try {
		JClass helper("info.dolezel.fatrat.plugins.helpers.NativeHelpers");
		JClass annotation("info.dolezel.fatrat.plugins.annotations.ExtractorPluginInfo");

		JExtractorPlugin::registerNatives();

		JArgs args;

		args << "info.dolezel.fatrat.plugins" << annotation.toVariant();

		JArray arr = helper.callStatic("findAnnotatedClasses",
						  JSignature().addString().add("java.lang.Class").retA("java.lang.Class"),
						  args).value<JArray>();
		qDebug() << "Found" << arr.size() << "annotated classes (ExtractorPluginInfo)";

		int classes = arr.size();
		for (int i = 0; i < classes; i++)
		{
			try
			{
				JClass obj = (jobject) arr.getObject(i);
				JObject ann = obj.getAnnotation(annotation);
				QString regexp = ann.call("regexp", JSignature().retString()).toString();
				QString name = ann.call("name", JSignature().retString()).toString();
				QString targetClassName = ann.call("transferClassName", JSignature().retString()).toString();
				QString clsName = obj.getClassName();
				JObject instance(obj, JSignature());

				if (targetClassName.isEmpty())
				{
					JClass cls = JClass(ann.call("transferClass", JSignature().ret("java.lang.Class")).value<JObject>());
					if (!cls.isNull() && cls.getClassName() != "java.lang.Object")
						targetClassName = cls.getClassName();
				}

				qDebug() << "Class name:" << clsName;
				qDebug() << "Name:" << name;
				qDebug() << "Regexp:" << regexp;

				JavaEngine e = { "EXT - " + name.toStdString(), clsName.toStdString(), QRegExp(regexp) };

				if (instance.instanceOf("info.dolezel.fatrat.plugins.extra.URLAcceptableFilter"))
					e.ownAcceptable = instance;
				if (instance.instanceOf("info.dolezel.fatrat.plugins.listeners.ConfigListener"))
					g_configListeners << instance;
				e.targetClass = targetClassName;

				m_engines[clsName] = e;

				EngineEntry entry;
				entry.longName = m_engines[clsName].name.c_str();
				entry.shortName = m_engines[clsName].shortName.c_str();
				entry.lpfnAcceptable2 = JavaExtractor::acceptable;
				entry.lpfnCreate2 = JavaExtractor::createInstance;
				entry.lpfnInit = 0;
				entry.lpfnExit = 0;
				entry.lpfnMultiOptions = 0;

				addTransferClass(entry, Transfer::Download);
			}
			catch (const RuntimeException& e)
			{
				qDebug() << e.what();
			}
		}
	}
	catch (const RuntimeException& e)
	{
		qDebug() << e.what();
	}
}
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:73,代码来源:JavaExtractor.cpp

示例5: recursive

void recursive(JFile from, JFile to) {
  JFile ff, tf;
  JString fn, tn;
  int attr = JFile::LA_DIRECTORY | JFile::LA_SORT;
  JArray fa = from.list(attr, "*.*");
  JArray ta = to.list(attr, "*.*");
  if (*(JString*)fa[0] == dotdot) fa.del(0);
  if (*(JString*)ta[0] == dotdot) ta.del(0);
  int i, sz = fa.size();
  int tsz = ta.size();
  for (i=0; i<sz; i++) {
    fn = *(JString*)fa[i];
    ff = JFile(from, fn(1, fn.length()-1));
    if (i < tsz) {
      tn = *(JString*)ta[i];
      tf = JFile(to, tn(1, tn.length()-1));
    } else tf = JFile(to, "*");
    if ((i >= tsz) || (ff.getName() != tf.getName())) {
      if ((i < tsz) && (ff.getName() > tf.getName())) {
        printf("Remove Extra Directory %s\n", (char*)tf.getPath());
	removeDir(tf);
	ta.del(i);
	tsz--;
	i--;
	continue;
      }
      tf = JFile(to, ff.getName());
      printf("Create Directory %s\n", (char*)tf.getPath());
      tf.makeDir();
      ta.insert(JString("[")+ff.getName()+"]", i);
      tsz++;
    }
    if ((ff.getName() == tf.getName()) && tf.exists()) {
      printf("Check Directory %s\n", (char*)tf.getPath());
      recursive(ff, tf);
    }
  }
  for (; i<tsz; i++) {
    tn = *(JString*)ta[i];
    tf = JFile(to, tn(1, tn.length()-1));
    printf("Remove Extra Directory %s\n", (char*)tf.getPath());
    removeDir(tf);
  }
  attr = JFile::LA_FILE | JFile::LA_SORT;
  fa = from.list(attr, "*.*");
  ta = to.list(attr, "*.*");
  sz = fa.size();
  tsz = ta.size();
  for (i=0; i<sz; i++) {
    ff = JFile(from, *(JString*)fa[i]);
    if (i < tsz) tf = JFile(to, *(JString*)ta[i]);
    else tf = JFile(to, "*");
    if ((i >= tsz) || (ff.getName() != tf.getName())) {
      if ((i < tsz) && (ff.getName() > tf.getName())) {
	printf("Delete Extra File %s\n", (char*)tf.getPath());
	tf.remove();
	ta.del(i);
	tsz--;
	i--;
	continue;
      }
      tf = JFile(to, ff.getName());
      printf("Create File %s\n", (char*)tf.getPath());
      copy(ff, tf);
      ta.insert(ff.getName(), i);
      tsz++;
    }
    if ((ff.getName() == tf.getName()) && tf.exists()) {
      if (ff.lastModified() > tf.lastModified()) {
        printf("Update File %s\n", (char*)tf.getPath());
        copy(ff, tf);
      }
    }
  }
  for (; i<tsz; i++) {
    tf = JFile(to, *(JString*)ta[i]);
    printf("Delete Extra File %s\n", (char*)tf.getPath());
    tf.remove();
  }
}
开发者ID:neattools,项目名称:neattools,代码行数:80,代码来源:backup.cpp


注:本文中的JArray::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。