コード例 #1
0
ファイル: ext_xmlreader.cpp プロジェクト: MatmaRex/hhvm
Variant HHVM_METHOD(XMLReader, __get,
                    const Variant& name) {
  auto* data = Native::data<XMLReader>(this_);
  const xmlChar *retchar = nullptr;
  int retint = 0;

  XMLPropertyAccessor *propertyMap = xmlreader_properties_map.get(name);
  if (!propertyMap) {
    this_->raiseUndefProp(name.getStringData());
    return init_null();
  }

  if (data->m_ptr) {
    if (propertyMap->getter_char) {
      retchar = propertyMap->getter_char(data->m_ptr);
    } else if (propertyMap->getter_int) {
      retint = propertyMap->getter_int(data->m_ptr);
    }
  }

  switch (DataType(propertyMap->return_type)) {
    case KindOfBoolean:
      return retint ? true : false;
    case KindOfInt64:
      return retint;
    case KindOfString:
      if (retchar) {
        return String((char*)retchar, CopyString);
      } else {
        return empty_string_variant();
      }
    case KindOfUninit:
    case KindOfNull:
    case KindOfDouble:
    case KindOfPersistentString:
    case KindOfArray:
    case KindOfPersistentArray:
    case KindOfVec:
    case KindOfPersistentVec:
    case KindOfDict:
    case KindOfPersistentDict:
    case KindOfKeyset:
    case KindOfPersistentKeyset:
    case KindOfObject:
    case KindOfResource:
    case KindOfRef:
      return init_null();

    case KindOfClass:
      break;
  }
  not_reached();
}
コード例 #2
0
ファイル: ext_xmlreader.cpp プロジェクト: Mo-k-tec/hhvm
Variant HHVM_METHOD(XMLReader, __get,
                    Variant name) {
  auto* data = Native::data<XMLReader>(this_);
  const xmlChar *retchar = nullptr;
  int retint = 0;

  XMLPropertyAccessor *propertyMap = xmlreader_properties_map.get(name);
  if (!propertyMap) {
    this_->raiseUndefProp(name.getStringData());
    return init_null();
  }

  if (data->m_ptr) {
    if (propertyMap->getter_char) {
      retchar = propertyMap->getter_char(data->m_ptr);
    } else if (propertyMap->getter_int) {
      retint = propertyMap->getter_int(data->m_ptr);
    }
  }

  switch (propertyMap->return_type) {
    case KindOfString:
      if (retchar) {
        return String((char*)retchar, CopyString);
      } else {
        return empty_string_variant();
      }
    case KindOfBoolean:
      return (retint ? true : false);

    case KindOfInt64:
      return retint;

    default:
      return init_null();
  }
  return init_null();
}
コード例 #3
0
ファイル: ext_xmlreader.cpp プロジェクト: 6api/hhvm
Variant c_XMLReader::t___get(Variant name) {
  const xmlChar *retchar = NULL;
  int retint = 0;

  XMLPropertyAccessor *propertyMap = xmlreader_properties_map.get(name);
  if (!propertyMap) {
    raiseUndefProp(name.getStringData());
    return init_null();
  }

  if (m_ptr) {
    if (propertyMap->getter_char) {
      retchar = propertyMap->getter_char(m_ptr);
    } else if (propertyMap->getter_int) {
      retint = propertyMap->getter_int(m_ptr);
    }
  }

  switch (propertyMap->return_type) {
    case KindOfString:
      if (retchar) {
        return String((char*)retchar, CopyString);
      } else {
        return empty_string_variant();
      }
    case KindOfBoolean:
      return (retint ? true : false);

    case KindOfInt64:
      return retint;

    default:
      return init_null();
  }
  return init_null();
}