Code

A simple layout document as to what, why and how is cppification.
[inkscape.git] / src / sp-stop.cpp
1 /** @file
2  * @gradient stop class.
3  */
4 /* Authors:
5  *   Lauris Kaplinski <lauris@kaplinski.com>
6  *   bulia byak
7  *   Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
8  *   Jon A. Cruz <jon@joncruz.org>
9  *
10  * Copyright (C) 1999,2005 authors
11  * Copyright (C) 2010 Jon A. Cruz
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
17 #include "sp-stop.h"
20 // A stop might have some non-stop siblings
21 SPStop* SPStop::getNextStop()
22 {
23     SPStop *result = 0;
25     for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) {
26         if (SP_IS_STOP(obj)) {
27             result = SP_STOP(obj);
28         }
29     }
31     return result;
32 }
34 SPStop* SPStop::getPrevStop()
35 {
36     SPStop *result = 0;
38     for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) {
39         // The closest previous SPObject that is an SPStop *should* be ourself.
40         if (SP_IS_STOP(obj)) {
41             SPStop* stop = SP_STOP(obj);
42             // Sanity check to ensure we have a proper sibling structure.
43             if (stop->getNextStop() == this) {
44                 result = stop;
45             } else {
46                 g_warning("SPStop previous/next relationship broken");
47             }
48             break;
49         }
50     }
52     return result;
53 }
57 /*
58   Local Variables:
59   mode:c++
60   c-file-style:"stroustrup"
61   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62   indent-tabs-mode:nil
63   fill-column:99
64   End:
65 */
66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :