void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter)
{
	LLLocationHistory::location_list_t filtered_items;
	const LLLocationHistory::location_list_t* itemsp = NULL;
	LLLocationHistory* lh = LLLocationHistory::getInstance();
	
	if (filter.empty())
	{
		itemsp = &lh->getItems();
	}
	else
	{
		lh->getMatchingItems(filter, filtered_items);
		itemsp = &filtered_items;
	}
	
	removeall();
	for (LLLocationHistory::location_list_t::const_reverse_iterator it = itemsp->rbegin(); it != itemsp->rend(); it++)
	{
		LLSD value;
		value["tooltip"] = it->getToolTip();
		//location history can contain only typed locations
		value["item_type"] = TYPED_REGION_SLURL;
		value["global_pos"] = it->mGlobalPos.getValue();
		add(it->getLocation(), value);
	}
}
Example #2
0
void
removeall(char *p)
{
	DIR *d;
	struct dirent *dp;
	char *q;
	struct stat st;

	if(stat(p, &st) < 0)
		return;
	if(!S_ISDIR(st.st_mode)) {
		unlink(p);
		return;
	}

	d = opendir(p);
	while((dp = readdir(d)) != nil) {
		if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
			continue;
		q = smprint("%s/%s", p, dp->d_name);
		removeall(q);
		free(q);
	}
	closedir(d);
	rmdir(p);
}
Example #3
0
void
removeall(char *p)
{
	int fd, n, i;
	Dir *d;
	char *q;
	
	if(remove(p) >= 0)
		return;
	if((d = dirstat(p)) == nil)
		return;
	if(!(d->mode & DMDIR)) {
		free(d);
		return;
	}
	free(d);
	
	if((fd = open(p, OREAD)) < 0)
		return;
	n = dirreadall(fd, &d);
	close(fd);
	for(i=0; i<n; i++) {
		q = smprint("%s/%s", p, d[i].name);
		removeall(q);
		free(q);
	}
	free(d);
}
Example #4
0
/*
 * Terminates the testing environment
 */
static void
vfstest_term(void)
{
        if (0 != removeall(root_dir)) {
                fprintf(stderr, "ERROR: could not remove testing root %s: %s\n", root_dir, strerror(errno));
                exit(-1);
        }
        printf("Removed test root directory: ./%s\n", root_dir);
}
Example #5
0
static int
removeall(const char *dir)
{
        int ret, fd = -1;
        dirent_t dirent;
        struct stat status;

        if (0 > chdir(dir)) {
                goto error;
        }

        ret = 1;
        while (ret != 0) {
                if (0 > (ret = getdent(".", &dirent))) {
                        goto error;
                }
                if (0 == ret) {
                        break;
                }

                if (0 > stat(dirent.d_name, &status)) {
                        goto error;
                }

                if (S_ISDIR(status.st_mode)) {
                        if (0 > removeall(dirent.d_name)) {
                                goto error;
                        }
                } else {
                        if (0 > unlink(dirent.d_name)) {
                                goto error;
                        }
                }
        }

        if (0 > chdir("..")) {
                return errno;
        }

        if (0 > rmdir(dir)) {
                return errno;
        }

        close(fd);
        return 0;

error:
        if (0 <= fd) {
                close(fd);
        }

        return errno;
}
int doall(int except_flag)
{
	itemcount = 0;
	try {
		// before and after the run, removing any
		// old environment/database.
		//
		removeall();
		t1(except_flag);
		t2(except_flag);
		t3(except_flag);
		t4(except_flag);
		t5(except_flag);
		t6(except_flag);

		removeall();
		return 0;
	}
	catch (DbException &dbe) {
		ERR2("EXCEPTION RECEIVED", dbe.what());
	}
	return 1;
}
Example #7
0
void
removeall(char *p)
{
	WinRune *r, *r1;
	DWORD attr;
	char *q, *qt, *elem;
	HANDLE h;
	WIN32_FIND_DATAW data;
	
	r = torune(p);
	attr = GetFileAttributesW(r);
	if(attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY)) {
		DeleteFileW(r);
		free(r);
		return;
	}

	q = smprint("%s\\*", p);
	r1 = torune(q);
	free(q);
	h = FindFirstFileW(r1, &data);
	if(h == INVALID_HANDLE_VALUE)
		goto done;
	do{
		q = toutf(data.cFileName);
		elem = strrchr(q, '\\');
		if(elem != nil)
			elem++;
		else
			elem = q;
		if(strcmp(elem, ".") == 0 || strcmp(elem, "..") == 0) {
			free(q);
			continue;
		}
		qt = smprint("%s\\%s", p, q);
		free(q);
		removeall(qt);
		free(qt);
	}while(FindNextFileW(h, &data));
	FindClose(h);

done:
	free(r1);
	RemoveDirectoryW(r);
	free(r);
}
Example #8
0
void LLSearchComboBox::clearHistory()
{
	removeall();
	setTextEntry(LLStringUtil::null);
}
Example #9
0
LinkedList::~LinkedList()
{
	removeall();
}
Example #10
0
static void
rmtemp(void)
{
	removeall(tmpdir);
}
 void clear()  // Clear list
 { 
     removeall(); 
     init(); 
 }
 ˜LList() // Destructor 
 { 
     removeall(); 
 }