本文整理汇总了C++中JArray::del方法的典型用法代码示例。如果您正苦于以下问题:C++ JArray::del方法的具体用法?C++ JArray::del怎么用?C++ JArray::del使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JArray
的用法示例。
在下文中一共展示了JArray::del方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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();
}
}