diff --git a/.gitignore b/.gitignore
index c486fd317..ec4575b6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,9 +14,12 @@ config.py
.sconsign.dblite
demo/viewer/viewer.ini
tests/cpp_tests/font_registration_test
+tests/python_tests/raster_colorizer_test.png
+tests/python_tests/raster_colorizer_test_save.xml
utils/mapnik-config/mapnik-config
utils/mapnik-config/mapnik2.pc
utils/shapeindex/shapeindex
+utils/pgsql2sqlite/pgsql2sqlite
utils/svg2png/svg2png
demo/python/demo*
demo/python/map.xml
\ No newline at end of file
diff --git a/AUTHORS.md b/AUTHORS.md
index 5a9f9935c..95563bce7 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,4 +1,4 @@
-## Mapnik Contibutors
+## Mapnik Contributors
Mapnik is written by Artem Pavlenko with contributions from:
diff --git a/SConstruct b/SConstruct
index b72940702..7200544d1 100644
--- a/SConstruct
+++ b/SConstruct
@@ -382,7 +382,7 @@ opts.AddVariables(
BoolVariable('FULL_LIB_PATH', 'Use the full path for the libmapnik.dylib "install_name" when linking on Mac OS X', 'True'),
ListVariable('BINDINGS','Language bindings to build','all',['python']),
EnumVariable('THREADING','Set threading support','multi', ['multi','single']),
- EnumVariable('XMLPARSER','Set xml parser ','libxml2', ['tinyxml','spirit','libxml2']),
+ EnumVariable('XMLPARSER','Set xml parser','libxml2', ['libxml2','ptree']),
('JOBS', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int),
BoolVariable('DEMO', 'Compile demo c++ application', 'False'),
BoolVariable('PGSQL2SQLITE', 'Compile and install a utility to convert postgres tables to sqlite', 'False'),
@@ -1073,7 +1073,6 @@ if not preconfigured:
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
-
conf.parse_config('FREETYPE_CONFIG')
# check if freetype links to bz2
@@ -1084,12 +1083,10 @@ if not preconfigured:
if 'bz2' in temp_env['LIBS']:
env['EXTRA_FREETYPE_LIBS'].append('bz2')
- if env['XMLPARSER'] == 'tinyxml':
- env['CPPPATH'].append('#tinyxml')
- env.Append(CXXFLAGS = '-DBOOST_PROPERTY_TREE_XML_PARSER_TINYXML -DTIXML_USE_STL')
- elif env['XMLPARSER'] == 'libxml2':
- if conf.parse_config('XML2_CONFIG'):
- env['HAS_LIBXML2'] = True
+ # libxml2 should be optional but is currently not
+ # https://github.com/mapnik/mapnik/issues/913
+ if conf.parse_config('XML2_CONFIG'):
+ env['HAS_LIBXML2'] = True
LIBSHEADERS = [
['m', 'math.h', True,'C'],
@@ -1253,8 +1250,8 @@ if not preconfigured:
# we link locally
if env['INTERNAL_LIBAGG']:
- env.Prepend(CPPPATH = '#agg/include')
- env.Prepend(LIBPATH = '#agg')
+ env.Prepend(CPPPATH = '#deps/agg/include')
+ env.Prepend(LIBPATH = '#deps/agg')
else:
env.ParseConfig('pkg-config --libs --cflags libagg')
@@ -1597,7 +1594,7 @@ if not HELP_REQUESTED:
# Build agg first, doesn't need anything special
if env['RUNTIME_LINK'] == 'shared' and env['INTERNAL_LIBAGG']:
- SConscript('agg/build.py')
+ SConscript('deps/agg/build.py')
# Build the core library
SConscript('src/build.py')
diff --git a/agg/build.py b/deps/agg/build.py
similarity index 100%
rename from agg/build.py
rename to deps/agg/build.py
diff --git a/agg/copying b/deps/agg/copying
similarity index 100%
rename from agg/copying
rename to deps/agg/copying
diff --git a/agg/include/agg_alpha_mask_u8.h b/deps/agg/include/agg_alpha_mask_u8.h
similarity index 100%
rename from agg/include/agg_alpha_mask_u8.h
rename to deps/agg/include/agg_alpha_mask_u8.h
diff --git a/agg/include/agg_arc.h b/deps/agg/include/agg_arc.h
similarity index 100%
rename from agg/include/agg_arc.h
rename to deps/agg/include/agg_arc.h
diff --git a/agg/include/agg_array.h b/deps/agg/include/agg_array.h
similarity index 100%
rename from agg/include/agg_array.h
rename to deps/agg/include/agg_array.h
diff --git a/agg/include/agg_arrowhead.h b/deps/agg/include/agg_arrowhead.h
similarity index 100%
rename from agg/include/agg_arrowhead.h
rename to deps/agg/include/agg_arrowhead.h
diff --git a/agg/include/agg_basics.h b/deps/agg/include/agg_basics.h
similarity index 100%
rename from agg/include/agg_basics.h
rename to deps/agg/include/agg_basics.h
diff --git a/agg/include/agg_bezier_arc.h b/deps/agg/include/agg_bezier_arc.h
similarity index 100%
rename from agg/include/agg_bezier_arc.h
rename to deps/agg/include/agg_bezier_arc.h
diff --git a/agg/include/agg_bitset_iterator.h b/deps/agg/include/agg_bitset_iterator.h
similarity index 100%
rename from agg/include/agg_bitset_iterator.h
rename to deps/agg/include/agg_bitset_iterator.h
diff --git a/agg/include/agg_blur.h b/deps/agg/include/agg_blur.h
similarity index 100%
rename from agg/include/agg_blur.h
rename to deps/agg/include/agg_blur.h
diff --git a/agg/include/agg_bounding_rect.h b/deps/agg/include/agg_bounding_rect.h
similarity index 100%
rename from agg/include/agg_bounding_rect.h
rename to deps/agg/include/agg_bounding_rect.h
diff --git a/agg/include/agg_bspline.h b/deps/agg/include/agg_bspline.h
similarity index 100%
rename from agg/include/agg_bspline.h
rename to deps/agg/include/agg_bspline.h
diff --git a/agg/include/agg_clip_liang_barsky.h b/deps/agg/include/agg_clip_liang_barsky.h
similarity index 100%
rename from agg/include/agg_clip_liang_barsky.h
rename to deps/agg/include/agg_clip_liang_barsky.h
diff --git a/agg/include/agg_color_gray.h b/deps/agg/include/agg_color_gray.h
similarity index 100%
rename from agg/include/agg_color_gray.h
rename to deps/agg/include/agg_color_gray.h
diff --git a/agg/include/agg_color_rgba.h b/deps/agg/include/agg_color_rgba.h
similarity index 100%
rename from agg/include/agg_color_rgba.h
rename to deps/agg/include/agg_color_rgba.h
diff --git a/agg/include/agg_config.h b/deps/agg/include/agg_config.h
similarity index 100%
rename from agg/include/agg_config.h
rename to deps/agg/include/agg_config.h
diff --git a/agg/include/agg_conv_adaptor_vcgen.h b/deps/agg/include/agg_conv_adaptor_vcgen.h
similarity index 100%
rename from agg/include/agg_conv_adaptor_vcgen.h
rename to deps/agg/include/agg_conv_adaptor_vcgen.h
diff --git a/agg/include/agg_conv_adaptor_vpgen.h b/deps/agg/include/agg_conv_adaptor_vpgen.h
similarity index 100%
rename from agg/include/agg_conv_adaptor_vpgen.h
rename to deps/agg/include/agg_conv_adaptor_vpgen.h
diff --git a/agg/include/agg_conv_bspline.h b/deps/agg/include/agg_conv_bspline.h
similarity index 100%
rename from agg/include/agg_conv_bspline.h
rename to deps/agg/include/agg_conv_bspline.h
diff --git a/agg/include/agg_conv_clip_polygon.h b/deps/agg/include/agg_conv_clip_polygon.h
similarity index 100%
rename from agg/include/agg_conv_clip_polygon.h
rename to deps/agg/include/agg_conv_clip_polygon.h
diff --git a/agg/include/agg_conv_clip_polyline.h b/deps/agg/include/agg_conv_clip_polyline.h
similarity index 100%
rename from agg/include/agg_conv_clip_polyline.h
rename to deps/agg/include/agg_conv_clip_polyline.h
diff --git a/agg/include/agg_conv_close_polygon.h b/deps/agg/include/agg_conv_close_polygon.h
similarity index 100%
rename from agg/include/agg_conv_close_polygon.h
rename to deps/agg/include/agg_conv_close_polygon.h
diff --git a/agg/include/agg_conv_concat.h b/deps/agg/include/agg_conv_concat.h
similarity index 100%
rename from agg/include/agg_conv_concat.h
rename to deps/agg/include/agg_conv_concat.h
diff --git a/agg/include/agg_conv_contour.h b/deps/agg/include/agg_conv_contour.h
similarity index 100%
rename from agg/include/agg_conv_contour.h
rename to deps/agg/include/agg_conv_contour.h
diff --git a/agg/include/agg_conv_curve.h b/deps/agg/include/agg_conv_curve.h
similarity index 100%
rename from agg/include/agg_conv_curve.h
rename to deps/agg/include/agg_conv_curve.h
diff --git a/agg/include/agg_conv_dash.h b/deps/agg/include/agg_conv_dash.h
similarity index 100%
rename from agg/include/agg_conv_dash.h
rename to deps/agg/include/agg_conv_dash.h
diff --git a/agg/include/agg_conv_gpc.h b/deps/agg/include/agg_conv_gpc.h
similarity index 100%
rename from agg/include/agg_conv_gpc.h
rename to deps/agg/include/agg_conv_gpc.h
diff --git a/agg/include/agg_conv_marker.h b/deps/agg/include/agg_conv_marker.h
similarity index 100%
rename from agg/include/agg_conv_marker.h
rename to deps/agg/include/agg_conv_marker.h
diff --git a/agg/include/agg_conv_marker_adaptor.h b/deps/agg/include/agg_conv_marker_adaptor.h
similarity index 100%
rename from agg/include/agg_conv_marker_adaptor.h
rename to deps/agg/include/agg_conv_marker_adaptor.h
diff --git a/agg/include/agg_conv_segmentator.h b/deps/agg/include/agg_conv_segmentator.h
similarity index 100%
rename from agg/include/agg_conv_segmentator.h
rename to deps/agg/include/agg_conv_segmentator.h
diff --git a/agg/include/agg_conv_shorten_path.h b/deps/agg/include/agg_conv_shorten_path.h
similarity index 100%
rename from agg/include/agg_conv_shorten_path.h
rename to deps/agg/include/agg_conv_shorten_path.h
diff --git a/agg/include/agg_conv_smooth_poly1.h b/deps/agg/include/agg_conv_smooth_poly1.h
similarity index 100%
rename from agg/include/agg_conv_smooth_poly1.h
rename to deps/agg/include/agg_conv_smooth_poly1.h
diff --git a/agg/include/agg_conv_stroke.h b/deps/agg/include/agg_conv_stroke.h
similarity index 100%
rename from agg/include/agg_conv_stroke.h
rename to deps/agg/include/agg_conv_stroke.h
diff --git a/agg/include/agg_conv_transform.h b/deps/agg/include/agg_conv_transform.h
similarity index 100%
rename from agg/include/agg_conv_transform.h
rename to deps/agg/include/agg_conv_transform.h
diff --git a/agg/include/agg_conv_unclose_polygon.h b/deps/agg/include/agg_conv_unclose_polygon.h
similarity index 100%
rename from agg/include/agg_conv_unclose_polygon.h
rename to deps/agg/include/agg_conv_unclose_polygon.h
diff --git a/agg/include/agg_curves.h b/deps/agg/include/agg_curves.h
similarity index 100%
rename from agg/include/agg_curves.h
rename to deps/agg/include/agg_curves.h
diff --git a/agg/include/agg_dda_line.h b/deps/agg/include/agg_dda_line.h
similarity index 100%
rename from agg/include/agg_dda_line.h
rename to deps/agg/include/agg_dda_line.h
diff --git a/agg/include/agg_ellipse.h b/deps/agg/include/agg_ellipse.h
similarity index 100%
rename from agg/include/agg_ellipse.h
rename to deps/agg/include/agg_ellipse.h
diff --git a/agg/include/agg_ellipse_bresenham.h b/deps/agg/include/agg_ellipse_bresenham.h
similarity index 100%
rename from agg/include/agg_ellipse_bresenham.h
rename to deps/agg/include/agg_ellipse_bresenham.h
diff --git a/agg/include/agg_embedded_raster_fonts.h b/deps/agg/include/agg_embedded_raster_fonts.h
similarity index 100%
rename from agg/include/agg_embedded_raster_fonts.h
rename to deps/agg/include/agg_embedded_raster_fonts.h
diff --git a/agg/include/agg_font_cache_manager.h b/deps/agg/include/agg_font_cache_manager.h
similarity index 100%
rename from agg/include/agg_font_cache_manager.h
rename to deps/agg/include/agg_font_cache_manager.h
diff --git a/agg/include/agg_gamma_functions.h b/deps/agg/include/agg_gamma_functions.h
similarity index 100%
rename from agg/include/agg_gamma_functions.h
rename to deps/agg/include/agg_gamma_functions.h
diff --git a/agg/include/agg_gamma_lut.h b/deps/agg/include/agg_gamma_lut.h
similarity index 100%
rename from agg/include/agg_gamma_lut.h
rename to deps/agg/include/agg_gamma_lut.h
diff --git a/agg/include/agg_glyph_raster_bin.h b/deps/agg/include/agg_glyph_raster_bin.h
similarity index 100%
rename from agg/include/agg_glyph_raster_bin.h
rename to deps/agg/include/agg_glyph_raster_bin.h
diff --git a/agg/include/agg_gradient_lut.h b/deps/agg/include/agg_gradient_lut.h
similarity index 100%
rename from agg/include/agg_gradient_lut.h
rename to deps/agg/include/agg_gradient_lut.h
diff --git a/agg/include/agg_gsv_text.h b/deps/agg/include/agg_gsv_text.h
similarity index 100%
rename from agg/include/agg_gsv_text.h
rename to deps/agg/include/agg_gsv_text.h
diff --git a/agg/include/agg_image_accessors.h b/deps/agg/include/agg_image_accessors.h
similarity index 100%
rename from agg/include/agg_image_accessors.h
rename to deps/agg/include/agg_image_accessors.h
diff --git a/agg/include/agg_image_filters.h b/deps/agg/include/agg_image_filters.h
similarity index 100%
rename from agg/include/agg_image_filters.h
rename to deps/agg/include/agg_image_filters.h
diff --git a/agg/include/agg_line_aa_basics.h b/deps/agg/include/agg_line_aa_basics.h
similarity index 100%
rename from agg/include/agg_line_aa_basics.h
rename to deps/agg/include/agg_line_aa_basics.h
diff --git a/agg/include/agg_math.h b/deps/agg/include/agg_math.h
similarity index 100%
rename from agg/include/agg_math.h
rename to deps/agg/include/agg_math.h
diff --git a/agg/include/agg_math_stroke.h b/deps/agg/include/agg_math_stroke.h
similarity index 100%
rename from agg/include/agg_math_stroke.h
rename to deps/agg/include/agg_math_stroke.h
diff --git a/agg/include/agg_path_length.h b/deps/agg/include/agg_path_length.h
similarity index 100%
rename from agg/include/agg_path_length.h
rename to deps/agg/include/agg_path_length.h
diff --git a/agg/include/agg_path_storage.h b/deps/agg/include/agg_path_storage.h
similarity index 100%
rename from agg/include/agg_path_storage.h
rename to deps/agg/include/agg_path_storage.h
diff --git a/agg/include/agg_path_storage_integer.h b/deps/agg/include/agg_path_storage_integer.h
similarity index 100%
rename from agg/include/agg_path_storage_integer.h
rename to deps/agg/include/agg_path_storage_integer.h
diff --git a/agg/include/agg_pattern_filters_rgba.h b/deps/agg/include/agg_pattern_filters_rgba.h
similarity index 100%
rename from agg/include/agg_pattern_filters_rgba.h
rename to deps/agg/include/agg_pattern_filters_rgba.h
diff --git a/agg/include/agg_pixfmt_amask_adaptor.h b/deps/agg/include/agg_pixfmt_amask_adaptor.h
similarity index 100%
rename from agg/include/agg_pixfmt_amask_adaptor.h
rename to deps/agg/include/agg_pixfmt_amask_adaptor.h
diff --git a/agg/include/agg_pixfmt_gray.h b/deps/agg/include/agg_pixfmt_gray.h
similarity index 100%
rename from agg/include/agg_pixfmt_gray.h
rename to deps/agg/include/agg_pixfmt_gray.h
diff --git a/agg/include/agg_pixfmt_rgb.h b/deps/agg/include/agg_pixfmt_rgb.h
similarity index 100%
rename from agg/include/agg_pixfmt_rgb.h
rename to deps/agg/include/agg_pixfmt_rgb.h
diff --git a/agg/include/agg_pixfmt_rgb_packed.h b/deps/agg/include/agg_pixfmt_rgb_packed.h
similarity index 100%
rename from agg/include/agg_pixfmt_rgb_packed.h
rename to deps/agg/include/agg_pixfmt_rgb_packed.h
diff --git a/agg/include/agg_pixfmt_rgba.h b/deps/agg/include/agg_pixfmt_rgba.h
similarity index 100%
rename from agg/include/agg_pixfmt_rgba.h
rename to deps/agg/include/agg_pixfmt_rgba.h
diff --git a/agg/include/agg_pixfmt_transposer.h b/deps/agg/include/agg_pixfmt_transposer.h
similarity index 100%
rename from agg/include/agg_pixfmt_transposer.h
rename to deps/agg/include/agg_pixfmt_transposer.h
diff --git a/agg/include/agg_rasterizer_cells_aa.h b/deps/agg/include/agg_rasterizer_cells_aa.h
similarity index 100%
rename from agg/include/agg_rasterizer_cells_aa.h
rename to deps/agg/include/agg_rasterizer_cells_aa.h
diff --git a/agg/include/agg_rasterizer_compound_aa.h b/deps/agg/include/agg_rasterizer_compound_aa.h
similarity index 100%
rename from agg/include/agg_rasterizer_compound_aa.h
rename to deps/agg/include/agg_rasterizer_compound_aa.h
diff --git a/agg/include/agg_rasterizer_outline.h b/deps/agg/include/agg_rasterizer_outline.h
similarity index 100%
rename from agg/include/agg_rasterizer_outline.h
rename to deps/agg/include/agg_rasterizer_outline.h
diff --git a/agg/include/agg_rasterizer_outline_aa.h b/deps/agg/include/agg_rasterizer_outline_aa.h
similarity index 100%
rename from agg/include/agg_rasterizer_outline_aa.h
rename to deps/agg/include/agg_rasterizer_outline_aa.h
diff --git a/agg/include/agg_rasterizer_scanline_aa.h b/deps/agg/include/agg_rasterizer_scanline_aa.h
similarity index 100%
rename from agg/include/agg_rasterizer_scanline_aa.h
rename to deps/agg/include/agg_rasterizer_scanline_aa.h
diff --git a/agg/include/agg_rasterizer_sl_clip.h b/deps/agg/include/agg_rasterizer_sl_clip.h
similarity index 100%
rename from agg/include/agg_rasterizer_sl_clip.h
rename to deps/agg/include/agg_rasterizer_sl_clip.h
diff --git a/agg/include/agg_renderer_base.h b/deps/agg/include/agg_renderer_base.h
similarity index 100%
rename from agg/include/agg_renderer_base.h
rename to deps/agg/include/agg_renderer_base.h
diff --git a/agg/include/agg_renderer_markers.h b/deps/agg/include/agg_renderer_markers.h
similarity index 100%
rename from agg/include/agg_renderer_markers.h
rename to deps/agg/include/agg_renderer_markers.h
diff --git a/agg/include/agg_renderer_mclip.h b/deps/agg/include/agg_renderer_mclip.h
similarity index 100%
rename from agg/include/agg_renderer_mclip.h
rename to deps/agg/include/agg_renderer_mclip.h
diff --git a/agg/include/agg_renderer_outline_aa.h b/deps/agg/include/agg_renderer_outline_aa.h
similarity index 100%
rename from agg/include/agg_renderer_outline_aa.h
rename to deps/agg/include/agg_renderer_outline_aa.h
diff --git a/agg/include/agg_renderer_outline_image.h b/deps/agg/include/agg_renderer_outline_image.h
similarity index 100%
rename from agg/include/agg_renderer_outline_image.h
rename to deps/agg/include/agg_renderer_outline_image.h
diff --git a/agg/include/agg_renderer_primitives.h b/deps/agg/include/agg_renderer_primitives.h
similarity index 100%
rename from agg/include/agg_renderer_primitives.h
rename to deps/agg/include/agg_renderer_primitives.h
diff --git a/agg/include/agg_renderer_raster_text.h b/deps/agg/include/agg_renderer_raster_text.h
similarity index 100%
rename from agg/include/agg_renderer_raster_text.h
rename to deps/agg/include/agg_renderer_raster_text.h
diff --git a/agg/include/agg_renderer_scanline.h b/deps/agg/include/agg_renderer_scanline.h
similarity index 100%
rename from agg/include/agg_renderer_scanline.h
rename to deps/agg/include/agg_renderer_scanline.h
diff --git a/agg/include/agg_rendering_buffer.h b/deps/agg/include/agg_rendering_buffer.h
similarity index 100%
rename from agg/include/agg_rendering_buffer.h
rename to deps/agg/include/agg_rendering_buffer.h
diff --git a/agg/include/agg_rendering_buffer_dynarow.h b/deps/agg/include/agg_rendering_buffer_dynarow.h
similarity index 100%
rename from agg/include/agg_rendering_buffer_dynarow.h
rename to deps/agg/include/agg_rendering_buffer_dynarow.h
diff --git a/agg/include/agg_rounded_rect.h b/deps/agg/include/agg_rounded_rect.h
similarity index 100%
rename from agg/include/agg_rounded_rect.h
rename to deps/agg/include/agg_rounded_rect.h
diff --git a/agg/include/agg_scanline_bin.h b/deps/agg/include/agg_scanline_bin.h
similarity index 100%
rename from agg/include/agg_scanline_bin.h
rename to deps/agg/include/agg_scanline_bin.h
diff --git a/agg/include/agg_scanline_boolean_algebra.h b/deps/agg/include/agg_scanline_boolean_algebra.h
similarity index 100%
rename from agg/include/agg_scanline_boolean_algebra.h
rename to deps/agg/include/agg_scanline_boolean_algebra.h
diff --git a/agg/include/agg_scanline_p.h b/deps/agg/include/agg_scanline_p.h
similarity index 100%
rename from agg/include/agg_scanline_p.h
rename to deps/agg/include/agg_scanline_p.h
diff --git a/agg/include/agg_scanline_storage_aa.h b/deps/agg/include/agg_scanline_storage_aa.h
similarity index 100%
rename from agg/include/agg_scanline_storage_aa.h
rename to deps/agg/include/agg_scanline_storage_aa.h
diff --git a/agg/include/agg_scanline_storage_bin.h b/deps/agg/include/agg_scanline_storage_bin.h
similarity index 100%
rename from agg/include/agg_scanline_storage_bin.h
rename to deps/agg/include/agg_scanline_storage_bin.h
diff --git a/agg/include/agg_scanline_u.h b/deps/agg/include/agg_scanline_u.h
similarity index 100%
rename from agg/include/agg_scanline_u.h
rename to deps/agg/include/agg_scanline_u.h
diff --git a/agg/include/agg_shorten_path.h b/deps/agg/include/agg_shorten_path.h
similarity index 100%
rename from agg/include/agg_shorten_path.h
rename to deps/agg/include/agg_shorten_path.h
diff --git a/agg/include/agg_simul_eq.h b/deps/agg/include/agg_simul_eq.h
similarity index 100%
rename from agg/include/agg_simul_eq.h
rename to deps/agg/include/agg_simul_eq.h
diff --git a/agg/include/agg_span_allocator.h b/deps/agg/include/agg_span_allocator.h
similarity index 100%
rename from agg/include/agg_span_allocator.h
rename to deps/agg/include/agg_span_allocator.h
diff --git a/agg/include/agg_span_converter.h b/deps/agg/include/agg_span_converter.h
similarity index 100%
rename from agg/include/agg_span_converter.h
rename to deps/agg/include/agg_span_converter.h
diff --git a/agg/include/agg_span_gouraud.h b/deps/agg/include/agg_span_gouraud.h
similarity index 100%
rename from agg/include/agg_span_gouraud.h
rename to deps/agg/include/agg_span_gouraud.h
diff --git a/agg/include/agg_span_gouraud_gray.h b/deps/agg/include/agg_span_gouraud_gray.h
similarity index 100%
rename from agg/include/agg_span_gouraud_gray.h
rename to deps/agg/include/agg_span_gouraud_gray.h
diff --git a/agg/include/agg_span_gouraud_rgba.h b/deps/agg/include/agg_span_gouraud_rgba.h
similarity index 100%
rename from agg/include/agg_span_gouraud_rgba.h
rename to deps/agg/include/agg_span_gouraud_rgba.h
diff --git a/agg/include/agg_span_gradient.h b/deps/agg/include/agg_span_gradient.h
similarity index 100%
rename from agg/include/agg_span_gradient.h
rename to deps/agg/include/agg_span_gradient.h
diff --git a/agg/include/agg_span_gradient_alpha.h b/deps/agg/include/agg_span_gradient_alpha.h
similarity index 100%
rename from agg/include/agg_span_gradient_alpha.h
rename to deps/agg/include/agg_span_gradient_alpha.h
diff --git a/agg/include/agg_span_image_filter.h b/deps/agg/include/agg_span_image_filter.h
similarity index 100%
rename from agg/include/agg_span_image_filter.h
rename to deps/agg/include/agg_span_image_filter.h
diff --git a/agg/include/agg_span_image_filter_gray.h b/deps/agg/include/agg_span_image_filter_gray.h
similarity index 100%
rename from agg/include/agg_span_image_filter_gray.h
rename to deps/agg/include/agg_span_image_filter_gray.h
diff --git a/agg/include/agg_span_image_filter_rgb.h b/deps/agg/include/agg_span_image_filter_rgb.h
similarity index 100%
rename from agg/include/agg_span_image_filter_rgb.h
rename to deps/agg/include/agg_span_image_filter_rgb.h
diff --git a/agg/include/agg_span_image_filter_rgba.h b/deps/agg/include/agg_span_image_filter_rgba.h
similarity index 100%
rename from agg/include/agg_span_image_filter_rgba.h
rename to deps/agg/include/agg_span_image_filter_rgba.h
diff --git a/agg/include/agg_span_interpolator_adaptor.h b/deps/agg/include/agg_span_interpolator_adaptor.h
similarity index 100%
rename from agg/include/agg_span_interpolator_adaptor.h
rename to deps/agg/include/agg_span_interpolator_adaptor.h
diff --git a/agg/include/agg_span_interpolator_linear.h b/deps/agg/include/agg_span_interpolator_linear.h
similarity index 100%
rename from agg/include/agg_span_interpolator_linear.h
rename to deps/agg/include/agg_span_interpolator_linear.h
diff --git a/agg/include/agg_span_interpolator_persp.h b/deps/agg/include/agg_span_interpolator_persp.h
similarity index 100%
rename from agg/include/agg_span_interpolator_persp.h
rename to deps/agg/include/agg_span_interpolator_persp.h
diff --git a/agg/include/agg_span_interpolator_trans.h b/deps/agg/include/agg_span_interpolator_trans.h
similarity index 100%
rename from agg/include/agg_span_interpolator_trans.h
rename to deps/agg/include/agg_span_interpolator_trans.h
diff --git a/agg/include/agg_span_pattern_gray.h b/deps/agg/include/agg_span_pattern_gray.h
similarity index 100%
rename from agg/include/agg_span_pattern_gray.h
rename to deps/agg/include/agg_span_pattern_gray.h
diff --git a/agg/include/agg_span_pattern_rgb.h b/deps/agg/include/agg_span_pattern_rgb.h
similarity index 100%
rename from agg/include/agg_span_pattern_rgb.h
rename to deps/agg/include/agg_span_pattern_rgb.h
diff --git a/agg/include/agg_span_pattern_rgba.h b/deps/agg/include/agg_span_pattern_rgba.h
similarity index 100%
rename from agg/include/agg_span_pattern_rgba.h
rename to deps/agg/include/agg_span_pattern_rgba.h
diff --git a/agg/include/agg_span_solid.h b/deps/agg/include/agg_span_solid.h
similarity index 100%
rename from agg/include/agg_span_solid.h
rename to deps/agg/include/agg_span_solid.h
diff --git a/agg/include/agg_span_subdiv_adaptor.h b/deps/agg/include/agg_span_subdiv_adaptor.h
similarity index 100%
rename from agg/include/agg_span_subdiv_adaptor.h
rename to deps/agg/include/agg_span_subdiv_adaptor.h
diff --git a/agg/include/agg_trans_affine.h b/deps/agg/include/agg_trans_affine.h
similarity index 100%
rename from agg/include/agg_trans_affine.h
rename to deps/agg/include/agg_trans_affine.h
diff --git a/agg/include/agg_trans_bilinear.h b/deps/agg/include/agg_trans_bilinear.h
similarity index 100%
rename from agg/include/agg_trans_bilinear.h
rename to deps/agg/include/agg_trans_bilinear.h
diff --git a/agg/include/agg_trans_double_path.h b/deps/agg/include/agg_trans_double_path.h
similarity index 100%
rename from agg/include/agg_trans_double_path.h
rename to deps/agg/include/agg_trans_double_path.h
diff --git a/agg/include/agg_trans_lens.h b/deps/agg/include/agg_trans_lens.h
similarity index 100%
rename from agg/include/agg_trans_lens.h
rename to deps/agg/include/agg_trans_lens.h
diff --git a/agg/include/agg_trans_perspective.h b/deps/agg/include/agg_trans_perspective.h
similarity index 100%
rename from agg/include/agg_trans_perspective.h
rename to deps/agg/include/agg_trans_perspective.h
diff --git a/agg/include/agg_trans_single_path.h b/deps/agg/include/agg_trans_single_path.h
similarity index 100%
rename from agg/include/agg_trans_single_path.h
rename to deps/agg/include/agg_trans_single_path.h
diff --git a/agg/include/agg_trans_viewport.h b/deps/agg/include/agg_trans_viewport.h
similarity index 100%
rename from agg/include/agg_trans_viewport.h
rename to deps/agg/include/agg_trans_viewport.h
diff --git a/agg/include/agg_trans_warp_magnifier.h b/deps/agg/include/agg_trans_warp_magnifier.h
similarity index 100%
rename from agg/include/agg_trans_warp_magnifier.h
rename to deps/agg/include/agg_trans_warp_magnifier.h
diff --git a/agg/include/agg_vcgen_bspline.h b/deps/agg/include/agg_vcgen_bspline.h
similarity index 100%
rename from agg/include/agg_vcgen_bspline.h
rename to deps/agg/include/agg_vcgen_bspline.h
diff --git a/agg/include/agg_vcgen_contour.h b/deps/agg/include/agg_vcgen_contour.h
similarity index 100%
rename from agg/include/agg_vcgen_contour.h
rename to deps/agg/include/agg_vcgen_contour.h
diff --git a/agg/include/agg_vcgen_dash.h b/deps/agg/include/agg_vcgen_dash.h
similarity index 100%
rename from agg/include/agg_vcgen_dash.h
rename to deps/agg/include/agg_vcgen_dash.h
diff --git a/agg/include/agg_vcgen_markers_term.h b/deps/agg/include/agg_vcgen_markers_term.h
similarity index 100%
rename from agg/include/agg_vcgen_markers_term.h
rename to deps/agg/include/agg_vcgen_markers_term.h
diff --git a/agg/include/agg_vcgen_smooth_poly1.h b/deps/agg/include/agg_vcgen_smooth_poly1.h
similarity index 100%
rename from agg/include/agg_vcgen_smooth_poly1.h
rename to deps/agg/include/agg_vcgen_smooth_poly1.h
diff --git a/agg/include/agg_vcgen_stroke.h b/deps/agg/include/agg_vcgen_stroke.h
similarity index 100%
rename from agg/include/agg_vcgen_stroke.h
rename to deps/agg/include/agg_vcgen_stroke.h
diff --git a/agg/include/agg_vcgen_vertex_sequence.h b/deps/agg/include/agg_vcgen_vertex_sequence.h
similarity index 100%
rename from agg/include/agg_vcgen_vertex_sequence.h
rename to deps/agg/include/agg_vcgen_vertex_sequence.h
diff --git a/agg/include/agg_vertex_sequence.h b/deps/agg/include/agg_vertex_sequence.h
similarity index 100%
rename from agg/include/agg_vertex_sequence.h
rename to deps/agg/include/agg_vertex_sequence.h
diff --git a/agg/include/agg_vpgen_clip_polygon.h b/deps/agg/include/agg_vpgen_clip_polygon.h
similarity index 100%
rename from agg/include/agg_vpgen_clip_polygon.h
rename to deps/agg/include/agg_vpgen_clip_polygon.h
diff --git a/agg/include/agg_vpgen_clip_polyline.h b/deps/agg/include/agg_vpgen_clip_polyline.h
similarity index 100%
rename from agg/include/agg_vpgen_clip_polyline.h
rename to deps/agg/include/agg_vpgen_clip_polyline.h
diff --git a/agg/include/agg_vpgen_segmentator.h b/deps/agg/include/agg_vpgen_segmentator.h
similarity index 100%
rename from agg/include/agg_vpgen_segmentator.h
rename to deps/agg/include/agg_vpgen_segmentator.h
diff --git a/agg/src/agg_arc.cpp b/deps/agg/src/agg_arc.cpp
similarity index 100%
rename from agg/src/agg_arc.cpp
rename to deps/agg/src/agg_arc.cpp
diff --git a/agg/src/agg_arrowhead.cpp b/deps/agg/src/agg_arrowhead.cpp
similarity index 100%
rename from agg/src/agg_arrowhead.cpp
rename to deps/agg/src/agg_arrowhead.cpp
diff --git a/agg/src/agg_bezier_arc.cpp b/deps/agg/src/agg_bezier_arc.cpp
similarity index 100%
rename from agg/src/agg_bezier_arc.cpp
rename to deps/agg/src/agg_bezier_arc.cpp
diff --git a/agg/src/agg_bspline.cpp b/deps/agg/src/agg_bspline.cpp
similarity index 100%
rename from agg/src/agg_bspline.cpp
rename to deps/agg/src/agg_bspline.cpp
diff --git a/agg/src/agg_curves.cpp b/deps/agg/src/agg_curves.cpp
similarity index 100%
rename from agg/src/agg_curves.cpp
rename to deps/agg/src/agg_curves.cpp
diff --git a/agg/src/agg_embedded_raster_fonts.cpp b/deps/agg/src/agg_embedded_raster_fonts.cpp
similarity index 100%
rename from agg/src/agg_embedded_raster_fonts.cpp
rename to deps/agg/src/agg_embedded_raster_fonts.cpp
diff --git a/agg/src/agg_gsv_text.cpp b/deps/agg/src/agg_gsv_text.cpp
similarity index 100%
rename from agg/src/agg_gsv_text.cpp
rename to deps/agg/src/agg_gsv_text.cpp
diff --git a/agg/src/agg_image_filters.cpp b/deps/agg/src/agg_image_filters.cpp
similarity index 100%
rename from agg/src/agg_image_filters.cpp
rename to deps/agg/src/agg_image_filters.cpp
diff --git a/agg/src/agg_line_aa_basics.cpp b/deps/agg/src/agg_line_aa_basics.cpp
similarity index 100%
rename from agg/src/agg_line_aa_basics.cpp
rename to deps/agg/src/agg_line_aa_basics.cpp
diff --git a/agg/src/agg_line_profile_aa.cpp b/deps/agg/src/agg_line_profile_aa.cpp
similarity index 100%
rename from agg/src/agg_line_profile_aa.cpp
rename to deps/agg/src/agg_line_profile_aa.cpp
diff --git a/agg/src/agg_rounded_rect.cpp b/deps/agg/src/agg_rounded_rect.cpp
similarity index 100%
rename from agg/src/agg_rounded_rect.cpp
rename to deps/agg/src/agg_rounded_rect.cpp
diff --git a/agg/src/agg_sqrt_tables.cpp b/deps/agg/src/agg_sqrt_tables.cpp
similarity index 100%
rename from agg/src/agg_sqrt_tables.cpp
rename to deps/agg/src/agg_sqrt_tables.cpp
diff --git a/agg/src/agg_trans_affine.cpp b/deps/agg/src/agg_trans_affine.cpp
similarity index 100%
rename from agg/src/agg_trans_affine.cpp
rename to deps/agg/src/agg_trans_affine.cpp
diff --git a/agg/src/agg_trans_double_path.cpp b/deps/agg/src/agg_trans_double_path.cpp
similarity index 100%
rename from agg/src/agg_trans_double_path.cpp
rename to deps/agg/src/agg_trans_double_path.cpp
diff --git a/agg/src/agg_trans_single_path.cpp b/deps/agg/src/agg_trans_single_path.cpp
similarity index 100%
rename from agg/src/agg_trans_single_path.cpp
rename to deps/agg/src/agg_trans_single_path.cpp
diff --git a/agg/src/agg_trans_warp_magnifier.cpp b/deps/agg/src/agg_trans_warp_magnifier.cpp
similarity index 100%
rename from agg/src/agg_trans_warp_magnifier.cpp
rename to deps/agg/src/agg_trans_warp_magnifier.cpp
diff --git a/agg/src/agg_vcgen_bspline.cpp b/deps/agg/src/agg_vcgen_bspline.cpp
similarity index 100%
rename from agg/src/agg_vcgen_bspline.cpp
rename to deps/agg/src/agg_vcgen_bspline.cpp
diff --git a/agg/src/agg_vcgen_contour.cpp b/deps/agg/src/agg_vcgen_contour.cpp
similarity index 100%
rename from agg/src/agg_vcgen_contour.cpp
rename to deps/agg/src/agg_vcgen_contour.cpp
diff --git a/agg/src/agg_vcgen_dash.cpp b/deps/agg/src/agg_vcgen_dash.cpp
similarity index 100%
rename from agg/src/agg_vcgen_dash.cpp
rename to deps/agg/src/agg_vcgen_dash.cpp
diff --git a/agg/src/agg_vcgen_markers_term.cpp b/deps/agg/src/agg_vcgen_markers_term.cpp
similarity index 100%
rename from agg/src/agg_vcgen_markers_term.cpp
rename to deps/agg/src/agg_vcgen_markers_term.cpp
diff --git a/agg/src/agg_vcgen_smooth_poly1.cpp b/deps/agg/src/agg_vcgen_smooth_poly1.cpp
similarity index 100%
rename from agg/src/agg_vcgen_smooth_poly1.cpp
rename to deps/agg/src/agg_vcgen_smooth_poly1.cpp
diff --git a/agg/src/agg_vcgen_stroke.cpp b/deps/agg/src/agg_vcgen_stroke.cpp
similarity index 100%
rename from agg/src/agg_vcgen_stroke.cpp
rename to deps/agg/src/agg_vcgen_stroke.cpp
diff --git a/agg/src/agg_vpgen_clip_polygon.cpp b/deps/agg/src/agg_vpgen_clip_polygon.cpp
similarity index 100%
rename from agg/src/agg_vpgen_clip_polygon.cpp
rename to deps/agg/src/agg_vpgen_clip_polygon.cpp
diff --git a/agg/src/agg_vpgen_clip_polyline.cpp b/deps/agg/src/agg_vpgen_clip_polyline.cpp
similarity index 100%
rename from agg/src/agg_vpgen_clip_polyline.cpp
rename to deps/agg/src/agg_vpgen_clip_polyline.cpp
diff --git a/agg/src/agg_vpgen_segmentator.cpp b/deps/agg/src/agg_vpgen_segmentator.cpp
similarity index 100%
rename from agg/src/agg_vpgen_segmentator.cpp
rename to deps/agg/src/agg_vpgen_segmentator.cpp
diff --git a/docs/contributing.markdown b/docs/contributing.markdown
new file mode 100644
index 000000000..722841a34
--- /dev/null
+++ b/docs/contributing.markdown
@@ -0,0 +1,120 @@
+# Contributing
+
+## Community
+
+Mapnik is an open source community creating a tool to enable to the craft of making beautiful maps. Working together collaboratively towards this goal is what makes it all possible and fun.
+
+We host our code on github.com/mapnik and encourage anyone interested to fork the repository and provide pull requests or patches for things they want to see added.
+
+If you just have a question about the code, or a feature you want to discuss then feel free to create a new issue.
+
+
+## Code Philosophy
+
+Look through the code to get an idea, and do not hesitate to ask questions.
+
+Also read the design philosophy page for the motivations that lead to code decisions.
+
+In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG, besides producing the best visual output, strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much.
+
+You will also notice that we don't use many of the standard geo libraries when we could. For instance we don't use GDAL, OGR, or GEOS anywhere in core, and only leverage them in optional plugins. We feel we can often write code that is faster and more thread safe than these libraries but that still does the job. If this ever changes we can adapt and start using these libraries or others as dependencies - nothing is nicer than standing on the shoulders of giants when it makes sense.
+
+
+## License
+
+Mapnik is licensed LGPL, which means that you are a free to use the code in any of your applications whether they be open source or not. It also means that if you contribute code to Mapnik that others are free to continue using Mapnik in the same way, even with your new additions. If you choose to redistribute an application using Mapnik just make sure to provide any source code modifications you make back to the community. For the actual details see the full LGPL license in the COPYING doc.
+
+
+## Copyright
+
+Mapnik is an open source project and will always be, proudly, an open source project. Your contributions to Mapnik should be motivated by (amount other things) your desire to contribute to a community effort and by the knowledge that your open code will stay that way.
+
+Artem, as the founder and leader of the Mapnik project, is the primary copyright holder and therefore also the primary contact for any current or future license questions around Mapnik. It is important that the copyright holder is respected, trusted, and known to the community so maintaining copyright with Artem is key to maintaining the project as open source.
+
+Therefore, convention is that all new files created by any core developers or patch
+authors should have a copyright declaration like:
+
+ /*****************************************************************************
+ *
+ * This file is part of Mapnik (c++ mapping toolkit)
+ *
+ * Copyright (C) {YEAR} Artem Pavlenko
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+
+## Coding Conventions
+
+Mapnik is written in C++, and we try to follow general coding guidelines.
+
+If you see bits of code around that do not follow these please don't hesitate to flag the issue or correct it yourself.
+
+#### Spaces not tabs, and avoid trailing whitespace
+
+#### Indentation is four spaces
+
+#### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible
+
+#### Function definitions should not be separated from their arguments:
+
+ void foo(int a) { ... } // please
+
+ void foo (int a) { ... } // no
+
+#### Separate arguments by a single space:
+
+ void foo(int a, float b) // please
+
+ void foo(int a,float b) // no
+
+#### Space between operators:
+
+ if (a == b) // please
+
+ if(a==b) // no
+
+#### Braces should ideally be on a separate line:
+
+ if (a == b)
+ {
+ int z = 5;
+ // more...
+ }
+
+
+### Other C++ style resources
+
+Many also follow the useful [google](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) which mostly fits our style. However, Google obviously has to maintain a lot of aging codebases. Mapnik can move faster, so we don't follow all
+of those style recommendations.
+
+
+### Emacs helper
+
+To auto-convert to the above syntax you can put this in an .emacs file:
+
+ ;; mapnik c++
+
+ (setq c-default-style "bsd")
+ ;; no tabs please
+ (setq indent-tabs-mode nil)
+ ;; ident by four spaces
+ (setq c-basic-offset 4)
+ ;; don't ident inside namespace decl
+ (c-set-offset 'innamespace 0)
+ ;;
+ (c-set-offset 'template-args-cont 'c-lineup-template-args)
+
diff --git a/docs/design.markdown b/docs/design.markdown
new file mode 100644
index 000000000..4081ff8e4
--- /dev/null
+++ b/docs/design.markdown
@@ -0,0 +1,20 @@
+# Design philosophy
+
+Above all Mapnik is about making beautiful maps. This aim drives us to be constantly forward looking. Progress in technology and design are reshaping the art of the possible for maps. Mapnik joins the best ideas in high quality graphics with robust patterns and algorithms for spatial data access. The goal should be no less than enabling a new generation of map makers and gorgous maps.
+
+Mapnik is a library. It is not a server - rather it's for writing servers. Or for writing desktop graphics engines to display maps. Or for visualizing new galaxies - its up to you. If you have an inclination for scripting and something to render in real world or celestial coordinates, Mapnik is for you. Mapnik is not a full solution, or even half a solution. At its best, Mapnik is a drawing api that provides the right tools for the developer to make sense of, and art from, geodata.
+
+But Mapnik is not just about drawing on a canvas. Beautiful maps can also be interactive maps and Mapnik aims to provide very flexible, custom access to geo features both in its C++ api and in binding languages. MetaWriters and the Grid renderer are two recent advances that enable highly interactive feature display in mapping applications using JSON serialized features, but more will come.
+
+Mapnik core is simple set of objects providing structures for features and the ability to query, filter, cache, and render them. This design can be lightweight, flexible, and high performance because the core library does have to worry about where data comes from or where it goes after rendering. Datasources are separate plugin libraries loaded at runtime that, when called, provide feature arrays. The core classes make no assumptions about map size, format, or projection. The core is designed to make writing a high performance tile server, that renders on-demand and uses multi-threaded or multi-process concurrency, as easy as possible.
+
+Chasing beauty and speed, as technology advances, requires experimentation and a
+frequent stream of new ideas. To write fast and creative code we strive to avoid hard dependencies on older libraries or libraries that attempt to do too much at the cost of performance. At the same time, to be able to maintain ambitious goals we cannot write boilerplate code or attempt to write robust code for domains outside of mapping and graphics. As such we rely as much as possible on the Boost libraries.
+
+Mapnik is cross platform because the C++ language and the Boost makes this feasible
+enough it would be a shame not to be. But our development target is the latest
+release of linux, particularly server based distributions, and many Mapnik developers
+use OSX as a development environment.
+
+If you are having fun using Mapnik, stick with it. But, Mapnik is not always the right tool, of course. If you have small sets of data (MB's), try just rendering it in a web browser client using a javascript mapping api. Or if you need to set up an array of OGC Web services, use GeoServer. Lastly, if you are looking for a full solution for web cartography, use TileMill.
+
diff --git a/docs/ogcserver/readme.txt b/docs/ogcserver/readme.txt
deleted file mode 100644
index de0713b7e..000000000
--- a/docs/ogcserver/readme.txt
+++ /dev/null
@@ -1,184 +0,0 @@
-# $Id$
-
-Mapnik OGC Server
------------------
-
-
-Introduction
-------------
-
-Mapnik provides a server package to allow the publishing of maps
-through the open and standard WMS interface published by the Open Geospatial
-Consortium (OGC). It is in implemented in Python, around the core Mapnik C++
-library.
-
-This is the very first implementation of a WMS for Mapnik. Although initial
-testing seems to suggest it works well, there may be bugs, and it lacks some
-useful features. Comments, contributions, and requests for help should all be
-directed to the Mapnik mailing list.
-
-
-Features
---------
-
-- WMS 1.1.1 and 1.3.0
-- CGI/FastCGI, WSGI, mod_python
-- Supports all 3 requests: GetCapabilities, GetMap and GetFeatureInfo
-- JPEG/PNG output
-- XML/INIMAGE/BLANK error handling
-- Multiple named styles support
-- Reprojection support
-- Supported layer metadata: title, abstract
-- Ability to request all layers with LAYERS=__all__
-
-
-Caveats
-----------------
-- GetFeatureInfo supports text/plain output only
-- PNG256(8-bit PNG not yet supported)
-- CGI/FastCGI interface needs to be able to write to tempfile.gettempdir() (most likely "/tmp")
-- Need to be further evaluated for thread safety
-
-
-Dependencies
-------------
-
-Please properly install the following before proceeding further:
-
-- Mapnik python bindings (which will also install the `ogcserver` module code)
-- lxml (http://codespeak.net/lxml/)
-- PIL (http://www.pythonware.com/products/pil)
-
-For the CGI/FastCGI interface also install:
-
-- jonpy (http://jonpy.sourceforge.net/)
-
-
-Installation
-------------
-
-- The OGC Server uses the Mapnik interface to the Proj.4 library for projection support
- and depends on integer EPSG codes. Confirm that you have installed Proj.4 with
- all necessary data files (http://trac.osgeo.org/proj/wiki/FAQ) and have added any custom
- projections to the 'epsg' file usually located at '/usr/local/share/proj/epsg'.
-
-- Test that the server code is available and installed properly by importing it within a
- python interpreter::
-
- >>> from mapnik import ogcserver
- >>> # no error means proper installation
-
-- There is a sample python script called "wms.py" in the utils/ogcserver folder of the
- Mapnik source code that will work for both CGI and FastCGI operations. Where to place it
- will depend on your server choice and configuration and is beyond this documentation.
- For information on FastCGI go to http://www.fastcgi.com/.
-
-
-Configuring the server
-----------------------
-
-- You will need to create two simple python scripts:
-
- 1) The web-accessible python script ('wms.py') which will import the
- ogcserver module code and associate itself with the 'ogcserver.conf'
- configuration file. The code of this script will depend upon whether
- you deploy the server as cgi/fastcgi/wsgi/mod_python. See the Mapnik
- Community Wiki for examples: http://trac.mapnik.org/wiki/OgcServer and
- see the cgi sample in the /utils/ogcserver folder.
-
- 2) A 'map_factory' script which loads your layers and styles. Samples of this
- script can be found below.
-
-
-- Next you need to edit the ogcserver.conf file to:
-
- 1) Point to the 'map_factory' script by using the "module" parameter
-
- 2) Fill out further settings for the server.
-
- Edit the configuration file to your liking, the comments within the file will
- help you further. Be sure to, at the very minimum, edit the "module"
- parameter. The server will not work without setting it properly first.
-
-
-Defining Layers and Styles
---------------------------
-
-The ogcserver obviously needs layers to publish and styles for how to display those layers.
-
-You create your layers and styles in the 'map_factory' script.
-
-For now this can be done by either loading an XML mapfile inside that script using the
-'loadXML()' function or by writing your layers and styles in python code, or both.
-
-If you load your layers and styles using an existing XML mapfile the 'map_factory' module
-should look like::
-
- from mapnik.ogcserver.WMS import BaseWMSFactory
-
- class WMSFactory(BaseWMSFactory):
- def __init__(self):
- BaseWMSFactory.__init__(self)
- self.loadXML('/full/path/to/mapfile.xml')
- self.finalize()
-
-Or if you want to define your layers and styles in pure python you might
-have a 'map_factory' more like::
-
- from mapnik.ogcserver.WMS import BaseWMSFactory
- from mapnik import *
-
- SHAPEFILE = '/path/to/world_borders.shp'
- PROJ4_STRING = '+init=epsg:4326'
-
- class WMSFactory(BaseWMSFactory):
- def __init__(self):
- BaseWMSFactory.__init__(self)
- sty,rl = Style(),Rule()
- poly = PolygonSymbolizer(Color('#f2eff9'))
- line = LineSymbolizer(Color('steelblue'),.1)
- rl.symbols.extend([poly,line])
- sty.rules.append(rl)
- self.register_style('world_style',sty)
- lyr = Layer('world',PROJ4_STRING)
- lyr.datasource = Shapefile(file=SHAPEFILE)
- lyr.title = 'World Borders'
- lyr.abstract = 'Country Borders of the World'
- self.register_layer(lyr,'world_style',('world_style',))
- self.finalize()
-
-The rules for writing this class are:
-
-- It MUST be called 'WMSFactory'.
-- It MUST sub-class mapnik.ogcserver.WMS.BaseWMSFactory.
-- The __init__ MUST call the base class.
-- Layers MUST be named with the first parameter to the constructor.
-- Layers MUST define an EPSG projection in the second parameter of the
- constructor. This implies that the underlying data must be in an EPSG
- projection already.
-- Style and layer names are meant for machine readability, not human. Keep
- them short and simple, without spaces or special characters.
-- For human readable info, set the title and abstract properties on the layer
- object.
-- DO NOT register styles using layer.styles.append(), instead, provide style
- information to the register_layer() call::
-
- register_layer(layerobject, defaultstylename, (tuple of alternative style names,))
-
-- No Map() object is used or needed here.
-- Be sure to call self.finalize() once you have registered everything! This will
- validate everything and let you know if there are any problems.
-- For a layer to be queryable via GetFeatureInfo, simply set the 'queryable'
- property to True::
-
- lyr.queryable = True
-
-
-To Do
------
-
-- Investigate moving to cElementTree from lxml.
-- Add some internal "caching" for performance improvements.
-- Switch to using C/C++ libs for image generation, instead of PIL (also
- requires core changes). PIL requirement will remain for INIMAGE/BLANK
- error handling.
\ No newline at end of file
diff --git a/osx/Info.plist b/osx/Info.plist
deleted file mode 100644
index b195d8abd..000000000
--- a/osx/Info.plist
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- Mapnik
- CFBundleGetInfoString
- Mapnik 2.0.0-1
- CFBundleIdentifier
- org.mapnik
- CFBundleInfoDictionaryVersion
- 2.0
- CFBundleName
- Mapnik
- CFBundlePackageType
- FMWK
- CFBundleShortVersionString
- 0.2.0
- CFBundleSignature
- ????
- CFBundleVersion
- Mapnik 2.0.0-1
-
-
diff --git a/osx/README.txt b/osx/README.txt
deleted file mode 100644
index 3aba10d38..000000000
--- a/osx/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-A few scripts to assist with building a Mapnik.framework for OS X.
-
-It is not currently meant for others to use, but eventually I may
-add docs and instructions such that others can build their own
-framework packages.
-
-Contact Dane (dane@dbsgeo.com) with any questions.
diff --git a/osx/config.py b/osx/config.py
deleted file mode 100644
index a9f662859..000000000
--- a/osx/config.py
+++ /dev/null
@@ -1,29 +0,0 @@
-CXX = 'clang++'
-CC = 'clang'
-CUSTOM_CXXFLAGS = '-arch i386 -arch x86_64 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isystem osx/sources/include'
-CUSTOM_LDFLAGS = '-arch i386 -arch x86_64 -Wl,-search_paths_first -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -Losx/sources/lib '
-RUNTIME_LINK = 'static'
-INPUT_PLUGINS = 'gdal,ogr,postgis,shape,sqlite'
-DESTDIR = './osx/sources/'
-PATH_INSERT = './osx/sources/bin/'
-BOOST_INCLUDES = 'osx/sources/include'
-BOOST_LIBS = 'osx/sources/lib'
-FREETYPE_CONFIG = './osx/sources/bin/freetype-config'
-ICU_INCLUDES = './osx/sources/include'
-ICU_LIB_NAME = 'icucore'
-PNG_INCLUDES = './osx/sources/include'
-PNG_LIBS = './osx/sources/lib'
-JPEG_INCLUDES = './osx/sources/include'
-JPEG_LIBS = './osx/sources/lib'
-TIFF_INCLUDES = './osx/sources/include'
-TIFF_LIBS = './osx/sources/lib'
-PROJ_INCLUDES = './osx/sources/include'
-PROJ_LIBS = './osx/sources/lib'
-PKG_CONFIG_PATH = './osx/sources/lib/pkgconfig'
-CAIRO_INCLUDES = './osx/sources/include/'
-CAIRO_LIBS = './osx/sources/lib'
-SQLITE_INCLUDES = './osx/sources/include'
-SQLITE_LIBS = './osx/sources/lib'
-BINDINGS = 'none'
-DEMO = True
-PGSQL2SQLITE = True
diff --git a/osx/config_framework.py b/osx/config_framework.py
deleted file mode 100644
index 99c8dda16..000000000
--- a/osx/config_framework.py
+++ /dev/null
@@ -1,29 +0,0 @@
-CXX = 'clang++'
-CC = 'clang'
-CUSTOM_CXXFLAGS = '-arch i386 -arch x86_64 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isystem osx/sources/include'
-CUSTOM_LDFLAGS = '-arch i386 -arch x86_64 -headerpad_max_install_names -Wl,-search_paths_first -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -Losx/sources/lib '
-INPUT_PLUGINS = 'gdal,geos,ogr,osm,postgis,raster,shape,sqlite'
-PREFIX = '/Library/Frameworks/Mapnik.framework/Versions/2.0/unix'
-PYTHON_PREFIX = '/Library/Frameworks/Mapnik.framework/Versions/2.0/unix'
-DESTDIR = '/Users/dane/projects/mapnik-dev/trunk-build/osx/'
-PATH_INSERT = './osx/sources/bin/'
-BOOST_INCLUDES = 'osx/sources/include'
-BOOST_LIBS = 'osx/sources/lib'
-BOOST_PYTHON_LIB = 'boost_python32'
-PNG_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
-PNG_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
-JPEG_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
-JPEG_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
-TIFF_INCLUDES = '/Library/Frameworks/UnixImageIO.framework/unix/include'
-TIFF_LIBS = '/Library/Frameworks/UnixImageIO.framework/unix/lib'
-PROJ_INCLUDES = '/Library/Frameworks/PROJ.framework/unix/include'
-PROJ_LIBS = '/Library/Frameworks/PROJ.framework/unix/lib'
-PKG_CONFIG_PATH = './osx/sources/lib/pkgconfig'
-GEOS_CONFIG = '/Library/Frameworks/GEOS.framework/unix/bin/geos-config'
-SQLITE_INCLUDES = './osx/sources/include'
-SQLITE_LIBS = './osx/sources/lib'
-PYTHON = '/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2m'
-PYTHON_DYNAMIC_LOOKUP = True
-BINDINGS = 'all'
-DEMO = True
-PGSQL2SQLITE = True
diff --git a/osx/installer/media/finish_up.rtf b/osx/installer/media/finish_up.rtf
deleted file mode 100644
index 5b33fc4ee..000000000
--- a/osx/installer/media/finish_up.rtf
+++ /dev/null
@@ -1,17 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\margl1440\margr1440\vieww9000\viewh8400\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0\b\fs24 \cf0 Learning Mapnik\
-\
-
-\b0 Find documentation at: {\field{\*\fldinst{HYPERLINK "http://mapnik.org/documentation/"}}{\fldrslt mapnik.org}}\
-
-\b \
-
-\b0 Join Mapnik IRC (chat): at {\field{\*\fldinst{HYPERLINK "irc://irc.freenode.net#mapnik"}}{\fldrslt irc.freenode.net}}\
-\
-Sign up and post to the community mailing list: {\field{\*\fldinst{HYPERLINK "http://lists.berlios.de/mailman/listinfo/mapnik-users"}}{\fldrslt Mapnik users}}\
-}
\ No newline at end of file
diff --git a/osx/installer/media/intro.rtf b/osx/installer/media/intro.rtf
deleted file mode 100644
index d9de75119..000000000
--- a/osx/installer/media/intro.rtf
+++ /dev/null
@@ -1,28 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
-{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
-{\colortbl;\red255\green255\blue255;\red0\green0\blue153;}
-\margl1440\margr1440\vieww18660\viewh8460\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0\b\fs28 \cf0 Mapnik
-\b0 is an OpenSource C++/Python toolkit for developing mapping applications.
-\fs26 \
-
-\fs24 \
-At the core is a C++ shared library providing algorithms/patterns for spatial data access and visualization.\
-\
-Essentially a collection of geographic objects (map, layer, datasource, feature, geometry), the library doesn't rely on "windowing systems" and can be deployed in any server environment. \
-\
-It is intended to play fair in a multi-threaded environment and is aimed primarily, but not exclusively, at web-based development.\
-\
-High-level Python bindings (boost.python) facilitate rapid application development, targeting zope3, django etc.\
-\
-Mapnik is a free software and is released under LGPL (GNU Lesser General Public Licence) (see COPYING)\
-\
-For further information see:\
- \'95 {\field{\*\fldinst{HYPERLINK "http://mapnik.org"}}{\fldrslt \cf2 \expnd0\expndtw0\kerning0
-\ul \ulc2 http://mapnik.org}}\
- \'95 {\field{\*\fldinst{HYPERLINK "http://trac.mapnik.org"}}{\fldrslt \cf2 \expnd0\expndtw0\kerning0
-\ul \ulc2 http://trac.mapnik.org}}\
- \'95 {\field{\*\fldinst{HYPERLINK "http://ohloh.net/p/mapnik"}}{\fldrslt \cf2 \expnd0\expndtw0\kerning0
-\ul \ulc2 http://ohloh.net/p/mapnik}}}
\ No newline at end of file
diff --git a/osx/installer/media/license.rtf b/osx/installer/media/license.rtf
deleted file mode 100644
index cd7d9704e..000000000
--- a/osx/installer/media/license.rtf
+++ /dev/null
@@ -1,177 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
-{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
-{\colortbl;\red255\green255\blue255;\red0\green0\blue153;}
-\margl1440\margr1440\vieww9000\viewh8400\viewkind0
-\deftab720
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\ql\qnatural\pardirnatural
-
-\f0\b\fs22 \cf0 \expnd0\expndtw0\kerning0
-GNU LESSER GENERAL PUBLIC LICENSE
-\b0 \
-
-\b Version 3, 29 June 2007
-\b0 \
-\
- Copyright (C) 2007 Free Software Foundation, Inc. <{\field{\*\fldinst{HYPERLINK "http://fsf.org"}}{\fldrslt \cf2 \expnd0\expndtw0\kerning0
-\ul \ulc2 http://fsf.org/}}>\
- Everyone is permitted to copy and distribute verbatim copies\
- of this license document, but changing it is not allowed.\
-\
-\
- This version of the GNU Lesser General Public License incorporates\
-the terms and conditions of version 3 of the GNU General Public\
-License, supplemented by the additional permissions listed below.\
-\
- 0. Additional Definitions.\
-\
- As used herein, "this License" refers to version 3 of the GNU Lesser\
-General Public License, and the "GNU GPL" refers to version 3 of the GNU\
-General Public License.\
-\
- "The Library" refers to a covered work governed by this License,\
-other than an Application or a Combined Work as defined below.\
-\
- An "Application" is any work that makes use of an interface provided\
-by the Library, but which is not otherwise based on the Library.\
-Defining a subclass of a class defined by the Library is deemed a mode\
-of using an interface provided by the Library.\
-\
- A "Combined Work" is a work produced by combining or linking an\
-Application with the Library. The particular version of the Library\
-with which the Combined Work was made is also called the "Linked\
-Version".\
-\
- The "Minimal Corresponding Source" for a Combined Work means the\
-Corresponding Source for the Combined Work, excluding any source code\
-for portions of the Combined Work that, considered in isolation, are\
-based on the Application, and not on the Linked Version.\
-\
- The "Corresponding Application Code" for a Combined Work means the\
-object code and/or source code for the Application, including any data\
-and utility programs needed for reproducing the Combined Work from the\
-Application, but excluding the System Libraries of the Combined Work.\
-\
- 1. Exception to Section 3 of the GNU GPL.\
-\
- You may convey a covered work under sections 3 and 4 of this License\
-without being bound by section 3 of the GNU GPL.\
-\
- 2. Conveying Modified Versions.\
-\
- If you modify a copy of the Library, and, in your modifications, a\
-facility refers to a function or data to be supplied by an Application\
-that uses the facility (other than as an argument passed when the\
-facility is invoked), then you may convey a copy of the modified\
-version:\
-\
- a) under this License, provided that you make a good faith effort to\
- ensure that, in the event an Application does not supply the\
- function or data, the facility still operates, and performs\
- whatever part of its purpose remains meaningful, or\
-\
- b) under the GNU GPL, with none of the additional permissions of\
- this License applicable to that copy.\
-\
- 3. Object Code Incorporating Material from Library Header Files.\
-\
- The object code form of an Application may incorporate material from\
-a header file that is part of the Library. You may convey such object\
-code under terms of your choice, provided that, if the incorporated\
-material is not limited to numerical parameters, data structure\
-layouts and accessors, or small macros, inline functions and templates\
-(ten or fewer lines in length), you do both of the following:\
-\
- a) Give prominent notice with each copy of the object code that the\
- Library is used in it and that the Library and its use are\
- covered by this License.\
-\
- b) Accompany the object code with a copy of the GNU GPL and this license\
- document.\
-\
- 4. Combined Works.\
-\
- You may convey a Combined Work under terms of your choice that,\
-taken together, effectively do not restrict modification of the\
-portions of the Library contained in the Combined Work and reverse\
-engineering for debugging such modifications, if you also do each of\
-the following:\
-\
- a) Give prominent notice with each copy of the Combined Work that\
- the Library is used in it and that the Library and its use are\
- covered by this License.\
-\
- b) Accompany the Combined Work with a copy of the GNU GPL and this license\
- document.\
-\
- c) For a Combined Work that displays copyright notices during\
- execution, include the copyright notice for the Library among\
- these notices, as well as a reference directing the user to the\
- copies of the GNU GPL and this license document.\
-\
- d) Do one of the following:\
-\
- 0) Convey the Minimal Corresponding Source under the terms of this\
- License, and the Corresponding Application Code in a form\
- suitable for, and under terms that permit, the user to\
- recombine or relink the Application with a modified version of\
- the Linked Version to produce a modified Combined Work, in the\
- manner specified by section 6 of the GNU GPL for conveying\
- Corresponding Source.\
-\
- 1) Use a suitable shared library mechanism for linking with the\
- Library. A suitable mechanism is one that (a) uses at run time\
- a copy of the Library already present on the user's computer\
- system, and (b) will operate properly with a modified version\
- of the Library that is interface-compatible with the Linked\
- Version.\
-\
- e) Provide Installation Information, but only if you would otherwise\
- be required to provide such information under section 6 of the\
- GNU GPL, and only to the extent that such information is\
- necessary to install and execute a modified version of the\
- Combined Work produced by recombining or relinking the\
- Application with a modified version of the Linked Version. (If\
- you use option 4d0, the Installation Information must accompany\
- the Minimal Corresponding Source and Corresponding Application\
- Code. If you use option 4d1, you must provide the Installation\
- Information in the manner specified by section 6 of the GNU GPL\
- for conveying Corresponding Source.)\
-\
- 5. Combined Libraries.\
-\
- You may place library facilities that are a work based on the\
-Library side by side in a single library together with other library\
-facilities that are not Applications and are not covered by this\
-License, and convey such a combined library under terms of your\
-choice, if you do both of the following:\
-\
- a) Accompany the combined library with a copy of the same work based\
- on the Library, uncombined with any other library facilities,\
- conveyed under the terms of this License.\
-\
- b) Give prominent notice with the combined library that part of it\
- is a work based on the Library, and explaining where to find the\
- accompanying uncombined form of the same work.\
-\
- 6. Revised Versions of the GNU Lesser General Public License.\
-\
- The Free Software Foundation may publish revised and/or new versions\
-of the GNU Lesser General Public License from time to time. Such new\
-versions will be similar in spirit to the present version, but may\
-differ in detail to address new problems or concerns.\
-\
- Each version is given a distinguishing version number. If the\
-Library as you received it specifies that a certain numbered version\
-of the GNU Lesser General Public License "or any later version"\
-applies to it, you have the option of following the terms and\
-conditions either of that published version or of any later version\
-published by the Free Software Foundation. If the Library as you\
-received it does not specify a version number of the GNU Lesser\
-General Public License, you may choose any version of the GNU Lesser\
-General Public License ever published by the Free Software Foundation.\
-\
- If the Library as you received it specifies that a proxy can decide\
-whether future versions of the GNU Lesser General Public License shall\
-apply, that proxy's public statement of acceptance of any version is\
-permanent authorization for you to choose that version for the\
-Library.}
\ No newline at end of file
diff --git a/osx/installer/media/mapnik.png b/osx/installer/media/mapnik.png
deleted file mode 100644
index 32265f91d..000000000
Binary files a/osx/installer/media/mapnik.png and /dev/null differ
diff --git a/osx/installer/pkg/readme.rtf b/osx/installer/pkg/readme.rtf
deleted file mode 100644
index eb322f53b..000000000
--- a/osx/installer/pkg/readme.rtf
+++ /dev/null
@@ -1,150 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
-{\fonttbl\f0\fnil\fcharset0 LucidaGrande;\f1\fnil\fcharset0 AndaleMono;}
-{\colortbl;\red255\green255\blue255;}
-\margl1440\margr1440\vieww11580\viewh11940\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0\fs32 \cf0 Welcome to Mapnik!
-\fs34 \
-
-\fs24 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b\fs28 \cf0 Quickstart
-\b0\fs22 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs24 \cf0 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b \cf0 \'95
-\b0 Install the "Mapnik.pkg".\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b\fs22 \cf0 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs24 \cf0 \'95
-\b0 Test your installation via Python:\
-\
- Open the Terminal.app and confirm that below command returns 'True':\
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 $ python -c "import mapnik2; print 'Mapnik.framework' in mapnik2.__file__"
-\f0 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs26 \cf0 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs24 \cf0 If it does then Mapnik is installed correctly! You can now head along to {\field{\*\fldinst{HYPERLINK "http://mapnik.org"}}{\fldrslt http://mapnik.org}} for documentation.
-\b\fs22 \
-
-\b0\fs24 \
- If it does not then you may need to add this line to your environment settings:\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 \
- export PYTHONPATH=/Library/Frameworks/Mapnik.framework/Python:$PYTHONPATH\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0 \cf0 \
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b\fs28 \cf0 Details\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b0\fs24 \cf0 \
-This installer only works for Snow Leopard (10.6).\
-\
-This install should play nicely with any existing installations of Mapnik.\
-\
-It automatically puts the following lines in your ~/.bash_profile to enable Mapnik:\
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 export PATH=/Library/Frameworks/Mapnik.framework/Programs:$PATH\
- export PYTHONPATH=/Library/Frameworks/Mapnik.framework/Python:$PYTHONPATH\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0 \cf0 \
-It also enables the Mapnik python bindings for QGIS/Python2.6 by putting a 'mapnik2.pth' file in:\
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 /Library/Python/2.6/site-packages\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0 \cf0 \
-This Mapnik installer includes:\
-\
- *
-\b Mapnik Core
-\b0 (mapnik library)\
- *
-\b Python bindings
-\b0 compatible with versions:\
- - 2.5, 2.6, 2.7, and 3.1\
- *
-\b Datasources
-\b0 (aka "input plugins"):\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs22 \cf0 - Shapefile, PostGIS, Raster, GDAL, OGR,\
- GEOS, SQLite, Rasterlite, OSM, Kismet \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs24 \cf0 *
-\b Dependencies:
-\b0 Boost, ICU, Cairo, Freetype2 and other minor libraries\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs26 \cf0 *
-\b GDAL_Complete-1.8.dmg
-\b0 from:\
-
-\fs24 - http://www.kyngchaos.com/software/frameworks
-\fs26 \
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\fs24 \cf0 \
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b\fs28 \cf0 Uninstalling\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b0\fs24 \cf0 \
-To disable this installation remove the lines including '
-\f1 /Library/Frameworks/Mapnik.framework'
-\f0 from your ~/.bash_profile\
-\
-And remove this file\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 \
- /Library/Python/2.6/site-packages/mapnik2.pth\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0 \cf0 \
-To fully remove the Installation remove this folder:\
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f1 \cf0 /Library/Frameworks/Mapnik.framework\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0 \cf0 \
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b\fs28 \cf0 Issues?\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\b0\fs24 \cf0 \
-Any questions or problems with the installer please get in touch with Dane (
-\b dane@dbsgeo.com
-\b0 ).\
-}
\ No newline at end of file
diff --git a/osx/installer/scripts/setup.sh b/osx/installer/scripts/setup.sh
deleted file mode 100755
index ea887d4bd..000000000
--- a/osx/installer/scripts/setup.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# TODO
-# - find safer way to do this: http://trac.mapnik.org/ticket/776
-# - check for ~/.profile so that adding a new bash_profile does not override
-
-# backup bash_profile
-cp ~/.bash_profile ~/.bash_profile.mapnik.backup
-
-# add installer Programs to PATH
-# by appending new entries to bash_profile
-echo '' >> ~/.bash_profile
-echo '# Settings for Mapnik.framework Installer to enable Mapnik programs and python bindings' >> ~/.bash_profile
-echo 'export PATH=/Library/Frameworks/Mapnik.framework/Programs:$PATH' >> ~/.bash_profile
-echo 'export PYTHONPATH=/Library/Frameworks/Mapnik.framework/Python:$PYTHONPATH' >> ~/.bash_profile
\ No newline at end of file
diff --git a/osx/patches/boost_python1_46_1_for_3.2.diff b/osx/patches/boost_python1_46_1_for_3.2.diff
deleted file mode 100644
index 46c33cb54..000000000
--- a/osx/patches/boost_python1_46_1_for_3.2.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: libs/python/src/converter/builtin_converters.cpp
-===================================================================
---- libs/python/src/converter/builtin_converters.cpp (revision 56305)
-+++ libs/python/src/converter/builtin_converters.cpp (revision 71050)
-@@ -432,5 +432,8 @@
- {
- int err = PyUnicode_AsWideChar(
-- (PyUnicodeObject *)intermediate
-+#if PY_VERSION_HEX < 0x03020000
-+ (PyUnicodeObject *)
-+#endif
-+ intermediate
- , &result[0]
- , result.size());
diff --git a/osx/patches/boost_python3k_bytes.diff b/osx/patches/boost_python3k_bytes.diff
deleted file mode 100644
index 8c6450cd4..000000000
--- a/osx/patches/boost_python3k_bytes.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: libs/python/src/converter/builtin_converters.cpp
-===================================================================
---- libs/python/src/converter/builtin_converters.cpp (revision 67415)
-+++ libs/python/src/converter/builtin_converters.cpp (working copy)
-@@ -375,7 +375,8 @@
- static unaryfunc* get_slot(PyObject* obj)
- {
- #if PY_VERSION_HEX >= 0x03000000
-- return (PyUnicode_Check(obj)) ? &py_unicode_as_string_unaryfunc : 0;
-+ return (PyUnicode_Check(obj)) ? &py_unicode_as_string_unaryfunc :
-+ PyBytes_Check(obj) ? &py_object_identity : 0;
- #else
- return (PyString_Check(obj)) ? &obj->ob_type->tp_str : 0;
-
diff --git a/osx/patches/mapnik-config.diff b/osx/patches/mapnik-config.diff
deleted file mode 100644
index 776f48592..000000000
--- a/osx/patches/mapnik-config.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-Index: utils/mapnik-config/SConscript
-===================================================================
---- utils/mapnik-config/SConscript (revision 2594)
-+++ utils/mapnik-config/SConscript (working copy)
-@@ -64,8 +64,8 @@
- version='%(version)s'
- mapnik_libname=%(mapnik_libname)s
- private_libs='%(private_libs)s'
--other_libs='%(other_libs)s'
--other_includes='%(other_includes)s'
-+other_libs='-arch i386 -arch x86_64 -headerpad_max_install_names -L/Library/Frameworks/Mapnik.framework/unix/lib -L/Library/Frameworks/UnixImageIO.framework/unix/lib -L/Library/Frameworks/PROJ.framework/unix/lib -lfreetype -licuuc -lboost_filesystem -lboost_regex -lboost_thread -lboost_system -lcairomm-1.0 -lcairo'
-+other_includes='-arch i386 -arch x86_64 -I/Library/Frameworks/Mapnik.framework/unix/include -I/Library/Frameworks/Mapnik.framework/unix/include/cairo -I/Library/Frameworks/Mapnik.framework/unix/include/cairomm-1.0 -I/Library/Frameworks/Mapnik.framework/unix/include/sigc++-2.0 -I/Library/Frameworks/Mapnik.framework/unix/lib/sigc++-2.0/include/ -I/Library/Frameworks/Mapnik.framework/unix/include/freetype2 -I/Library/Frameworks/UnixImageIO.framework/unix/include -I/Library/Frameworks/PROJ.framework/unix/include -I/usr/include/libxml2'
- fonts='%(fonts)s'
- input_plugins='%(input_plugins)s'
- svn_revision='%(svn_revision)s'
diff --git a/osx/patches/postgis_static.diff b/osx/patches/postgis_static.diff
deleted file mode 100644
index 97e72a6fd..000000000
--- a/osx/patches/postgis_static.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: plugins/input/postgis/SConscript
-===================================================================
---- plugins/input/postgis/SConscript (revision 2476)
-+++ plugins/input/postgis/SConscript (working copy)
-@@ -33,7 +33,11 @@
- """
- )
-
--libraries = ['pq']
-+static = '-lintl -liconv -lxml2 -lpam -lssl -lcrypto -lkrb5 -lldap -lreadline -lz'
-+libraries = ['pq_s']
-+libraries.extend(static.split(' '))
-+ldflags = env['CUSTOM_LDFLAGS']
-+ldflags += ' -framework CoreFoundation'
-
- if env['PLATFORM'] == 'Darwin':
- libraries.append('mapnik2')
-@@ -41,7 +45,7 @@
- if env['THREADING'] == 'multi':
- libraries.append('boost_thread%s' % env['BOOST_APPEND'])
-
--input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
-+input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=ldflags)
-
- if env['PLATFORM'] == 'Darwin':
- # if the plugin links to libmapnik2 ensure it is built first
diff --git a/osx/patches/tests.diff b/osx/patches/tests.diff
deleted file mode 100644
index 7c4a4f7ae..000000000
--- a/osx/patches/tests.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: tests/run_tests.py
-===================================================================
---- tests/run_tests.py (revision 2488)
-+++ tests/run_tests.py (working copy)
-@@ -46,7 +46,8 @@
-
- if not quiet:
- print "- mapnik2 path: %s" % mapnik2.__file__
-- print "- _mapnik2.so path: %s" % mapnik2._mapnik2.__file__
-+ if hasattr(mapnik2,'_mapnik2'):
-+ print "- _mapnik2.so path: %s" % mapnik2._mapnik2.__file__
- print "- Input plugins path: %s" % mapnik2.inputpluginspath
- print "- Font path: %s" % mapnik2.fontscollectionpath
- print
diff --git a/osx/patches/viewer.diff b/osx/patches/viewer.diff
deleted file mode 100644
index d43dc38f0..000000000
--- a/osx/patches/viewer.diff
+++ /dev/null
@@ -1,82 +0,0 @@
-Index: demo/viewer/viewer.pro
-===================================================================
---- demo/viewer/viewer.pro (revision 2594)
-+++ demo/viewer/viewer.pro (working copy)
-@@ -5,14 +5,33 @@
- TEMPLATE = app
-
- INCLUDEPATH += /usr/local/include/
--INCLUDEPATH += /usr/boost/include/
--INCLUDEPATH += /usr/X11/include/
--INCLUDEPATH += /usr/X11/include/freetype2
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/include
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/include/cairo
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/include/cairomm-1.0
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/include/sigc++-2.0
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/lib/sigc++-2.0/include/
-+INCLUDEPATH += /Library/Frameworks/Mapnik.framework/unix/include/freetype2
-+INCLUDEPATH += /Library/Frameworks/UnixImageIO.framework/unix/include
-+INCLUDEPATH += /Library/Frameworks/PROJ.framework/unix/include
-+INCLUDEPATH += /usr/include/libxml2
- INCLUDEPATH += .
-
--QMAKE_CXXFLAGS +=' -DDARWIN -Wno-missing-field-initializers -ansi'
--unix:LIBS = -L/usr/local/lib -L/usr/X11/lib -lmapnik2 -lfreetype
--unix:LIBS += -lboost_system -licuuc -lboost_filesystem -lboost_regex
-+QMAKE_CXXFLAGS +=' -arch i386 -arch x86_64 -DDARWIN -Wno-missing-field-initializers -ansi'
-+unix:LIBS = -arch i386
-+unix:LIBS += -arch x86_64
-+unix:LIBS += -headerpad_max_install_names
-+unix:LIBS += -L/Library/Frameworks/Mapnik.framework/unix/lib
-+unix:LIBS += -lmapnik2
-+unix:LIBS += -L/Library/Frameworks/UnixImageIO.framework/unix/lib
-+unix:LIBS += -L/Library/Frameworks/PROJ.framework/unix/lib
-+unix:LIBS += -lfreetype
-+unix:LIBS += -licuuc
-+unix:LIBS += -lboost_filesystem
-+unix:LIBS += -lboost_regex
-+unix:LIBS += -lboost_thread
-+unix:LIBS += -lboost_system
-+unix:LIBS += -lcairomm-1.0
-+unix:LIBS += -lcairo
-
- # Input
-
-Index: demo/viewer/main.cpp
-===================================================================
---- demo/viewer/main.cpp (revision 2594)
-+++ demo/viewer/main.cpp (working copy)
-@@ -43,22 +43,24 @@
-
- // register input plug-ins
- QString plugins_dir = settings.value("mapnik/plugins_dir",
-- QVariant("/usr/local/lib/mapnik2/input/")).toString();
-+ QVariant("/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib/mapnik2/input/")).toString();
- datasource_cache::instance()->register_datasources(plugins_dir.toStdString());
- // register fonts
-- int count = settings.beginReadArray("mapnik/fonts");
-- for (int index=0; index < count; ++index)
-- {
-- settings.setArrayIndex(index);
-- QString font_dir = settings.value("dir").toString();
-- freetype_engine::register_fonts(font_dir.toStdString());
-- }
-+ //int count = settings.beginReadArray("mapnik/fonts");
-+ //for (int index=0; index < count; ++index)
-+ //{
-+ // settings.setArrayIndex(index);
-+ // QString font_dir = settings.value("dir").toString();
-+ freetype_engine::register_fonts("/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib/mapnik2/fonts");
-+ //}
- settings.endArray();
-
- QApplication app( argc, argv );
- MainWindow window;
- window.show();
-- if (argc > 1) window.open(argv[1]);
-+ if (argc > 1) {
-+ window.open(argv[1]);
-+ }
- if (argc >= 3)
- {
- QStringList list = QString(argv[2]).split(",");
diff --git a/osx/python/cairo.py b/osx/python/cairo.py
deleted file mode 100644
index 1c55276e8..000000000
--- a/osx/python/cairo.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import sys
-
-ver_int = int('%s%s' % (sys.version_info[0],sys.version_info[1]))
-ver_str = '%s.%s' % (sys.version_info[0],sys.version_info[1])
-
-path_insert = '/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib/python%s/site-packages/'
-
-if ver_int < 26:
- raise ImportError('Cairo bindings are only available for python versions >= 2.6')
-elif ver_int in (26,27,31):
- sys.path.insert(0, path_insert % ver_str)
- from cairo import *
-elif ver_int > 31:
- raise ImportError('Cairo bindings are only available for python versions <= 3.1')
-else:
- raise ImportError('Cairo bindings are only available for python versions 2.6, 2.7, and 3.1')
-
diff --git a/osx/python/mapnik.py b/osx/python/mapnik.py
deleted file mode 100644
index c10775b5d..000000000
--- a/osx/python/mapnik.py
+++ /dev/null
@@ -1,779 +0,0 @@
-#
-# This file is part of Mapnik (C++/Python mapping toolkit)
-# Copyright (C) 2009 Artem Pavlenko, Dane Springmeyer
-#
-# Mapnik is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-"""Mapnik Python module.
-
-Boost Python bindings to the Mapnik C++ shared library.
-
-Several things happen when you do:
-
- >>> import mapnik
-
- 1) Mapnik C++ objects are imported via the '__init__.py' from the '_mapnik.so' shared object
- (_mapnik.pyd on win) which references libmapnik.so (linux), libmapnik.dylib (mac), or
- mapnik.dll (win32).
-
- 2) The paths to the input plugins and font directories are imported from the 'paths.py'
- file which was constructed and installed during SCons installation.
-
- 3) All available input plugins and TrueType fonts are automatically registered.
-
- 4) Boost Python metaclass injectors are used in the '__init__.py' to extend several
- objects adding extra convenience when accessed via Python.
-
-"""
-
-import os
-import sys
-import warnings
-
-try:
- from ctypes import RTLD_NOW, RTLD_GLOBAL
-except ImportError:
- try:
- from DLFCN import RTLD_NOW, RTLD_GLOBAL
- except ImportError:
- RTLD_NOW = 2
- RTLD_GLOBAL = 256
-
-flags = sys.getdlopenflags()
-sys.setdlopenflags(RTLD_NOW | RTLD_GLOBAL)
-
-ver_int = int('%s%s' % (sys.version_info[0],sys.version_info[1]))
-ver_str = '%s.%s' % (sys.version_info[0],sys.version_info[1])
-
-path_insert = '/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib/python%s/site-packages/mapnik2'
-
-if ver_int < 25:
- raise ImportError('Mapnik bindings are only available for python versions >= 2.5')
-elif ver_int in (25,26,27,31,32):
- sys.path.insert(0, path_insert % ver_str)
- from _mapnik2 import *
-elif ver_int > 32:
- raise ImportError('Mapnik bindings are only available for python versions <= 3.1')
-else:
- raise ImportError('Mapnik bindings are only available for python versions 2.5, 2.6, 2.7, and 3.1')
-
-from paths import inputpluginspath, fontscollectionpath
-
-#import printing
-#printing.renderer = render
-
-# The base Boost.Python class
-BoostPythonMetaclass = Coord.__class__
-
-class _MapnikMetaclass(BoostPythonMetaclass):
- def __init__(self, name, bases, dict):
- for b in bases:
- if type(b) not in (self, type):
- for k,v in list(dict.items()):
- if hasattr(b, k):
- setattr(b, '_c_'+k, getattr(b, k))
- setattr(b,k,v)
- return type.__init__(self, name, bases, dict)
-
-# metaclass injector compatible with both python 2 and 3
-# http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/
-_injector = _MapnikMetaclass('_injector', (object, ), {})
-
-def render_grid(m,layer,key,resolution=4,fields=[]):
- return render_grid_(m,layer,key,resolution,fields)
-
-def Filter(*args,**kwargs):
- warnings.warn("'Filter' is deprecated and will be removed in Mapnik 2.0.1, use 'Expression' instead",
- DeprecationWarning, 2)
- return Expression(*args, **kwargs)
-
-class Envelope(Box2d):
- def __init__(self, *args, **kwargs):
- warnings.warn("'Envelope' is deprecated and will be removed in Mapnik 2.0.1, use 'Box2d' instead",
- DeprecationWarning, 2)
- Box2d.__init__(self, *args, **kwargs)
-
-class _Coord(Coord,_injector):
- """
- Represents a point with two coordinates (either lon/lat or x/y).
-
- Following operators are defined for Coord:
-
- Addition and subtraction of Coord objects:
-
- >>> Coord(10, 10) + Coord(20, 20)
- Coord(30.0, 30.0)
- >>> Coord(10, 10) - Coord(20, 20)
- Coord(-10.0, -10.0)
-
- Addition, subtraction, multiplication and division between
- a Coord and a float:
-
- >>> Coord(10, 10) + 1
- Coord(11.0, 11.0)
- >>> Coord(10, 10) - 1
- Coord(-9.0, -9.0)
- >>> Coord(10, 10) * 2
- Coord(20.0, 20.0)
- >>> Coord(10, 10) / 2
- Coord(5.0, 5.0)
-
- Equality of coords (as pairwise equality of components):
- >>> Coord(10, 10) is Coord(10, 10)
- False
- >>> Coord(10, 10) == Coord(10, 10)
- True
- """
- def __repr__(self):
- return 'Coord(%s,%s)' % (self.x, self.y)
-
- def forward(self, projection):
- """
- Projects the point from the geographic coordinate
- space into the cartesian space. The x component is
- considered to be longitude, the y component the
- latitude.
-
- Returns the easting (x) and northing (y) as a
- coordinate pair.
-
- Example: Project the geographic coordinates of the
- city center of Stuttgart into the local
- map projection (GK Zone 3/DHDN, EPSG 31467)
- >>> p = Projection('+init=epsg:31467')
- >>> Coord(9.1, 48.7).forward(p)
- Coord(3507360.12813,5395719.2749)
- """
- return forward_(self, projection)
-
- def inverse(self, projection):
- """
- Projects the point from the cartesian space
- into the geographic space. The x component is
- considered to be the easting, the y component
- to be the northing.
-
- Returns the longitude (x) and latitude (y) as a
- coordinate pair.
-
- Example: Project the cartesian coordinates of the
- city center of Stuttgart in the local
- map projection (GK Zone 3/DHDN, EPSG 31467)
- into geographic coordinates:
- >>> p = Projection('+init=epsg:31467')
- >>> Coord(3507360.12813,5395719.2749).inverse(p)
- Coord(9.1, 48.7)
- """
- return inverse_(self, projection)
-
-class _Box2d(Box2d,_injector):
- """
- Represents a spatial envelope (i.e. bounding box).
-
-
- Following operators are defined for Box2d:
-
- Addition:
- e1 + e2 is equvalent to e1.expand_to_include(e2) but yields
- a new envelope instead of modifying e1
-
- Subtraction:
- Currently e1 - e2 returns e1.
-
- Multiplication and division with floats:
- Multiplication and division change the width and height of the envelope
- by the given factor without modifying its center..
-
- That is, e1 * x is equivalent to:
- e1.width(x * e1.width())
- e1.height(x * e1.height()),
- except that a new envelope is created instead of modifying e1.
-
- e1 / x is equivalent to e1 * (1.0/x).
-
- Equality: two envelopes are equal if their corner points are equal.
- """
-
- def __repr__(self):
- return 'Box2d(%s,%s,%s,%s)' % \
- (self.minx,self.miny,self.maxx,self.maxy)
-
- def forward(self, projection):
- """
- Projects the envelope from the geographic space
- into the cartesian space by projecting its corner
- points.
-
- See also:
- Coord.forward(self, projection)
- """
- return forward_(self, projection)
-
- def inverse(self, projection):
- """
- Projects the envelope from the cartesian space
- into the geographic space by projecting its corner
- points.
-
- See also:
- Coord.inverse(self, projection).
- """
- return inverse_(self, projection)
-
-class _Projection(Projection,_injector):
-
- def __repr__(self):
- return "Projection('%s')" % self.params()
-
- def forward(self,obj):
- """
- Projects the given object (Box2d or Coord)
- from the geographic space into the cartesian space.
-
- See also:
- Box2d.forward(self, projection),
- Coord.forward(self, projection).
- """
- return forward_(obj,self)
-
- def inverse(self,obj):
- """
- Projects the given object (Box2d or Coord)
- from the cartesian space into the geographic space.
-
- See also:
- Box2d.inverse(self, projection),
- Coord.inverse(self, projection).
- """
- return inverse_(obj,self)
-
-def get_types(num):
- dispatch = {1: int,
- 2: float,
- 3: float,
- 4: str,
- 5: Geometry2d,
- 6: object}
- return dispatch.get(num)
-
-class _Datasource(Datasource,_injector):
-
- def describe(self):
- return Describe(self)
-
- def field_types(self):
- return map(get_types,self._field_types())
-
- def all_features(self,fields=None):
- query = Query(self.envelope())
- attributes = fields or self.fields()
- for fld in attributes:
- query.add_property_name(fld)
- return self.features(query).features
-
- def featureset(self,fields=None):
- query = Query(self.envelope())
- attributes = fields or self.fields()
- for fld in attributes:
- query.add_property_name(fld)
- return self.features(query)
-
-class _DeprecatedFeatureProperties(object):
-
- def __init__(self, feature):
- self._feature = feature
-
- def __getitem__(self, name):
- warnings.warn("indexing feature.properties is deprecated, index the "
- "feature object itself for the same effect", DeprecationWarning, 2)
- return self._feature[name]
-
- def __iter__(self):
- warnings.warn("iterating feature.properties is deprecated, iterate the "
- "feature object itself for the same effect", DeprecationWarning, 2)
- return iter(self._feature)
-
-class _Feature(Feature, _injector):
- """
- A Feature.
-
- TODO: docs
- """
- @property
- def properties(self):
- return _DeprecatedFeatureProperties(self)
-
- @property
- def attributes(self):
- #XXX Returns a copy! changes to it won't affect feat.'s attrs.
- # maybe deprecate?
- return dict(self)
-
- @property
- def geometries(self):
- return [self.get_geometry(i) for i in xrange(self.num_geometries())]
-
- def __init__(self, id, geometry=None, **properties):
- Feature._c___init__(self, id)
- if geometry is not None:
- self.add_geometry(geometry)
- for k, v in properties.iteritems():
- self[k] = v
-
-class _Color(Color,_injector):
-
- def __repr__(self):
- return "Color(%r)" % self.to_hex_string()
-
-class _Symbolizers(Symbolizers,_injector):
-
- def __getitem__(self, idx):
- sym = Symbolizers._c___getitem__(self, idx)
- return sym.symbol()
-
-def _add_symbol_method_to_symbolizers(vars=globals()):
-
- def symbol_for_subcls(self):
- return self
-
- def symbol_for_cls(self):
- return getattr(self,self.type())()
-
- for name, obj in vars.items():
- if name.endswith('Symbolizer') and not name.startswith('_'):
- if name == 'Symbolizer':
- symbol = symbol_for_cls
- else:
- symbol = symbol_for_subcls
- type('dummy', (obj,_injector), {'symbol': symbol})
-_add_symbol_method_to_symbolizers()
-
-def Datasource(**keywords):
- """Wrapper around CreateDatasource.
-
- Create a Mapnik Datasource using a dictionary of parameters.
-
- Keywords must include:
-
- type='plugin_name' # e.g. type='gdal'
-
- See the convenience factory methods of each input plugin for
- details on additional required keyword arguments.
-
- """
-
- return CreateDatasource(keywords)
-
-# convenience factory methods
-
-def Shapefile(**keywords):
- """Create a Shapefile Datasource.
-
- Required keyword arguments:
- file -- path to shapefile without extension
-
- Optional keyword arguments:
- base -- path prefix (default None)
- encoding -- file encoding (default 'utf-8')
-
- >>> from mapnik import Shapefile, Layer
- >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders')
- >>> lyr = Layer('Shapefile Layer')
- >>> lyr.datasource = shp
-
- """
- keywords['type'] = 'shape'
- return CreateDatasource(keywords)
-
-def PostGIS(**keywords):
- """Create a PostGIS Datasource.
-
- Required keyword arguments:
- dbname -- database name to connect to
- table -- table name or subselect query
-
- *Note: if using subselects for the 'table' value consider also
- passing the 'geometry_field' and 'srid' and 'extent_from_subquery'
- options and/or specifying the 'geometry_table' option.
-
- Optional db connection keyword arguments:
- user -- database user to connect as (default: see postgres docs)
- password -- password for database user (default: see postgres docs)
- host -- portgres hostname (default: see postgres docs)
- port -- postgres port (default: see postgres docs)
- initial_size -- integer size of connection pool (default: 1)
- max_size -- integer max of connection pool (default: 10)
- persist_connection -- keep connection open (default: True)
-
- Optional table-level keyword arguments:
- extent -- manually specified data extent (comma delimited string, default: None)
- estimate_extent -- boolean, direct PostGIS to use the faster, less accurate `estimate_extent` over `extent` (default: False)
- extent_from_subquery -- boolean, direct Mapnik to query Postgis for the extent of the raw 'table' value (default: uses 'geometry_table')
- geometry_table -- specify geometry table to use to look up metadata (default: automatically parsed from 'table' value)
- geometry_field -- specify geometry field to use (default: first entry in geometry_columns)
- srid -- specify srid to use (default: auto-detected from geometry_field)
- row_limit -- integer limit of rows to return (default: 0)
- cursor_size -- integer size of binary cursor to use (default: 0, no binary cursor is used)
- multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)
-
- >>> from mapnik import PostGIS, Layer
- >>> params = dict(dbname='mapnik',table='osm',user='postgres',password='gis')
- >>> params['estimate_extent'] = False
- >>> params['extent'] = '-20037508,-19929239,20037508,19929239'
- >>> postgis = PostGIS(**params)
- >>> lyr = Layer('PostGIS Layer')
- >>> lyr.datasource = postgis
-
- """
- keywords['type'] = 'postgis'
- return CreateDatasource(keywords)
-
-
-def Raster(**keywords):
- """Create a Raster (Tiff) Datasource.
-
- Required keyword arguments:
- file -- path to stripped or tiled tiff
- lox -- lowest (min) x/longitude of tiff extent
- loy -- lowest (min) y/latitude of tiff extent
- hix -- highest (max) x/longitude of tiff extent
- hiy -- highest (max) y/latitude of tiff extent
-
- Hint: lox,loy,hix,hiy make a Mapnik Box2d
-
- Optional keyword arguments:
- base -- path prefix (default None)
-
- >>> from mapnik import Raster, Layer
- >>> raster = Raster(base='/home/mapnik/data',file='elevation.tif',lox=-122.8,loy=48.5,hix=-122.7,hiy=48.6)
- >>> lyr = Layer('Tiff Layer')
- >>> lyr.datasource = raster
-
- """
- keywords['type'] = 'raster'
- return CreateDatasource(keywords)
-
-def Gdal(**keywords):
- """Create a GDAL Raster Datasource.
-
- Required keyword arguments:
- file -- path to GDAL supported dataset
-
- Optional keyword arguments:
- base -- path prefix (default None)
- shared -- boolean, open GdalDataset in shared mode (default: False)
- bbox -- tuple (minx, miny, maxx, maxy). If specified, overrides the bbox detected by GDAL.
-
- >>> from mapnik import Gdal, Layer
- >>> dataset = Gdal(base='/home/mapnik/data',file='elevation.tif')
- >>> lyr = Layer('GDAL Layer from TIFF file')
- >>> lyr.datasource = dataset
-
- """
- keywords['type'] = 'gdal'
- if 'bbox' in keywords:
- if isinstance(keywords['bbox'], (tuple, list)):
- keywords['bbox'] = ','.join([str(item) for item in keywords['bbox']])
- return CreateDatasource(keywords)
-
-def Occi(**keywords):
- """Create a Oracle Spatial (10g) Vector Datasource.
-
- Required keyword arguments:
- user -- database user to connect as
- password -- password for database user
- host -- oracle host to connect to (does not refer to SID in tsnames.ora)
- table -- table name or subselect query
-
- Optional keyword arguments:
- initial_size -- integer size of connection pool (default 1)
- max_size -- integer max of connection pool (default 10)
- extent -- manually specified data extent (comma delimited string, default None)
- estimate_extent -- boolean, direct Oracle to use the faster, less accurate estimate_extent() over extent() (default False)
- encoding -- file encoding (default 'utf-8')
- geometry_field -- specify geometry field (default 'GEOLOC')
- use_spatial_index -- boolean, force the use of the spatial index (default True)
- multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)
-
- >>> from mapnik import Occi, Layer
- >>> params = dict(host='myoracle',user='scott',password='tiger',table='test')
- >>> params['estimate_extent'] = False
- >>> params['extent'] = '-20037508,-19929239,20037508,19929239'
- >>> oracle = Occi(**params)
- >>> lyr = Layer('Oracle Spatial Layer')
- >>> lyr.datasource = oracle
- """
- keywords['type'] = 'occi'
- return CreateDatasource(keywords)
-
-def Ogr(**keywords):
- """Create a OGR Vector Datasource.
-
- Required keyword arguments:
- file -- path to OGR supported dataset
- layer -- name of layer to use within datasource (optional if layer_by_index is used)
-
- Optional keyword arguments:
- layer_by_index -- choose layer by index number instead of by layer name.
- base -- path prefix (default None)
- encoding -- file encoding (default 'utf-8')
- multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)
-
- >>> from mapnik import Ogr, Layer
- >>> datasource = Ogr(base='/home/mapnik/data',file='rivers.geojson',layer='OGRGeoJSON')
- >>> lyr = Layer('OGR Layer from GeoJSON file')
- >>> lyr.datasource = datasource
-
- """
- keywords['type'] = 'ogr'
- return CreateDatasource(keywords)
-
-def SQLite(**keywords):
- """Create a SQLite Datasource.
-
- Required keyword arguments:
- file -- path to SQLite database file
- table -- table name or subselect query
-
- Optional keyword arguments:
- base -- path prefix (default None)
- encoding -- file encoding (default 'utf-8')
- extent -- manually specified data extent (comma delimited string, default None)
- metadata -- name of auxillary table containing record for table with xmin, ymin, xmax, ymax, and f_table_name
- geometry_field -- name of geometry field (default 'the_geom')
- key_field -- name of primary key field (default 'OGC_FID')
- row_offset -- specify a custom integer row offset (default 0)
- row_limit -- specify a custom integer row limit (default 0)
- wkb_format -- specify a wkb type of 'spatialite' (default None)
- multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False)
- use_spatial_index -- boolean, instruct sqlite plugin to use Rtree spatial index (default True)
-
- >>> from mapnik import SQLite, Layer
- >>> sqlite = SQLite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239')
- >>> lyr = Layer('SQLite Layer')
- >>> lyr.datasource = sqlite
-
- """
- keywords['type'] = 'sqlite'
- return CreateDatasource(keywords)
-
-def Rasterlite(**keywords):
- """Create a Rasterlite Datasource.
-
- Required keyword arguments:
- file -- path to Rasterlite database file
- table -- table name or subselect query
-
- Optional keyword arguments:
- base -- path prefix (default None)
- extent -- manually specified data extent (comma delimited string, default None)
-
- >>> from mapnik import Rasterlite, Layer
- >>> rasterlite = Rasterlite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239')
- >>> lyr = Layer('Rasterlite Layer')
- >>> lyr.datasource = rasterlite
-
- """
- keywords['type'] = 'rasterlite'
- return CreateDatasource(keywords)
-
-def Osm(**keywords):
- """Create a Osm Datasource.
-
- Required keyword arguments:
- file -- path to OSM file
-
- Optional keyword arguments:
- encoding -- file encoding (default 'utf-8')
- url -- url to fetch data (default None)
- bbox -- data bounding box for fetching data (default None)
-
- >>> from mapnik import Osm, Layer
- >>> datasource = Osm(file='test.osm')
- >>> lyr = Layer('Osm Layer')
- >>> lyr.datasource = datasource
-
- """
- # note: parser only supports libxml2 so not exposing option
- # parser -- xml parser to use (default libxml2)
- keywords['type'] = 'osm'
- return CreateDatasource(keywords)
-
-def Kismet(**keywords):
- """Create a Kismet Datasource.
-
- Required keyword arguments:
- host -- kismet hostname
- port -- kismet port
-
- Optional keyword arguments:
- encoding -- file encoding (default 'utf-8')
- extent -- manually specified data extent (comma delimited string, default None)
-
- >>> from mapnik import Kismet, Layer
- >>> datasource = Kismet(host='localhost',port=2501,extent='-179,-85,179,85')
- >>> lyr = Layer('Kismet Server Layer')
- >>> lyr.datasource = datasource
-
- """
- keywords['type'] = 'kismet'
- return CreateDatasource(keywords)
-
-def Geos(**keywords):
- """Create a GEOS Vector Datasource.
-
- Required keyword arguments:
- wkt -- inline WKT text of the geometry
-
- Optional keyword arguments:
- multiple_geometries -- boolean, direct the GEOS wkt reader to interpret as multigeometries (default False)
- extent -- manually specified data extent (comma delimited string, default None)
-
- >>> from mapnik import Geos, Layer
- >>> datasource = Geos(wkt='MULTIPOINT(100 100, 50 50, 0 0)')
- >>> lyr = Layer('GEOS Layer from WKT string')
- >>> lyr.datasource = datasource
-
- """
- keywords['type'] = 'geos'
- return CreateDatasource(keywords)
-
-def mapnik_version_string(version=mapnik_version()):
- """Return the Mapnik version as a string."""
- patch_level = version % 100
- minor_version = version / 100 % 1000
- major_version = version / 100000
- return '%s.%s.%s' % ( major_version, minor_version,patch_level)
-
-def mapnik_version_from_string(version_string):
- """Return the Mapnik version from a string."""
- n = version_string.split('.')
- return (int(n[0]) * 100000) + (int(n[1]) * 100) + (int(n[2]));
-
-def register_plugins(path=inputpluginspath):
- """Register plugins located by specified path"""
- DatasourceCache.instance().register_datasources(path)
-
-def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.ttc','.pfa','.pfb','.ttc','.dfont']):
- """Recursively register fonts using path argument as base directory"""
- for dirpath, _, filenames in os.walk(path):
- for filename in filenames:
- if os.path.splitext(filename)[1] in valid_extensions:
- FontEngine.instance().register_font(os.path.join(dirpath, filename))
-
-# auto-register known plugins and fonts
-register_plugins()
-register_fonts()
-
-#set dlopen flags back to the original
-sys.setdlopenflags(flags)
-
-# Explicitly export API members to avoid namespace pollution
-# and ensure correct documentation processing
-__all__ = [
- # classes
- 'Color',
- 'Coord',
- #'ColorBand',
- 'CompositeOp',
- 'DatasourceCache',
- 'Box2d',
- 'Feature',
- 'Featureset',
- 'FontEngine',
- 'Geometry2d',
- 'GlyphSymbolizer',
- 'Image',
- 'ImageView',
- 'Layer',
- 'Layers',
- 'LinePatternSymbolizer',
- 'LineSymbolizer',
- 'Map',
- 'MarkersSymbolizer',
- 'Names',
- 'Parameter',
- 'Parameters',
- 'PointDatasource',
- 'PointSymbolizer',
- 'PolygonPatternSymbolizer',
- 'PolygonSymbolizer',
- 'ProjTransform',
- 'Projection',
- 'Query',
- 'RasterSymbolizer',
- 'RasterColorizer',
- 'Rule', 'Rules',
- 'ShieldSymbolizer',
- 'Singleton',
- 'Stroke',
- 'Style',
- 'Symbolizer',
- 'Symbolizers',
- 'TextSymbolizer',
- 'ViewTransform',
- # enums
- 'aspect_fix_mode',
- 'point_placement',
- 'label_placement',
- 'line_cap',
- 'line_join',
- 'text_transform',
- 'vertical_alignment',
- 'horizontal_alignment',
- 'justify_alignment',
- 'pattern_alignment',
- 'filter_mode',
- # functions
- # datasources
- 'Datasource',
- 'CreateDatasource',
- 'Shapefile',
- 'PostGIS',
- 'Raster',
- 'Gdal',
- 'Occi',
- 'Ogr',
- 'SQLite',
- 'Osm',
- 'Kismet',
- 'Describe',
- # version and environment
- 'mapnik_version_string',
- 'mapnik_version',
- 'mapnik_svn_revision',
- 'has_cairo',
- 'has_pycairo',
- # factory methods
- 'Expression',
- 'PathExpression',
- # load/save/render
- 'load_map',
- 'load_map_from_string',
- 'save_map',
- 'save_map_to_string',
- 'render',
- 'render_grid',
- 'render_tile_to_file',
- 'render_to_file',
- # other
- 'register_plugins',
- 'register_fonts',
- 'scale_denominator',
- # deprecated
- 'Filter',
- 'Envelope',
- ]
diff --git a/osx/scripts/build_boost_pythons.py b/osx/scripts/build_boost_pythons.py
deleted file mode 100644
index df68524ff..000000000
--- a/osx/scripts/build_boost_pythons.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# script to build boost python versions
-# this should be run with the boost source directory as the cwd
-
-import os
-import sys
-
-USER_JAM = """
-import option ;
-import feature ;
-if ! darwin in [ feature.values ]
-{
- using darwin ;
-}
-project : default-build darwin ;
-using python
- : %(ver)s # version
- : %(system)s/Library/Frameworks/Python.framework/Versions/%(ver)s/bin/python%(ver)s%(variant)s # cmd-or-prefix
- : %(system)s/Library/Frameworks/Python.framework/Versions/%(ver)s/include/python%(ver)s%(variant)s # includes
- : %(system)s/Library/Frameworks/Python.framework/Versions/%(ver)s/lib/python%(ver)s/config%(variant)s # a lib actually symlink
- : darwin # condition
- ;
-libraries = --with-python ;
-"""
-
-def compile_lib(ver,arch='32_64'):
- if ver in ('3.2'):
- open('user-config.jam','w').write(USER_JAM % {'ver':ver,'system':'','variant':'m'})
- elif ver in ('2.5','2.6'):
- # build against system pythons so we can reliably link against FAT binaries
- open('user-config.jam','w').write(USER_JAM % {'ver':ver,'system':'/System','variant':''})
- else:
- # for 2.7 and above hope that python.org provides 64 bit ready binaries...
- open('user-config.jam','w').write(USER_JAM % {'ver':ver,'system':'','variant':''})
- cmd = "./bjam -q --with-python -a -j2 --ignore-site-config --user-config=user-config.jam link=shared toolset=darwin -d2 address-model=%s architecture=x86 variant=release stage" % arch#linkflags=-search_paths_first
- print cmd
- os.system(cmd)
-
-if __name__ == '__main__':
- if not len(sys.argv) > 2:
- sys.exit('usage: %s ' % os.path.basename(sys.argv[0]))
- compile_lib(sys.argv[1],sys.argv[2])
-
-
\ No newline at end of file
diff --git a/osx/scripts/fetch_py_releases.sh b/osx/scripts/fetch_py_releases.sh
deleted file mode 100755
index 3e924103d..000000000
--- a/osx/scripts/fetch_py_releases.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# http://www.python.org/download/releases/
-# http://www.python.org/ftp/python/
-
-# 2.5.4 (2.5.5 did not provide binaries)
-wget http://www.python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg
-
-# 2.6.6
-wget http://www.python.org/ftp/python/2.6.6/python-2.6.6-macosx10.3.dmg
-
-# 2.7
-wget http://www.python.org/ftp/python/2.7.2/python-2.7.2-macosx10.6.dmg
-
-# 3.1.x does not provide 64 bit versions for some reasons, so skip...
-#wget http://www.python.org/ftp/python/3.1.3/python-3.1.3-macosx10.3.dmg
-#wget http://www.python.org/ftp/python/3.1.2/Python-3.1.2.tar.bz2
-
-# 3.2
-wget http://www.python.org/ftp/python/3.2.1/python-3.2.1-macosx10.6.dmg
\ No newline at end of file
diff --git a/osx/scripts/package.py b/osx/scripts/package.py
deleted file mode 100644
index 06913533c..000000000
--- a/osx/scripts/package.py
+++ /dev/null
@@ -1,68 +0,0 @@
-import os
-import re
-import sys
-import datetime
-from subprocess import PIPE, Popen, call as subcall
-
-now = datetime.datetime.now()
-date = now.strftime('%Y_%m_%d') # year, mon, day
-
-INSTALL = False
-
-plat = 'snow_leopard'
-arch = 'intel'
-version = '2.0.0'#-dev
-
-def get(cmd):
- try:
- sub = cmd.split(' ')
- response = Popen(sub, stdin=PIPE, stdout=PIPE, stderr=PIPE)
- cm = response.communicate()
- return cm[0]
- if not cm[0]:
- sys.exit(cm[1])
- except OSError, E:
- sys.exit(E)
-
-if plat == 'snow_leopard':
- short_plat = 'snow'
-else:
- short_plat = plat
-
-def get_svn():
- pattern = r'(\d+)(.*)'
- svn_version = get('svnversion ../')
- return re.match(pattern,svn_version).groups()[0]
-
-svn = get_svn()
-
-identifier = '''mapnik build log
-----------------
-version: %(version)s
-os: %(plat)s
-arch: %(arch)s
-date: %(date)s
-svn revision: %(svn)s
-
-''' % locals()
-
-if __name__ == '__main__':
-
-
- if not os.path.exists('installer'):
- sys.exit("must be run from directory below 'installer' dir")
-
- print 'removing old files'
- #os.system('rm installer/pkg/Mapnik.pkg')
- os.system('rm installer/*dmg')
-
- print 'writing build log'
- open('installer/pkg/build_log.txt','w').write(identifier)
-
- cmd = 'packagemaker --doc installer/mapnik.pmdoc --out installer/pkg/Mapnik.pkg'
- print cmd
- #os.system(cmd)
-
- cmd = 'hdiutil create "installer/mapnik_%s_%s_%s_%s_%s.dmg" -volname "Mapnik %s" -fs HFS+ -srcfolder installer/pkg' % (version,short_plat,arch,date,svn,version)
- print cmd
- os.system(cmd)
diff --git a/osx/scripts/setup.sh b/osx/scripts/setup.sh
deleted file mode 100644
index 59e5ac70f..000000000
--- a/osx/scripts/setup.sh
+++ /dev/null
@@ -1,421 +0,0 @@
-
-# start here
-cd osx/sources
-
-# build icu and boost for packaging up within Mapnik Framework
-
-# local install location
-PREFIX=/Users/dane/projects/mapnik-dev/trunk-build/osx/sources
-mkdir -p $PREFIX
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-# final resting place
-INSTALL=/Library/Frameworks/Mapnik.framework/unix/lib
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
-export CFLAGS="-O3 -arch i386 -arch x86_64"
-export CXXFLAGS="-O3 -arch i386 -arch x86_64"
-export LDFLAGS="-arch i386 -arch x86_64 -headerpad_max_install_names"
-# universal flags
-export CFLAGS="-O3 -arch i386 -arch x86_64"
-export CXXFLAGS="-O3 -arch i386 -arch x86_64"
-export LDFLAGS="-arch i386 -arch x86_64 -headerpad_max_install_names"
-
-
-# make a directory to hold icu and boost
-mkdir -p ../deps
-cd ../deps
-
-# ICU
-wget http://download.icu-project.org/files/icu4c/4.6/icu4c-4_6-src.tgz
-tar xvf icu4c-4_6-src.tgz
-cd icu/source
-
-# universal flags
-#./runConfigureICU MacOSX --prefix=$PREFIX --disable-static --enable-shared --disable-samples --disable-icuio --disable-layout --disable-tests --disable-extras --with-library-bits=64
-./runConfigureICU MacOSX --prefix=$PREFIX --disable-static --enable-shared --with-library-bits=64
-make install -j4
-# note -R is needed to preserve the symlinks
-#cp -R lib/libicuuc.* ../../../sources/lib/
-#cp -R lib/libicudata.* ../../../sources/lib/
-cd ../../../sources/lib/
-
-
-# libicuuc
-install_name_tool -id $INSTALL/libicuuc.46.dylib libicuuc.46.0.dylib
-# --enable-layout
-#install_name_tool -change ../lib/libicudata.46.0.dylib $INSTALL/libicudata.46.dylib libicuuc.46.0.dylib
-#--disable-layout
-install_name_tool -change libicudata.46.dylib $INSTALL/libicudata.46.dylib libicuuc.46.0.dylib
-# libicudata
-install_name_tool -id $INSTALL/libicudata.46.dylib libicudata.46.0.dylib
-# libicui18n - needed by boost_regex
-install_name_tool -id $INSTALL/libicui18n.46.dylib libicui18n.46.0.dylib
-# --enable-layout
-#install_name_tool -change ../lib/libicudata.46.0.dylib $INSTALL/libicudata.46.dylib libicui18n.46.0.dylib
-#--disable-layout
-install_name_tool -change libicudata.46.dylib $INSTALL/libicudata.46.dylib libicui18n.46.0.dylib
-install_name_tool -change libicuuc.46.dylib $INSTALL/libicuuc.46.dylib libicui18n.46.0.dylib
-cd ../
-
-
-# freetype2
-wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.4.tar.gz
-tar xvf freetype-2.4.4.tar.gz
-export CFLAGS="-O3 -arch i386 -arch x86_64"
-export LDFLAGS="-arch i386 -arch x86_64 -headerpad_max_install_names"
-cd freetype-2.4.4
-./configure --prefix=$PREFIX
-make -j4
-make install
-install_name_tool -id $INSTALL/libfreetype.6.dylib ../../sources/lib/libfreetype.6.dylib
-cd ../
-
-# pkg-config so we get cairo and friends configured correctly
-wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz
-tar xvf pkg-config-0.26.tar.gz
-cd pkg-config-0.26
-./configure --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-
-# pixman
-wget http://cairographics.org/releases/pixman-0.22.2.tar.gz
-tar xvf pixman-0.22.2.tar.gz
-cd pixman-0.22.2
-./configure --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../../sources/lib/
-install_name_tool -id $INSTALL/libpixman-1.0.dylib ../../sources/lib/libpixman-1.0.dylib
-cd ../
-
-# fontconfig
-wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.8.0.tar.gz
-tar xvf fontconfig-2.8.0.tar.gz
-cd fontconfig-2.8.0
-./configure --disable-dependency-tracking --prefix=$PREFIX \
- --with-freetype-config=$PREFIX/bin/freetype-config
-make -j4
-make install
-install_name_tool -id $INSTALL/libfontconfig.1.dylib ../../sources/lib/libfontconfig.1.dylib
-cd ../
-
-# Cairo
-wget http://cairographics.org/releases/cairo-1.10.2.tar.gz
-tar xvf cairo-1.10.2.tar.gz
-cd cairo-1.10.2
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export LDFLAGS="-L/Library/Frameworks/UnixImageIO.framework/unix/lib "$LDFLAGS
-export CFLAGS="-I/Library/Frameworks/UnixImageIO.framework/unix/include "$CFLAGS
-export png_CFLAGS="-I/Library/Frameworks/UnixImageIO.framework/unix/include"
-export png_LIBS="-I/Library/Frameworks/UnixImageIO.framework/unix/lib -lpng15"
-./configure \
- --disable-valgrind \
- --enable-gobject=no \
- --enable-static=no \
- --enable-xlib=no \
- --enable-xlib-xrender=no \
- --enable-xcb=no \
- --enable-xlib-xcb=no \
- --enable-xcb-shm=no \
- --enable-xcb-drm=no \
- --disable-dependency-tracking \
- --prefix=$PREFIX
-
-make -j4
-make install
-install_name_tool -id $INSTALL/libcairo.2.dylib ../../sources/lib/libcairo.2.dylib
-cd ../
-
-# since linking to libpng framework (which does not provide a pkg-config) fake it:
-# match to /Library/Frameworks/UnixImageIO.framework/unix/
-# vim ../sources/lib/pkgconfig/libpng.pc
-
-prefix=/Library/Frameworks/UnixImageIO.framework/unix
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include/libpng15
-
-Name: libpng
-Description: Loads and saves PNG files
-Version: 1.5
-Libs: -L${libdir} -lpng15
-Libs.private: -lz
-Cflags: -I${includedir}
-
-
-# libsigcxx
-wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.10.tar.bz2
-tar xvf libsigc++-2.2.10.tar.bz2
-cd libsigc++-2.2.10
-./configure --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-install_name_tool -id $INSTALL/libsigc-2.0.dylib ../../sources/lib/libsigc-2.0.dylib
-cd ../
-
-wget http://cairographics.org/releases/cairomm-1.9.8.tar.gz
-tar xvf cairomm-1.9.8.tar.gz
-cd cairomm-1.9.8
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export LDFLAGS="-L$PREFIX/lib -lcairo -lsigc-2.0 "$LDFLAGS
-export CFLAGS="-I$PREFIX/include -I$PREFIX/include/cairo -I$PREFIX/include/freetype2 -I$PREFIX/lib/sigc++-2.0/include -I$PREFIX/include/sigc++-2.0 -I$PREFIX/include/sigc++-2.0/sigc++ "$CFLAGS
-export CXXFLAGS="-I$PREFIX/include "$CFLAGS
-
-./configure --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-
-install_name_tool -id $INSTALL/libcairomm-1.0.1.dylib ../../sources/lib/libcairomm-1.0.1.dylib
-
-# also make sure cairo and friends did not link against anything in /opt/local or /usr/local
-otool -L ../../sources/lib/*dylib | grep local
-
-# ensure we're linking to the right image libs
-otool -L ../../sources/lib/*dylib | grep UnixImageIO
-
-# pycairo
-# >= python 3.1
-#wget http://cairographics.org/releases/pycairo-1.8.10.tar.bz2
-#tar xvf pycairo-1.8.10.tar.bz2
-#./waf configure
-
-#wget http://cairographics.org/releases/pycairo-1.8.8.tar.gz
-#tar xvf pycairo-1.8.8.tar.gz
-#cd pycairo-1.8.8
-
-# py25
-# line 35 of configure.ac AM_PATH_PYTHON(2.5)
-#export PATH=/Library/Frameworks/Python.framework/Versions/2.5/bin/:$PATH
-#./configure --prefix=$PREFIX
-#make -j4 install
-
-# py26
-#export PATH=/Library/Frameworks/Python.framework/Versions/2.6/bin/:$PATH
-#./configure --prefix=$PREFIX
-#make -j4 install
-
-#py27
-#export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin/:$PATH
-#make clean
-#./configure --prefix=$PREFIX
-#make -j4 install
-
-
-# boost
-cd ../../deps
-wget http://voxel.dl.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2
-tar xjvf boost_1_47_0.tar.bz2
-cd boost_1_47_0
-
-# edit tools/build/v2/tools/python.jam, line 980, replace with:
- if $(target-os) in windows cygwin
- {
- alias python_for_extensions : python : $(target-requirements) ;
- }
- else if $(target-os) = darwin
- {
- alias python_for_extensions
- :
- : $(target-requirements)
- :
- : $(usage-requirements) "-undefined dynamic_lookup"
- ;
- }
-
-./bootstrap.sh
-./bjam --prefix=$PREFIX --with-thread --with-filesystem \
- --with-regex --with-program_options --with-system --with-chrono \
- -sHAVE_ICU=1 -sICU_PATH=$PREFIX \
- toolset=darwin \
- address-model=32_64 \
- architecture=x86 \
- link=shared \
- variant=release \
- stage
-
-./bjam --prefix=$PREFIX --with-thread --with-filesystem \
- --with-regex --with-program_options --with-system --with-chrono \
- -sHAVE_ICU=1 -sICU_PATH=$PREFIX \
- toolset=darwin \
- address-model=32_64 \
- architecture=x86 \
- link=shared \
- variant=release \
- install
-
-# if needed, rebuild regex without icu..
-./bjam --prefix=$PREFIX --with-regex \
- --disable-icu -a \
- toolset=darwin \
- address-model=32_64 \
- architecture=x86 \
- link=shared \
- variant=release \
- install
-
-# toolset=clang-darwin cxxflags="-fPIC" linkflags="-undefined dynamic_lookup"
-
-# boost python for various versions are done in python script
-python ../../scripts/build_boost_pythons.py 2.5 32_64
-mv stage/lib/libboost_python.dylib stage/lib/libboost_python25.dylib
-cp stage/lib/libboost_python25.dylib ../../sources/lib/libboost_python25.dylib
-
-python ../../scripts/build_boost_pythons.py 2.6 32_64
-mv stage/lib/libboost_python.dylib stage/lib/libboost_python26.dylib
-cp stage/lib/libboost_python26.dylib ../../sources/lib/libboost_python26.dylib
-
-python ../../scripts/build_boost_pythons.py 2.7 32_64
-mv stage/lib/libboost_python.dylib stage/lib/libboost_python27.dylib
-cp stage/lib/libboost_python27.dylib ../../sources/lib/libboost_python27.dylib
-
-python ../../scripts/build_boost_pythons.py 3.1 32_64
-mv stage/lib/libboost_python3.dylib stage/lib/libboost_python31.dylib
-cp stage/lib/libboost_python31.dylib ../../sources/lib/libboost_python31.dylib
-
-python ../../scripts/build_boost_pythons.py 3.2 32_64
-mv stage/lib/libboost_python3.dylib stage/lib/libboost_python32.dylib
-cp stage/lib/libboost_python32.dylib ../../sources/lib/libboost_python32.dylib
-
-
-#cp stage/lib/libboost_*dylib ../../sources/lib/
-
-cd ../../sources/lib
-
-# fix boost pythons
-install_name_tool -id $INSTALL/libboost_python25.dylib libboost_python25.dylib
-install_name_tool -id $INSTALL/libboost_python26.dylib libboost_python26.dylib
-install_name_tool -id $INSTALL/libboost_python27.dylib libboost_python27.dylib
-install_name_tool -id $INSTALL/libboost_python31.dylib libboost_python31.dylib
-install_name_tool -id $INSTALL/libboost_python32.dylib libboost_python32.dylib
-
-# fix boost libs
-install_name_tool -id $INSTALL/libboost_system.dylib libboost_system.dylib
-install_name_tool -id $INSTALL/libboost_filesystem.dylib libboost_filesystem.dylib
-install_name_tool -id $INSTALL/libboost_regex.dylib libboost_regex.dylib
-install_name_tool -id $INSTALL/libboost_program_options.dylib libboost_program_options.dylib
-install_name_tool -id $INSTALL/libboost_thread.dylib libboost_thread.dylib
-install_name_tool -change libboost_system.dylib $INSTALL/libboost_system.dylib libboost_filesystem.dylib
-#install_name_tool -change libicui18n.46.dylib $INSTALL/libicui18n.46.dylib libboost_regex.dylib
-
-# currently broken, waiting on http://www.gaia-gis.it/rasterlite2/
-# rasterlite we must bundle as it is not available in the SQLite.framework
-#cd ../../deps
-#svn co https://www.gaia-gis.it/svn/librasterlite
-#export LDFLAGS="-arch i386 -arch x86_64 -headerpad_max_install_names -L/Library/Frameworks/SQLite3.framework/unix/lib -L/Library/Frameworks/UnixImageIO.framework/unix/lib -L/Library/Frameworks/PROJ.framework/unix/lib"
-#export CFLAGS="-Os -arch i386 -arch x86_64 -I/Library/Frameworks/SQLite3.framework/unix/include -I/Library/Frameworks/UnixImageIO.framework/unix/include -I/Library/Frameworks/PROJ.framework/unix/include"
-#export CXXFLAGS=$CFLAGS
-#cd librasterlite
-#./configure --disable-dependency-tracking --prefix=$PREFIX
-#make clean
-#make -j4
-#make install
-#cd ../../sources/lib
-#install_name_tool -id $INSTALL/librasterlite.0.dylib librasterlite.0.dylib
-
-# sqlite with rtree
-cd ../../deps
-wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
-tar xvf sqlite-autoconf-3070701.tar.gz
-cd sqlite-autoconf-3070701
-export CFLAGS="-DSQLITE_ENABLE_RTREE=1 -O3 "$CFLAGS
-./configure --prefix=$PREFIX --enable-static=yes --enable-shared=no --disable-dependency-tracking
-make -j4 && make install
-
-
-### MAPNIK ###
-
-# make sure we set DYLD path so we can link to libs without installing
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-
-# compile mapnik using osx/config.py
-scons PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig -j2 install BINDINGS=''
-
-# then compile each python version..
-
-# 2.5
-rm bindings/python/*os
-rm bindings/python/mapnik/_mapnik2.so
-scons configure BINDINGS=python PYTHON=/usr/bin/python2.5 BOOST_PYTHON_LIB=boost_python25
-scons -j2 install
-cp bindings/python/mapnik/_mapnik2.so osx/python/_mapnik2_25.so
-
-# 2.6
-rm bindings/python/*os
-rm bindings/python/mapnik/_mapnik2.so
-scons configure BINDINGS=python PYTHON=/usr/bin/python2.6 BOOST_PYTHON_LIB=boost_python26
-scons -j2 install
-cp bindings/python/mapnik/_mapnik2.so osx/python/_mapnik2_26.so
-
-# 2.7
-rm bindings/python/*os
-rm bindings/python/mapnik/_mapnik2.so
-scons configure BINDINGS=python PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 BOOST_PYTHON_LIB=boost_python27
-scons -j2 install
-cp bindings/python/mapnik/_mapnik2.so osx/python/_mapnik2_27.so
-
-
-# 3.1
-# needs patch: http://trac.mapnik.org/wiki/Python3k
-rm bindings/python/*os
-rm bindings/python/mapnik/_mapnik2.so
-scons configure BINDINGS=python PYTHON=/Library/Frameworks/Python.framework/Versions/3.1/bin/python3.1 BOOST_PYTHON_LIB=boost_python31
-scons -j2 install
-cp bindings/python/mapnik/_mapnik2.so osx/python/_mapnik2_31.so
-
-# 3.2
-rm bindings/python/*os
-rm bindings/python/mapnik/_mapnik2.so
-scons configure BINDINGS=python PYTHON=/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2m BOOST_PYTHON_LIB=boost_python32
-scons -j2 install
-cp bindings/python/mapnik/_mapnik2.so osx/python/_mapnik2_32.so
-
-
-
-
-# build a ton of versions of node (just to be safe about ABI)
-cd ../../deps
-
-for VER in {"0.2.4","0.2.5","0.2.6","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4","0.3.5","0.3.6","0.3.7"}
-do
- wget http://nodejs.org/dist/node-v$VER.tar.gz
- tar xvf node-v$VER.tar.gz
- cd node-v$VER
- ./configure --prefix=$PREFIX/node$VER
- make
- make install
- cd ../
-done
-
-# node-mapnik
-cd ../../deps
-git clone git://github.com/mapnik/node-mapnik.git
-cd node-mapnik
-#export PATH=../../Library/Frameworks/Mapnik.framework/Programs:$PATH
-export PATH=/Library/Frameworks/Mapnik.framework/Programs:$PATH
-
-# TODO - needs work
-# only 64 bit
-# versioned module
-# all targets
-# custom node prefix
-# cairo support
-
-#CXXFLAGS=" -g -DNDEBUG -O3 -Wall -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -ansi -finline-functions -Wno-inline -fPIC -arch x86_64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DEV_MULTIPLICITY=0 -I/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/include -I/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/include/freetype2 "
-
-#for VER in {"0.2.4","0.2.5","0.2.6","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4"}
-#for VER in {"0.3.4","0.3.5","0.3.6","0.3.7"}
-#do
-# mkdir build/default/src/$VER
-# mkdir lib/$VER
-# NODE_PREFIX="$PREFIX/node$VER"
-# export PATH=$NODE_PREFIX/bin:$PATH
-# OBJ="build/default/src/$VER/_mapnik_1.o"
-# TARGET="lib/$VER/_mapnik.node"
-# g++ $CXXFLAGS -I$NODE_PREFIX/include/node src/_mapnik.cc -c -o $OBJ
-# LDFLAGS="-L/Library/Frameworks/Mapnik.framework/Versions/2.0/unix/lib -lmapnik2 -bundle -#undefined dynamic_lookup"
-# g++ $OBJ -o $TARGET $LDFLAGS
-#done
-
-
-# then re-run wrap.py
\ No newline at end of file
diff --git a/osx/scripts/static-universal.sh b/osx/scripts/static-universal.sh
deleted file mode 100644
index 510680746..000000000
--- a/osx/scripts/static-universal.sh
+++ /dev/null
@@ -1,340 +0,0 @@
-# build notes for compiling mapnik deps statically
-# and "FAT" (aka. universal) in order to allow
-# linking a fully standalone libmapnik.a
-
-PREFIX=`pwd`/osx/sources
-mkdir -p $PREFIX
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
-export PATH=$PREFIX/bin:$PATH
-export CORE_CFLAGS="-O3 -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk"
-export CORE_CXXFLAGS=$CORE_CFLAGS
-export CORE_LDFLAGS="-Wl,-search_paths_first -arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk"
-export ARCHFLAGS="-arch x86_64 -arch i386"
-
-
-cd osx
-mkdir -p deps
-cd deps
-
-
-# icucore headers - temporary workaround until I can get more recent icu versions working
-wget http://www.opensource.apple.com/tarballs/ICU/ICU-400.38.tar.gz
-tar xvf ICU-400.38.tar.gz
-cd ICU-400.38
-make install
-cp -R build/usr/local/include/unicode/ ../../sources/include/unicode
-cd ../
-
-# boost
-wget http://voxel.dl.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2
-tar xjvf boost_1_47_0.tar.bz2
-cd boost_1_47_0
-./bootstrap.sh
-
-# no icu variant
-./bjam --prefix=$PREFIX -j2 -d2 \
- --with-thread \
- --with-filesystem \
- --with-program_options --with-system --with-chrono \
- --with-regex --disable-icu \
- toolset=darwin \
- macosx-version=10.6 \
- address-model=32_64 \
- architecture=x86 \
- link=static \
- variant=release \
- stage
-
-./bjam --prefix=$PREFIX -j2 -d2 \
- --with-thread \
- --with-filesystem \
- --with-program_options --with-system --with-chrono \
- --with-regex --disable-icu \
- toolset=darwin \
- macosx-version=10.6 \
- address-model=32_64 \
- architecture=x86 \
- link=static \
- variant=release \
- install
-
-cd ../
-
-# universal flags
-export CFLAGS=$CORE_CFLAGS
-export CXXFLAGS=$CORE_CXXFLAGS
-export LDFLAGS=$CORE_LDFLAGS
-
-# sqlite
-wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
-tar xvf sqlite-autoconf-3070701.tar.gz
-cd sqlite-autoconf-3070701
-export CFLAGS="-DSQLITE_ENABLE_RTREE=1 -O3 "$CFLAGS
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-
-# freetype
-wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
-tar xvf freetype-2.4.6.tar.bz2
-cd freetype-2.4.6
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-# proj4
-wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
-#wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz
-#tar xvf proj-4.7.0.tar.gz
-#cd proj-4.7.0
-# we use trunk instead for better threading support
-svn co http://svn.osgeo.org/metacrs/proj/trunk/proj proj-trunk # at the time pre-release 4.8.0
-cd proj-trunk/nad
-unzip ../../proj-datumgrid-1.5.zip
-cd ../
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-# libpng
-wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.5.tar.gz
-tar xvf libpng-1.5.5.tar.gz
-cd libpng-1.5.5
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-# libjpeg
-wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
-tar xvf jpegsrc.v8c.tar.gz
-cd jpeg-8c
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-# libtiff
-wget http://download.osgeo.org/libtiff/tiff-3.9.5.tar.gz
-tar xvf tiff-3.9.5.tar.gz
-cd tiff-3.9.5
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-cd ../
-
-# gettext which provides libintl for libpq
-wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
-tar xvf gettext-0.18.1.1.tar.gz
-cd gettext-0.18.1.1
-export CC=gcc
-export CXX=g++
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
---without-included-gettext --disable-debug --without-included-glib \
---without-included-libcroco --without-included-libxml \
---without-emacs --without-git --without-cvs
-make -j4
-make install
-cd ../
-
-
-# postgis
-# install postgres 9.x client from somewhere.
-# http://www.kyngchaos.com/software/postgres works nicely
-# then copy the clients static libpq.a to a prioritized directory:
-cp /usr/local/pgsql/lib/libpq.a osx/sources/lib/libpq.a
-# then edit plugins/input/postgis/SConscript adding more libs to link to
-
-
-# gdal 1.8.1
-wget http://download.osgeo.org/gdal/gdal-1.8.1.tar.gz
-tar xvf gdal-1.8.1.tar.gz
-cd gdal-1.8.1
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
---with-libtiff=$PREFIX \
---with-jpeg=$PREFIX \
---with-png=$PREFIX \
---with-static-proj4=$PREFIX \
---with-sqlite3=no \
---with-spatialite=no \
---with-curl=no \
---with-geos=no \
---with-pcraster=no \
---with-cfitsio=no \
---with-odbc=no \
---with-libkml=no \
---with-pcidsk=no \
---with-jasper=no \
---with-gif=no \
---with-pg=no \
---with-hide-internal-symbols=yes \
---with-vfk=no \
---with-grib=no
-
-make -j4
-make install
-cd ../
-
-
-# cairo and friends
-
-# pkg-config so we get cairo and friends configured correctly
-# note: we use 0.25 because >= 0.26 no long bundles glib and we don't
-# want to have to depend on an external glib dep
-wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.25.tar.gz
-tar xvf pkg-config-0.25.tar.gz
-cd pkg-config-0.25
-# patch glib.h
-# change line 198 to:
-# ifndef G_INLINE_FUNC inline
-./configure --disable-debug --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-# pixman
-wget http://cairographics.org/releases/pixman-0.22.2.tar.gz
-tar xvf pixman-0.22.2.tar.gz
-cd pixman-0.22.2
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-# fontconfig
-wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.8.0.tar.gz
-tar xvf fontconfig-2.8.0.tar.gz
-cd fontconfig-2.8.0
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX \
- --with-freetype-config=$PREFIX/bin/freetype-config
-make -j4
-make install
-cd ../
-
-
-# cairo
-wget http://cairographics.org/releases/cairo-1.10.2.tar.gz
-tar xvf cairo-1.10.2.tar.gz
-cd cairo-1.10.2
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export LDFLAGS="-L$PREFIX/lib "$CORE_LDFLAGS
-export CFLAGS="-I$PREFIX/include "$CORE_CFLAGS
-export png_CFLAGS="-I$PREFIX/include"
-export png_LIBS="-I$PREFIX/lib -lpng"
-./configure \
- --enable-static --disable-shared \
- --enable-pdf=yes \
- --enable-ft=yes \
- --enable-png=yes \
- --enable-svg=yes \
- --enable-ps=yes \
- --enable-fc=yes \
- --enable-trace=no \
- --enable-gtk-doc=no \
- --enable-qt=no \
- --enable-quartz=no \
- --enable-quartz-font=no \
- --enable-quartz-image=no \
- --enable-win32=no \
- --enable-win32-font=no \
- --enable-skia=no \
- --enable-os2=no \
- --enable-beos=no \
- --enable-drm=no \
- --enable-drm-xr=no \
- --enable-gallium=no \
- --enable-gl=no \
- --enable-directfb=no \
- --enable-vg=no \
- --enable-egl=no \
- --enable-glx=no \
- --enable-wgl=no \
- --enable-test-surfaces=no \
- --enable-tee=no \
- --enable-xml=no \
- --enable-interpreter=no \
- --disable-valgrind \
- --enable-gobject=no \
- --enable-static=no \
- --enable-xlib=no \
- --enable-xlib-xrender=no \
- --enable-xcb=no \
- --enable-xlib-xcb=no \
- --enable-xcb-shm=no \
- --enable-xcb-drm=no \
- --disable-dependency-tracking \
- --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-
-# libsigcxx
-wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.10.tar.bz2
-tar xvf libsigc++-2.2.10.tar.bz2
-cd libsigc++-2.2.10
-export CFLAGS=$CORE_CFLAGS
-export CXXFLAGS=$CORE_CXXFLAGS
-export LDFLAGS=$CORE_LDFLAGS
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-# cairomm
-wget http://cairographics.org/releases/cairomm-1.10.0.tar.gz
-tar xvf cairomm-1.10.0.tar.gz
-cd cairomm-1.10.0
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export LDFLAGS="-L$PREFIX/lib -lcairo -lfontconfig -lsigc-2.0 "$CORE_LDFLAGS
-export CFLAGS="-I$PREFIX/include -I$PREFIX/include/cairo -I$PREFIX/include/freetype2 -I$PREFIX/include/fontconfig -I$PREFIX/lib/sigc++-2.0/include -I$PREFIX/include/sigc++-2.0 -I$PREFIX/include/sigc++-2.0/sigc++ "$CORE_CFLAGS
-export CXXFLAGS="-I$PREFIX/include "$CFLAGS
-
-./configure --enable-static --disable-shared \
- --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-# mapnik
-
-# config.py
-
-CXX = 'clang++'
-CC = 'clang++'
-CUSTOM_CXXFLAGS = '-arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk'
-CUSTOM_LDFLAGS = '-Wl,-search_paths_first -arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk'
-INPUT_PLUGINS = 'gdal,ogr,postgis,shape'
-DESTDIR = './osx/sources/'
-BOOST_INCLUDES = './osx/sources/include'
-BOOST_LIBS = './osx/sources/lib'
-FREETYPE_CONFIG = './osx/sources/bin/freetype-config'
-ICU_INCLUDES = './osx/sources/include'
-ICU_LIB_NAME = 'icucore'
-PNG_INCLUDES = './osx/sources/include'
-PNG_LIBS = './osx/sources/lib'
-JPEG_INCLUDES = './osx/sources/include'
-JPEG_LIBS = './osx/sources/lib'
-TIFF_INCLUDES = './osx/sources/include'
-TIFF_LIBS = './osx/sources/lib'
-PROJ_INCLUDES = './osx/sources/include'
-PROJ_LIBS = './osx/sources/lib'
-PKG_CONFIG_PATH = './osx/sources/lib/pkgconfig'
-SQLITE_INCLUDES = './osx/sources/include'
-SQLITE_LIBS = './osx/sources/lib'
-BINDINGS = 'none'
-
-
-# fixup the mapnik-config
-# we need to remove the local paths so that 'other-libs' and 'other-includes' look something like:
-
-other_libs='-Wl,-search_paths_first -arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -L/usr/lib -lfreetype -licucore -lboost_filesystem -lboost_regex -lcairomm-1.0 -lcairo -lboost_thread -lboost_system'
-
-other_includes='-arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DU_HIDE_DRAFT_API -DUDISABLE_RENAMING -DHAVE_JPEG -ansi -Wall -ftemplate-depth-200 -DDARWIN -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O3 -finline-functions -Wno-inline -DNDEBUG -DHAVE_CAIRO -I/usr/include/libxml2 -DHAVE_CAIRO -DLIBTOOL_SUPPORTS_ADVISE'
-
diff --git a/osx/scripts/static.sh b/osx/scripts/static.sh
deleted file mode 100644
index 861e7d739..000000000
--- a/osx/scripts/static.sh
+++ /dev/null
@@ -1,286 +0,0 @@
-
-PREFIX=/Users/dane/projects/mapnik-dev/trunk-build-static/osx/sources
-mkdir -p $PREFIX
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-# final resting place
-INSTALL=/Library/Frameworks/Mapnik.framework/unix/lib
-export DYLD_LIBRARY_PATH=$PREFIX/lib
-export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
-export PATH=$PREFIX/bin:$PATH
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-
-
-cd osx
-mkdir -p deps
-cd deps
-
-
-wget http://download.icu-project.org/files/icu4c/4.6.1/icu4c-4_6_1-src.tgz
-tar xvf icu4c-4_6_1-src.tgz
-cd icu/source
-
-# universal flags
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-./runConfigureICU MacOSX --prefix=$PREFIX --enable-static --disable-shared \
---with-library-bits=64 --enable-release \
---with-data-packaging=static
-
-#Data Packaging: archive
-# This means: ICU data will be stored in a single .dat file.
-# To locate data: ICU will look in /Users/dane/projects/mapnik-dev/trunk-build-static/osx/sources/share/icu/4.6 which is the #installation location. Call u_setDataDirectory() or use the ICU_DATA environment variable to override.
-
-make install -j4
-
-ln -s `pwd`/../sources/lib `pwd`/../sources/lib64
-
-
-
-wget http://voxel.dl.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2
-tar xjvf boost_1_47_0.tar.bz2
-cd boost_1_47_0
-./bootstrap.sh
-#--prefix-dir
-
-# architecture=x86 prevents icu link test from working?
-l
-./bjam --prefix=$PREFIX --with-python \
- --with-thread \
- --with-filesystem \
- --with-program_options --with-system --with-chrono \
- --with-regex define=U_STATIC_IMPLEMENTATION=1 \
- -sHAVE_ICU=1 -sICU_PATH=$PREFIX \
- toolset=darwin \
- address-model=64 \
- link=static \
- variant=release \
- stage
-
-./bjam --prefix=$PREFIX --with-python \
- --with-thread \
- --with-filesystem \
- --with-program_options --with-system --with-chrono \
- --with-regex define=U_STATIC_IMPLEMENTATION=1 \
- -sHAVE_ICU=1 -sICU_PATH=$PREFIX \
- toolset=darwin \
- address-model=64 \
- link=static \
- variant=release \
- install
-
-# no icu variant
-./bjam --prefix=$PREFIX --with-python \
- --with-thread \
- --with-filesystem \
- --with-program_options --with-system --with-chrono \
- --with-regex --disable-icu \
- toolset=darwin \
- address-model=64 \
- link=static \
- variant=release \
- install
-
-
-./bjam --prefix=$PREFIX -a \
- --with-regex define=U_STATIC_IMPLEMENTATION=1 \
- -sHAVE_ICU=1 -sICU_PATH=$PREFIX \
- toolset=darwin \
- address-model=64 \
- link=static \
- variant=release \
- stage
-
-cp stage/lib/libboost_regex.a ../../sources/lib/
-
-
-tar xvf ../deps/freetype-2.4.4.tar.gz
-export CFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-cd freetype-2.4.4
-./configure --prefix=$PREFIX \
---enable-static \
---disable-shared
-make -j4
-make install
-
-
-
-wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz
-tar xvf proj-4.7.0.tar.gz
-cd proj-4.7.0
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make
-make install
-
-
-wget http://downloads.sourceforge.net/project/libpng/libpng12/1.2.44/libpng-1.2.44.tar.bz2
-tar xvf libpng-1.2.44.tar.bz2
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-
-wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
-tar xvf jpegsrc.v8c.tar.gz
-cd jpeg-8c
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-
-wget http://download.osgeo.org/libtiff/tiff-3.9.4.zip
-tar xvf tiff-3.9.4.zip
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-cd tiff-3.9.4
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
-make -j4
-make install
-
-
-# gdal 1.8
-./configure --prefix=$PREFIX --disable-static --enable-shared --disable-dependency-tracking \
-
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
---with-libtiff=$PREFIX \
---with-jpeg=$PREFIX \
---with-png=$PREFIX \
---with-geos=no \
---with-pcraster=no \
---with-libkml=no \
---with-pcidsk=no \
---with-jasper=no \
---with-gif=no \
---with-pg=no
-
-make -j4
-
-file ../../sources/lib/libgdal.a
-
-ldd ../../sources/lib/libgdal.dylib
-
-
-# cairo and friends
-
-# pkg-config so we get cairo and friends configured correctly
-wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz
-tar xvf pkg-config-0.26.tar.gz
-cd pkg-config-0.26
-./configure --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-wget http://cairographics.org/releases/pixman-0.22.2.tar.gz
-tar xvf pixman-0.22.2.tar.gz
-cd pixman-0.22.2
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.8.0.tar.gz
-tar xvf fontconfig-2.8.0.tar.gz
-cd fontconfig-2.8.0
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX \
- --with-freetype-config=$PREFIX/bin/freetype-config
-make -j4
-make install
-cd ../
-
-
-# Cairo
-wget http://cairographics.org/releases/cairo-1.10.2.tar.gz
-tar xvf cairo-1.10.2.tar.gz
-cd cairo-1.10.2
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export LDFLAGS="-L$PREFIX/lib "$LDFLAGS
-export CFLAGS="-I$PREFIX/include "$CFLAGS
-export png_CFLAGS="-I$PREFIX/include"
-export png_LIBS="-I$PREFIX/lib -lpng12"
-./configure \
- --enable-static --disable-shared \
- --enable-pdf=yes \
- --enable-ft=yes \
- --enable-png=yes \
- --enable-svg=yes \
- --enable-ps=yes \
- --enable-fc=yes \
- --enable-trace=no \
- --enable-gtk-doc=no \
- --enable-qt=no \
- --enable-quartz=no \
- --enable-quartz-font=no \
- --enable-quartz-image=no \
- --enable-win32=no \
- --enable-win32-font=no \
- --enable-skia=no \
- --enable-os2=no \
- --enable-beos=no \
- --enable-drm=no \
- --enable-drm-xr=no \
- --enable-gallium=no \
- --enable-gl=no \
- --enable-directfb=no \
- --enable-vg=no \
- --enable-egl=no \
- --enable-glx=no \
- --enable-wgl=no \
- --enable-test-surfaces=no \
- --enable-tee=no \
- --enable-xml=no \
- --enable-interpreter=no \
- --disable-valgrind \
- --enable-gobject=no \
- --enable-static=no \
- --enable-xlib=no \
- --enable-xlib-xrender=no \
- --enable-xcb=no \
- --enable-xlib-xcb=no \
- --enable-xcb-shm=no \
- --enable-xcb-drm=no \
- --disable-dependency-tracking \
- --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-
-# libsigcxx
-wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.10.tar.bz2
-tar xvf libsigc++-2.2.10.tar.bz2
-cd libsigc++-2.2.10
-./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
-cd ../
-
-wget http://cairographics.org/releases/cairomm-1.10.0.tar.gz
-tar xvf cairomm-1.10.0.tar.gz
-cd cairomm-1.10.0
-# NOTE: PKG_CONFIG_PATH must be correctly set by this point
-export CFLAGS="-O3 -arch x86_64"
-export CXXFLAGS="-O3 -arch x86_64"
-export LDFLAGS="-arch x86_64"
-export LDFLAGS="-L$PREFIX/lib -lcairo -lfontconfig -lsigc-2.0 "$LDFLAGS
-export CFLAGS="-I$PREFIX/include -I$PREFIX/include/cairo -I$PREFIX/include/freetype2 -I$PREFIX/include/fontconfig -I$PREFIX/lib/sigc++-2.0/include -I$PREFIX/include/sigc++-2.0 -I$PREFIX/include/sigc++-2.0/sigc++ "$CFLAGS
-# undef CAIRO_HAS_FT_FONT in include/cairo/cairo-features.h
-#mv ../../sources/lib/pkgconfig/cairo-ft.pc ../../sources/lib/pkgconfig/_cairo-ft.pc
-#export CFLAGS="-DNCAIRO_HAS_FT_FONT -I$PREFIX/include -I$PREFIX/include/cairo -I$PREFIX/lib/sigc++-2.0/include -I$PREFIX/include/sigc++-2.0 -I$PREFIX/include/sigc++-2.0/sigc++ "
-export CXXFLAGS="-I$PREFIX/include "$CFLAGS
-
-./configure --enable-static --disable-shared \
- --disable-dependency-tracking --prefix=$PREFIX
-make -j4
-make install
diff --git a/osx/wrap.py b/osx/wrap.py
deleted file mode 100644
index 032a04446..000000000
--- a/osx/wrap.py
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import glob
-import shutil
-from os.path import join
-import sys
-
-def sym(target,link):
- relative = os.path.relpath(target,link)
- if relative.startswith('../'):
- relative = relative.replace('../','',1)
- try:
- if os.path.exists(link):
- os.unlink(link)
- os.symlink(relative,link)
- except OSError, e:
- raise OSError('%s: %s' % (e,link))
-
-def copy_all_items(pattern,place,recursive=True):
- items = glob.glob(pattern)
- for i in items:
- if recursive:
- # -R is needed to preserve symlinks
- os.system('cp -R %s %s' % (i,place))
- else:
- shutil.copy(i,place)
-
-def drop(path):
- if os.path.islink(path) or os.path.lexists(path):
- if os.path.isabs(path):
- print 'not deleting item as it is an absolute path: %' % path
- else:
- os.system('rm -r %s' % path)
-
-if __name__ == "__main__":
-
-
- # include headers for a full SDK?
- INCLUDE_HEADERS = True
-
- INCLUDE_NODE = False
-
- INCLUDE_PYTHON = True
-
- INCLUDE_CAIRO = True
-
- INCLUDE_PYCAIRO = False
-
- # final resting place
- install_path = '/Library/Frameworks'
-
- # move to this dir
- here = os.path.dirname(os.path.realpath(__file__))
- os.chdir(here)
-
- # relative path to DESTDIR output
- framework = 'Library/Frameworks/Mapnik.framework'
-
- # Framework version, likely should be 2.0.0..
- version = '2.0'
-
- # Versions/Current symlink
- current = join(framework,'Versions',version)
-
- # HERE WE GO...
-
- # set up symlinks
- # from existing directory, to link
- active = join(framework,'Versions/Current')
- #drop('rm -rf %s' % active)
- sym(current,active)
-
- # point top level 'unix' to active one
- sym(join(active,'unix'),join(framework,'unix'))
-
- # create headers directory if needed
- if INCLUDE_HEADERS:
- if not os.path.exists(join(active,'unix/include')):
- os.mkdir(join(active,'unix/include'))
-
- # Mapnik Headers
- if INCLUDE_HEADERS:
- sym(join(active,'unix/include'),join(active,'Headers'))
- sym(join(active,'Headers'),join(framework,'Headers'))
- else:
- # purge the installed headers of mapnik
- drop('rm -rf %s' % join(active,'unix/include'))
-
- if INCLUDE_CAIRO:
-
- # install cairo libs and deps
- copy_all_items('sources/lib/libcairo*dylib',join(active,'unix/lib'),recursive=True)
- copy_all_items('sources/lib/libfontconfig*dylib',join(active,'unix/lib'),recursive=True)
- copy_all_items('sources/lib/libsigc-2.0*dylib',join(active,'unix/lib'),recursive=True)
- copy_all_items('sources/lib/libpixman*dylib',join(active,'unix/lib'),recursive=True)
-
- # install cairo includes
- if INCLUDE_HEADERS:
- # what is layout?
- for group in ['cairo','cairomm-1.0','fontconfig','pixman-1','pycairo','sigc++-2.0','layout']:
- if not os.path.exists(join(active,'unix/include/%s' % group)):
- os.mkdir(join(active,'unix/include/%s' % group))
- copy_all_items('sources/include/%s/*' % group,join(active,'unix/include/%s' % group),recursive=True)
-
- if not INCLUDE_PYCAIRO:
- drop('rm -rf %s' % join(active,'unix/include/pycairo'))
-
- # likely uneeded
- if not os.path.exists(join(active,'unix/lib/sigc++-2.0')):
- os.mkdir(join(active,'unix/lib/sigc++-2.0'))
- copy_all_items('sources/lib/sigc++-2.0/*',join(active,'unix/lib/sigc++-2.0'),recursive=True)
-
-
- # install icu libs
- copy_all_items('sources/lib/libicuu*dylib',join(active,'unix/lib'),recursive=True)
- copy_all_items('sources/lib/libicud*dylib',join(active,'unix/lib'),recursive=True)
- copy_all_items('sources/lib/libicui1*dylib',join(active,'unix/lib'),recursive=True)
-
- # install icu includes
- if INCLUDE_HEADERS:
- if not os.path.exists(join(active,'unix/include/unicode')):
- os.mkdir(join(active,'unix/include/unicode'))
- copy_all_items('sources/include/unicode/*',join(active,'unix/include/unicode'),recursive=True)
-
- # install boost libs
- copy_all_items('sources/lib/libboost*dylib',join(active,'unix/lib'),recursive=True)
-
- # install boost includes
- if INCLUDE_HEADERS:
- if not os.path.exists(join(active,'unix/include/boost')):
- os.mkdir(join(active,'unix/include/boost'))
- copy_all_items('sources/include/boost/*',join(active,'unix/include/boost'),recursive=True)
-
- # install rasterlite lib
- copy_all_items('sources/lib/librasterlite*dylib',join(active,'unix/lib'),recursive=True)
-
- # install freetype2 libs
- copy_all_items('sources/lib/libfreetype*dylib',join(active,'unix/lib'),recursive=True)
-
- # install freetype2 includes
- if INCLUDE_HEADERS:
- if not os.path.exists(join(active,'unix/include/freetype2')):
- os.mkdir(join(active,'unix/include/freetype2'))
- copy_all_items('sources/include/freetype2/*',join(active,'unix/include/freetype2'),recursive=True)
- copy_all_items('sources/include/ft2build.h',join(active,'unix/include/'),recursive=True)
-
- # Node-mapnik bindings location
- if INCLUDE_NODE:
- if not os.path.exists(join(active,'unix/lib/node')):
- os.mkdir(join(active,'unix/lib/node'))
- os.mkdir(join(active,'unix/lib/node/mapnik'))
- sym(join(active,'unix/lib/node'),join(active,'Node'))
- sym(join(active,'Node'),join(framework,'Node'))
-
- # do this later...
- copy_all_items('deps/node-mapnik/mapnik/*',join(active,'unix/lib/node/mapnik/'),recursive=True)
- else:
- drop('rm -r %s' % join(active,'Node'))
- drop('rm -r %s' % join(framework,'Node'))
- drop('rm -r %s' % join(active,'unix/lib/node/'))
-
- # Resources
- if not os.path.exists(join(active,'Resources')):
- os.mkdir(join(active,'Resources'))
- # TODO - put docs and other stuff here...
- # or link to /share
- sym(join(active,'Resources'),join(framework,'Resources'))
- shutil.copy('Info.plist',join(active,'Resources'))
-
- # Programs
- sym(join(active,'unix/bin'),join(active,'Programs'))
- sym(join(active,'Programs'),join(framework,'Programs'))
-
- # Datasources
- sym(join(active,'unix/lib/mapnik2/input'),join(active,'Datasources'))
- sym(join(active,'Datasources'),join(framework,'Datasources'))
-
- # Fonts
- # TODO - move fonts to main level...
- sym(join(active,'unix/lib/mapnik2/fonts'),join(active,'Fonts'))
- sym(join(active,'Fonts'),join(framework,'Fonts'))
-
- # symlinks to user and system font directories.
- # TODO - NEED TO BENCHMARK performance hit of extra loading time and memory usage
- #sym('/Library/Fonts', join(fonts,'Library'))
- #sym('/System/Library/Fonts', join(fonts,'System'))
-
- # symlink the lib
- sym(join(active,'unix/lib/libmapnik2.dylib'),join(active,'Mapnik'))
- sym(join(active,'Mapnik'),join(framework,'Mapnik'))
-
- # Python
- if INCLUDE_PYTHON:
- #python_versions = glob.glob('unix/lib/python*')
- #for py in python_versions:
- # py_dir = join(active,'%s/site-packages' % py)
- if not os.path.exists(join(active,'Python')):
- os.mkdir(join(active,'Python'))
- os.mkdir(join(active,'Python/mapnik2'))
- if INCLUDE_PYCAIRO:
- os.mkdir(join(active,'Python/cairo'))
- shutil.copy('python/mapnik.py',join(active,'Python/mapnik2/__init__.py'))
- if INCLUDE_PYCAIRO:
- if not os.path.exists(join(active,'Python/cairo/')):
- os.mkdir(join(active,'Python/cairo/'))
- shutil.copy('python/cairo.py',join(active,'Python/cairo/__init__.py'))
- else:
- drop('rm -rf %s' % join(active,'Python/cairo'))
-
- #sym(py_dir,join(active,'Python'))
- sym(join(active,'Python'),join(framework,'Python'))
-
-
- # pycairo module
- for pyver in glob.glob('sources/lib/python*'):
- ver = os.path.basename(pyver)
- to = join(active,'unix/lib/%s/site-packages/cairo/' % ver)
- if INCLUDE_PYCAIRO:
- assert os.path.exists(join(active,'unix/lib/%s' % ver))
- assert os.path.exists(join(active,'unix/lib/%s/site-packages' % ver))
- if not os.path.exists(to):
- os.mkdir(to)
- copy_all_items('sources/lib/%s/site-packages/cairo/*' % ver,to,recursive=True)
- else:
- drop('rm -r %s' % to)
-
- # try to start using relative paths..
- #paths_py = '''
- #import os
- #inputpluginspath = os.path.normpath(os.path.join(os.path.dirname(__file__),'../../../../Datasources'))
- #fontscollectionpath = os.path.normpath(os.path.join(os.path.dirname(__file__),'../../../../Fonts'))
- #'''
-
- #paths_py = '''
- #inputpluginspath = '%(install_path)s/Mapnik.framework/Datasources'
- #fontscollectionpath = '%(install_path)s/Mapnik.framework/Fonts'
- #'''
-
- # TODO - consider making _mapnik.so import dependent on version
- # so we can simplify install..
-
- # done via scons install...
- #mapnik_module = join(py_dir,'mapnik2')
- #open(mapnik_module+'/paths.py','w').write(paths_py % locals())
- #shutil.copy('../bindings/python/mapnik/__init__.py',mapnik_module)
-
- # pth file
- pth ='''import sys; sys.path.insert(0,'%(install_path)s/Mapnik.framework/Python')
- ''' % locals()
-
- # TODO - testing hack, will add this local python binding to sys path for snow leopard
- #open('/Library/Python/2.6/site-packages/mapnik.pth','w').write(pth)
-
- # Stash in resources as well
- open(join(active,'Resources/mapnik2.pth'),'w').write(pth)
-
\ No newline at end of file
diff --git a/src/build.py b/src/build.py
index c3227be77..b5e0bd834 100644
--- a/src/build.py
+++ b/src/build.py
@@ -60,8 +60,9 @@ lib_env['LIBS'] = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB
if len(env['EXTRA_FREETYPE_LIBS']):
lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS']))
-if env['XMLPARSER'] == 'libxml2':
- lib_env['LIBS'].append('xml2')
+# libxml2 should be optional but is currently not
+# https://github.com/mapnik/mapnik/issues/913
+lib_env['LIBS'].append('xml2')
if env['THREADING'] == 'multi':
lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
@@ -228,7 +229,7 @@ source += Split(
)
if env['RUNTIME_LINK'] == "static":
- source += glob.glob('../agg/src/' + '*.cpp')
+ source += glob.glob('../deps/agg/src/' + '*.cpp')
# grid backend
source += Split(
@@ -269,15 +270,7 @@ if env['SVG_RENDERER']: # svg backend
lib_env.Append(CXXFLAGS = '-DSVG_RENDERER')
libmapnik_cxxflags.append('-DSVG_RENDERER')
-if env['XMLPARSER'] == 'tinyxml':
- source += Split(
- """
- ../tinyxml/tinystr.cpp
- ../tinyxml/tinyxml.cpp
- ../tinyxml/tinyxmlerror.cpp
- ../tinyxml/tinyxmlparser.cpp
- """)
-elif env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']:
+if env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']:
source += Split(
"""
libxml2_loader.cpp
diff --git a/tinyxml/tinystr.cpp b/tinyxml/tinystr.cpp
deleted file mode 100644
index 12850e99d..000000000
--- a/tinyxml/tinystr.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-/*
- * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
- */
-
-
-#ifndef TIXML_USE_STL
-
-#include "tinystr.h"
-
-// Error value for find primitive
-const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
-
-
-// Null rep.
-TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, '\0' };
-
-
-void TiXmlString::reserve (size_type cap)
-{
- if (cap > capacity())
- {
- TiXmlString tmp;
- tmp.init(length(), cap);
- memcpy(tmp.start(), data(), length());
- swap(tmp);
- }
-}
-
-
-TiXmlString& TiXmlString::assign(const char* str, size_type len)
-{
- size_type cap = capacity();
- if (len > cap || cap > 3*(len + 8))
- {
- TiXmlString tmp;
- tmp.init(len);
- memcpy(tmp.start(), str, len);
- swap(tmp);
- }
- else
- {
- memmove(start(), str, len);
- set_size(len);
- }
- return *this;
-}
-
-
-TiXmlString& TiXmlString::append(const char* str, size_type len)
-{
- size_type newsize = length() + len;
- if (newsize > capacity())
- {
- reserve (newsize + capacity());
- }
- memmove(finish(), str, len);
- set_size(newsize);
- return *this;
-}
-
-
-TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
-{
- TiXmlString tmp;
- tmp.reserve(a.length() + b.length());
- tmp += a;
- tmp += b;
- return tmp;
-}
-
-TiXmlString operator + (const TiXmlString & a, const char* b)
-{
- TiXmlString tmp;
- TiXmlString::size_type b_len = static_cast( strlen(b) );
- tmp.reserve(a.length() + b_len);
- tmp += a;
- tmp.append(b, b_len);
- return tmp;
-}
-
-TiXmlString operator + (const char* a, const TiXmlString & b)
-{
- TiXmlString tmp;
- TiXmlString::size_type a_len = static_cast( strlen(a) );
- tmp.reserve(a_len + b.length());
- tmp.append(a, a_len);
- tmp += b;
- return tmp;
-}
-
-
-#endif // TIXML_USE_STL
diff --git a/tinyxml/tinystr.h b/tinyxml/tinystr.h
deleted file mode 100644
index 3c2aa9d54..000000000
--- a/tinyxml/tinystr.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-/*
- * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
- *
- * - completely rewritten. compact, clean, and fast implementation.
- * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
- * - fixed reserve() to work as per specification.
- * - fixed buggy compares operator==(), operator<(), and operator>()
- * - fixed operator+=() to take a const ref argument, following spec.
- * - added "copy" constructor with length, and most compare operators.
- * - added swap(), clear(), size(), capacity(), operator+().
- */
-
-#ifndef TIXML_USE_STL
-
-#ifndef TIXML_STRING_INCLUDED
-#define TIXML_STRING_INCLUDED
-
-#include
-#include
-
-/* The support for explicit isn't that universal, and it isn't really
- required - it is used to check that the TiXmlString class isn't incorrectly
- used. Be nice to old compilers and macro it here:
-*/
-#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
- // Microsoft visual studio, version 6 and higher.
- #define TIXML_EXPLICIT explicit
-#elif defined(__GNUC__) && (__GNUC__ >= 3 )
- // GCC version 3 and higher.s
- #define TIXML_EXPLICIT explicit
-#else
- #define TIXML_EXPLICIT
-#endif
-
-
-/*
- TiXmlString is an emulation of a subset of the std::string template.
- Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
- Only the member functions relevant to the TinyXML project have been implemented.
- The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
- a string and there's no more room, we allocate a buffer twice as big as we need.
-*/
-class TiXmlString
-{
- public :
- // The size type used
- typedef size_t size_type;
-
- // Error value for find primitive
- static const size_type npos; // = -1;
-
-
- // TiXmlString empty constructor
- TiXmlString () : rep_(&nullrep_)
- {
- }
-
- // TiXmlString copy constructor
- TiXmlString ( const TiXmlString & copy) : rep_(0)
- {
- init(copy.length());
- memcpy(start(), copy.data(), length());
- }
-
- // TiXmlString constructor, based on a string
- TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
- {
- init( static_cast( strlen(copy) ));
- memcpy(start(), copy, length());
- }
-
- // TiXmlString constructor, based on a string
- TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
- {
- init(len);
- memcpy(start(), str, len);
- }
-
- // TiXmlString destructor
- ~TiXmlString ()
- {
- quit();
- }
-
- // = operator
- TiXmlString& operator = (const char * copy)
- {
- return assign( copy, (size_type)strlen(copy));
- }
-
- // = operator
- TiXmlString& operator = (const TiXmlString & copy)
- {
- return assign(copy.start(), copy.length());
- }
-
-
- // += operator. Maps to append
- TiXmlString& operator += (const char * suffix)
- {
- return append(suffix, static_cast( strlen(suffix) ));
- }
-
- // += operator. Maps to append
- TiXmlString& operator += (char single)
- {
- return append(&single, 1);
- }
-
- // += operator. Maps to append
- TiXmlString& operator += (const TiXmlString & suffix)
- {
- return append(suffix.data(), suffix.length());
- }
-
-
- // Convert a TiXmlString into a null-terminated char *
- const char * c_str () const { return rep_->str; }
-
- // Convert a TiXmlString into a char * (need not be null terminated).
- const char * data () const { return rep_->str; }
-
- // Return the length of a TiXmlString
- size_type length () const { return rep_->size; }
-
- // Alias for length()
- size_type size () const { return rep_->size; }
-
- // Checks if a TiXmlString is empty
- bool empty () const { return rep_->size == 0; }
-
- // Return capacity of string
- size_type capacity () const { return rep_->capacity; }
-
-
- // single char extraction
- const char& at (size_type index) const
- {
- assert( index < length() );
- return rep_->str[ index ];
- }
-
- // [] operator
- char& operator [] (size_type index) const
- {
- assert( index < length() );
- return rep_->str[ index ];
- }
-
- // find a char in a string. Return TiXmlString::npos if not found
- size_type find (char lookup) const
- {
- return find(lookup, 0);
- }
-
- // find a char in a string from an offset. Return TiXmlString::npos if not found
- size_type find (char tofind, size_type offset) const
- {
- if (offset >= length()) return npos;
-
- for (const char* p = c_str() + offset; *p != '\0'; ++p)
- {
- if (*p == tofind) return static_cast< size_type >( p - c_str() );
- }
- return npos;
- }
-
- void clear ()
- {
- //Lee:
- //The original was just too strange, though correct:
- // TiXmlString().swap(*this);
- //Instead use the quit & re-init:
- quit();
- init(0,0);
- }
-
- /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
- function DOES NOT clear the content of the TiXmlString if any exists.
- */
- void reserve (size_type cap);
-
- TiXmlString& assign (const char* str, size_type len);
-
- TiXmlString& append (const char* str, size_type len);
-
- void swap (TiXmlString& other)
- {
- Rep* r = rep_;
- rep_ = other.rep_;
- other.rep_ = r;
- }
-
- private:
-
- void init(size_type sz) { init(sz, sz); }
- void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
- char* start() const { return rep_->str; }
- char* finish() const { return rep_->str + rep_->size; }
-
- struct Rep
- {
- size_type size, capacity;
- char str[1];
- };
-
- void init(size_type sz, size_type cap)
- {
- if (cap)
- {
- // Lee: the original form:
- // rep_ = static_cast(operator new(sizeof(Rep) + cap));
- // doesn't work in some cases of new being overloaded. Switching
- // to the normal allocation, although use an 'int' for systems
- // that are overly picky about structure alignment.
- const size_type bytesNeeded = sizeof(Rep) + cap;
- const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
- rep_ = reinterpret_cast( new int[ intsNeeded ] );
-
- rep_->str[ rep_->size = sz ] = '\0';
- rep_->capacity = cap;
- }
- else
- {
- rep_ = &nullrep_;
- }
- }
-
- void quit()
- {
- if (rep_ != &nullrep_)
- {
- // The rep_ is really an array of ints. (see the allocator, above).
- // Cast it back before delete, so the compiler won't incorrectly call destructors.
- delete [] ( reinterpret_cast( rep_ ) );
- }
- }
-
- Rep * rep_;
- static Rep nullrep_;
-
-} ;
-
-
-inline bool operator == (const TiXmlString & a, const TiXmlString & b)
-{
- return ( a.length() == b.length() ) // optimization on some platforms
- && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
-}
-inline bool operator < (const TiXmlString & a, const TiXmlString & b)
-{
- return strcmp(a.c_str(), b.c_str()) < 0;
-}
-
-inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
-inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
-inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
-inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
-
-inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
-inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
-inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
-inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
-
-TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
-TiXmlString operator + (const TiXmlString & a, const char* b);
-TiXmlString operator + (const char* a, const TiXmlString & b);
-
-
-/*
- TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
- Only the operators that we need for TinyXML have been developped.
-*/
-class TiXmlOutStream : public TiXmlString
-{
-public :
-
- // TiXmlOutStream << operator.
- TiXmlOutStream & operator << (const TiXmlString & in)
- {
- *this += in;
- return *this;
- }
-
- // TiXmlOutStream << operator.
- TiXmlOutStream & operator << (const char * in)
- {
- *this += in;
- return *this;
- }
-
-} ;
-
-#endif // TIXML_STRING_INCLUDED
-#endif // TIXML_USE_STL
diff --git a/tinyxml/tinyxml.cpp b/tinyxml/tinyxml.cpp
deleted file mode 100644
index 1bd61cd6c..000000000
--- a/tinyxml/tinyxml.cpp
+++ /dev/null
@@ -1,1866 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-#include
-
-#ifdef TIXML_USE_STL
-#include
-#include
-#endif
-
-#include "tinyxml.h"
-
-
-bool TiXmlBase::condenseWhiteSpace = true;
-
-void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
-{
- int i=0;
-
- while( i<(int)str.length() )
- {
- unsigned char c = (unsigned char) str[i];
-
- if ( c == '&'
- && i < ( (int)str.length() - 2 )
- && str[i+1] == '#'
- && str[i+2] == 'x' )
- {
- // Hexadecimal character reference.
- // Pass through unchanged.
- // © -- copyright symbol, for example.
- //
- // The -1 is a bug fix from Rob Laveaux. It keeps
- // an overflow from happening if there is no ';'.
- // There are actually 2 ways to exit this loop -
- // while fails (error case) and break (semicolon found).
- // However, there is no mechanism (currently) for
- // this function to return an error.
- while ( i<(int)str.length()-1 )
- {
- outString->append( str.c_str() + i, 1 );
- ++i;
- if ( str[i] == ';' )
- break;
- }
- }
- else if ( c == '&' )
- {
- outString->append( entity[0].str, entity[0].strLength );
- ++i;
- }
- else if ( c == '<' )
- {
- outString->append( entity[1].str, entity[1].strLength );
- ++i;
- }
- else if ( c == '>' )
- {
- outString->append( entity[2].str, entity[2].strLength );
- ++i;
- }
- else if ( c == '\"' )
- {
- outString->append( entity[3].str, entity[3].strLength );
- ++i;
- }
- else if ( c == '\'' )
- {
- outString->append( entity[4].str, entity[4].strLength );
- ++i;
- }
- else if ( c < 32 )
- {
- // Easy pass at non-alpha/numeric/symbol
- // Below 32 is symbolic.
- char buf[ 32 ];
-
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%02X;", (unsigned) ( c & 0xff ) );
- #else
- sprintf( buf, "%02X;", (unsigned) ( c & 0xff ) );
- #endif
-
- //*ME: warning C4267: convert 'size_t' to 'int'
- //*ME: Int-Cast to make compiler happy ...
- outString->append( buf, (int)strlen( buf ) );
- ++i;
- }
- else
- {
- //char realc = (char) c;
- //outString->append( &realc, 1 );
- *outString += (char) c; // somewhat more efficient function call.
- ++i;
- }
- }
-}
-
-
-TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
-{
- parent = 0;
- type = _type;
- firstChild = 0;
- lastChild = 0;
- prev = 0;
- next = 0;
-}
-
-
-TiXmlNode::~TiXmlNode()
-{
- TiXmlNode* node = firstChild;
- TiXmlNode* temp = 0;
-
- while ( node )
- {
- temp = node;
- node = node->next;
- delete temp;
- }
-}
-
-
-void TiXmlNode::CopyTo( TiXmlNode* target ) const
-{
- target->SetValue (value.c_str() );
- target->userData = userData;
-}
-
-
-void TiXmlNode::Clear()
-{
- TiXmlNode* node = firstChild;
- TiXmlNode* temp = 0;
-
- while ( node )
- {
- temp = node;
- node = node->next;
- delete temp;
- }
-
- firstChild = 0;
- lastChild = 0;
-}
-
-
-TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
-{
- assert( node->parent == 0 || node->parent == this );
- assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() );
-
- if ( node->Type() == TiXmlNode::DOCUMENT )
- {
- delete node;
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
-
- node->parent = this;
-
- node->prev = lastChild;
- node->next = 0;
-
- if ( lastChild )
- lastChild->next = node;
- else
- firstChild = node; // it was an empty list.
-
- lastChild = node;
- return node;
-}
-
-
-TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
-{
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
- {
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
- TiXmlNode* node = addThis.Clone();
- if ( !node )
- return 0;
-
- return LinkEndChild( node );
-}
-
-
-TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
-{
- if ( !beforeThis || beforeThis->parent != this ) {
- return 0;
- }
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
- {
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
-
- TiXmlNode* node = addThis.Clone();
- if ( !node )
- return 0;
- node->parent = this;
-
- node->next = beforeThis;
- node->prev = beforeThis->prev;
- if ( beforeThis->prev )
- {
- beforeThis->prev->next = node;
- }
- else
- {
- assert( firstChild == beforeThis );
- firstChild = node;
- }
- beforeThis->prev = node;
- return node;
-}
-
-
-TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
-{
- if ( !afterThis || afterThis->parent != this ) {
- return 0;
- }
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
- {
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
-
- TiXmlNode* node = addThis.Clone();
- if ( !node )
- return 0;
- node->parent = this;
-
- node->prev = afterThis;
- node->next = afterThis->next;
- if ( afterThis->next )
- {
- afterThis->next->prev = node;
- }
- else
- {
- assert( lastChild == afterThis );
- lastChild = node;
- }
- afterThis->next = node;
- return node;
-}
-
-
-TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
-{
- if ( replaceThis->parent != this )
- return 0;
-
- TiXmlNode* node = withThis.Clone();
- if ( !node )
- return 0;
-
- node->next = replaceThis->next;
- node->prev = replaceThis->prev;
-
- if ( replaceThis->next )
- replaceThis->next->prev = node;
- else
- lastChild = node;
-
- if ( replaceThis->prev )
- replaceThis->prev->next = node;
- else
- firstChild = node;
-
- delete replaceThis;
- node->parent = this;
- return node;
-}
-
-
-bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
-{
- if ( removeThis->parent != this )
- {
- assert( 0 );
- return false;
- }
-
- if ( removeThis->next )
- removeThis->next->prev = removeThis->prev;
- else
- lastChild = removeThis->prev;
-
- if ( removeThis->prev )
- removeThis->prev->next = removeThis->next;
- else
- firstChild = removeThis->next;
-
- delete removeThis;
- return true;
-}
-
-const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
-{
- const TiXmlNode* node;
- for ( node = firstChild; node; node = node->next )
- {
- if ( strcmp( node->Value(), _value ) == 0 )
- return node;
- }
- return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
-{
- const TiXmlNode* node;
- for ( node = lastChild; node; node = node->prev )
- {
- if ( strcmp( node->Value(), _value ) == 0 )
- return node;
- }
- return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
-{
- if ( !previous )
- {
- return FirstChild();
- }
- else
- {
- assert( previous->parent == this );
- return previous->NextSibling();
- }
-}
-
-
-const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
-{
- if ( !previous )
- {
- return FirstChild( val );
- }
- else
- {
- assert( previous->parent == this );
- return previous->NextSibling( val );
- }
-}
-
-
-const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
-{
- const TiXmlNode* node;
- for ( node = next; node; node = node->next )
- {
- if ( strcmp( node->Value(), _value ) == 0 )
- return node;
- }
- return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
-{
- const TiXmlNode* node;
- for ( node = prev; node; node = node->prev )
- {
- if ( strcmp( node->Value(), _value ) == 0 )
- return node;
- }
- return 0;
-}
-
-
-void TiXmlElement::RemoveAttribute( const char * name )
-{
- #ifdef TIXML_USE_STL
- TIXML_STRING str( name );
- TiXmlAttribute* node = attributeSet.Find( str );
- #else
- TiXmlAttribute* node = attributeSet.Find( name );
- #endif
- if ( node )
- {
- attributeSet.Remove( node );
- delete node;
- }
-}
-
-const TiXmlElement* TiXmlNode::FirstChildElement() const
-{
- const TiXmlNode* node;
-
- for ( node = FirstChild();
- node;
- node = node->NextSibling() )
- {
- if ( node->ToElement() )
- return node->ToElement();
- }
- return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
-{
- const TiXmlNode* node;
-
- for ( node = FirstChild( _value );
- node;
- node = node->NextSibling( _value ) )
- {
- if ( node->ToElement() )
- return node->ToElement();
- }
- return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::NextSiblingElement() const
-{
- const TiXmlNode* node;
-
- for ( node = NextSibling();
- node;
- node = node->NextSibling() )
- {
- if ( node->ToElement() )
- return node->ToElement();
- }
- return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
-{
- const TiXmlNode* node;
-
- for ( node = NextSibling( _value );
- node;
- node = node->NextSibling( _value ) )
- {
- if ( node->ToElement() )
- return node->ToElement();
- }
- return 0;
-}
-
-
-const TiXmlDocument* TiXmlNode::GetDocument() const
-{
- const TiXmlNode* node;
-
- for( node = this; node; node = node->parent )
- {
- if ( node->ToDocument() )
- return node->ToDocument();
- }
- return 0;
-}
-
-
-TiXmlElement::TiXmlElement (const char * _value)
- : TiXmlNode( TiXmlNode::ELEMENT )
-{
- firstChild = lastChild = 0;
- value = _value;
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlElement::TiXmlElement( const std::string& _value )
- : TiXmlNode( TiXmlNode::ELEMENT )
-{
- firstChild = lastChild = 0;
- value = _value;
-}
-#endif
-
-
-TiXmlElement::TiXmlElement( const TiXmlElement& copy)
- : TiXmlNode( TiXmlNode::ELEMENT )
-{
- firstChild = lastChild = 0;
- copy.CopyTo( this );
-}
-
-
-void TiXmlElement::operator=( const TiXmlElement& base )
-{
- ClearThis();
- base.CopyTo( this );
-}
-
-
-TiXmlElement::~TiXmlElement()
-{
- ClearThis();
-}
-
-
-void TiXmlElement::ClearThis()
-{
- Clear();
- while( attributeSet.First() )
- {
- TiXmlAttribute* node = attributeSet.First();
- attributeSet.Remove( node );
- delete node;
- }
-}
-
-
-const char* TiXmlElement::Attribute( const char* name ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( node )
- return node->Value();
- return 0;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( node )
- return &node->ValueStr();
- return 0;
-}
-#endif
-
-
-const char* TiXmlElement::Attribute( const char* name, int* i ) const
-{
- const char* s = Attribute( name );
- if ( i )
- {
- if ( s ) {
- *i = atoi( s );
- }
- else {
- *i = 0;
- }
- }
- return s;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
-{
- const std::string* s = Attribute( name );
- if ( i )
- {
- if ( s ) {
- *i = atoi( s->c_str() );
- }
- else {
- *i = 0;
- }
- }
- return s;
-}
-#endif
-
-
-const char* TiXmlElement::Attribute( const char* name, double* d ) const
-{
- const char* s = Attribute( name );
- if ( d )
- {
- if ( s ) {
- *d = atof( s );
- }
- else {
- *d = 0;
- }
- }
- return s;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const
-{
- const std::string* s = Attribute( name );
- if ( d )
- {
- if ( s ) {
- *d = atof( s->c_str() );
- }
- else {
- *d = 0;
- }
- }
- return s;
-}
-#endif
-
-
-int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
- return TIXML_NO_ATTRIBUTE;
- return node->QueryIntValue( ival );
-}
-
-
-#ifdef TIXML_USE_STL
-int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
- return TIXML_NO_ATTRIBUTE;
- return node->QueryIntValue( ival );
-}
-#endif
-
-
-int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
- return TIXML_NO_ATTRIBUTE;
- return node->QueryDoubleValue( dval );
-}
-
-
-#ifdef TIXML_USE_STL
-int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const
-{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
- return TIXML_NO_ATTRIBUTE;
- return node->QueryDoubleValue( dval );
-}
-#endif
-
-
-void TiXmlElement::SetAttribute( const char * name, int val )
-{
- char buf[64];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%d", val );
- #else
- sprintf( buf, "%d", val );
- #endif
- SetAttribute( name, buf );
-}
-
-
-#ifdef TIXML_USE_STL
-void TiXmlElement::SetAttribute( const std::string& name, int val )
-{
- std::ostringstream oss;
- oss << val;
- SetAttribute( name, oss.str() );
-}
-#endif
-
-
-void TiXmlElement::SetDoubleAttribute( const char * name, double val )
-{
- char buf[256];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
- #else
- sprintf( buf, "%f", val );
- #endif
- SetAttribute( name, buf );
-}
-
-
-void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
-{
- #ifdef TIXML_USE_STL
- TIXML_STRING _name( cname );
- TIXML_STRING _value( cvalue );
- #else
- const char* _name = cname;
- const char* _value = cvalue;
- #endif
-
- TiXmlAttribute* node = attributeSet.Find( _name );
- if ( node )
- {
- node->SetValue( _value );
- return;
- }
-
- TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
- if ( attrib )
- {
- attributeSet.Add( attrib );
- }
- else
- {
- TiXmlDocument* document = GetDocument();
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
- }
-}
-
-
-#ifdef TIXML_USE_STL
-void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value )
-{
- TiXmlAttribute* node = attributeSet.Find( name );
- if ( node )
- {
- node->SetValue( _value );
- return;
- }
-
- TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
- if ( attrib )
- {
- attributeSet.Add( attrib );
- }
- else
- {
- TiXmlDocument* document = GetDocument();
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
- }
-}
-#endif
-
-
-void TiXmlElement::Print( FILE* cfile, int depth ) const
-{
- int i;
- assert( cfile );
- for ( i=0; iNext() )
- {
- fprintf( cfile, " " );
- attrib->Print( cfile, depth );
- }
-
- // There are 3 different formatting approaches:
- // 1) An element without children is printed as a node
- // 2) An element with only a text child is printed as text
- // 3) An element with children is printed on multiple lines.
- TiXmlNode* node;
- if ( !firstChild )
- {
- fprintf( cfile, " />" );
- }
- else if ( firstChild == lastChild && firstChild->ToText() )
- {
- fprintf( cfile, ">" );
- firstChild->Print( cfile, depth + 1 );
- fprintf( cfile, "%s>", value.c_str() );
- }
- else
- {
- fprintf( cfile, ">" );
-
- for ( node = firstChild; node; node=node->NextSibling() )
- {
- if ( !node->ToText() )
- {
- fprintf( cfile, "\n" );
- }
- node->Print( cfile, depth+1 );
- }
- fprintf( cfile, "\n" );
- for( i=0; i", value.c_str() );
- }
-}
-
-
-void TiXmlElement::CopyTo( TiXmlElement* target ) const
-{
- // superclass:
- TiXmlNode::CopyTo( target );
-
- // Element class:
- // Clone the attributes, then clone the children.
- const TiXmlAttribute* attribute = 0;
- for( attribute = attributeSet.First();
- attribute;
- attribute = attribute->Next() )
- {
- target->SetAttribute( attribute->Name(), attribute->Value() );
- }
-
- TiXmlNode* node = 0;
- for ( node = firstChild; node; node = node->NextSibling() )
- {
- target->LinkEndChild( node->Clone() );
- }
-}
-
-bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
-{
- if ( visitor->VisitEnter( *this, attributeSet.First() ) )
- {
- for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
- {
- if ( !node->Accept( visitor ) )
- break;
- }
- }
- return visitor->VisitExit( *this );
-}
-
-
-TiXmlNode* TiXmlElement::Clone() const
-{
- TiXmlElement* clone = new TiXmlElement( Value() );
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-const char* TiXmlElement::GetText() const
-{
- const TiXmlNode* child = this->FirstChild();
- if ( child ) {
- const TiXmlText* childText = child->ToText();
- if ( childText ) {
- return childText->Value();
- }
- }
- return 0;
-}
-
-
-TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
-{
- tabsize = 4;
- useMicrosoftBOM = false;
- ClearError();
-}
-
-TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
- tabsize = 4;
- useMicrosoftBOM = false;
- value = documentName;
- ClearError();
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
- tabsize = 4;
- useMicrosoftBOM = false;
- value = documentName;
- ClearError();
-}
-#endif
-
-
-TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
- copy.CopyTo( this );
-}
-
-
-void TiXmlDocument::operator=( const TiXmlDocument& copy )
-{
- Clear();
- copy.CopyTo( this );
-}
-
-
-bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
-{
- // See STL_STRING_BUG below.
- //StringToBuffer buf( value );
-
- return LoadFile( Value(), encoding );
-}
-
-
-bool TiXmlDocument::SaveFile() const
-{
- // See STL_STRING_BUG below.
-// StringToBuffer buf( value );
-//
-// if ( buf.buffer && SaveFile( buf.buffer ) )
-// return true;
-//
-// return false;
- return SaveFile( Value() );
-}
-
-bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
-{
- // There was a really terrifying little bug here. The code:
- // value = filename
- // in the STL case, cause the assignment method of the std::string to
- // be called. What is strange, is that the std::string had the same
- // address as it's c_str() method, and so bad things happen. Looks
- // like a bug in the Microsoft STL implementation.
- // Add an extra string to avoid the crash.
- TIXML_STRING filename( _filename );
- value = filename;
-
- // reading in binary mode so that tinyxml can normalize the EOL
- FILE* file = fopen( value.c_str (), "rb" );
-
- if ( file )
- {
- bool result = LoadFile( file, encoding );
- fclose( file );
- return result;
- }
- else
- {
- SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
- return false;
- }
-}
-
-bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
-{
- if ( !file )
- {
- SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
- return false;
- }
-
- // Delete the existing data:
- Clear();
- location.Clear();
-
- // Get the file size, so we can pre-allocate the string. HUGE speed impact.
- long length = 0;
- fseek( file, 0, SEEK_END );
- length = ftell( file );
- fseek( file, 0, SEEK_SET );
-
- // Strange case, but good to handle up front.
- if ( length == 0 )
- {
- SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return false;
- }
-
- // If we have a file, assume it is all one big XML file, and read it in.
- // The document parser may decide the document ends sooner than the entire file, however.
- TIXML_STRING data;
- data.reserve( length );
-
- // Subtle bug here. TinyXml did use fgets. But from the XML spec:
- // 2.11 End-of-Line Handling
- //
- //
- // ...the XML processor MUST behave as if it normalized all line breaks in external
- // parsed entities (including the document entity) on input, before parsing, by translating
- // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to
- // a single #xA character.
- //
- //
- // It is not clear fgets does that, and certainly isn't clear it works cross platform.
- // Generally, you expect fgets to translate from the convention of the OS to the c/unix
- // convention, and not work generally.
-
- /*
- while( fgets( buf, sizeof(buf), file ) )
- {
- data += buf;
- }
- */
-
- char* buf = new char[ length+1 ];
- buf[0] = 0;
-
- if ( fread( buf, length, 1, file ) != 1 ) {
- delete [] buf;
- SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
- return false;
- }
-
- const char* lastPos = buf;
- const char* p = buf;
-
- buf[length] = 0;
- while( *p ) {
- assert( p < (buf+length) );
- if ( *p == 0xa ) {
- // Newline character. No special rules for this. Append all the characters
- // since the last string, and include the newline.
- data.append( lastPos, (p-lastPos+1) ); // append, include the newline
- ++p; // move past the newline
- lastPos = p; // and point to the new buffer (may be 0)
- assert( p <= (buf+length) );
- }
- else if ( *p == 0xd ) {
- // Carriage return. Append what we have so far, then
- // handle moving forward in the buffer.
- if ( (p-lastPos) > 0 ) {
- data.append( lastPos, p-lastPos ); // do not add the CR
- }
- data += (char)0xa; // a proper newline
-
- if ( *(p+1) == 0xa ) {
- // Carriage return - new line sequence
- p += 2;
- lastPos = p;
- assert( p <= (buf+length) );
- }
- else {
- // it was followed by something else...that is presumably characters again.
- ++p;
- lastPos = p;
- assert( p <= (buf+length) );
- }
- }
- else {
- ++p;
- }
- }
- // Handle any left over characters.
- if ( p-lastPos ) {
- data.append( lastPos, p-lastPos );
- }
- delete [] buf;
- buf = 0;
-
- Parse( data.c_str(), 0, encoding );
-
- if ( Error() )
- return false;
- else
- return true;
-}
-
-
-bool TiXmlDocument::SaveFile( const char * filename ) const
-{
- // The old c stuff lives on...
- FILE* fp = fopen( filename, "w" );
- if ( fp )
- {
- bool result = SaveFile( fp );
- fclose( fp );
- return result;
- }
- return false;
-}
-
-
-bool TiXmlDocument::SaveFile( FILE* fp ) const
-{
- if ( useMicrosoftBOM )
- {
- const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
- const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
- const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
-
- fputc( TIXML_UTF_LEAD_0, fp );
- fputc( TIXML_UTF_LEAD_1, fp );
- fputc( TIXML_UTF_LEAD_2, fp );
- }
- Print( fp, 0 );
- return (ferror(fp) == 0);
-}
-
-
-void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
-{
- TiXmlNode::CopyTo( target );
-
- target->error = error;
- target->errorDesc = errorDesc.c_str ();
-
- TiXmlNode* node = 0;
- for ( node = firstChild; node; node = node->NextSibling() )
- {
- target->LinkEndChild( node->Clone() );
- }
-}
-
-
-TiXmlNode* TiXmlDocument::Clone() const
-{
- TiXmlDocument* clone = new TiXmlDocument();
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-void TiXmlDocument::Print( FILE* cfile, int depth ) const
-{
- assert( cfile );
- for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
- {
- node->Print( cfile, depth );
- fprintf( cfile, "\n" );
- }
-}
-
-
-bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const
-{
- if ( visitor->VisitEnter( *this ) )
- {
- for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
- {
- if ( !node->Accept( visitor ) )
- break;
- }
- }
- return visitor->VisitExit( *this );
-}
-
-
-const TiXmlAttribute* TiXmlAttribute::Next() const
-{
- // We are using knowledge of the sentinel. The sentinel
- // have a value or name.
- if ( next->value.empty() && next->name.empty() )
- return 0;
- return next;
-}
-
-/*
-TiXmlAttribute* TiXmlAttribute::Next()
-{
- // We are using knowledge of the sentinel. The sentinel
- // have a value or name.
- if ( next->value.empty() && next->name.empty() )
- return 0;
- return next;
-}
-*/
-
-const TiXmlAttribute* TiXmlAttribute::Previous() const
-{
- // We are using knowledge of the sentinel. The sentinel
- // have a value or name.
- if ( prev->value.empty() && prev->name.empty() )
- return 0;
- return prev;
-}
-
-/*
-TiXmlAttribute* TiXmlAttribute::Previous()
-{
- // We are using knowledge of the sentinel. The sentinel
- // have a value or name.
- if ( prev->value.empty() && prev->name.empty() )
- return 0;
- return prev;
-}
-*/
-
-void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
-{
- TIXML_STRING n, v;
-
- PutString( name, &n );
- PutString( value, &v );
-
- if (value.find ('\"') == TIXML_STRING::npos) {
- if ( cfile ) {
- fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
- }
- if ( str ) {
- (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
- }
- }
- else {
- if ( cfile ) {
- fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
- }
- if ( str ) {
- (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
- }
- }
-}
-
-
-int TiXmlAttribute::QueryIntValue( int* ival ) const
-{
- if ( sscanf( value.c_str(), "%d", ival ) == 1 )
- return TIXML_SUCCESS;
- return TIXML_WRONG_TYPE;
-}
-
-int TiXmlAttribute::QueryDoubleValue( double* dval ) const
-{
- if ( sscanf( value.c_str(), "%lf", dval ) == 1 )
- return TIXML_SUCCESS;
- return TIXML_WRONG_TYPE;
-}
-
-void TiXmlAttribute::SetIntValue( int _value )
-{
- char buf [64];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
- #else
- sprintf (buf, "%d", _value);
- #endif
- SetValue (buf);
-}
-
-void TiXmlAttribute::SetDoubleValue( double _value )
-{
- char buf [256];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
- #else
- sprintf (buf, "%lf", _value);
- #endif
- SetValue (buf);
-}
-
-int TiXmlAttribute::IntValue() const
-{
- return atoi (value.c_str ());
-}
-
-double TiXmlAttribute::DoubleValue() const
-{
- return atof (value.c_str ());
-}
-
-
-TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
-{
- copy.CopyTo( this );
-}
-
-
-void TiXmlComment::operator=( const TiXmlComment& base )
-{
- Clear();
- base.CopyTo( this );
-}
-
-
-void TiXmlComment::Print( FILE* cfile, int depth ) const
-{
- assert( cfile );
- for ( int i=0; i", value.c_str() );
-}
-
-
-void TiXmlComment::CopyTo( TiXmlComment* target ) const
-{
- TiXmlNode::CopyTo( target );
-}
-
-
-bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const
-{
- return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlComment::Clone() const
-{
- TiXmlComment* clone = new TiXmlComment();
-
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-void TiXmlText::Print( FILE* cfile, int depth ) const
-{
- assert( cfile );
- if ( cdata )
- {
- int i;
- fprintf( cfile, "\n" );
- for ( i=0; i\n", value.c_str() ); // unformatted output
- }
- else
- {
- TIXML_STRING buffer;
- PutString( value, &buffer );
- fprintf( cfile, "%s", buffer.c_str() );
- }
-}
-
-
-void TiXmlText::CopyTo( TiXmlText* target ) const
-{
- TiXmlNode::CopyTo( target );
- target->cdata = cdata;
-}
-
-
-bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
-{
- return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlText::Clone() const
-{
- TiXmlText* clone = 0;
- clone = new TiXmlText( "" );
-
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-TiXmlDeclaration::TiXmlDeclaration( const char * _version,
- const char * _encoding,
- const char * _standalone )
- : TiXmlNode( TiXmlNode::DECLARATION )
-{
- version = _version;
- encoding = _encoding;
- standalone = _standalone;
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
- const std::string& _encoding,
- const std::string& _standalone )
- : TiXmlNode( TiXmlNode::DECLARATION )
-{
- version = _version;
- encoding = _encoding;
- standalone = _standalone;
-}
-#endif
-
-
-TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
- : TiXmlNode( TiXmlNode::DECLARATION )
-{
- copy.CopyTo( this );
-}
-
-
-void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
-{
- Clear();
- copy.CopyTo( this );
-}
-
-
-void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
-{
- if ( cfile ) fprintf( cfile, "" );
- if ( str ) (*str) += "?>";
-}
-
-
-void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
-{
- TiXmlNode::CopyTo( target );
-
- target->version = version;
- target->encoding = encoding;
- target->standalone = standalone;
-}
-
-
-bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
-{
- return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlDeclaration::Clone() const
-{
- TiXmlDeclaration* clone = new TiXmlDeclaration();
-
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-void TiXmlUnknown::Print( FILE* cfile, int depth ) const
-{
- for ( int i=0; i", value.c_str() );
-}
-
-
-void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
-{
- TiXmlNode::CopyTo( target );
-}
-
-
-bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const
-{
- return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlUnknown::Clone() const
-{
- TiXmlUnknown* clone = new TiXmlUnknown();
-
- if ( !clone )
- return 0;
-
- CopyTo( clone );
- return clone;
-}
-
-
-TiXmlAttributeSet::TiXmlAttributeSet()
-{
- sentinel.next = &sentinel;
- sentinel.prev = &sentinel;
-}
-
-
-TiXmlAttributeSet::~TiXmlAttributeSet()
-{
- assert( sentinel.next == &sentinel );
- assert( sentinel.prev == &sentinel );
-}
-
-
-void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
-{
- #ifdef TIXML_USE_STL
- assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set.
- #else
- assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
- #endif
-
- addMe->next = &sentinel;
- addMe->prev = sentinel.prev;
-
- sentinel.prev->next = addMe;
- sentinel.prev = addMe;
-}
-
-void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
-{
- TiXmlAttribute* node;
-
- for( node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( node == removeMe )
- {
- node->prev->next = node->next;
- node->next->prev = node->prev;
- node->next = 0;
- node->prev = 0;
- return;
- }
- }
- assert( 0 ); // we tried to remove a non-linked attribute.
-}
-
-
-#ifdef TIXML_USE_STL
-const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
-{
- for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( node->name == name )
- return node;
- }
- return 0;
-}
-
-/*
-TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name )
-{
- for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( node->name == name )
- return node;
- }
- return 0;
-}
-*/
-#endif
-
-
-const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
-{
- for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( strcmp( node->name.c_str(), name ) == 0 )
- return node;
- }
- return 0;
-}
-
-/*
-TiXmlAttribute* TiXmlAttributeSet::Find( const char* name )
-{
- for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( strcmp( node->name.c_str(), name ) == 0 )
- return node;
- }
- return 0;
-}
-*/
-
-#ifdef TIXML_USE_STL
-std::istream& operator>> (std::istream & in, TiXmlNode & base)
-{
- TIXML_STRING tag;
- tag.reserve( 8 * 1000 );
- base.StreamIn( &in, &tag );
-
- base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
- return in;
-}
-#endif
-
-
-#ifdef TIXML_USE_STL
-std::ostream& operator<< (std::ostream & out, const TiXmlNode & base)
-{
- TiXmlPrinter printer;
- printer.SetStreamPrinting();
- base.Accept( &printer );
- out << printer.Str();
-
- return out;
-}
-
-
-std::string& operator<< (std::string& out, const TiXmlNode& base )
-{
- TiXmlPrinter printer;
- printer.SetStreamPrinting();
- base.Accept( &printer );
- out.append( printer.Str() );
-
- return out;
-}
-#endif
-
-
-TiXmlHandle TiXmlHandle::FirstChild() const
-{
- if ( node )
- {
- TiXmlNode* child = node->FirstChild();
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
-{
- if ( node )
- {
- TiXmlNode* child = node->FirstChild( value );
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChildElement() const
-{
- if ( node )
- {
- TiXmlElement* child = node->FirstChildElement();
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
-{
- if ( node )
- {
- TiXmlElement* child = node->FirstChildElement( value );
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::Child( int count ) const
-{
- if ( node )
- {
- int i;
- TiXmlNode* child = node->FirstChild();
- for ( i=0;
- child && iNextSibling(), ++i )
- {
- // nothing
- }
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
-{
- if ( node )
- {
- int i;
- TiXmlNode* child = node->FirstChild( value );
- for ( i=0;
- child && iNextSibling( value ), ++i )
- {
- // nothing
- }
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::ChildElement( int count ) const
-{
- if ( node )
- {
- int i;
- TiXmlElement* child = node->FirstChildElement();
- for ( i=0;
- child && iNextSiblingElement(), ++i )
- {
- // nothing
- }
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
-{
- if ( node )
- {
- int i;
- TiXmlElement* child = node->FirstChildElement( value );
- for ( i=0;
- child && iNextSiblingElement( value ), ++i )
- {
- // nothing
- }
- if ( child )
- return TiXmlHandle( child );
- }
- return TiXmlHandle( 0 );
-}
-
-
-bool TiXmlPrinter::VisitEnter( const TiXmlDocument& )
-{
- return true;
-}
-
-bool TiXmlPrinter::VisitExit( const TiXmlDocument& )
-{
- return true;
-}
-
-bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
-{
- DoIndent();
- buffer += "<";
- buffer += element.Value();
-
- for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
- {
- buffer += " ";
- attrib->Print( 0, 0, &buffer );
- }
-
- if ( !element.FirstChild() )
- {
- buffer += " />";
- DoLineBreak();
- }
- else
- {
- buffer += ">";
- if ( element.FirstChild()->ToText()
- && element.LastChild() == element.FirstChild()
- && element.FirstChild()->ToText()->CDATA() == false )
- {
- simpleTextPrint = true;
- // no DoLineBreak()!
- }
- else
- {
- DoLineBreak();
- }
- }
- ++depth;
- return true;
-}
-
-
-bool TiXmlPrinter::VisitExit( const TiXmlElement& element )
-{
- --depth;
- if ( !element.FirstChild() )
- {
- // nothing.
- }
- else
- {
- if ( simpleTextPrint )
- {
- simpleTextPrint = false;
- }
- else
- {
- DoIndent();
- }
- buffer += "";
- buffer += element.Value();
- buffer += ">";
- DoLineBreak();
- }
- return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlText& text )
-{
- if ( text.CDATA() )
- {
- DoIndent();
- buffer += "";
- DoLineBreak();
- }
- else if ( simpleTextPrint )
- {
- buffer += text.Value();
- }
- else
- {
- DoIndent();
- buffer += text.Value();
- DoLineBreak();
- }
- return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration )
-{
- DoIndent();
- declaration.Print( 0, 0, &buffer );
- DoLineBreak();
- return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlComment& comment )
-{
- DoIndent();
- buffer += "";
- DoLineBreak();
- return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown )
-{
- DoIndent();
- buffer += "<";
- buffer += unknown.Value();
- buffer += ">";
- DoLineBreak();
- return true;
-}
-
diff --git a/tinyxml/tinyxml.h b/tinyxml/tinyxml.h
deleted file mode 100644
index 5391236e6..000000000
--- a/tinyxml/tinyxml.h
+++ /dev/null
@@ -1,1776 +0,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-
-#ifndef TINYXML_INCLUDED
-#define TINYXML_INCLUDED
-
-#ifdef _MSC_VER
-#pragma warning( push )
-#pragma warning( disable : 4530 )
-#pragma warning( disable : 4786 )
-#endif
-
-#include
-#include
-#include
-#include
-#include
-
-// Help out windows:
-#if defined( _DEBUG ) && !defined( DEBUG )
-#define DEBUG
-#endif
-
-#ifdef TIXML_USE_STL
- #include
- #include
- #include
- #define TIXML_STRING std::string
-#else
- #include "tinystr.h"
- #define TIXML_STRING TiXmlString
-#endif
-
-// Deprecated library function hell. Compilers want to use the
-// new safe versions. This probably doesn't fully address the problem,
-// but it gets closer. There are too many compilers for me to fully
-// test. If you get compilation troubles, undefine TIXML_SAFE
-#define TIXML_SAFE
-
-#ifdef TIXML_SAFE
- #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
- // Microsoft visual studio, version 2005 and higher.
- #define TIXML_SNPRINTF _snprintf_s
- #define TIXML_SNSCANF _snscanf_s
- #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
- // Microsoft visual studio, version 6 and higher.
- //#pragma message( "Using _sn* functions." )
- #define TIXML_SNPRINTF _snprintf
- #define TIXML_SNSCANF _snscanf
- #elif defined(__GNUC__) && (__GNUC__ >= 3 )
- // GCC version 3 and higher.s
- //#warning( "Using sn* functions." )
- #define TIXML_SNPRINTF snprintf
- #define TIXML_SNSCANF snscanf
- #endif
-#endif
-
-class TiXmlDocument;
-class TiXmlElement;
-class TiXmlComment;
-class TiXmlUnknown;
-class TiXmlAttribute;
-class TiXmlText;
-class TiXmlDeclaration;
-class TiXmlParsingData;
-
-const int TIXML_MAJOR_VERSION = 2;
-const int TIXML_MINOR_VERSION = 5;
-const int TIXML_PATCH_VERSION = 2;
-
-/* Internal structure for tracking location of items
- in the XML file.
-*/
-struct TiXmlCursor
-{
- TiXmlCursor() { Clear(); }
- void Clear() { row = col = -1; }
-
- int row; // 0 based.
- int col; // 0 based.
-};
-
-
-/**
- If you call the Accept() method, it requires being passed a TiXmlVisitor
- class to handle callbacks. For nodes that contain other nodes (Document, Element)
- you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves
- are simple called with Visit().
-
- If you return 'true' from a Visit method, recursive parsing will continue. If you return
- false, no children of this node or its sibilings will be Visited.
-
- All flavors of Visit methods have a default implementation that returns 'true' (continue
- visiting). You need to only override methods that are interesting to you.
-
- Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting.
-
- You should never change the document from a callback.
-
- @sa TiXmlNode::Accept()
-*/
-class TiXmlVisitor
-{
-public:
- virtual ~TiXmlVisitor() {}
-
- /// Visit a document.
- virtual bool VisitEnter( const TiXmlDocument& doc ) { return true; }
- /// Visit a document.
- virtual bool VisitExit( const TiXmlDocument& doc ) { return true; }
-
- /// Visit an element.
- virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) { return true; }
- /// Visit an element.
- virtual bool VisitExit( const TiXmlElement& element ) { return true; }
-
- /// Visit a declaration
- virtual bool Visit( const TiXmlDeclaration& declaration ) { return true; }
- /// Visit a text node
- virtual bool Visit( const TiXmlText& text ) { return true; }
- /// Visit a comment node
- virtual bool Visit( const TiXmlComment& comment ) { return true; }
- /// Visit an unknow node
- virtual bool Visit( const TiXmlUnknown& unknown ) { return true; }
-};
-
-// Only used by Attribute::Query functions
-enum
-{
- TIXML_SUCCESS,
- TIXML_NO_ATTRIBUTE,
- TIXML_WRONG_TYPE
-};
-
-
-// Used by the parsing routines.
-enum TiXmlEncoding
-{
- TIXML_ENCODING_UNKNOWN,
- TIXML_ENCODING_UTF8,
- TIXML_ENCODING_LEGACY
-};
-
-const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
-
-/** TiXmlBase is a base class for every class in TinyXml.
- It does little except to establish that TinyXml classes
- can be printed and provide some utility functions.
-
- In XML, the document and elements can contain
- other elements and other types of nodes.
-
- @verbatim
- A Document can contain: Element (container or leaf)
- Comment (leaf)
- Unknown (leaf)
- Declaration( leaf )
-
- An Element can contain: Element (container or leaf)
- Text (leaf)
- Attributes (not on tree)
- Comment (leaf)
- Unknown (leaf)
-
- A Decleration contains: Attributes (not on tree)
- @endverbatim
-*/
-class TiXmlBase
-{
- friend class TiXmlNode;
- friend class TiXmlElement;
- friend class TiXmlDocument;
-
-public:
- TiXmlBase() : userData(0) {}
- virtual ~TiXmlBase() {}
-
- /** All TinyXml classes can print themselves to a filestream
- or the string class (TiXmlString in non-STL mode, std::string
- in STL mode.) Either or both cfile and str can be null.
-
- This is a formatted print, and will insert
- tabs and newlines.
-
- (For an unformatted stream, use the << operator.)
- */
- virtual void Print( FILE* cfile, int depth ) const = 0;
-
- /** The world does not agree on whether white space should be kept or
- not. In order to make everyone happy, these global, static functions
- are provided to set whether or not TinyXml will condense all white space
- into a single space or not. The default is to condense. Note changing this
- value is not thread safe.
- */
- static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
-
- /// Return the current white space setting.
- static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
-
- /** Return the position, in the original source file, of this node or attribute.
- The row and column are 1-based. (That is the first row and first column is
- 1,1). If the returns values are 0 or less, then the parser does not have
- a row and column value.
-
- Generally, the row and column value will be set when the TiXmlDocument::Load(),
- TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set
- when the DOM was created from operator>>.
-
- The values reflect the initial load. Once the DOM is modified programmatically
- (by adding or changing nodes and attributes) the new values will NOT update to
- reflect changes in the document.
-
- There is a minor performance cost to computing the row and column. Computation
- can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.
-
- @sa TiXmlDocument::SetTabSize()
- */
- int Row() const { return location.row + 1; }
- int Column() const { return location.col + 1; } ///< See Row()
-
- void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data.
- void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data.
- const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data.
-
- // Table that returs, for a given lead byte, the total number of bytes
- // in the UTF-8 sequence.
- static const int utf8ByteTable[256];
-
- virtual const char* Parse( const char* p,
- TiXmlParsingData* data,
- TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
-
- enum
- {
- TIXML_NO_ERROR = 0,
- TIXML_ERROR,
- TIXML_ERROR_OPENING_FILE,
- TIXML_ERROR_OUT_OF_MEMORY,
- TIXML_ERROR_PARSING_ELEMENT,
- TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
- TIXML_ERROR_READING_ELEMENT_VALUE,
- TIXML_ERROR_READING_ATTRIBUTES,
- TIXML_ERROR_PARSING_EMPTY,
- TIXML_ERROR_READING_END_TAG,
- TIXML_ERROR_PARSING_UNKNOWN,
- TIXML_ERROR_PARSING_COMMENT,
- TIXML_ERROR_PARSING_DECLARATION,
- TIXML_ERROR_DOCUMENT_EMPTY,
- TIXML_ERROR_EMBEDDED_NULL,
- TIXML_ERROR_PARSING_CDATA,
- TIXML_ERROR_DOCUMENT_TOP_ONLY,
-
- TIXML_ERROR_STRING_COUNT
- };
-
-protected:
-
- static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
- inline static bool IsWhiteSpace( char c )
- {
- return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
- }
- inline static bool IsWhiteSpace( int c )
- {
- if ( c < 256 )
- return IsWhiteSpace( (char) c );
- return false; // Again, only truly correct for English/Latin...but usually works.
- }
-
- #ifdef TIXML_USE_STL
- static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
- static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
- #endif
-
- /* Reads an XML name into the string provided. Returns
- a pointer just past the last character of the name,
- or 0 if the function has an error.
- */
- static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
-
- /* Reads text. Returns a pointer past the given end tag.
- Wickedly complex options, but it keeps the (sensitive) code in one place.
- */
- static const char* ReadText( const char* in, // where to start
- TIXML_STRING* text, // the string read
- bool ignoreWhiteSpace, // whether to keep the white space
- const char* endTag, // what ends this text
- bool ignoreCase, // whether to ignore case in the end tag
- TiXmlEncoding encoding ); // the current encoding
-
- // If an entity has been found, transform it into a character.
- static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
-
- // Get a character, while interpreting entities.
- // The length can be from 0 to 4 bytes.
- inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
- {
- assert( p );
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- *length = utf8ByteTable[ *((const unsigned char*)p) ];
- assert( *length >= 0 && *length < 5 );
- }
- else
- {
- *length = 1;
- }
-
- if ( *length == 1 )
- {
- if ( *p == '&' )
- return GetEntity( p, _value, length, encoding );
- *_value = *p;
- return p+1;
- }
- else if ( *length )
- {
- //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
- // and the null terminator isn't needed
- for( int i=0; p[i] && i<*length; ++i ) {
- _value[i] = p[i];
- }
- return p + (*length);
- }
- else
- {
- // Not valid text.
- return 0;
- }
- }
-
- // Puts a string to a stream, expanding entities as it goes.
- // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
- static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
-
- // Return true if the next characters in the stream are any of the endTag sequences.
- // Ignore case only works for english, and should only be relied on when comparing
- // to English words: StringEqual( p, "version", true ) is fine.
- static bool StringEqual( const char* p,
- const char* endTag,
- bool ignoreCase,
- TiXmlEncoding encoding );
-
- static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
-
- TiXmlCursor location;
-
- /// Field containing a generic user pointer
- void* userData;
-
- // None of these methods are reliable for any language except English.
- // Good for approximation, not great for accuracy.
- static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
- static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
- inline static int ToLower( int v, TiXmlEncoding encoding )
- {
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- if ( v < 128 ) return tolower( v );
- return v;
- }
- else
- {
- return tolower( v );
- }
- }
- static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
-
-private:
- TiXmlBase( const TiXmlBase& ); // not implemented.
- void operator=( const TiXmlBase& base ); // not allowed.
-
- struct Entity
- {
- const char* str;
- unsigned int strLength;
- char chr;
- };
- enum
- {
- NUM_ENTITY = 5,
- MAX_ENTITY_LENGTH = 6
-
- };
- static Entity entity[ NUM_ENTITY ];
- static bool condenseWhiteSpace;
-};
-
-
-/** The parent class for everything in the Document Object Model.
- (Except for attributes).
- Nodes have siblings, a parent, and children. A node can be
- in a document, or stand on its own. The type of a TiXmlNode
- can be queried, and it can be cast to its more defined type.
-*/
-class TiXmlNode : public TiXmlBase
-{
- friend class TiXmlDocument;
- friend class TiXmlElement;
-
-public:
- #ifdef TIXML_USE_STL
-
- /** An input stream operator, for every class. Tolerant of newlines and
- formatting, but doesn't expect them.
- */
- friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
-
- /** An output stream operator, for every class. Note that this outputs
- without any newlines or formatting, as opposed to Print(), which
- includes tabs and new lines.
-
- The operator<< and operator>> are not completely symmetric. Writing
- a node to a stream is very well defined. You'll get a nice stream
- of output, without any extra whitespace or newlines.
-
- But reading is not as well defined. (As it always is.) If you create
- a TiXmlElement (for example) and read that from an input stream,
- the text needs to define an element or junk will result. This is
- true of all input streams, but it's worth keeping in mind.
-
- A TiXmlDocument will read nodes until it reads a root element, and
- all the children of that root element.
- */
- friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
-
- /// Appends the XML node or attribute to a std::string.
- friend std::string& operator<< (std::string& out, const TiXmlNode& base );
-
- #endif
-
- /** The types of XML nodes supported by TinyXml. (All the
- unsupported types are picked up by UNKNOWN.)
- */
- enum NodeType
- {
- DOCUMENT,
- ELEMENT,
- COMMENT,
- UNKNOWN,
- TEXT,
- DECLARATION,
- TYPECOUNT
- };
-
- virtual ~TiXmlNode();
-
- /** The meaning of 'value' changes for the specific type of
- TiXmlNode.
- @verbatim
- Document: filename of the xml file
- Element: name of the element
- Comment: the comment text
- Unknown: the tag contents
- Text: the text string
- @endverbatim
-
- The subclasses will wrap this function.
- */
- const char *Value() const { return value.c_str (); }
-
- #ifdef TIXML_USE_STL
- /** Return Value() as a std::string. If you only use STL,
- this is more efficient than calling Value().
- Only available in STL mode.
- */
- const std::string& ValueStr() const { return value; }
- #endif
-
- /** Changes the value of the node. Defined as:
- @verbatim
- Document: filename of the xml file
- Element: name of the element
- Comment: the comment text
- Unknown: the tag contents
- Text: the text string
- @endverbatim
- */
- void SetValue(const char * _value) { value = _value;}
-
- #ifdef TIXML_USE_STL
- /// STL std::string form.
- void SetValue( const std::string& _value ) { value = _value; }
- #endif
-
- /// Delete all the children of this node. Does not affect 'this'.
- void Clear();
-
- /// One step up the DOM.
- TiXmlNode* Parent() { return parent; }
- const TiXmlNode* Parent() const { return parent; }
-
- const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
- TiXmlNode* FirstChild() { return firstChild; }
- const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found.
- /// The first child of this node with the matching 'value'. Will be null if none found.
- TiXmlNode* FirstChild( const char * _value ) {
- // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
- // call the method, cast the return back to non-const.
- return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
- }
- const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
- TiXmlNode* LastChild() { return lastChild; }
-
- const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
- TiXmlNode* LastChild( const char * _value ) {
- return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
- }
-
- #ifdef TIXML_USE_STL
- const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form.
- TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form.
- const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form.
- TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form.
- #endif
-
- /** An alternate way to walk the children of a node.
- One way to iterate over nodes is:
- @verbatim
- for( child = parent->FirstChild(); child; child = child->NextSibling() )
- @endverbatim
-
- IterateChildren does the same thing with the syntax:
- @verbatim
- child = 0;
- while( child = parent->IterateChildren( child ) )
- @endverbatim
-
- IterateChildren takes the previous child as input and finds
- the next one. If the previous child is null, it returns the
- first. IterateChildren will return null when done.
- */
- const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
- TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
- return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
- }
-
- /// This flavor of IterateChildren searches for children with a particular 'value'
- const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
- TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
- return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
- }
-
- #ifdef TIXML_USE_STL
- const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form.
- TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form.
- #endif
-
- /** Add a new node related to this. Adds a child past the LastChild.
- Returns a pointer to the new object or NULL if an error occured.
- */
- TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
-
-
- /** Add a new node related to this. Adds a child past the LastChild.
-
- NOTE: the node to be added is passed by pointer, and will be
- henceforth owned (and deleted) by tinyXml. This method is efficient
- and avoids an extra copy, but should be used with care as it
- uses a different memory model than the other insert functions.
-
- @sa InsertEndChild
- */
- TiXmlNode* LinkEndChild( TiXmlNode* addThis );
-
- /** Add a new node related to this. Adds a child before the specified child.
- Returns a pointer to the new object or NULL if an error occured.
- */
- TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
-
- /** Add a new node related to this. Adds a child after the specified child.
- Returns a pointer to the new object or NULL if an error occured.
- */
- TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
-
- /** Replace a child of this node.
- Returns a pointer to the new object or NULL if an error occured.
- */
- TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
-
- /// Delete a child of this node.
- bool RemoveChild( TiXmlNode* removeThis );
-
- /// Navigate to a sibling node.
- const TiXmlNode* PreviousSibling() const { return prev; }
- TiXmlNode* PreviousSibling() { return prev; }
-
- /// Navigate to a sibling node.
- const TiXmlNode* PreviousSibling( const char * ) const;
- TiXmlNode* PreviousSibling( const char *_prev ) {
- return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
- }
-
- #ifdef TIXML_USE_STL
- const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form.
- TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form.
- const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form.
- TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form.
- #endif
-
- /// Navigate to a sibling node.
- const TiXmlNode* NextSibling() const { return next; }
- TiXmlNode* NextSibling() { return next; }
-
- /// Navigate to a sibling node with the given 'value'.
- const TiXmlNode* NextSibling( const char * ) const;
- TiXmlNode* NextSibling( const char* _next ) {
- return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
- }
-
- /** Convenience function to get through elements.
- Calls NextSibling and ToElement. Will skip all non-Element
- nodes. Returns 0 if there is not another element.
- */
- const TiXmlElement* NextSiblingElement() const;
- TiXmlElement* NextSiblingElement() {
- return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
- }
-
- /** Convenience function to get through elements.
- Calls NextSibling and ToElement. Will skip all non-Element
- nodes. Returns 0 if there is not another element.
- */
- const TiXmlElement* NextSiblingElement( const char * ) const;
- TiXmlElement* NextSiblingElement( const char *_next ) {
- return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
- }
-
- #ifdef TIXML_USE_STL
- const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form.
- TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form.
- #endif
-
- /// Convenience function to get through elements.
- const TiXmlElement* FirstChildElement() const;
- TiXmlElement* FirstChildElement() {
- return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
- }
-
- /// Convenience function to get through elements.
- const TiXmlElement* FirstChildElement( const char * _value ) const;
- TiXmlElement* FirstChildElement( const char * _value ) {
- return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
- }
-
- #ifdef TIXML_USE_STL
- const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form.
- TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form.
- #endif
-
- /** Query the type (as an enumerated value, above) of this node.
- The possible types are: DOCUMENT, ELEMENT, COMMENT,
- UNKNOWN, TEXT, and DECLARATION.
- */
- int Type() const { return type; }
-
- /** Return a pointer to the Document this node lives in.
- Returns null if not in a document.
- */
- const TiXmlDocument* GetDocument() const;
- TiXmlDocument* GetDocument() {
- return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
- }
-
- /// Returns true if this node has no children.
- bool NoChildren() const { return !firstChild; }
-
- virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
-
- virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
- virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
-
- /** Create an exact duplicate of this node and return it. The memory must be deleted
- by the caller.
- */
- virtual TiXmlNode* Clone() const = 0;
-
- /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
- XML tree will be conditionally visited and the host will be called back
- via the TiXmlVisitor interface.
-
- This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse
- the XML for the callbacks, so the performance of TinyXML is unchanged by using this
- interface versus any other.)
-
- The interface has been based on ideas from:
-
- - http://www.saxproject.org/
- - http://c2.com/cgi/wiki?HierarchicalVisitorPattern
-
- Which are both good references for "visiting".
-
- An example of using Accept():
- @verbatim
- TiXmlPrinter printer;
- tinyxmlDoc.Accept( &printer );
- const char* xmlcstr = printer.CStr();
- @endverbatim
- */
- virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
-
-protected:
- TiXmlNode( NodeType _type );
-
- // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
- // and the assignment operator.
- void CopyTo( TiXmlNode* target ) const;
-
- #ifdef TIXML_USE_STL
- // The real work of the input operator.
- virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
- #endif
-
- // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
- TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
-
- TiXmlNode* parent;
- NodeType type;
-
- TiXmlNode* firstChild;
- TiXmlNode* lastChild;
-
- TIXML_STRING value;
-
- TiXmlNode* prev;
- TiXmlNode* next;
-
-private:
- TiXmlNode( const TiXmlNode& ); // not implemented.
- void operator=( const TiXmlNode& base ); // not allowed.
-};
-
-
-/** An attribute is a name-value pair. Elements have an arbitrary
- number of attributes, each with a unique name.
-
- @note The attributes are not TiXmlNodes, since they are not
- part of the tinyXML document object model. There are other
- suggested ways to look at this problem.
-*/
-class TiXmlAttribute : public TiXmlBase
-{
- friend class TiXmlAttributeSet;
-
-public:
- /// Construct an empty attribute.
- TiXmlAttribute() : TiXmlBase()
- {
- document = 0;
- prev = next = 0;
- }
-
- #ifdef TIXML_USE_STL
- /// std::string constructor.
- TiXmlAttribute( const std::string& _name, const std::string& _value )
- {
- name = _name;
- value = _value;
- document = 0;
- prev = next = 0;
- }
- #endif
-
- /// Construct an attribute with a name and value.
- TiXmlAttribute( const char * _name, const char * _value )
- {
- name = _name;
- value = _value;
- document = 0;
- prev = next = 0;
- }
-
- const char* Name() const { return name.c_str(); } ///< Return the name of this attribute.
- const char* Value() const { return value.c_str(); } ///< Return the value of this attribute.
- #ifdef TIXML_USE_STL
- const std::string& ValueStr() const { return value; } ///< Return the value of this attribute.
- #endif
- int IntValue() const; ///< Return the value of this attribute, converted to an integer.
- double DoubleValue() const; ///< Return the value of this attribute, converted to a double.
-
- // Get the tinyxml string representation
- const TIXML_STRING& NameTStr() const { return name; }
-
- /** QueryIntValue examines the value string. It is an alternative to the
- IntValue() method with richer error checking.
- If the value is an integer, it is stored in 'value' and
- the call returns TIXML_SUCCESS. If it is not
- an integer, it returns TIXML_WRONG_TYPE.
-
- A specialized but useful call. Note that for success it returns 0,
- which is the opposite of almost all other TinyXml calls.
- */
- int QueryIntValue( int* _value ) const;
- /// QueryDoubleValue examines the value string. See QueryIntValue().
- int QueryDoubleValue( double* _value ) const;
-
- void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute.
- void SetValue( const char* _value ) { value = _value; } ///< Set the value.
-
- void SetIntValue( int _value ); ///< Set the value from an integer.
- void SetDoubleValue( double _value ); ///< Set the value from a double.
-
- #ifdef TIXML_USE_STL
- /// STL std::string form.
- void SetName( const std::string& _name ) { name = _name; }
- /// STL std::string form.
- void SetValue( const std::string& _value ) { value = _value; }
- #endif
-
- /// Get the next sibling attribute in the DOM. Returns null at end.
- const TiXmlAttribute* Next() const;
- TiXmlAttribute* Next() {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
- }
-
- /// Get the previous sibling attribute in the DOM. Returns null at beginning.
- const TiXmlAttribute* Previous() const;
- TiXmlAttribute* Previous() {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
- }
-
- bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
- bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
- bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
-
- /* Attribute parsing starts: first letter of the name
- returns: the next char after the value end quote
- */
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- // Prints this Attribute to a FILE stream.
- virtual void Print( FILE* cfile, int depth ) const {
- Print( cfile, depth, 0 );
- }
- void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
-
- // [internal use]
- // Set the document pointer so the attribute can report errors.
- void SetDocument( TiXmlDocument* doc ) { document = doc; }
-
-private:
- TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
- void operator=( const TiXmlAttribute& base ); // not allowed.
-
- TiXmlDocument* document; // A pointer back to a document, for error reporting.
- TIXML_STRING name;
- TIXML_STRING value;
- TiXmlAttribute* prev;
- TiXmlAttribute* next;
-};
-
-
-/* A class used to manage a group of attributes.
- It is only used internally, both by the ELEMENT and the DECLARATION.
-
- The set can be changed transparent to the Element and Declaration
- classes that use it, but NOT transparent to the Attribute
- which has to implement a next() and previous() method. Which makes
- it a bit problematic and prevents the use of STL.
-
- This version is implemented with circular lists because:
- - I like circular lists
- - it demonstrates some independence from the (typical) doubly linked list.
-*/
-class TiXmlAttributeSet
-{
-public:
- TiXmlAttributeSet();
- ~TiXmlAttributeSet();
-
- void Add( TiXmlAttribute* attribute );
- void Remove( TiXmlAttribute* attribute );
-
- const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
- TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
- const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
- TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
-
- const TiXmlAttribute* Find( const char* _name ) const;
- TiXmlAttribute* Find( const char* _name ) {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
- }
- #ifdef TIXML_USE_STL
- const TiXmlAttribute* Find( const std::string& _name ) const;
- TiXmlAttribute* Find( const std::string& _name ) {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
- }
-
- #endif
-
-private:
- //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
- //*ME: this class must be also use a hidden/disabled copy-constructor !!!
- TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
- void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
-
- TiXmlAttribute sentinel;
-};
-
-
-/** The element is a container class. It has a value, the element name,
- and can contain other elements, text, comments, and unknowns.
- Elements also contain an arbitrary number of attributes.
-*/
-class TiXmlElement : public TiXmlNode
-{
-public:
- /// Construct an element.
- TiXmlElement (const char * in_value);
-
- #ifdef TIXML_USE_STL
- /// std::string constructor.
- TiXmlElement( const std::string& _value );
- #endif
-
- TiXmlElement( const TiXmlElement& );
-
- void operator=( const TiXmlElement& base );
-
- virtual ~TiXmlElement();
-
- /** Given an attribute name, Attribute() returns the value
- for the attribute of that name, or null if none exists.
- */
- const char* Attribute( const char* name ) const;
-
- /** Given an attribute name, Attribute() returns the value
- for the attribute of that name, or null if none exists.
- If the attribute exists and can be converted to an integer,
- the integer value will be put in the return 'i', if 'i'
- is non-null.
- */
- const char* Attribute( const char* name, int* i ) const;
-
- /** Given an attribute name, Attribute() returns the value
- for the attribute of that name, or null if none exists.
- If the attribute exists and can be converted to an double,
- the double value will be put in the return 'd', if 'd'
- is non-null.
- */
- const char* Attribute( const char* name, double* d ) const;
-
- /** QueryIntAttribute examines the attribute - it is an alternative to the
- Attribute() method with richer error checking.
- If the attribute is an integer, it is stored in 'value' and
- the call returns TIXML_SUCCESS. If it is not
- an integer, it returns TIXML_WRONG_TYPE. If the attribute
- does not exist, then TIXML_NO_ATTRIBUTE is returned.
- */
- int QueryIntAttribute( const char* name, int* _value ) const;
- /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
- int QueryDoubleAttribute( const char* name, double* _value ) const;
- /// QueryFloatAttribute examines the attribute - see QueryIntAttribute().
- int QueryFloatAttribute( const char* name, float* _value ) const {
- double d;
- int result = QueryDoubleAttribute( name, &d );
- if ( result == TIXML_SUCCESS ) {
- *_value = (float)d;
- }
- return result;
- }
- #ifdef TIXML_USE_STL
- /** Template form of the attribute query which will try to read the
- attribute into the specified type. Very easy, very powerful, but
- be careful to make sure to call this with the correct type.
-
- @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE
- */
- template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
- {
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
- return TIXML_NO_ATTRIBUTE;
-
- std::stringstream sstream( node->ValueStr() );
- sstream >> *outValue;
- if ( !sstream.fail() )
- return TIXML_SUCCESS;
- return TIXML_WRONG_TYPE;
- }
- #endif
-
- /** Sets an attribute of name to a given value. The attribute
- will be created if it does not exist, or changed if it does.
- */
- void SetAttribute( const char* name, const char * _value );
-
- #ifdef TIXML_USE_STL
- const std::string* Attribute( const std::string& name ) const;
- const std::string* Attribute( const std::string& name, int* i ) const;
- const std::string* Attribute( const std::string& name, double* d ) const;
- int QueryIntAttribute( const std::string& name, int* _value ) const;
- int QueryDoubleAttribute( const std::string& name, double* _value ) const;
-
- /// STL std::string form.
- void SetAttribute( const std::string& name, const std::string& _value );
- ///< STL std::string form.
- void SetAttribute( const std::string& name, int _value );
- #endif
-
- /** Sets an attribute of name to a given value. The attribute
- will be created if it does not exist, or changed if it does.
- */
- void SetAttribute( const char * name, int value );
-
- /** Sets an attribute of name to a given value. The attribute
- will be created if it does not exist, or changed if it does.
- */
- void SetDoubleAttribute( const char * name, double value );
-
- /** Deletes an attribute with the given name.
- */
- void RemoveAttribute( const char * name );
- #ifdef TIXML_USE_STL
- void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form.
- #endif
-
- const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
- TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
- const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element.
- TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
-
- /** Convenience function for easy access to the text inside an element. Although easy
- and concise, GetText() is limited compared to getting the TiXmlText child
- and accessing it directly.
-
- If the first child of 'this' is a TiXmlText, the GetText()
- returns the character string of the Text node, else null is returned.
-
- This is a convenient method for getting the text of simple contained text:
- @verbatim
- This is text
- const char* str = fooElement->GetText();
- @endverbatim
-
- 'str' will be a pointer to "This is text".
-
- Note that this function can be misleading. If the element foo was created from
- this XML:
- @verbatim
- This is text
- @endverbatim
-
- then the value of str would be null. The first child node isn't a text node, it is
- another element. From this XML:
- @verbatim
- This is text
- @endverbatim
- GetText() will return "This is ".
-
- WARNING: GetText() accesses a child node - don't become confused with the
- similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
- safe type casts on the referenced node.
- */
- const char* GetText() const;
-
- /// Creates a new Element and returns it - the returned element is a copy.
- virtual TiXmlNode* Clone() const;
- // Print the Element to a FILE stream.
- virtual void Print( FILE* cfile, int depth ) const;
-
- /* Attribtue parsing starts: next char past '<'
- returns: next char past '>'
- */
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* visitor ) const;
-
-protected:
-
- void CopyTo( TiXmlElement* target ) const;
- void ClearThis(); // like clear, but initializes 'this' object as well
-
- // Used to be public [internal use]
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
- /* [internal use]
- Reads the "value" of the element -- another element, or text.
- This should terminate with the current end tag.
- */
- const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
-
-private:
-
- TiXmlAttributeSet attributeSet;
-};
-
-
-/** An XML comment.
-*/
-class TiXmlComment : public TiXmlNode
-{
-public:
- /// Constructs an empty comment.
- TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
- /// Construct a comment from text.
- TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
- SetValue( _value );
- }
- TiXmlComment( const TiXmlComment& );
- void operator=( const TiXmlComment& base );
-
- virtual ~TiXmlComment() {}
-
- /// Returns a copy of this Comment.
- virtual TiXmlNode* Clone() const;
- // Write this Comment to a FILE stream.
- virtual void Print( FILE* cfile, int depth ) const;
-
- /* Attribtue parsing starts: at the ! of the !--
- returns: next char past '>'
- */
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* visitor ) const;
-
-protected:
- void CopyTo( TiXmlComment* target ) const;
-
- // used to be public
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
-// virtual void StreamOut( TIXML_OSTREAM * out ) const;
-
-private:
-
-};
-
-
-/** XML text. A text node can have 2 ways to output the next. "normal" output
- and CDATA. It will default to the mode it was parsed from the XML file and
- you generally want to leave it alone, but you can change the output mode with
- SetCDATA() and query it with CDATA().
-*/
-class TiXmlText : public TiXmlNode
-{
- friend class TiXmlElement;
-public:
- /** Constructor for text element. By default, it is treated as
- normal, encoded text. If you want it be output as a CDATA text
- element, set the parameter _cdata to 'true'
- */
- TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
- {
- SetValue( initValue );
- cdata = false;
- }
- virtual ~TiXmlText() {}
-
- #ifdef TIXML_USE_STL
- /// Constructor.
- TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
- {
- SetValue( initValue );
- cdata = false;
- }
- #endif
-
- TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
- void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
-
- // Write this text object to a FILE stream.
- virtual void Print( FILE* cfile, int depth ) const;
-
- /// Queries whether this represents text using a CDATA section.
- bool CDATA() const { return cdata; }
- /// Turns on or off a CDATA representation of text.
- void SetCDATA( bool _cdata ) { cdata = _cdata; }
-
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* content ) const;
-
-protected :
- /// [internal use] Creates a new Element and returns it.
- virtual TiXmlNode* Clone() const;
- void CopyTo( TiXmlText* target ) const;
-
- bool Blank() const; // returns true if all white space and new lines
- // [internal use]
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
-
-private:
- bool cdata; // true if this should be input and output as a CDATA style text element
-};
-
-
-/** In correct XML the declaration is the first entry in the file.
- @verbatim
-
- @endverbatim
-
- TinyXml will happily read or write files without a declaration,
- however. There are 3 possible attributes to the declaration:
- version, encoding, and standalone.
-
- Note: In this version of the code, the attributes are
- handled as special cases, not generic attributes, simply
- because there can only be at most 3 and they are always the same.
-*/
-class TiXmlDeclaration : public TiXmlNode
-{
-public:
- /// Construct an empty declaration.
- TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
-
-#ifdef TIXML_USE_STL
- /// Constructor.
- TiXmlDeclaration( const std::string& _version,
- const std::string& _encoding,
- const std::string& _standalone );
-#endif
-
- /// Construct.
- TiXmlDeclaration( const char* _version,
- const char* _encoding,
- const char* _standalone );
-
- TiXmlDeclaration( const TiXmlDeclaration& copy );
- void operator=( const TiXmlDeclaration& copy );
-
- virtual ~TiXmlDeclaration() {}
-
- /// Version. Will return an empty string if none was found.
- const char *Version() const { return version.c_str (); }
- /// Encoding. Will return an empty string if none was found.
- const char *Encoding() const { return encoding.c_str (); }
- /// Is this a standalone document?
- const char *Standalone() const { return standalone.c_str (); }
-
- /// Creates a copy of this Declaration and returns it.
- virtual TiXmlNode* Clone() const;
- // Print this declaration to a FILE stream.
- virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
- virtual void Print( FILE* cfile, int depth ) const {
- Print( cfile, depth, 0 );
- }
-
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* visitor ) const;
-
-protected:
- void CopyTo( TiXmlDeclaration* target ) const;
- // used to be public
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
-
-private:
-
- TIXML_STRING version;
- TIXML_STRING encoding;
- TIXML_STRING standalone;
-};
-
-
-/** Any tag that tinyXml doesn't recognize is saved as an
- unknown. It is a tag of text, but should not be modified.
- It will be written back to the XML, unchanged, when the file
- is saved.
-
- DTD tags get thrown into TiXmlUnknowns.
-*/
-class TiXmlUnknown : public TiXmlNode
-{
-public:
- TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
- virtual ~TiXmlUnknown() {}
-
- TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
- void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
-
- /// Creates a copy of this Unknown and returns it.
- virtual TiXmlNode* Clone() const;
- // Print this Unknown to a FILE stream.
- virtual void Print( FILE* cfile, int depth ) const;
-
- virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
-
- virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* content ) const;
-
-protected:
- void CopyTo( TiXmlUnknown* target ) const;
-
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
-
-private:
-
-};
-
-
-/** Always the top level node. A document binds together all the
- XML pieces. It can be saved, loaded, and printed to the screen.
- The 'value' of a document node is the xml file name.
-*/
-class TiXmlDocument : public TiXmlNode
-{
-public:
- /// Create an empty document, that has no name.
- TiXmlDocument();
- /// Create a document with a name. The name of the document is also the filename of the xml.
- TiXmlDocument( const char * documentName );
-
- #ifdef TIXML_USE_STL
- /// Constructor.
- TiXmlDocument( const std::string& documentName );
- #endif
-
- TiXmlDocument( const TiXmlDocument& copy );
- void operator=( const TiXmlDocument& copy );
-
- virtual ~TiXmlDocument() {}
-
- /** Load a file using the current document value.
- Returns true if successful. Will delete any existing
- document data before loading.
- */
- bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- /// Save a file using the current document value. Returns true if successful.
- bool SaveFile() const;
- /// Load a file using the given filename. Returns true if successful.
- bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- /// Save a file using the given filename. Returns true if successful.
- bool SaveFile( const char * filename ) const;
- /** Load a file using the given FILE*. Returns true if successful. Note that this method
- doesn't stream - the entire object pointed at by the FILE*
- will be interpreted as an XML file. TinyXML doesn't stream in XML from the current
- file location. Streaming may be added in the future.
- */
- bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- /// Save a file using the given FILE*. Returns true if successful.
- bool SaveFile( FILE* ) const;
-
- #ifdef TIXML_USE_STL
- bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version.
- {
-// StringToBuffer f( filename );
-// return ( f.buffer && LoadFile( f.buffer, encoding ));
- return LoadFile( filename.c_str(), encoding );
- }
- bool SaveFile( const std::string& filename ) const ///< STL std::string version.
- {
-// StringToBuffer f( filename );
-// return ( f.buffer && SaveFile( f.buffer ));
- return SaveFile( filename.c_str() );
- }
- #endif
-
- /** Parse the given null terminated block of xml data. Passing in an encoding to this
- method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml
- to use that encoding, regardless of what TinyXml might otherwise try to detect.
- */
- virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
-
- /** Get the root element -- the only top level element -- of the document.
- In well formed XML, there should only be one. TinyXml is tolerant of
- multiple elements at the document level.
- */
- const TiXmlElement* RootElement() const { return FirstChildElement(); }
- TiXmlElement* RootElement() { return FirstChildElement(); }
-
- /** If an error occurs, Error will be set to true. Also,
- - The ErrorId() will contain the integer identifier of the error (not generally useful)
- - The ErrorDesc() method will return the name of the error. (very useful)
- - The ErrorRow() and ErrorCol() will return the location of the error (if known)
- */
- bool Error() const { return error; }
-
- /// Contains a textual (english) description of the error if one occurs.
- const char * ErrorDesc() const { return errorDesc.c_str (); }
-
- /** Generally, you probably want the error string ( ErrorDesc() ). But if you
- prefer the ErrorId, this function will fetch it.
- */
- int ErrorId() const { return errorId; }
-
- /** Returns the location (if known) of the error. The first column is column 1,
- and the first row is row 1. A value of 0 means the row and column wasn't applicable
- (memory errors, for example, have no row/column) or the parser lost the error. (An
- error in the error reporting, in that case.)
-
- @sa SetTabSize, Row, Column
- */
- int ErrorRow() const { return errorLocation.row+1; }
- int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow()
-
- /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol())
- to report the correct values for row and column. It does not change the output
- or input in any way.
-
- By calling this method, with a tab size
- greater than 0, the row and column of each node and attribute is stored
- when the file is loaded. Very useful for tracking the DOM back in to
- the source file.
-
- The tab size is required for calculating the location of nodes. If not
- set, the default of 4 is used. The tabsize is set per document. Setting
- the tabsize to 0 disables row/column tracking.
-
- Note that row and column tracking is not supported when using operator>>.
-
- The tab size needs to be enabled before the parse or load. Correct usage:
- @verbatim
- TiXmlDocument doc;
- doc.SetTabSize( 8 );
- doc.Load( "myfile.xml" );
- @endverbatim
-
- @sa Row, Column
- */
- void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
-
- int TabSize() const { return tabsize; }
-
- /** If you have handled the error, it can be reset with this call. The error
- state is automatically cleared if you Parse a new XML block.
- */
- void ClearError() { error = false;
- errorId = 0;
- errorDesc = "";
- errorLocation.row = errorLocation.col = 0;
- //errorLocation.last = 0;
- }
-
- /** Write the document to standard out using formatted printing ("pretty print"). */
- void Print() const { Print( stdout, 0 ); }
-
- /* Write the document to a string using formatted printing ("pretty print"). This
- will allocate a character array (new char[]) and return it as a pointer. The
- calling code pust call delete[] on the return char* to avoid a memory leak.
- */
- //char* PrintToMemory() const;
-
- /// Print this Document to a FILE stream.
- virtual void Print( FILE* cfile, int depth = 0 ) const;
- // [internal use]
- void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
-
- virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
-
- /** Walk the XML tree visiting this node and all of its children.
- */
- virtual bool Accept( TiXmlVisitor* content ) const;
-
-protected :
- // [internal use]
- virtual TiXmlNode* Clone() const;
- #ifdef TIXML_USE_STL
- virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- #endif
-
-private:
- void CopyTo( TiXmlDocument* target ) const;
-
- bool error;
- int errorId;
- TIXML_STRING errorDesc;
- int tabsize;
- TiXmlCursor errorLocation;
- bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
-};
-
-
-/**
- A TiXmlHandle is a class that wraps a node pointer with null checks; this is
- an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml
- DOM structure. It is a separate utility class.
-
- Take an example:
- @verbatim
-
-
-
-
-
-
- @endverbatim
-
- Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
- easy to write a *lot* of code that looks like:
-
- @verbatim
- TiXmlElement* root = document.FirstChildElement( "Document" );
- if ( root )
- {
- TiXmlElement* element = root->FirstChildElement( "Element" );
- if ( element )
- {
- TiXmlElement* child = element->FirstChildElement( "Child" );
- if ( child )
- {
- TiXmlElement* child2 = child->NextSiblingElement( "Child" );
- if ( child2 )
- {
- // Finally do something useful.
- @endverbatim
-
- And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
- of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
- and correct to use:
-
- @verbatim
- TiXmlHandle docHandle( &document );
- TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
- if ( child2 )
- {
- // do something useful
- @endverbatim
-
- Which is MUCH more concise and useful.
-
- It is also safe to copy handles - internally they are nothing more than node pointers.
- @verbatim
- TiXmlHandle handleCopy = handle;
- @endverbatim
-
- What they should not be used for is iteration:
-
- @verbatim
- int i=0;
- while ( true )
- {
- TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement();
- if ( !child )
- break;
- // do something
- ++i;
- }
- @endverbatim
-
- It seems reasonable, but it is in fact two embedded while loops. The Child method is
- a linear walk to find the element, so this code would iterate much more than it needs
- to. Instead, prefer:
-
- @verbatim
- TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement();
-
- for( child; child; child=child->NextSiblingElement() )
- {
- // do something
- }
- @endverbatim
-*/
-class TiXmlHandle
-{
-public:
- /// Create a handle from any node (at any depth of the tree.) This can be a null pointer.
- TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
- /// Copy constructor
- TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
- TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
-
- /// Return a handle to the first child node.
- TiXmlHandle FirstChild() const;
- /// Return a handle to the first child node with the given name.
- TiXmlHandle FirstChild( const char * value ) const;
- /// Return a handle to the first child element.
- TiXmlHandle FirstChildElement() const;
- /// Return a handle to the first child element with the given name.
- TiXmlHandle FirstChildElement( const char * value ) const;
-
- /** Return a handle to the "index" child with the given name.
- The first child is 0, the second 1, etc.
- */
- TiXmlHandle Child( const char* value, int index ) const;
- /** Return a handle to the "index" child.
- The first child is 0, the second 1, etc.
- */
- TiXmlHandle Child( int index ) const;
- /** Return a handle to the "index" child element with the given name.
- The first child element is 0, the second 1, etc. Note that only TiXmlElements
- are indexed: other types are not counted.
- */
- TiXmlHandle ChildElement( const char* value, int index ) const;
- /** Return a handle to the "index" child element.
- The first child element is 0, the second 1, etc. Note that only TiXmlElements
- are indexed: other types are not counted.
- */
- TiXmlHandle ChildElement( int index ) const;
-
- #ifdef TIXML_USE_STL
- TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
- TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
-
- TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
- TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
- #endif
-
- /** Return the handle as a TiXmlNode. This may return null.
- */
- TiXmlNode* ToNode() const { return node; }
- /** Return the handle as a TiXmlElement. This may return null.
- */
- TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
- /** Return the handle as a TiXmlText. This may return null.
- */
- TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
- /** Return the handle as a TiXmlUnknown. This may return null.
- */
- TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
-
- /** @deprecated use ToNode.
- Return the handle as a TiXmlNode. This may return null.
- */
- TiXmlNode* Node() const { return ToNode(); }
- /** @deprecated use ToElement.
- Return the handle as a TiXmlElement. This may return null.
- */
- TiXmlElement* Element() const { return ToElement(); }
- /** @deprecated use ToText()
- Return the handle as a TiXmlText. This may return null.
- */
- TiXmlText* Text() const { return ToText(); }
- /** @deprecated use ToUnknown()
- Return the handle as a TiXmlUnknown. This may return null.
- */
- TiXmlUnknown* Unknown() const { return ToUnknown(); }
-
-private:
- TiXmlNode* node;
-};
-
-
-/** Print to memory functionality. The TiXmlPrinter is useful when you need to:
-
- -# Print to memory (especially in non-STL mode)
- -# Control formatting (line endings, etc.)
-
- When constructed, the TiXmlPrinter is in its default "pretty printing" mode.
- Before calling Accept() you can call methods to control the printing
- of the XML document. After TiXmlNode::Accept() is called, the printed document can
- be accessed via the CStr(), Str(), and Size() methods.
-
- TiXmlPrinter uses the Visitor API.
- @verbatim
- TiXmlPrinter printer;
- printer.SetIndent( "\t" );
-
- doc.Accept( &printer );
- fprintf( stdout, "%s", printer.CStr() );
- @endverbatim
-*/
-class TiXmlPrinter : public TiXmlVisitor
-{
-public:
- TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
- buffer(), indent( " " ), lineBreak( "\n" ) {}
-
- virtual bool VisitEnter( const TiXmlDocument& doc );
- virtual bool VisitExit( const TiXmlDocument& doc );
-
- virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
- virtual bool VisitExit( const TiXmlElement& element );
-
- virtual bool Visit( const TiXmlDeclaration& declaration );
- virtual bool Visit( const TiXmlText& text );
- virtual bool Visit( const TiXmlComment& comment );
- virtual bool Visit( const TiXmlUnknown& unknown );
-
- /** Set the indent characters for printing. By default 4 spaces
- but tab (\t) is also useful, or null/empty string for no indentation.
- */
- void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
- /// Query the indention string.
- const char* Indent() { return indent.c_str(); }
- /** Set the line breaking string. By default set to newline (\n).
- Some operating systems prefer other characters, or can be
- set to the null/empty string for no indenation.
- */
- void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; }
- /// Query the current line breaking string.
- const char* LineBreak() { return lineBreak.c_str(); }
-
- /** Switch over to "stream printing" which is the most dense formatting without
- linebreaks. Common when the XML is needed for network transmission.
- */
- void SetStreamPrinting() { indent = "";
- lineBreak = "";
- }
- /// Return the result.
- const char* CStr() { return buffer.c_str(); }
- /// Return the length of the result string.
- size_t Size() { return buffer.size(); }
-
- #ifdef TIXML_USE_STL
- /// Return the result.
- const std::string& Str() { return buffer; }
- #endif
-
-private:
- void DoIndent() {
- for( int i=0; i
-#include
-
-#include "tinyxml.h"
-
-//#define DEBUG_PARSER
-#if defined( DEBUG_PARSER )
-# if defined( DEBUG ) && defined( _MSC_VER )
-# include
-# define TIXML_LOG OutputDebugString
-# else
-# define TIXML_LOG printf
-# endif
-#endif
-
-// Note tha "PutString" hardcodes the same list. This
-// is less flexible than it appears. Changing the entries
-// or order will break putstring.
-TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
-{
- { "&", 5, '&' },
- { "<", 4, '<' },
- { ">", 4, '>' },
- { """, 6, '\"' },
- { "'", 6, '\'' }
-};
-
-// Bunch of unicode info at:
-// http://www.unicode.org/faq/utf_bom.html
-// Including the basic of this table, which determines the #bytes in the
-// sequence from the lead byte. 1 placed for invalid sequences --
-// although the result will be junk, pass it through as much as possible.
-// Beware of the non-characters in UTF-8:
-// ef bb bf (Microsoft "lead bytes")
-// ef bf be
-// ef bf bf
-
-const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
-const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
-const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
-
-const int TiXmlBase::utf8ByteTable[256] =
-{
- // 0 1 2 3 4 5 6 7 8 9 a b c d e f
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
- 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
- 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
-};
-
-
-void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
-{
- const unsigned long BYTE_MASK = 0xBF;
- const unsigned long BYTE_MARK = 0x80;
- const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
- if (input < 0x80)
- *length = 1;
- else if ( input < 0x800 )
- *length = 2;
- else if ( input < 0x10000 )
- *length = 3;
- else if ( input < 0x200000 )
- *length = 4;
- else
- { *length = 0; return; } // This code won't covert this correctly anyway.
-
- output += *length;
-
- // Scary scary fall throughs.
- switch (*length)
- {
- case 4:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 3:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 2:
- --output;
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
- input >>= 6;
- case 1:
- --output;
- *output = (char)(input | FIRST_BYTE_MARK[*length]);
- }
-}
-
-
-/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
-{
- // This will only work for low-ascii, everything else is assumed to be a valid
- // letter. I'm not sure this is the best approach, but it is quite tricky trying
- // to figure out alhabetical vs. not across encoding. So take a very
- // conservative approach.
-
-// if ( encoding == TIXML_ENCODING_UTF8 )
-// {
- if ( anyByte < 127 )
- return isalpha( anyByte );
- else
- return 1; // What else to do? The unicode set is huge...get the english ones right.
-// }
-// else
-// {
-// return isalpha( anyByte );
-// }
-}
-
-
-/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
-{
- // This will only work for low-ascii, everything else is assumed to be a valid
- // letter. I'm not sure this is the best approach, but it is quite tricky trying
- // to figure out alhabetical vs. not across encoding. So take a very
- // conservative approach.
-
-// if ( encoding == TIXML_ENCODING_UTF8 )
-// {
- if ( anyByte < 127 )
- return isalnum( anyByte );
- else
- return 1; // What else to do? The unicode set is huge...get the english ones right.
-// }
-// else
-// {
-// return isalnum( anyByte );
-// }
-}
-
-
-class TiXmlParsingData
-{
- friend class TiXmlDocument;
- public:
- void Stamp( const char* now, TiXmlEncoding encoding );
-
- const TiXmlCursor& Cursor() { return cursor; }
-
- private:
- // Only used by the document!
- TiXmlParsingData( const char* start, int _tabsize, int row, int col )
- {
- assert( start );
- stamp = start;
- tabsize = _tabsize;
- cursor.row = row;
- cursor.col = col;
- }
-
- TiXmlCursor cursor;
- const char* stamp;
- int tabsize;
-};
-
-
-void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
-{
- assert( now );
-
- // Do nothing if the tabsize is 0.
- if ( tabsize < 1 )
- {
- return;
- }
-
- // Get the current row, column.
- int row = cursor.row;
- int col = cursor.col;
- const char* p = stamp;
- assert( p );
-
- while ( p < now )
- {
- // Treat p as unsigned, so we have a happy compiler.
- const unsigned char* pU = (const unsigned char*)p;
-
- // Code contributed by Fletcher Dunn: (modified by lee)
- switch (*pU) {
- case 0:
- // We *should* never get here, but in case we do, don't
- // advance past the terminating null character, ever
- return;
-
- case '\r':
- // bump down to the next line
- ++row;
- col = 0;
- // Eat the character
- ++p;
-
- // Check for \r\n sequence, and treat this as a single character
- if (*p == '\n') {
- ++p;
- }
- break;
-
- case '\n':
- // bump down to the next line
- ++row;
- col = 0;
-
- // Eat the character
- ++p;
-
- // Check for \n\r sequence, and treat this as a single
- // character. (Yes, this bizarre thing does occur still
- // on some arcane platforms...)
- if (*p == '\r') {
- ++p;
- }
- break;
-
- case '\t':
- // Eat the character
- ++p;
-
- // Skip to next tab stop
- col = (col / tabsize + 1) * tabsize;
- break;
-
- case TIXML_UTF_LEAD_0:
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- if ( *(p+1) && *(p+2) )
- {
- // In these cases, don't advance the column. These are
- // 0-width spaces.
- if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
- p += 3;
- else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
- p += 3;
- else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
- p += 3;
- else
- { p +=3; ++col; } // A normal character.
- }
- }
- else
- {
- ++p;
- ++col;
- }
- break;
-
- default:
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- // Eat the 1 to 4 byte utf8 character.
- int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)];
- if ( step == 0 )
- step = 1; // Error case from bad encoding, but handle gracefully.
- p += step;
-
- // Just advance one column, of course.
- ++col;
- }
- else
- {
- ++p;
- ++col;
- }
- break;
- }
- }
- cursor.row = row;
- cursor.col = col;
- assert( cursor.row >= -1 );
- assert( cursor.col >= -1 );
- stamp = p;
- assert( stamp );
-}
-
-
-const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
-{
- if ( !p || !*p )
- {
- return 0;
- }
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- while ( *p )
- {
- const unsigned char* pU = (const unsigned char*)p;
-
- // Skip the stupid Microsoft UTF-8 Byte order marks
- if ( *(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==TIXML_UTF_LEAD_1
- && *(pU+2)==TIXML_UTF_LEAD_2 )
- {
- p += 3;
- continue;
- }
- else if(*(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==0xbfU
- && *(pU+2)==0xbeU )
- {
- p += 3;
- continue;
- }
- else if(*(pU+0)==TIXML_UTF_LEAD_0
- && *(pU+1)==0xbfU
- && *(pU+2)==0xbfU )
- {
- p += 3;
- continue;
- }
-
- if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
- ++p;
- else
- break;
- }
- }
- else
- {
- while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
- ++p;
- }
-
- return p;
-}
-
-#ifdef TIXML_USE_STL
-/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag )
-{
- for( ;; )
- {
- if ( !in->good() ) return false;
-
- int c = in->peek();
- // At this scope, we can't get to a document. So fail silently.
- if ( !IsWhiteSpace( c ) || c <= 0 )
- return true;
-
- *tag += (char) in->get();
- }
-}
-
-/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag )
-{
- //assert( character > 0 && character < 128 ); // else it won't work in utf-8
- while ( in->good() )
- {
- int c = in->peek();
- if ( c == character )
- return true;
- if ( c <= 0 ) // Silent failure: can't get document at this scope
- return false;
-
- in->get();
- *tag += (char) c;
- }
- return false;
-}
-#endif
-
-// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The
-// "assign" optimization removes over 10% of the execution time.
-//
-const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
-{
- // Oddly, not supported on some comilers,
- //name->clear();
- // So use this:
- *name = "";
- assert( p );
-
- // Names start with letters or underscores.
- // Of course, in unicode, tinyxml has no idea what a letter *is*. The
- // algorithm is generous.
- //
- // After that, they can be letters, underscores, numbers,
- // hyphens, or colons. (Colons are valid ony for namespaces,
- // but tinyxml can't tell namespaces from names.)
- if ( p && *p
- && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
- {
- const char* start = p;
- while( p && *p
- && ( IsAlphaNum( (unsigned char ) *p, encoding )
- || *p == '_'
- || *p == '-'
- || *p == '.'
- || *p == ':' ) )
- {
- //(*name) += *p; // expensive
- ++p;
- }
- if ( p-start > 0 ) {
- name->assign( start, p-start );
- }
- return p;
- }
- return 0;
-}
-
-const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
-{
- // Presume an entity, and pull it out.
- TIXML_STRING ent;
- int i;
- *length = 0;
-
- if ( *(p+1) && *(p+1) == '#' && *(p+2) )
- {
- unsigned long ucs = 0;
- ptrdiff_t delta = 0;
- unsigned mult = 1;
-
- if ( *(p+2) == 'x' )
- {
- // Hexadecimal.
- if ( !*(p+3) ) return 0;
-
- const char* q = p+3;
- q = strchr( q, ';' );
-
- if ( !q || !*q ) return 0;
-
- delta = q-p;
- --q;
-
- while ( *q != 'x' )
- {
- if ( *q >= '0' && *q <= '9' )
- ucs += mult * (*q - '0');
- else if ( *q >= 'a' && *q <= 'f' )
- ucs += mult * (*q - 'a' + 10);
- else if ( *q >= 'A' && *q <= 'F' )
- ucs += mult * (*q - 'A' + 10 );
- else
- return 0;
- mult *= 16;
- --q;
- }
- }
- else
- {
- // Decimal.
- if ( !*(p+2) ) return 0;
-
- const char* q = p+2;
- q = strchr( q, ';' );
-
- if ( !q || !*q ) return 0;
-
- delta = q-p;
- --q;
-
- while ( *q != '#' )
- {
- if ( *q >= '0' && *q <= '9' )
- ucs += mult * (*q - '0');
- else
- return 0;
- mult *= 10;
- --q;
- }
- }
- if ( encoding == TIXML_ENCODING_UTF8 )
- {
- // convert the UCS to UTF-8
- ConvertUTF32ToUTF8( ucs, value, length );
- }
- else
- {
- *value = (char)ucs;
- *length = 1;
- }
- return p + delta + 1;
- }
-
- // Now try to match it.
- for( i=0; iappend( cArr, len );
- }
- }
- else
- {
- bool whitespace = false;
-
- // Remove leading white space:
- p = SkipWhiteSpace( p, encoding );
- while ( p && *p
- && !StringEqual( p, endTag, caseInsensitive, encoding ) )
- {
- if ( *p == '\r' || *p == '\n' )
- {
- whitespace = true;
- ++p;
- }
- else if ( IsWhiteSpace( *p ) )
- {
- whitespace = true;
- ++p;
- }
- else
- {
- // If we've found whitespace, add it before the
- // new character. Any whitespace just becomes a space.
- if ( whitespace )
- {
- (*text) += ' ';
- whitespace = false;
- }
- int len;
- char cArr[4] = { 0, 0, 0, 0 };
- p = GetChar( p, cArr, &len, encoding );
- if ( len == 1 )
- (*text) += cArr[0]; // more efficient
- else
- text->append( cArr, len );
- }
- }
- }
- if ( p )
- p += strlen( endTag );
- return p;
-}
-
-#ifdef TIXML_USE_STL
-
-void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
- // The basic issue with a document is that we don't know what we're
- // streaming. Read something presumed to be a tag (and hope), then
- // identify it, and call the appropriate stream method on the tag.
- //
- // This "pre-streaming" will never read the closing ">" so the
- // sub-tag can orient itself.
-
- if ( !StreamTo( in, '<', tag ) )
- {
- SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return;
- }
-
- while ( in->good() )
- {
- int tagIndex = (int) tag->length();
- while ( in->good() && in->peek() != '>' )
- {
- int c = in->get();
- if ( c <= 0 )
- {
- SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
- break;
- }
- (*tag) += (char) c;
- }
-
- if ( in->good() )
- {
- // We now have something we presume to be a node of
- // some sort. Identify it, and call the node to
- // continue streaming.
- TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
-
- if ( node )
- {
- node->StreamIn( in, tag );
- bool isElement = node->ToElement() != 0;
- delete node;
- node = 0;
-
- // If this is the root element, we're done. Parsing will be
- // done by the >> operator.
- if ( isElement )
- {
- return;
- }
- }
- else
- {
- SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
- return;
- }
- }
- }
- // We should have returned sooner.
- SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
-}
-
-#endif
-
-const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
-{
- ClearError();
-
- // Parse away, at the document level. Since a document
- // contains nothing but other tags, most of what happens
- // here is skipping white space.
- if ( !p || !*p )
- {
- SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
-
- // Note that, for a document, this needs to come
- // before the while space skip, so that parsing
- // starts from the pointer we are given.
- location.Clear();
- if ( prevData )
- {
- location.row = prevData->cursor.row;
- location.col = prevData->cursor.col;
- }
- else
- {
- location.row = 0;
- location.col = 0;
- }
- TiXmlParsingData data( p, TabSize(), location.row, location.col );
- location = data.Cursor();
-
- if ( encoding == TIXML_ENCODING_UNKNOWN )
- {
- // Check for the Microsoft UTF-8 lead bytes.
- const unsigned char* pU = (const unsigned char*)p;
- if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
- && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
- && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
- {
- encoding = TIXML_ENCODING_UTF8;
- useMicrosoftBOM = true;
- }
- }
-
- p = SkipWhiteSpace( p, encoding );
- if ( !p )
- {
- SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
- return 0;
- }
-
- while ( p && *p )
- {
- TiXmlNode* node = Identify( p, encoding );
- if ( node )
- {
- p = node->Parse( p, &data, encoding );
- LinkEndChild( node );
- }
- else
- {
- break;
- }
-
- // Did we get encoding info?
- if ( encoding == TIXML_ENCODING_UNKNOWN
- && node->ToDeclaration() )
- {
- TiXmlDeclaration* dec = node->ToDeclaration();
- const char* enc = dec->Encoding();
- assert( enc );
-
- if ( *enc == 0 )
- encoding = TIXML_ENCODING_UTF8;
- else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
- encoding = TIXML_ENCODING_UTF8;
- else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
- encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
- else
- encoding = TIXML_ENCODING_LEGACY;
- }
-
- p = SkipWhiteSpace( p, encoding );
- }
-
- // Was this empty?
- if ( !firstChild ) {
- SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
- return 0;
- }
-
- // All is well.
- return p;
-}
-
-void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
- // The first error in a chain is more accurate - don't set again!
- if ( error )
- return;
-
- assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
- error = true;
- errorId = err;
- errorDesc = errorString[ errorId ];
-
- errorLocation.Clear();
- if ( pError && data )
- {
- data->Stamp( pError, encoding );
- errorLocation = data->Cursor();
- }
-}
-
-
-TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
-{
- TiXmlNode* returnNode = 0;
-
- p = SkipWhiteSpace( p, encoding );
- if( !p || !*p || *p != '<' )
- {
- return 0;
- }
-
- TiXmlDocument* doc = GetDocument();
- p = SkipWhiteSpace( p, encoding );
-
- if ( !p || !*p )
- {
- return 0;
- }
-
- // What is this thing?
- // - Elements start with a letter or underscore, but xml is reserved.
- // - Comments: ";
-
- if ( !StringEqual( p, startTag, false, encoding ) )
- {
- document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
- return 0;
- }
- p += strlen( startTag );
- p = ReadText( p, &value, false, endTag, false, encoding );
- return p;
-}
-
-
-const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
- p = SkipWhiteSpace( p, encoding );
- if ( !p || !*p ) return 0;
-
-// int tabsize = 4;
-// if ( document )
-// tabsize = document->TabSize();
-
- if ( data )
- {
- data->Stamp( p, encoding );
- location = data->Cursor();
- }
- // Read the name, the '=' and the value.
- const char* pErr = p;
- p = ReadName( p, &name, encoding );
- if ( !p || !*p )
- {
- if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
- return 0;
- }
- p = SkipWhiteSpace( p, encoding );
- if ( !p || !*p || *p != '=' )
- {
- if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
- return 0;
- }
-
- ++p; // skip '='
- p = SkipWhiteSpace( p, encoding );
- if ( !p || !*p )
- {
- if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
- return 0;
- }
-
- const char* end;
- const char SINGLE_QUOTE = '\'';
- const char DOUBLE_QUOTE = '\"';
-
- if ( *p == SINGLE_QUOTE )
- {
- ++p;
- end = "\'"; // single quote in string
- p = ReadText( p, &value, false, end, false, encoding );
- }
- else if ( *p == DOUBLE_QUOTE )
- {
- ++p;
- end = "\""; // double quote in string
- p = ReadText( p, &value, false, end, false, encoding );
- }
- else
- {
- // All attribute values should be in single or double quotes.
- // But this is such a common error that the parser will try
- // its best, even without them.
- value = "";
- while ( p && *p // existence
- && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace
- && *p != '/' && *p != '>' ) // tag end
- {
- if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
- // [ 1451649 ] Attribute values with trailing quotes not handled correctly
- // We did not have an opening quote but seem to have a
- // closing one. Give up and throw an error.
- if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
- return 0;
- }
- value += *p;
- ++p;
- }
- }
- return p;
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
- while ( in->good() )
- {
- int c = in->peek();
- if ( !cdata && (c == '<' ) )
- {
- return;
- }
- if ( c <= 0 )
- {
- TiXmlDocument* document = GetDocument();
- if ( document )
- document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
- return;
- }
-
- (*tag) += (char) c;
- in->get(); // "commits" the peek made above
-
- if ( cdata && c == '>' && tag->size() >= 3 ) {
- size_t len = tag->size();
- if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) {
- // terminator of cdata.
- return;
- }
- }
- }
-}
-#endif
-
-const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
- value = "";
- TiXmlDocument* document = GetDocument();
-
- if ( data )
- {
- data->Stamp( p, encoding );
- location = data->Cursor();
- }
-
- const char* const startTag = "";
-
- if ( cdata || StringEqual( p, startTag, false, encoding ) )
- {
- cdata = true;
-
- if ( !StringEqual( p, startTag, false, encoding ) )
- {
- document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
- return 0;
- }
- p += strlen( startTag );
-
- // Keep all the white space, ignore the encoding, etc.
- while ( p && *p
- && !StringEqual( p, endTag, false, encoding )
- )
- {
- value += *p;
- ++p;
- }
-
- TIXML_STRING dummy;
- p = ReadText( p, &dummy, false, endTag, false, encoding );
- return p;
- }
- else
- {
- bool ignoreWhite = true;
-
- const char* end = "<";
- p = ReadText( p, &value, ignoreWhite, end, false, encoding );
- if ( p )
- return p-1; // don't truncate the '<'
- return 0;
- }
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
- while ( in->good() )
- {
- int c = in->get();
- if ( c <= 0 )
- {
- TiXmlDocument* document = GetDocument();
- if ( document )
- document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
- return;
- }
- (*tag) += (char) c;
-
- if ( c == '>' )
- {
- // All is well.
- return;
- }
- }
-}
-#endif
-
-const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
-{
- p = SkipWhiteSpace( p, _encoding );
- // Find the beginning, find the end, and look for
- // the stuff in-between.
- TiXmlDocument* document = GetDocument();
- if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
- return 0;
- }
- if ( data )
- {
- data->Stamp( p, _encoding );
- location = data->Cursor();
- }
- p += 5;
-
- version = "";
- encoding = "";
- standalone = "";
-
- while ( p && *p )
- {
- if ( *p == '>' )
- {
- ++p;
- return p;
- }
-
- p = SkipWhiteSpace( p, _encoding );
- if ( StringEqual( p, "version", true, _encoding ) )
- {
- TiXmlAttribute attrib;
- p = attrib.Parse( p, data, _encoding );
- version = attrib.Value();
- }
- else if ( StringEqual( p, "encoding", true, _encoding ) )
- {
- TiXmlAttribute attrib;
- p = attrib.Parse( p, data, _encoding );
- encoding = attrib.Value();
- }
- else if ( StringEqual( p, "standalone", true, _encoding ) )
- {
- TiXmlAttribute attrib;
- p = attrib.Parse( p, data, _encoding );
- standalone = attrib.Value();
- }
- else
- {
- // Read over whatever it is.
- while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
- ++p;
- }
- }
- return 0;
-}
-
-bool TiXmlText::Blank() const
-{
- for ( unsigned i=0; i