root/branches/branch-5-0/mapserver/mapcopy.h
| Revision 6428, 3.1 kB (checked in by dmorissette, 1 year ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /****************************************************************************** |
| 2 | * $Id$ |
| 3 | * |
| 4 | * Project: MapServer |
| 5 | * Purpose: Declarations related to copyng mapObjs. |
| 6 | * Author: Mladen Turk (and Sean Gilles?) |
| 7 | * |
| 8 | * Provided by Mladen Turk for resolution of bug 701. |
| 9 | * |
| 10 | * http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=701 |
| 11 | * |
| 12 | ****************************************************************************** |
| 13 | * Copyright (c) 1996-2005 Regents of the University of Minnesota. |
| 14 | * |
| 15 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 16 | * copy of this software and associated documentation files (the "Software"), |
| 17 | * to deal in the Software without restriction, including without limitation |
| 18 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 19 | * and/or sell copies of the Software, and to permit persons to whom the |
| 20 | * Software is furnished to do so, subject to the following conditions: |
| 21 | * |
| 22 | * The above copyright notice and this permission notice shall be included in |
| 23 | * all copies of this Software or works derived from this Software. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 26 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 28 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 31 | * DEALINGS IN THE SOFTWARE. |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | /* Following works for GCC and MSVC. That's ~98% of our users, if Tyler |
| 35 | * Mitchell's survey is correct |
| 36 | */ |
| 37 | #define MS_COPYSTELEM(_name) (dst)->/**/_name = (src)->/**/_name |
| 38 | |
| 39 | #define MS_MACROBEGIN do { |
| 40 | #define MS_MACROEND } while (0) |
| 41 | |
| 42 | #define MS_COPYRECT(_dst, _src) \ |
| 43 | MS_MACROBEGIN \ |
| 44 | (_dst)->minx = (_src)->minx; \ |
| 45 | (_dst)->miny = (_src)->miny; \ |
| 46 | (_dst)->maxx = (_src)->maxx; \ |
| 47 | (_dst)->maxy = (_src)->maxy; \ |
| 48 | MS_MACROEND |
| 49 | |
| 50 | #ifdef USE_POINT_Z_M |
| 51 | #define MS_COPYPOINT(_dst, _src) \ |
| 52 | MS_MACROBEGIN \ |
| 53 | (_dst)->x = (_src)->x; \ |
| 54 | (_dst)->y = (_src)->y; \ |
| 55 | (_dst)->m = (_src)->m; \ |
| 56 | MS_MACROEND |
| 57 | #else |
| 58 | #define MS_COPYPOINT(_dst, _src) \ |
| 59 | MS_MACROBEGIN \ |
| 60 | (_dst)->x = (_src)->x; \ |
| 61 | (_dst)->y = (_src)->y; \ |
| 62 | MS_MACROEND |
| 63 | #endif |
| 64 | |
| 65 | #define MS_COPYCOLOR(_dst, _src) \ |
| 66 | MS_MACROBEGIN \ |
| 67 | (_dst)->pen = (_src)->pen; \ |
| 68 | (_dst)->red = (_src)->red; \ |
| 69 | (_dst)->green = (_src)->green;\ |
| 70 | (_dst)->blue = (_src)->blue; \ |
| 71 | MS_MACROEND |
| 72 | |
| 73 | #define MS_COPYSTRING(_dst, _src) \ |
| 74 | MS_MACROBEGIN \ |
| 75 | if ((_dst) != NULL) \ |
| 76 | msFree((_dst)); \ |
| 77 | if ((_src)) \ |
| 78 | (_dst) = strdup((_src)); \ |
| 79 | else \ |
| 80 | (_dst) = NULL; \ |
| 81 | MS_MACROEND |
| 82 | |
| 83 |
Note: See TracBrowser for help on using the browser.
