Esempio n. 1
0
bool
Name::Component::hasPrefix(const uint8_t* prefix, size_t prefixLength) const
{
  NameLite::Component componentLite;
  get(componentLite);
  return componentLite.hasPrefix(prefix, prefixLength) != 0;
}
Esempio n. 2
0
uint64_t
Name::Component::toNumber() const
{
  NameLite::Component componentLite;
  get(componentLite);
  return componentLite.toNumber();
}
Esempio n. 3
0
uint64_t
Name::Component::toNumberWithPrefix(const uint8_t* prefix, size_t prefixLength) const
{
  NameLite::Component componentLite;
  get(componentLite);
  uint64_t result;

  ndn_Error error;
  if ((error = componentLite.toNumberWithPrefix(prefix, prefixLength, result)))
    throw runtime_error(ndn_getErrorString(error));

  return result;
}
Esempio n. 4
0
uint64_t
Name::Component::toNumberWithMarker(uint8_t marker) const
{
  NameLite::Component componentLite;
  get(componentLite);
  uint64_t result;

  ndn_Error error;
  if ((error = componentLite.toNumberWithMarker(marker, result)))
    throw runtime_error(ndn_getErrorString(error));

  return result;
}
Esempio n. 5
0
// Imitate Name::Component::get(NameLite::Component& componentLite).
static void
toNameComponentLite(PyObject* nameComponent, NameLite::Component& componentLite)
{
  if (toBoolByMethod(nameComponent, str.isImplicitSha256Digest))
    componentLite.setImplicitSha256Digest
      (toBlobLiteByMethod(nameComponent, str.getValue));
  else if (toBoolByMethod(nameComponent, str.isParametersSha256Digest))
    componentLite.setParametersSha256Digest
      (toBlobLiteByMethod(nameComponent, str.getValue));
  else
    componentLite = NameLite::Component
      (toBlobLiteByMethod(nameComponent, str.getValue),
       (ndn_NameComponentType)(int)toLongByMethod(nameComponent, str.getType),
        (int)toLongByMethod(nameComponent, str.getOtherTypeCode));
}
Esempio n. 6
0
void
Name::Component::get(NameLite::Component& componentLite) const
{
  if (type_ == ndn_NameComponentType_IMPLICIT_SHA256_DIGEST)
    componentLite.setImplicitSha256Digest(value_);
  else
    componentLite = NameLite::Component(value_);
}
Esempio n. 7
0
// Imitate Name::Component::get(NameLite::Component& componentLite).
static void
toNameComponentLite(PyObject* nameComponent, NameLite::Component& componentLite)
{
  if (toBoolByMethod(nameComponent, str.isImplicitSha256Digest))
    componentLite.setImplicitSha256Digest
      (toBlobLiteByMethod(nameComponent, str.getValue));
  else
    componentLite = NameLite::Component
      (toBlobLiteByMethod(nameComponent, str.getValue));
}