Beispiel #1
0
CPDF_FormField* CFieldTree::RemoveField(const CFX_WideString& full_name) {
  if (full_name == L"") {
    return NULL;
  }
  CFieldNameExtractor name_extractor(full_name);
  const FX_WCHAR* pName;
  FX_STRSIZE nLength;
  name_extractor.GetNext(pName, nLength);
  _Node *pNode = &m_Root, *pLast = NULL;
  while (nLength > 0 && pNode) {
    pLast = pNode;
    CFX_WideString name = CFX_WideString(pName, nLength);
    pNode = _Lookup(pLast, name);
    name_extractor.GetNext(pName, nLength);
  }
  if (pNode && pNode != &m_Root) {
    CFX_PtrArray& ptr_array = pLast->children;
    for (int i = 0; i < ptr_array.GetSize(); i++) {
      if (pNode == (_Node*)ptr_array[i]) {
        ptr_array.RemoveAt(i);
        break;
      }
    }
    CPDF_FormField* pField = pNode->field_ptr;
    RemoveNode(pNode);
    return pField;
  }
  return NULL;
}
Beispiel #2
0
CDDBDaemon::CDDBDaemon()
	: BApplication("application/x-vnd.Haiku-cddb_daemon"),
	  fVolumeRoster(new BVolumeRoster)
{
	fVolumeRoster->StartWatching();
	
	BVolume volume;
	printf("Checking currently mounted volumes ...\n");
	while (fVolumeRoster->GetNextVolume(&volume) == B_OK) {
		if (_Lookup(volume.Device()) != B_OK) {
			continue;
		}
	}
	printf("Checking complete. Listening for device mounts.\n");
}
Beispiel #3
0
CFieldTree::_Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
  if (full_name == L"") {
    return NULL;
  }
  CFieldNameExtractor name_extractor(full_name);
  const FX_WCHAR* pName;
  FX_STRSIZE nLength;
  name_extractor.GetNext(pName, nLength);
  _Node *pNode = &m_Root, *pLast = NULL;
  while (nLength > 0 && pNode) {
    pLast = pNode;
    CFX_WideString name = CFX_WideString(pName, nLength);
    pNode = _Lookup(pLast, name);
    name_extractor.GetNext(pName, nLength);
  }
  return pNode;
}
Beispiel #4
0
void
CDDBDaemon::MessageReceived(BMessage* message)
{
	switch(message->what) {
		case B_NODE_MONITOR:
			int32 opcode;
			if (message->FindInt32("opcode", &opcode) == B_OK) {
				if (opcode == B_DEVICE_MOUNTED) {
					dev_t device;
					if (message->FindInt32("new device", &device) == B_OK) {
						if (_Lookup(device) != B_OK)
							break;
					}
				}		
			}
			break;
		default:
			BApplication::MessageReceived(message);
	}
}
Beispiel #5
0
void CFieldTree::SetField(const CFX_WideString& full_name,
                          CPDF_FormField* field_ptr) {
  if (full_name == L"") {
    return;
  }
  CFieldNameExtractor name_extractor(full_name);
  const FX_WCHAR* pName;
  FX_STRSIZE nLength;
  name_extractor.GetNext(pName, nLength);
  _Node *pNode = &m_Root, *pLast = NULL;
  while (nLength > 0) {
    pLast = pNode;
    CFX_WideString name = CFX_WideString(pName, nLength);
    pNode = _Lookup(pLast, name);
    if (pNode == NULL) {
      pNode = AddChild(pLast, name, NULL);
    }
    name_extractor.GetNext(pName, nLength);
  }
  if (pNode != &m_Root) {
    pNode->field_ptr = field_ptr;
  }
}