int
ACE_Registry_Name_Space::resolve (const ACE_WString &name,
				  ACE_WString &value,
				  char *&type)
{
  // This object will be used to query the size of the data.
  // Note: The query_object.data will be null for this invocation.
  ACE_Registry::Object query_object;
  int result = this->context_.resolve (name.fast_rep (), query_object);
  if (result != 0)
    return result;

  // Resize the value passed by the user
  // Note: -1 is used because the size includes the null terminator
  value.resize ((query_object.size () - 1) / sizeof (ACE_USHORT16));

  // Represent new space as an ACE_Registry::Object
  ACE_Registry::Object object ((void *) value.fast_rep (),
			       query_object.size (),
			       REG_SZ);

  result = this->context_.resolve (name.fast_rep (), object);
  if (object.size () != query_object.size ())
    return -1;
  if (result != 0)
    return result;

  return 0;
}
int
ACE_Registry_Name_Space::rebind (const ACE_WString &name,
				 const ACE_WString &value,
				 const char *type)
{
  // Pointer to data
  const ACE_USHORT16 *data = value.fast_rep ();

  // Size
  u_long size = value.length () * sizeof (ACE_USHORT16);

  // Represent value as an ACE_Registry::Object
  ACE_Registry::Object object ((void *) data,
			       size,
			       REG_SZ);
  // Add new <key>/<value> pair
  return this->context_.rebind (name.fast_rep (),
				object);
}
예제 #3
0
파일: URL_Properties.cpp 프로젝트: CCJY/ACE
size_t
ACE_WString_Helper::encode (void *buf, const ACE_WString &wstr)
{
  ACE_UINT16 *wptr = (ACE_UINT16 *) buf;
  size_t i;

  for (i= 0; i <= wstr.length (); i++)
    wptr[i] = htons (wstr[i]);

  return i * sizeof (ACE_UINT16);
}
int
ACE_Registry_Name_Space::unbind (const ACE_WString &name)
{
  return this->context_.unbind (name.fast_rep ());
}