~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/sdk/wxscintilla/src/scintilla/src/SVector.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#ifndef SVECTOR_H
9
9
#define SVECTOR_H
10
10
 
 
11
#ifdef SCI_NAMESPACE
 
12
namespace Scintilla {
 
13
#endif
 
14
 
11
15
/**
12
16
 * A simple expandable integer vector.
13
17
 * Storage not allocated for elements until an element is used.
19
23
        int *v;                         ///< The vector
20
24
        unsigned int size;      ///< Number of elements allocated
21
25
        unsigned int len;       ///< Number of elements used in vector
22
 
        bool allocFailure;      ///< A memory allocation call has failed
23
26
        
24
27
        /** Internally allocate more elements than the user wants
25
28
         * to avoid thrashing the memory allocator. */
29
32
                else 
30
33
                        newSize = (newSize * 3) / 2;
31
34
                int* newv = new int[newSize];
32
 
                if (!newv) {
33
 
                        allocFailure = true;
34
 
                        return;
35
 
                }
36
35
                size = newSize;
37
 
                unsigned int i=0;
 
36
        unsigned int i=0;
38
37
                for (; i<len; i++) {
39
38
                        newv[i] = v[i];
40
39
                }
47
46
        
48
47
public:
49
48
        SVector() {
50
 
                allocFailure = false;
51
49
                v = 0;
52
50
                len = 0;
53
51
                size = 0;
57
55
        }
58
56
        /// Constructor from another vector.
59
57
        SVector(const SVector &other) {
60
 
                allocFailure = false;
61
58
                v = 0;
62
59
                len = 0;
63
60
                size = 0;
64
61
                if (other.Length() > 0) {
65
62
                        SizeTo(other.Length());
66
 
                        if (!allocFailure) {
67
 
                                for (int i=0;i<other.Length();i++)
68
 
                                        v[i] = other.v[i];
69
 
                                len = other.Length();
70
 
                        }
 
63
                        for (int i=0;i<other.Length();i++)
 
64
                                v[i] = other.v[i];
 
65
                        len = other.Length();
71
66
                }
72
67
        }
73
68
        /// Copy constructor.
74
69
        SVector &operator=(const SVector &other) {
75
70
                if (this != &other) {
76
71
                        delete []v;
77
 
                        allocFailure = false;
78
72
                        v = 0;
79
73
                        len = 0;
80
74
                        size = 0;
81
75
                        if (other.Length() > 0) {
82
76
                                SizeTo(other.Length());
83
 
                                if (!allocFailure) {
84
 
                                        for (int i=0;i<other.Length();i++)
85
 
                                                v[i] = other.v[i];
86
 
                                }
 
77
                                for (int i=0;i<other.Length();i++)
 
78
                                        v[i] = other.v[i];
87
79
                                len = other.Length();
88
80
                        }
89
81
                }
124
116
        }
125
117
};
126
118
 
 
119
#ifdef SCI_NAMESPACE
 
120
}
 
121
#endif
 
122
 
127
123
#endif