~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipelib/ipefactory.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2004-06-08 00:44:02 UTC
  • Revision ID: james.westby@ubuntu.com-20040608004402-72yu51xlh7vt6p9m
Tags: upstream-6.0pre16
ImportĀ upstreamĀ versionĀ 6.0pre16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// --------------------------------------------------------------------
 
2
// The Ipe object factory.
 
3
// --------------------------------------------------------------------
 
4
/*
 
5
 
 
6
    This file is part of the extensible drawing editor Ipe.
 
7
    Copyright (C) 1993-2004  Otfried Cheong
 
8
 
 
9
    Ipe is free software; you can redistribute it and/or modify it
 
10
    under the terms of the GNU General Public License as published by
 
11
    the Free Software Foundation; either version 2 of the License, or
 
12
    (at your option) any later version.
 
13
 
 
14
    As a special exception, you have permission to link Ipe with the
 
15
    CGAL library and distribute executables, as long as you follow the
 
16
    requirements of the Gnu General Public License in regard to all of
 
17
    the software in the executable aside from CGAL.
 
18
 
 
19
    Ipe is distributed in the hope that it will be useful, but WITHOUT
 
20
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
21
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
22
    License for more details.
 
23
 
 
24
    You should have received a copy of the GNU General Public License
 
25
    along with Ipe; if not, you can find it at
 
26
    "http://www.gnu.org/copyleft/gpl.html", or write to the Free
 
27
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
28
 
 
29
*/
 
30
 
 
31
#include "ipefactory.h"
 
32
#include "ipepath.h"
 
33
#include "ipemark.h"
 
34
#include "ipetext.h"
 
35
#include "ipeimage.h"
 
36
#include "iperef.h"
 
37
 
 
38
// --------------------------------------------------------------------
 
39
 
 
40
/*! \class IpeObjectFactory
 
41
  \ingroup high
 
42
  \brief Factory for Ipe leaf objects.
 
43
*/
 
44
 
 
45
//! Create an Ipe object by calling the right constructor.
 
46
IpeObject *IpeObjectFactory::CreateObject(IpeRepository *rep,
 
47
                                          IpeString name,
 
48
                                          const IpeXmlAttributes &attr,
 
49
                                          IpeString data)
 
50
{
 
51
  if (name == "path")
 
52
    return new IpePath(rep, attr, data);
 
53
  else if (name == "mark")
 
54
    return new IpeMark(rep, attr, data);
 
55
  else if (name == "text")
 
56
    return new IpeText(rep, attr, data);
 
57
  else if (name == "image")
 
58
    return new IpeImage(rep, attr, data);
 
59
  else if (name == "ref")
 
60
    return new IpeReference(rep, attr, data);
 
61
  else
 
62
    return 0;
 
63
}
 
64
 
 
65
//! Create an IpeImage with a given bitmap.
 
66
IpeObject *IpeObjectFactory::CreateImage(IpeRepository *rep,
 
67
                                         IpeString /*name*/,
 
68
                                         const IpeXmlAttributes &attr,
 
69
                                         IpeBitmap bitmap)
 
70
{
 
71
  return new IpeImage(rep, attr, bitmap);
 
72
}
 
73
 
 
74
// --------------------------------------------------------------------