summaryrefslogtreecommitdiff
path: root/source/dphierarchies.cxx
blob: 6e49c43d8e79d3b1ea595c85998ee09f8d32e9fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

#include "dphierarchies.hxx"

#include <com/sun/star/container/XNamed.hpp>

using ::com::sun::star::container::NoSuchElementException;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::container::XNamed;
using ::com::sun::star::lang::IndexOutOfBoundsException;
using ::com::sun::star::lang::WrappedTargetException;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
using ::rtl::OUString;


#include <stdio.h>
#include <string>
#include <sys/time.h>

namespace {

class StackPrinter
{
public:
    explicit StackPrinter(const char* msg) :
        msMsg(msg)
    {
        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
        mfStartTime = getTime();
    }

    ~StackPrinter()
    {
        double fEndTime = getTime();
        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
    }

private:
    double getTime() const
    {
        timeval tv;
        gettimeofday(&tv, NULL);
        return tv.tv_sec + tv.tv_usec / 1000000.0;
    }

    ::std::string msMsg;
    double mfStartTime;
};

}

namespace dpsource {

DPHierarchies::DPHierarchies()
{
    init();
}

DPHierarchies::~DPHierarchies()
{
}

void DPHierarchies::init()
{
}

Any DPHierarchies::getByName(const OUString& aName) 
    throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
    StackPrinter __stack_printer__("dpsource/DPHierarchies::getByName");
    fprintf(stdout, "DPHierarchies::getByName:   name = '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
    throw NoSuchElementException();
    return Any();
}

Sequence<OUString> DPHierarchies::getElementNames() throw (RuntimeException)
{
    Sequence<OUString> aNames(1);
    aNames[0] = OUString::createFromAscii("flat");
    return aNames;
}

sal_Bool DPHierarchies::hasByName(const OUString& aName) throw (RuntimeException)
{
    return false;
}

Type DPHierarchies::getElementType() throw (RuntimeException)
{
    return getCppuType(static_cast< Reference<XNamed>* >(NULL));
}

sal_Bool DPHierarchies::hasElements() throw (RuntimeException)
{
    return false;
}

sal_Int32 DPHierarchies::getCount() throw (RuntimeException)
{
    return 0;
}

Any DPHierarchies::getByIndex(sal_Int32 nIndex) 
    throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
    StackPrinter __stack_printer__("dpsource/DPHierarchies::getByIndex");
    return Any();
}

}