All Data Structures Files Functions Variables Typedefs Macros Pages
readosm.h
Go to the documentation of this file.
/*
/ readosm.h
/
/ public declarations
/
/ version 1.0, 2012 April 10
/
/ Author: Sandro Furieri a.furieri@lqt.it
/
/ ------------------------------------------------------------------------------
/
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the ReadOSM library
/
/ The Initial Developer of the Original Code is Alessandro Furieri
/
/ Portions created by the Initial Developer are Copyright (C) 2012
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifdef _WIN32
#ifdef DLL_EXPORT
#define READOSM_DECLARE __declspec(dllexport)
#define READOSM_PRIVATE
#else
#define READOSM_DECLARE extern
#define READOSM_PRIVATE
#endif
#else
#define READOSM_DECLARE __attribute__ ((visibility("default")))
#define READOSM_PRIVATE __attribute__ ((visibility("hidden")))
#endif
#endif
#ifndef _READOSM_H
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define _READOSM_H
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* constants */
#define READOSM_UNDEFINED -1234567890
#define READOSM_MEMBER_NODE 7361
#define READOSM_MEMBER_WAY 6731
#define READOSM_MEMBER_RELATION 3671
/* Error codes */
#define READOSM_OK 0
#define READOSM_INVALID_SUFFIX -1
#define READOSM_FILE_NOT_FOUND -2
#define READOSM_NULL_HANDLE -3
#define READOSM_INVALID_HANDLE -4
#define READOSM_INSUFFICIENT_MEMORY -5
#define READOSM_CREATE_XML_PARSER_ERROR -6
#define READOSM_READ_ERROR -7
#define READOSM_XML_ERROR -8
#define READOSM_INVALID_PBF_HEADER -9
#define READOSM_UNZIP_ERROR -10
#define READOSM_ABORT -11
struct readosm_tag_struct
{
const char *key;
const char *value;
};
typedef struct readosm_tag_struct readosm_tag;
struct readosm_node_struct
{
const long long id;
const double latitude;
const double longitude;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_node_struct readosm_node;
struct readosm_way_struct
{
const long long id;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int node_ref_count;
const long long *node_refs;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_way_struct readosm_way;
struct readosm_member_struct
{
const int member_type;
const long long id;
const char *role;
};
typedef struct readosm_member_struct readosm_member;
struct readosm_relation_struct
{
const long long id;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int member_count;
const readosm_member *members;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_relation_struct readosm_relation;
typedef int (*readosm_node_callback) (const void *user_data,
const readosm_node * node);
typedef int (*readosm_way_callback) (const void *user_data,
const readosm_way * way);
typedef int (*readosm_relation_callback) (const void *user_data,
const readosm_relation *
relation);
READOSM_DECLARE int readosm_open (const char *path,
const void **osm_handle);
READOSM_DECLARE int readosm_close (const void *osm_handle);
READOSM_DECLARE int readosm_parse (const void *osm_handle,
const void *user_data,
readosm_node_callback node_fnct,
readosm_way_callback way_fnct,
readosm_relation_callback relation_fnct);
#ifdef __cplusplus
}
#endif
#endif /* _READOSM_H */