예제 #1
0
파일: world.go 프로젝트: caervs/golibrdf
//GuessParserName is used to guess the appropriate parser given a URI
func (world *World) GuessParserName(uri *Uri) string {
	var cUriAsString *C.uchar
	if cUriAsString = C.librdf_uri_as_string(uri.librdf_uri); cUriAsString == nil {
		return ""
	}
	defer C.free(unsafe.Pointer(cUriAsString))

	var cParserName *C.char
	if cParserName = C.librdf_parser_guess_name2(world.librdf_world, nil, nil, cUriAsString); cParserName == nil {
		return ""
	}
	defer C.free(unsafe.Pointer(cParserName))

	parserName := C.GoString(cParserName)

	return parserName
}
예제 #2
0
파일: uri.go 프로젝트: caervs/golibrdf
//ToString serializers a URI to string
func (uri Uri) ToString() string {
	cUriString := C.librdf_uri_as_string(uri.librdf_uri)
	defer C.free(unsafe.Pointer(cUriString))

	return C.GoString((*C.char)(unsafe.Pointer(cUriString)))
}