<commit_before>#include "ui/search-tab.h"
#include "ui/search-tab-items.h"

#include <QtGlobal>

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif

#include "api/requests.h"
#include "seafile-applet.h"
#include "account-mgr.h"
#include "repo-service.h"
#include "loading-view.h"
#include "utils/file-utils.h"

namespace {
const int kMinimumKeywordLength = 3;
const int kInputDelayInterval = 300;
const char *kLoadingFailedLabelName = "loadingFailedText";

enum {
    INDEX_WAITING_VIEW = 0,
    INDEX_LOADING_VIEW,
    INDEX_LOADING_FAILED_VIEW,
    INDEX_SEARCH_VIEW,
};

} // anonymous namespace

SearchTab::SearchTab(QWidget *parent)
    : TabView(parent), last_modified_(0), request_(NULL)
{
    createSearchView();
    createLoadingView();
    createLoadingFailedView();

    mStack->insertWidget(INDEX_WAITING_VIEW, waiting_view_);
    mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    mStack->insertWidget(INDEX_SEARCH_VIEW, search_view_);

    connect(line_edit_, SIGNAL(textChanged(const QString&)),
            this, SLOT(doSearch(const QString&)));

    connect(search_view_, SIGNAL(doubleClicked(const QModelIndex&)),
            this, SLOT(onDoubleClicked(const QModelIndex&)));

    search_timer_ = new QTimer(this);
    connect(search_timer_, SIGNAL(timeout()), this, SLOT(doRealSearch()));
    search_timer_->start(kInputDelayInterval);
}

SearchTab::~SearchTab()
{
    stopRefresh();
    delete search_model_;
}

void SearchTab::reset()
{
    stopRefresh();
    line_edit_->setText("");
    mStack->setCurrentIndex(INDEX_WAITING_VIEW);
}

void SearchTab::createSearchView()
{
    QVBoxLayout *layout = (QVBoxLayout*)this->layout();
    line_edit_ = new QLineEdit;
    line_edit_->setPlaceholderText(tr("Search Files..."));
    line_edit_->setObjectName("searchInput");
#ifdef Q_OS_MAC
    line_edit_->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
    line_edit_->setClearButtonEnabled(true);
#endif
    layout->insertWidget(0, line_edit_);

    waiting_view_ = new QWidget;
    waiting_view_->installEventFilter(this);

    search_view_ = new SearchResultListView;
    search_view_->setObjectName("searchResult");
#ifdef Q_OS_MAC
    search_view_->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
    search_model_ = new SearchResultListModel;
    search_view_->setModel(search_model_);

    search_delegate_ = new SearchResultItemDelegate;

    delete search_view_->itemDelegate();
    search_view_->setItemDelegate(search_delegate_);
}

void SearchTab::createLoadingView()
{
    loading_view_ = new LoadingView;
    static_cast<LoadingView*>(loading_view_)->setQssStyleForTab();
}

void SearchTab::createLoadingFailedView()
{
    loading_failed_view_ = new QWidget(this);

    QVBoxLayout *layout = new QVBoxLayout;
    loading_failed_view_->setLayout(layout);

    loading_failed_text_ = new QLabel;
    loading_failed_text_->setObjectName(kLoadingFailedLabelName);
    loading_failed_text_->setAlignment(Qt::AlignCenter);

    connect(loading_failed_text_, SIGNAL(linkActivated(const QString&)),
            this, SLOT(refresh()));

    layout->addWidget(loading_failed_text_);
}

void SearchTab::showLoadingView()
{
    mStack->setCurrentIndex(INDEX_LOADING_VIEW);
}

bool SearchTab::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == waiting_view_ && event->type() == QEvent::Paint) {
        QPainter painter(waiting_view_);

        QPaintEvent *ev = (QPaintEvent*)event;
        const QSize size(72, 72);
        const int x = ev->rect().width() / 2 - size.width() / 2;
        const int y = ev->rect().height() / 2 - size.height() / 2;
        QRect rect(QPoint(x, y), size);

        // get the device pixel radio from current painter device
        int scale_factor = 1;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        scale_factor = painter.device()->devicePixelRatio();
#endif // QT5

        QPixmap image(QIcon(":/images/main-panel/search-background.png").pixmap(size).scaled(scale_factor * size));

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        image.setDevicePixelRatio(scale_factor);
#endif // QT5

        painter.drawPixmap(rect.topLeft(), image);

        return true;
    };
    return QObject::eventFilter(obj, event);
}

void SearchTab::refresh()
{
    if (!line_edit_->text().isEmpty()) {
        last_modified_ = 1;
        doRealSearch();
    }
}

void SearchTab::startRefresh()
{
    search_timer_->start();
    refresh();
}

void SearchTab::stopRefresh()
{
    search_timer_->stop();
    if (request_) {
        request_->deleteLater();
        request_ = NULL;
    }
}

void SearchTab::doSearch(const QString& keyword)
{
    if (keyword.size() < kMinimumKeywordLength) {
        mStack->setCurrentIndex(INDEX_WAITING_VIEW);
        return;
    }

    // save for doRealSearch
    last_modified_ = QDateTime::currentMSecsSinceEpoch();
}

void SearchTab::doRealSearch()
{
    // not modified
    if (last_modified_ == 0)
        return;
    // modified too fast
    if (QDateTime::currentMSecsSinceEpoch() - last_modified_ <= kInputDelayInterval)
        return;

    if (!seafApplet->accountManager()->hasAccount())
        return;
    if (request_) {
        request_->deleteLater();
        request_ = NULL;
    }
    mStack->setCurrentIndex(INDEX_LOADING_VIEW);
    request_ = new FileSearchRequest(seafApplet->accountManager()->accounts().front(), line_edit_->text());
    connect(request_, SIGNAL(success(const std::vector<FileSearchResult>&)),
            this, SLOT(onSearchSuccess(const std::vector<FileSearchResult>&)));
    connect(request_, SIGNAL(failed(const ApiError&)),
            this, SLOT(onSearchFailed(const ApiError&)));

    request_->send();

    // reset
    last_modified_ = 0;
}

void SearchTab::onSearchSuccess(const std::vector<FileSearchResult>& results)
{
    std::vector<QListWidgetItem*> items;

    for (unsigned i = 0; i < results.size(); ++i) {
        QListWidgetItem *item = new QListWidgetItem(results[i].name);
        if (results[i].fullpath.endsWith("/"))
            item->setIcon(QIcon(":/images/main-panel/folder.png"));
        else
            item->setIcon(QIcon(getIconByFileName(results[i].name)));
        item->setData(Qt::UserRole, QVariant::fromValue(results[i]));
        items.push_back(item);
    }

    search_model_->clear();
    search_model_->addItems(items);

    mStack->setCurrentIndex(INDEX_SEARCH_VIEW);
}

void SearchTab::onSearchFailed(const ApiError& error)
{
    mStack->setCurrentIndex(INDEX_LOADING_FAILED_VIEW);
}

void SearchTab::onDoubleClicked(const QModelIndex& index)
{
    FileSearchResult result = search_model_->data(index, Qt::UserRole).value<FileSearchResult>();
    if (result.name.isEmpty() || result.fullpath.isEmpty())
        return;

    RepoService::instance()->openLocalFile(result.repo_id, result.fullpath);
}
<commit_msg>search-tab: make it search more actively<commit_after>#include "ui/search-tab.h"
#include "ui/search-tab-items.h"

#include <QtGlobal>

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif

#include "api/requests.h"
#include "seafile-applet.h"
#include "account-mgr.h"
#include "repo-service.h"
#include "loading-view.h"
#include "utils/file-utils.h"

namespace {
const int kMinimumKeywordLength = 3;
const int kInputDelayInterval = 300;
const char *kLoadingFailedLabelName = "loadingFailedText";

enum {
    INDEX_WAITING_VIEW = 0,
    INDEX_LOADING_VIEW,
    INDEX_LOADING_FAILED_VIEW,
    INDEX_SEARCH_VIEW,
};

} // anonymous namespace

SearchTab::SearchTab(QWidget *parent)
    : TabView(parent), last_modified_(0), request_(NULL)
{
    createSearchView();
    createLoadingView();
    createLoadingFailedView();

    mStack->insertWidget(INDEX_WAITING_VIEW, waiting_view_);
    mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    mStack->insertWidget(INDEX_SEARCH_VIEW, search_view_);

    connect(line_edit_, SIGNAL(textChanged(const QString&)),
            this, SLOT(doSearch(const QString&)));

    connect(search_view_, SIGNAL(doubleClicked(const QModelIndex&)),
            this, SLOT(onDoubleClicked(const QModelIndex&)));

    search_timer_ = new QTimer(this);
    connect(search_timer_, SIGNAL(timeout()), this, SLOT(doRealSearch()));
    search_timer_->start(kInputDelayInterval);
}

SearchTab::~SearchTab()
{
    stopRefresh();
    delete search_model_;
}

void SearchTab::reset()
{
    stopRefresh();
    line_edit_->setText("");
    mStack->setCurrentIndex(INDEX_WAITING_VIEW);
}

void SearchTab::createSearchView()
{
    QVBoxLayout *layout = (QVBoxLayout*)this->layout();
    line_edit_ = new QLineEdit;
    line_edit_->setPlaceholderText(tr("Search Files..."));
    line_edit_->setObjectName("searchInput");
#ifdef Q_OS_MAC
    line_edit_->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
    line_edit_->setClearButtonEnabled(true);
#endif
    layout->insertWidget(0, line_edit_);

    waiting_view_ = new QWidget;
    waiting_view_->installEventFilter(this);

    search_view_ = new SearchResultListView;
    search_view_->setObjectName("searchResult");
#ifdef Q_OS_MAC
    search_view_->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
    search_model_ = new SearchResultListModel;
    search_view_->setModel(search_model_);

    search_delegate_ = new SearchResultItemDelegate;

    delete search_view_->itemDelegate();
    search_view_->setItemDelegate(search_delegate_);
}

void SearchTab::createLoadingView()
{
    loading_view_ = new LoadingView;
    static_cast<LoadingView*>(loading_view_)->setQssStyleForTab();
}

void SearchTab::createLoadingFailedView()
{
    loading_failed_view_ = new QWidget(this);

    QVBoxLayout *layout = new QVBoxLayout;
    loading_failed_view_->setLayout(layout);

    loading_failed_text_ = new QLabel;
    loading_failed_text_->setObjectName(kLoadingFailedLabelName);
    loading_failed_text_->setAlignment(Qt::AlignCenter);

    connect(loading_failed_text_, SIGNAL(linkActivated(const QString&)),
            this, SLOT(refresh()));

    layout->addWidget(loading_failed_text_);
}

void SearchTab::showLoadingView()
{
    mStack->setCurrentIndex(INDEX_LOADING_VIEW);
}

bool SearchTab::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == waiting_view_ && event->type() == QEvent::Paint) {
        QPainter painter(waiting_view_);

        QPaintEvent *ev = (QPaintEvent*)event;
        const QSize size(72, 72);
        const int x = ev->rect().width() / 2 - size.width() / 2;
        const int y = ev->rect().height() / 2 - size.height() / 2;
        QRect rect(QPoint(x, y), size);

        // get the device pixel radio from current painter device
        int scale_factor = 1;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        scale_factor = painter.device()->devicePixelRatio();
#endif // QT5

        QPixmap image(QIcon(":/images/main-panel/search-background.png").pixmap(size).scaled(scale_factor * size));

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        image.setDevicePixelRatio(scale_factor);
#endif // QT5

        painter.drawPixmap(rect.topLeft(), image);

        return true;
    };
    return QObject::eventFilter(obj, event);
}

void SearchTab::refresh()
{
    if (!line_edit_->text().isEmpty()) {
        last_modified_ = 1;
        doRealSearch();
    }
}

void SearchTab::startRefresh()
{
    search_timer_->start();
    refresh();
}

void SearchTab::stopRefresh()
{
    search_timer_->stop();
    if (request_) {
        request_->deleteLater();
        request_ = NULL;
    }
}

void SearchTab::doSearch(const QString& keyword)
{
    // make it search utf-8 charcters
    if (keyword.toUtf8().size() < kMinimumKeywordLength) {
        mStack->setCurrentIndex(INDEX_WAITING_VIEW);
        return;
    }

    // save for doRealSearch
    last_modified_ = QDateTime::currentMSecsSinceEpoch();
}

void SearchTab::doRealSearch()
{
    // not modified
    if (last_modified_ == 0)
        return;
    // modified too fast
    if (QDateTime::currentMSecsSinceEpoch() - last_modified_ <= kInputDelayInterval)
        return;

    if (!seafApplet->accountManager()->hasAccount())
        return;
    if (request_) {
        request_->deleteLater();
        request_ = NULL;
    }
    mStack->setCurrentIndex(INDEX_LOADING_VIEW);
    request_ = new FileSearchRequest(seafApplet->accountManager()->accounts().front(), line_edit_->text());
    connect(request_, SIGNAL(success(const std::vector<FileSearchResult>&)),
            this, SLOT(onSearchSuccess(const std::vector<FileSearchResult>&)));
    connect(request_, SIGNAL(failed(const ApiError&)),
            this, SLOT(onSearchFailed(const ApiError&)));

    request_->send();

    // reset
    last_modified_ = 0;
}

void SearchTab::onSearchSuccess(const std::vector<FileSearchResult>& results)
{
    std::vector<QListWidgetItem*> items;

    for (unsigned i = 0; i < results.size(); ++i) {
        QListWidgetItem *item = new QListWidgetItem(results[i].name);
        if (results[i].fullpath.endsWith("/"))
            item->setIcon(QIcon(":/images/main-panel/folder.png"));
        else
            item->setIcon(QIcon(getIconByFileName(results[i].name)));
        item->setData(Qt::UserRole, QVariant::fromValue(results[i]));
        items.push_back(item);
    }

    search_model_->clear();
    search_model_->addItems(items);

    mStack->setCurrentIndex(INDEX_SEARCH_VIEW);
}

void SearchTab::onSearchFailed(const ApiError& error)
{
    mStack->setCurrentIndex(INDEX_LOADING_FAILED_VIEW);
}

void SearchTab::onDoubleClicked(const QModelIndex& index)
{
    FileSearchResult result = search_model_->data(index, Qt::UserRole).value<FileSearchResult>();
    if (result.name.isEmpty() || result.fullpath.isEmpty())
        return;

    RepoService::instance()->openLocalFile(result.repo_id, result.fullpath);
}
<|endoftext|>


<commit_before>/*
 * leveled_logger.hpp
 *
 *  Created on: Aug 12, 2012
 *      Author: philipp
 */

#ifndef LEVELED_LOGGER_HPP_
#define LEVELED_LOGGER_HPP_

#include "logger.hpp"
#include <sstream>

namespace mlog
{

extern char endl;

class leveled_logger
{
public:
	leveled_logger(mlog_level level, logger* log) :
			m_log(log), m_has_content(false), m_level(level)
	{
	}

	virtual ~leveled_logger()
	{
		if (m_has_content)
			write_to_log();

	}

	template<typename type>
	leveled_logger& operator<<(const type& rhs)
	{
		if (!m_has_content)
			init_line();

		m_stream << rhs;
		return *this;
	}

	leveled_logger& operator<<(char rhs)
	{
		if (rhs == mlog::endl)
			write_to_log();
		else
			m_stream << rhs;

		return *this;
	}

protected:
	inline logger* get_logger()
	{
		return m_log;
	}

private:
	std::stringstream m_stream;
	logger* m_log;
	bool m_has_content;
	mlog_level m_level;

	void write_to_log()
	{
		m_log->write(m_stream.str());
		m_stream.clear();
		m_has_content = false;
	}

	void init_line()
	{
		m_stream << "{";

		if (m_level == trace)
			m_stream << "trace";
		else if (m_level == debug)
			m_stream << "debug";
		else if (m_level == info)
			m_stream << "info";
		else if (m_level == warning)
			m_stream << "warning";
		else if (m_level == error)
			m_stream << "error";
		else if (m_level == fatal)
			m_stream << "fatal";

		m_stream << "}: ";
		m_has_content = true;
	}

};

} /* namespace mlog */
#endif /* LEVELED_LOGGER_HPP_ */
<commit_msg>Removed 2 operations.<commit_after>/*
 * leveled_logger.hpp
 *
 *  Created on: Aug 12, 2012
 *      Author: philipp
 */

#ifndef LEVELED_LOGGER_HPP_
#define LEVELED_LOGGER_HPP_

#include "logger.hpp"
#include <sstream>

namespace mlog
{

extern char endl;

class leveled_logger
{
public:
	leveled_logger(mlog_level level, logger* log) :
			m_log(log), m_has_content(false), m_level(level)
	{
	}

	virtual ~leveled_logger()
	{
		if (m_has_content)
			write_to_log();

	}

	template<typename type>
	leveled_logger& operator<<(const type& rhs)
	{
		if (!m_has_content)
			init_line();

		m_stream << rhs;
		return *this;
	}

	leveled_logger& operator<<(char rhs)
	{
		if (rhs == mlog::endl)
			write_to_log();
		else
			m_stream << rhs;

		return *this;
	}

protected:
	inline logger* get_logger()
	{
		return m_log;
	}

private:
	std::stringstream m_stream;
	logger* m_log;
	bool m_has_content;
	mlog_level m_level;

	void write_to_log()
	{
		m_log->write(m_stream.str());
		m_stream.clear();
		m_has_content = false;
	}

	void init_line()
	{
		if (m_level == trace)
			m_stream << "{trace}: ";
		else if (m_level == debug)
			m_stream << "{debug}: ";
		else if (m_level == info)
			m_stream << "{info}: ";
		else if (m_level == warning)
			m_stream << "{warning}: ";
		else if (m_level == error)
			m_stream << "{error}: ";
		else if (m_level == fatal)
			m_stream << "{fatal}: ";

		m_has_content = true;
	}

};

} /* namespace mlog */
#endif /* LEVELED_LOGGER_HPP_ */
<|endoftext|>


<commit_before>#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){

    UDPR.setup();

    ofTrueTypeFont smallFont, largeFont;

    smallFont.loadFont("selena.otf", 16); //http://openfontlibrary.org/en/font/selena
    largeFont.loadFont("selena.otf", 48);

    ofSetFrameRate(60);
    kinect.setup(12345, smallFont);
    kinect.setSmoothing(SIMPLE_MOVING_AVERAGE);
    skeletons = kinect.getSkeletons();
    renderer.setup(skeletons, largeFont);

    //gui.setup("panel");

    KS.setup();

    //KSAI.setup();

    skeletonTransform.setName("skeleton transform");
    skeletonTransform.add(scaleX.set("scaleX", 1.0,0.01, 20));
    skeletonTransform.add(scaleY.set("scaleY", 1.0,0.01, 20));
    skeletonTransform.add(scaleZ.set("scaleZ", 1.0,0.01, 140));
    skeletonTransform.add(offsetX.set("offsetX", 0, -2000,2000));
    skeletonTransform.add(offsetY.set("offsetY", 0, -2000,2000));
    skeletonTransform.add(offsetZ.set("offsetZ", 0, -2000,2000));
    skeletonTransform.add(rotationX.set("rotationX", 0,-180,180));
    skeletonTransform.add(rotationY.set("rotationY", 0,-180,180));
    skeletonTransform.add(rotationZ.set("rotationZ", 0,-180,180));

    dataPlayer.setName("dataPlayer");
    dataPlayer.add(bUseUdpPlayer.set("use udp player", false));
    dataPlayer.add(bLoadNewUDP.set("load udp", false));
    dataPlayer.add(udpDuration.set("Playback Pos", 0, 0, 1));

    cameraControl.setName("camera control");
    cameraControl.add(cameraHeight.set("camera height", 800,0, 2000));
    cameraControl.add(cameraRadius.set("camera radius", 800,0, 2000));
    cameraControl.add(cameraAngle.set("camera angle", 0,-TWO_PI*2, TWO_PI*2));

    debugView.setName("DebugView");
    debugView.add(drawSkeleton.set("Draw Skeleton", true));
    debugView.add(drawAnalyzer.set("Draw Analyzer", true));
    debugView.add(drawBoundingCube.set("Draw Bounding Cube", true));

    buttonControl.setName("button control");
    buttonControl.add(buttonDraw.set("Draw Buttons", false));
    buttonControl.add(buttonRadius.set("Radius", 75, 20, 150));
    buttonControl.add(buttonTriggerScale.set("Trigger Scale", 0.8, 0.3, 1.0));
    buttonControl.add(buttonApproachScale.set("Approach Scale", 1.2, 0.5, 2.0));

    gui.setup("controls", ofGetWidth()-300-10, 10, 300, 700);
    gui.addPanel("main control", 4, false);
    gui.addPanel("analysis", 4, false);
    gui.setWhichPanel(0);
    gui.setWhichColumn(0);

    gui.addGroup(skeletonTransform);
    gui.addGroup(dataPlayer);
    gui.addGroup(cameraControl);
    gui.addGroup(debugView);

    gui.setWhichPanel(1);
    gui.setWhichColumn(0);

    //gui.addGroup(KSA.anlaysisParams);
    //gui.addGroup(KSAI.interpreterParams);

    gui.setWhichPanel(2);
    gui.setWhichColumn(0);
    gui.addGroup(buttonControl);

    gui.setWhichPanel(0);

    status = "first frame";
    gui.setStatusMessage(status);

    gui.loadSettings("settings.xml");
    gui.setupEvents();
    gui.enableEvents();

    //ofAddListener(kinect.newGesture, this, &ofApp::newGesture);

    fooFbo.allocate(1024, 728, GL_RGBA, 4);
    fooFbo.begin();
    ofClear(0, 0, 0, 0);
    fooFbo.end();

    midiOut.openVirtualPort("OF Skeleton Tracker");
    midiNotes.push_back(0);
    midiNotes.push_back(2);
    midiNotes.push_back(4);
    midiNotes.push_back(5);
    midiNotes.push_back(7);
    midiNotes.push_back(9);
    midiNotes.push_back(11);
    buttons.resize(midiNotes.size() * 6);

    for(int i = 0; i < buttons.size(); i++) {
        buttons[i].setTriggerBlock(^(bool on, float vel) { sendMidi(i, 1, vel, on); });
        buttons[i].setApproachBlock(^(bool on, float vel) { sendMidi(i, 2, vel, on); });
    }
}

//--------------------------------------------------------------
void ofApp::update(){

    gui.update();

    ofSetWindowTitle(ofToString(ofGetFrameRate()));

    if (bLoadNewUDP == true){
        string folder = ofSystemLoadDialog("", true).getPath();
        if (folder != ""){
            UDPR.parseFolder(folder);
        }
        bLoadNewUDP = false;
    }

    if (bUseUdpPlayer){
        UDPR.update();
        udpDuration.set(UDPR.pct);
    }

    mat.makeIdentityMatrix();
    ofPoint offsetPt = ofPoint(offsetX, offsetY, offsetZ);
    mat.glTranslate(offsetPt);
    mat.glRotate(rotationX, 1,0,0);
    mat.glRotate(rotationY, 0,1,0);
    mat.glRotate(rotationZ, 0,0,1);
    ofPoint scaleTemp = ofPoint(scaleX, scaleY, scaleZ);;
    mat.glScale(scaleTemp.x, scaleTemp.y, scaleTemp.z);

    kinect.update();

    //ofLog(OF_LOG_NOTICE) << skeletons->size() << endl;
    //

    if (skeletons->size() >= 1){
        for(int i = 0; i < skeletons->size(); i++){
            KS.setFromSkeleton(skeletons->at(i), mat);
            kinectBody & body = bodyMap[skeletons->at(i).getBodyId()];
            bool bNewFrame = body.addSkeleton(KS);

            if (bNewFrame){
                KSA.analyze(body.getLastSkeleton());
                KBA.analyze(body);
                updateAudio(body);

                if(body.gestureHistory.size() > 0){
                    int count = 12;
                    for(map<string, Gesture>::iterator iter = body.gestureHistory.back().begin(); iter != body.gestureHistory.back().end(); ++iter){
                        if(iter->second.type == Discrete){
                            if(iter->second.triggered && !triggers[iter->first]){
                                triggers[iter->first] = true;
                                midiOut.sendNoteOn(3, count++, 127);
                            }else if(!iter->second.triggered){
                                 triggers[iter->first] = false;
                            }

                        }
                    }
                }
            }
        }
    }else{
        bodyMap.clear();
    }

    //KSAI.drawEvents( KSA.normFbo);
}

//--------------------------------------------------------------
void ofApp::draw(){

    ofBackground(ofColor::darkGray);

    ofPoint position (0 + cameraRadius * cos(cameraAngle), cameraHeight, 0 + cameraRadius * sin(cameraAngle));
    cam.setPosition(position);
    cam.lookAt( ofPoint(0,0,0));

    fooFbo.begin();
    ofBackground(ofColor::darkGray);
    //ofClear(0, 0, 0);
    cam.begin(ofRectangle(ofVec2f(0, 0), fooFbo.getWidth(), fooFbo.getHeight()));
    ofSetColor(255,255,255,127);
    ofSetLineWidth(3);
    ofPushMatrix();
    ofRotate(90,0,0,1);
    ofDrawGridPlane(1000);
    ofPopMatrix();
    ofDrawAxis(50);

    ofLine( ofPoint(0,0), ofPoint(800,0));

    for( vector<Skeleton>::iterator iter = skeletons->begin(); iter != skeletons->end(); ++iter){
        if(drawSkeleton){
            bodyMap[iter->getBodyId()].draw();
        }
        if(drawAnalyzer){
            bodyMap[iter->getBodyId()].drawDebug(drawBoundingCube);
        }
    }

    if(buttonDraw) {
        for(auto& button : buttons) {
            button.draw();
        }
    }

    cam.end();

    ofClearAlpha();
    fooFbo.end();
    ofSetLineWidth(1);

    ofSetColor(255,255,255);
    fooFbo.draw((ofGetWidth()-fooFbo.getWidth())/2.0, (ofGetHeight()-fooFbo.getHeight())/2.0);
    for( vector<Skeleton>::iterator iter = skeletons->begin(); iter != skeletons->end(); ++iter){
        bodyMap[iter->getBodyId()].drawHistory();
    }

    gui.draw();

    //    UDPR.draw(ofRectangle(2*ofGetWidth()/3,0, 400, 100));
}

void ofApp::updateAudio(kinectBody &body) {
    float spacing = 130;

    vector< pair<ofPoint, float> > activePoints;

    const float velNorm = 30;

    activePoints.push_back( make_pair(body.getLastSkeleton().getLeftPoint(::hand),
                                      body.velocity[body.getLastSkeleton().leftEnumsToIndex[::hand]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getRightPoint(::hand),
                                      body.velocity[body.getLastSkeleton().rightEnumsToIndex[::hand]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getLeftPoint(::foot),
                                      body.velocity[body.getLastSkeleton().leftEnumsToIndex[::foot]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getRightPoint(::foot),
                                      body.velocity[body.getLastSkeleton().rightEnumsToIndex[::foot]].length() / velNorm ));

    for(int i = 0; i < buttons.size(); i++) {
        int interval = i % (midiNotes.size() + 1);
        int octave = i / (midiNotes.size() + 1);

        float t = ofMap(interval, 0, midiNotes.size(), M_PI_2, M_PI + M_PI_2);

        float x = sin(t);
        float z = cos(t);
        float y = ofMap(octave, 0, 2, -1, 1);

        buttons[i].setParent(body.getLastSkeleton().centerPoint);
        buttons[i].setPosition(x * spacing, y * spacing, z * spacing);

        buttons[i].setRadius(buttonRadius);
        buttons[i].setTriggerScale(buttonTriggerScale);
        buttons[i].setApproachScale(buttonApproachScale);
        buttons[i].update(activePoints);
    }
}

void ofApp::sendMidi(int buttonIndex, int channel, float velocity, bool noteOn) {

    int midiRoot = 24; // C3
    int octave = buttonIndex / midiNotes.size();
    int interval = buttonIndex % midiNotes.size();
    int note = midiNotes[interval] + (octave * 12) + midiRoot;
    int velMidi = ofMap(velocity, 0, 1, 40, 120, true);

    if(noteOn) {
        midiOut.sendNoteOn(channel, note, velMidi);
    } else {
        midiOut.sendNoteOff(channel, note, velMidi);
    }
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if (key == 's'){
        gui.saveSettings("settings.xml");
    }
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){

}
<commit_msg>updates for gesture triggers<commit_after>#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){

    UDPR.setup();

    ofTrueTypeFont smallFont, largeFont;

    smallFont.loadFont("selena.otf", 16); //http://openfontlibrary.org/en/font/selena
    largeFont.loadFont("selena.otf", 48);

    ofSetFrameRate(60);
    kinect.setup(12345, smallFont);
    kinect.setSmoothing(SIMPLE_MOVING_AVERAGE);
    skeletons = kinect.getSkeletons();
    renderer.setup(skeletons, largeFont);

    //gui.setup("panel");

    KS.setup();

    //KSAI.setup();

    skeletonTransform.setName("skeleton transform");
    skeletonTransform.add(scaleX.set("scaleX", 1.0,0.01, 20));
    skeletonTransform.add(scaleY.set("scaleY", 1.0,0.01, 20));
    skeletonTransform.add(scaleZ.set("scaleZ", 1.0,0.01, 140));
    skeletonTransform.add(offsetX.set("offsetX", 0, -2000,2000));
    skeletonTransform.add(offsetY.set("offsetY", 0, -2000,2000));
    skeletonTransform.add(offsetZ.set("offsetZ", 0, -2000,2000));
    skeletonTransform.add(rotationX.set("rotationX", 0,-180,180));
    skeletonTransform.add(rotationY.set("rotationY", 0,-180,180));
    skeletonTransform.add(rotationZ.set("rotationZ", 0,-180,180));

    dataPlayer.setName("dataPlayer");
    dataPlayer.add(bUseUdpPlayer.set("use udp player", false));
    dataPlayer.add(bLoadNewUDP.set("load udp", false));
    dataPlayer.add(udpDuration.set("Playback Pos", 0, 0, 1));

    cameraControl.setName("camera control");
    cameraControl.add(cameraHeight.set("camera height", 800,0, 2000));
    cameraControl.add(cameraRadius.set("camera radius", 800,0, 2000));
    cameraControl.add(cameraAngle.set("camera angle", 0,-TWO_PI*2, TWO_PI*2));

    debugView.setName("DebugView");
    debugView.add(drawSkeleton.set("Draw Skeleton", true));
    debugView.add(drawAnalyzer.set("Draw Analyzer", true));
    debugView.add(drawBoundingCube.set("Draw Bounding Cube", true));

    buttonControl.setName("button control");
    buttonControl.add(buttonDraw.set("Draw Buttons", false));
    buttonControl.add(buttonRadius.set("Radius", 75, 20, 150));
    buttonControl.add(buttonTriggerScale.set("Trigger Scale", 0.8, 0.3, 1.0));
    buttonControl.add(buttonApproachScale.set("Approach Scale", 1.2, 0.5, 2.0));

    gui.setup("controls", ofGetWidth()-300-10, 10, 300, 700);
    gui.addPanel("main control", 4, false);
    gui.addPanel("analysis", 4, false);
    gui.setWhichPanel(0);
    gui.setWhichColumn(0);

    gui.addGroup(skeletonTransform);
    gui.addGroup(dataPlayer);
    gui.addGroup(cameraControl);
    gui.addGroup(debugView);

    gui.setWhichPanel(1);
    gui.setWhichColumn(0);

    //gui.addGroup(KSA.anlaysisParams);
    //gui.addGroup(KSAI.interpreterParams);

    gui.setWhichPanel(2);
    gui.setWhichColumn(0);
    gui.addGroup(buttonControl);

    gui.setWhichPanel(0);

    status = "first frame";
    gui.setStatusMessage(status);

    gui.loadSettings("settings.xml");
    gui.setupEvents();
    gui.enableEvents();

    //ofAddListener(kinect.newGesture, this, &ofApp::newGesture);

    fooFbo.allocate(1024, 728, GL_RGBA, 4);
    fooFbo.begin();
    ofClear(0, 0, 0, 0);
    fooFbo.end();

    midiOut.openVirtualPort("OF Skeleton Tracker");
    midiNotes.push_back(0);
    midiNotes.push_back(2);
    midiNotes.push_back(4);
    midiNotes.push_back(5);
    midiNotes.push_back(7);
    midiNotes.push_back(9);
    midiNotes.push_back(11);
    buttons.resize(midiNotes.size() * 6);

    for(int i = 0; i < buttons.size(); i++) {
        buttons[i].setTriggerBlock(^(bool on, float vel) { sendMidi(i, 1, vel, on); });
        buttons[i].setApproachBlock(^(bool on, float vel) { sendMidi(i, 2, vel, on); });
    }
}

//--------------------------------------------------------------
void ofApp::update(){

    gui.update();

    ofSetWindowTitle(ofToString(ofGetFrameRate()));

    if (bLoadNewUDP == true){
        string folder = ofSystemLoadDialog("", true).getPath();
        if (folder != ""){
            UDPR.parseFolder(folder);
        }
        bLoadNewUDP = false;
    }

    if (bUseUdpPlayer){
        UDPR.update();
        udpDuration.set(UDPR.pct);
    }

    mat.makeIdentityMatrix();
    ofPoint offsetPt = ofPoint(offsetX, offsetY, offsetZ);
    mat.glTranslate(offsetPt);
    mat.glRotate(rotationX, 1,0,0);
    mat.glRotate(rotationY, 0,1,0);
    mat.glRotate(rotationZ, 0,0,1);
    ofPoint scaleTemp = ofPoint(scaleX, scaleY, scaleZ);;
    mat.glScale(scaleTemp.x, scaleTemp.y, scaleTemp.z);

    kinect.update();

    //ofLog(OF_LOG_NOTICE) << skeletons->size() << endl;
    //

    if (skeletons->size() >= 1){
        for(int i = 0; i < skeletons->size(); i++){
            KS.setFromSkeleton(skeletons->at(i), mat);
            kinectBody & body = bodyMap[skeletons->at(i).getBodyId()];
            bool bNewFrame = body.addSkeleton(KS);

            if (bNewFrame){
                KSA.analyze(body.getLastSkeleton());
                KBA.analyze(body);
                updateAudio(body);

                if(body.gestureHistory.size() > 0){
                    int count = 12;
                    for(map<string, Gesture>::iterator iter = body.gestureHistory.back().begin(); iter != body.gestureHistory.back().end(); ++iter){
                        if(iter->second.type == Discrete){
                            if(iter->second.triggered && !triggers[iter->first]){
                                triggers[iter->first] = true;
                                midiOut.sendNoteOn(3, count, 127);
                            }else if(!iter->second.triggered){
                                 triggers[iter->first] = false;
                            }
                            count++;
                        }
                    }
                }
            }
        }
    }else{
        bodyMap.clear();
    }

    //KSAI.drawEvents( KSA.normFbo);
}

//--------------------------------------------------------------
void ofApp::draw(){

    ofBackground(ofColor::darkGray);

    ofPoint position (0 + cameraRadius * cos(cameraAngle), cameraHeight, 0 + cameraRadius * sin(cameraAngle));
    cam.setPosition(position);
    cam.lookAt( ofPoint(0,0,0));

    fooFbo.begin();
    ofBackground(ofColor::darkGray);
    //ofClear(0, 0, 0);
    cam.begin(ofRectangle(ofVec2f(0, 0), fooFbo.getWidth(), fooFbo.getHeight()));
    ofSetColor(255,255,255,127);
    ofSetLineWidth(3);
    ofPushMatrix();
    ofRotate(90,0,0,1);
    ofDrawGridPlane(1000);
    ofPopMatrix();
    ofDrawAxis(50);

    ofLine( ofPoint(0,0), ofPoint(800,0));

    for( vector<Skeleton>::iterator iter = skeletons->begin(); iter != skeletons->end(); ++iter){
        if(drawSkeleton){
            bodyMap[iter->getBodyId()].draw();
        }
        if(drawAnalyzer){
            bodyMap[iter->getBodyId()].drawDebug(drawBoundingCube);
        }
    }

    if(buttonDraw) {
        for(auto& button : buttons) {
            button.draw();
        }
    }

    cam.end();

    ofClearAlpha();
    fooFbo.end();
    ofSetLineWidth(1);

    ofSetColor(255,255,255);
    fooFbo.draw((ofGetWidth()-fooFbo.getWidth())/2.0, (ofGetHeight()-fooFbo.getHeight())/2.0);
    for( vector<Skeleton>::iterator iter = skeletons->begin(); iter != skeletons->end(); ++iter){
        bodyMap[iter->getBodyId()].drawHistory();
    }

    gui.draw();

    //    UDPR.draw(ofRectangle(2*ofGetWidth()/3,0, 400, 100));
}

void ofApp::updateAudio(kinectBody &body) {
    float spacing = 130;

    vector< pair<ofPoint, float> > activePoints;

    const float velNorm = 30;

    activePoints.push_back( make_pair(body.getLastSkeleton().getLeftPoint(::hand),
                                      body.velocity[body.getLastSkeleton().leftEnumsToIndex[::hand]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getRightPoint(::hand),
                                      body.velocity[body.getLastSkeleton().rightEnumsToIndex[::hand]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getLeftPoint(::foot),
                                      body.velocity[body.getLastSkeleton().leftEnumsToIndex[::foot]].length() / velNorm ));

    activePoints.push_back( make_pair(body.getLastSkeleton().getRightPoint(::foot),
                                      body.velocity[body.getLastSkeleton().rightEnumsToIndex[::foot]].length() / velNorm ));

    for(int i = 0; i < buttons.size(); i++) {
        int interval = i % (midiNotes.size() + 1);
        int octave = i / (midiNotes.size() + 1);

        float t = ofMap(interval, 0, midiNotes.size(), M_PI_2, M_PI + M_PI_2);

        float x = sin(t);
        float z = cos(t);
        float y = ofMap(octave, 0, 2, -1, 1);

        buttons[i].setParent(body.getLastSkeleton().centerPoint);
        buttons[i].setPosition(x * spacing, y * spacing, z * spacing);

        buttons[i].setRadius(buttonRadius);
        buttons[i].setTriggerScale(buttonTriggerScale);
        buttons[i].setApproachScale(buttonApproachScale);
        buttons[i].update(activePoints);
    }
}

void ofApp::sendMidi(int buttonIndex, int channel, float velocity, bool noteOn) {

    int midiRoot = 24; // C3
    int octave = buttonIndex / midiNotes.size();
    int interval = buttonIndex % midiNotes.size();
    int note = midiNotes[interval] + (octave * 12) + midiRoot;
    int velMidi = ofMap(velocity, 0, 1, 40, 120, true);

    if(noteOn) {
        midiOut.sendNoteOn(channel, note, velMidi);
    } else {
        midiOut.sendNoteOff(channel, note, velMidi);
    }
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if (key == 's'){
        gui.saveSettings("settings.xml");
    }
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){

}
<|endoftext|>


<commit_before>// RUN: %clang -cc1 -std=c++11 -verify %s

// Error cases.

[[gnu::this_attribute_does_not_exist]] int unknown_attr;
// expected-warning@-1 {{unknown attribute 'this_attribute_does_not_exist' ignored}}
int [[gnu::unused]] attr_on_type;
// expected-warning@-1 {{attribute 'unused' ignored, because it is not attached to a declaration}}
int *[[gnu::unused]] attr_on_ptr;
// expected-warning@-1 {{attribute 'unused' ignored, because it cannot be applied to a type}}

// Valid cases.

void alias1() {}
void alias2 [[gnu::alias("_Z6alias1v")]] ();

[[gnu::aligned(8)]] int aligned;
void aligned_fn [[gnu::aligned(32)]] ();
struct [[gnu::aligned(8)]] aligned_struct {};

[[gnu::malloc, gnu::alloc_size(1,2)]] void *alloc_size(int a, int b);

void always_inline [[gnu::always_inline]] ();

__thread int tls_model [[gnu::tls_model("local-exec")]];

void cleanup(int *p) {
  int n [[gnu::cleanup(cleanup)]];
}

void deprecated1 [[gnu::deprecated]] (); // expected-note {{here}}
[[gnu::deprecated("custom message")]] void deprecated2(); // expected-note {{here}}
void deprecated3() {
  deprecated1(); // expected-warning {{deprecated}}
  deprecated2(); // expected-warning {{custom message}}
}

[[gnu::naked(1,2,3)]] void naked(); // expected-error {{takes no arguments}}

void nonnull [[gnu::nonnull]] (); // expected-warning {{applied to function with no pointer arguments}}

int noreturn [[gnu::noreturn]]; // expected-warning {{'noreturn' only applies to function types}}

struct [[gnu::packed]] packed { char c; int n; };
static_assert(sizeof(packed) == sizeof(char) + sizeof(int), "not packed");
<commit_msg>clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.<commit_after>// RUN: %clang -cc1 -triple x86_64-unknown-unknown -std=c++11 -verify %s

// Error cases.

[[gnu::this_attribute_does_not_exist]] int unknown_attr;
// expected-warning@-1 {{unknown attribute 'this_attribute_does_not_exist' ignored}}
int [[gnu::unused]] attr_on_type;
// expected-warning@-1 {{attribute 'unused' ignored, because it is not attached to a declaration}}
int *[[gnu::unused]] attr_on_ptr;
// expected-warning@-1 {{attribute 'unused' ignored, because it cannot be applied to a type}}

// Valid cases.

void alias1() {}
void alias2 [[gnu::alias("_Z6alias1v")]] ();

[[gnu::aligned(8)]] int aligned;
void aligned_fn [[gnu::aligned(32)]] ();
struct [[gnu::aligned(8)]] aligned_struct {};

[[gnu::malloc, gnu::alloc_size(1,2)]] void *alloc_size(int a, int b);

void always_inline [[gnu::always_inline]] ();

__thread int tls_model [[gnu::tls_model("local-exec")]];

void cleanup(int *p) {
  int n [[gnu::cleanup(cleanup)]];
}

void deprecated1 [[gnu::deprecated]] (); // expected-note {{here}}
[[gnu::deprecated("custom message")]] void deprecated2(); // expected-note {{here}}
void deprecated3() {
  deprecated1(); // expected-warning {{deprecated}}
  deprecated2(); // expected-warning {{custom message}}
}

[[gnu::naked(1,2,3)]] void naked(); // expected-error {{takes no arguments}}

void nonnull [[gnu::nonnull]] (); // expected-warning {{applied to function with no pointer arguments}}

int noreturn [[gnu::noreturn]]; // expected-warning {{'noreturn' only applies to function types}}

struct [[gnu::packed]] packed { char c; int n; };
static_assert(sizeof(packed) == sizeof(char) + sizeof(int), "not packed");
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: StaticSet.cxx,v $
 *
 *  $Revision: 1.19 $
 *
 *  last change: $Author: vg $ $Date: 2006-11-21 17:15:48 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"

#ifndef DBACCESS_CORE_API_STATICSET_HXX
#include "StaticSet.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
#endif
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
#endif
#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
#endif
#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include <connectivity/CommonTools.hxx>
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif

using namespace dbaccess;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
//  using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
//  using namespace ::cppu;
using namespace ::osl;

// -------------------------------------------------------------------------
void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
{
    _rRow = *m_aSetIter;
}
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XRowLocate
Any SAL_CALL OStaticSet::getBookmark() throw(SQLException, RuntimeException)
{
    return makeAny(getRow());
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    return absolute(::comphelper::getINT32(bookmark));
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    return absolute(::comphelper::getINT32(bookmark)+rows);
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
{
    sal_Int32 nFirst = 0, nSecond = 0;
    _first >>= nFirst;
    _second >>= nSecond;
    return (nFirst < nSecond) ? CompareBookmark::LESS : ((nFirst > nSecond) ? CompareBookmark::GREATER : CompareBookmark::EQUAL);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::hasOrderedBookmarks(  ) throw(SQLException, RuntimeException)
{
    return sal_True;
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
    return ::comphelper::getINT32(bookmark);
}
// -------------------------------------------------------------------------
sal_Bool OStaticSet::fetchRow()
{
    sal_Bool bRet = sal_False;
    if ( !m_bEnd )
        bRet = m_xDriverSet->next();
    if ( bRet )
    {
        m_aSet.push_back(new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()));
        m_aSetIter = m_aSet.end() - 1;
        (*(*m_aSetIter))[0] = getRow();
        OCacheSet::fillValueRow(*m_aSetIter,(*(*m_aSetIter))[0]);
    }
    else
        m_bEnd = sal_True;
    return bRet;
}
// -------------------------------------------------------------------------
void OStaticSet::fillAllRows()
{
    if(!m_bEnd)
    {
        while(m_xDriverSet->next())
        {
            ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount());
            m_aSet.push_back(pRow);
            m_aSetIter = m_aSet.end() - 1;
            (*pRow)[0] = getRow();
            OCacheSet::fillValueRow(pRow,(*pRow)[0]);
        }
        m_bEnd = sal_True;
    }
}
// -------------------------------------------------------------------------
// XResultSet
sal_Bool SAL_CALL OStaticSet::next(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;

    if(isAfterLast())
        return sal_False;
    if(!m_bEnd) // not yet all records fetched
    {
        ++m_aSetIter;
        if(m_aSetIter == m_aSet.end() && !fetchRow())
            m_aSetIter = m_aSet.end();
    }
    else if(!isAfterLast())
        ++m_aSetIter;
    return !isAfterLast();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.begin();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isAfterLast(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.end() && m_bEnd;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isFirst(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.begin()+1;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isLast(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.end()-1 && m_bEnd;
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::beforeFirst(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    m_aSetIter = m_aSet.begin();
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::afterLast(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    fillAllRows();
    m_aSetIter = m_aSet.end();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::first(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    m_aSetIter = m_aSet.begin()+1;
    if(m_aSetIter == m_aSet.end() && !fetchRow())
        m_aSetIter = m_aSet.end();

    return m_aSetIter != m_aSet.end();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::last(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    fillAllRows();
    m_aSetIter = m_aSet.end()-1;

    return !isBeforeFirst() && !isAfterLast();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::getRow(  ) throw(SQLException, RuntimeException)
{
    OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!");
    OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!");

    sal_Int32 nPos = m_aSet.size() - (m_aSet.end() - m_aSetIter);
    OSL_ENSURE(nPos > 0,"RowPos is < 0");
    return nPos;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    OSL_ENSURE(row,"OStaticSet::absolute: INVALID row number!");
    // if row greater 0 than count from end - row means last
    if(row < 0)
    {
        if(!m_bEnd)
            fillAllRows();

        sal_Int32 nRow = getRow();
        nRow += row;
        if(nRow <= (sal_Int32)m_aSet.size())
            m_aSetIter = m_aSet.begin() + nRow;
        else
            m_aSetIter = m_aSet.begin();
    }
    else if(row > 0)
    {
        if(row >= (sal_Int32)m_aSet.size())
        {
            if(!m_bEnd)
            {
                sal_Bool bNext = sal_True;
                for(sal_Int32 i=m_aSet.size()-1;i < row && bNext;++i)
                    bNext = fetchRow();
            }

            if(row > (sal_Int32)m_aSet.size())
                m_aSetIter = m_aSet.end();  // check again
            else
                m_aSetIter = m_aSet.begin() + row;
        }
        else
            m_aSetIter = m_aSet.begin() + row;
    }

    return m_aSetIter != m_aSet.end() && m_aSetIter != m_aSet.begin();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
{
    if(!rows)
        return sal_True;

    sal_Int32 nCurPos = getRow();
    return absolute(nCurPos+rows);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::previous(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;

    if(m_aSetIter != m_aSet.begin())
        --m_aSetIter;

    return m_aSetIter != m_aSet.begin();
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::refreshRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowUpdated(  ) throw(SQLException, RuntimeException)
{
    return m_bUpdated;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowInserted(  ) throw(SQLException, RuntimeException)
{
    return m_bInserted;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowDeleted(  ) throw(SQLException, RuntimeException)
{
    return m_bDeleted;
}
// -------------------------------------------------------------------------
Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& rows,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
    Sequence< sal_Int32 > aRet(rows.getLength());
    const Any* pBegin   = rows.getConstArray();
    const Any* pEnd     = pBegin + rows.getLength();
    for(sal_Int32 i=0;pBegin != pEnd; ++pBegin,++i)
    {
        deleteRow(*(m_aSet.begin() + comphelper::getINT32(*pBegin)),_xTable);
        aRet.getArray()[i] = m_bDeleted;
    }
    return aRet;
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
    OCacheSet::insertRow( _rInsertRow,_xTable);
    if(m_bInserted)
    {
        m_aSet.push_back(new ORowVector< ORowSetValue >(*_rInsertRow)); // we don't know where the new row is so we append it to the current rows
        m_aSetIter = m_aSet.end() - 1;
        (*(*m_aSetIter))[0] = (*_rInsertRow)[0] = getBookmark();
        m_bEnd = sal_False;
    }
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
{
    OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable);
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
{
    OCacheSet::deleteRow(_rDeleteRow,_xTable);
    if(m_bDeleted)
    {
        ORowSetMatrix::iterator aPos = m_aSet.begin()+(*_rDeleteRow)[0].getInt32();
        if(aPos == (m_aSet.end()-1))
            m_aSetIter = m_aSet.end();
        m_aSet.erase(aPos);
    }
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------

<commit_msg>INTEGRATION: CWS changefileheader (1.19.224); FILE MERGED 2008/03/31 13:26:43 rt 1.19.224.1: #i87441# Change license header to LPGL v3.<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: StaticSet.cxx,v $
 * $Revision: 1.20 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"

#ifndef DBACCESS_CORE_API_STATICSET_HXX
#include "StaticSet.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
#endif
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
#endif
#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
#endif
#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include <connectivity/CommonTools.hxx>
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif

using namespace dbaccess;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
//  using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
//  using namespace ::cppu;
using namespace ::osl;

// -------------------------------------------------------------------------
void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
{
    _rRow = *m_aSetIter;
}
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XRowLocate
Any SAL_CALL OStaticSet::getBookmark() throw(SQLException, RuntimeException)
{
    return makeAny(getRow());
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    return absolute(::comphelper::getINT32(bookmark));
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    return absolute(::comphelper::getINT32(bookmark)+rows);
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
{
    sal_Int32 nFirst = 0, nSecond = 0;
    _first >>= nFirst;
    _second >>= nSecond;
    return (nFirst < nSecond) ? CompareBookmark::LESS : ((nFirst > nSecond) ? CompareBookmark::GREATER : CompareBookmark::EQUAL);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::hasOrderedBookmarks(  ) throw(SQLException, RuntimeException)
{
    return sal_True;
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
{
    return ::comphelper::getINT32(bookmark);
}
// -------------------------------------------------------------------------
sal_Bool OStaticSet::fetchRow()
{
    sal_Bool bRet = sal_False;
    if ( !m_bEnd )
        bRet = m_xDriverSet->next();
    if ( bRet )
    {
        m_aSet.push_back(new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()));
        m_aSetIter = m_aSet.end() - 1;
        (*(*m_aSetIter))[0] = getRow();
        OCacheSet::fillValueRow(*m_aSetIter,(*(*m_aSetIter))[0]);
    }
    else
        m_bEnd = sal_True;
    return bRet;
}
// -------------------------------------------------------------------------
void OStaticSet::fillAllRows()
{
    if(!m_bEnd)
    {
        while(m_xDriverSet->next())
        {
            ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount());
            m_aSet.push_back(pRow);
            m_aSetIter = m_aSet.end() - 1;
            (*pRow)[0] = getRow();
            OCacheSet::fillValueRow(pRow,(*pRow)[0]);
        }
        m_bEnd = sal_True;
    }
}
// -------------------------------------------------------------------------
// XResultSet
sal_Bool SAL_CALL OStaticSet::next(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;

    if(isAfterLast())
        return sal_False;
    if(!m_bEnd) // not yet all records fetched
    {
        ++m_aSetIter;
        if(m_aSetIter == m_aSet.end() && !fetchRow())
            m_aSetIter = m_aSet.end();
    }
    else if(!isAfterLast())
        ++m_aSetIter;
    return !isAfterLast();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.begin();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isAfterLast(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.end() && m_bEnd;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isFirst(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.begin()+1;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::isLast(  ) throw(SQLException, RuntimeException)
{
    return m_aSetIter == m_aSet.end()-1 && m_bEnd;
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::beforeFirst(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    m_aSetIter = m_aSet.begin();
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::afterLast(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    fillAllRows();
    m_aSetIter = m_aSet.end();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::first(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    m_aSetIter = m_aSet.begin()+1;
    if(m_aSetIter == m_aSet.end() && !fetchRow())
        m_aSetIter = m_aSet.end();

    return m_aSetIter != m_aSet.end();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::last(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    fillAllRows();
    m_aSetIter = m_aSet.end()-1;

    return !isBeforeFirst() && !isAfterLast();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OStaticSet::getRow(  ) throw(SQLException, RuntimeException)
{
    OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!");
    OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!");

    sal_Int32 nPos = m_aSet.size() - (m_aSet.end() - m_aSetIter);
    OSL_ENSURE(nPos > 0,"RowPos is < 0");
    return nPos;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;
    OSL_ENSURE(row,"OStaticSet::absolute: INVALID row number!");
    // if row greater 0 than count from end - row means last
    if(row < 0)
    {
        if(!m_bEnd)
            fillAllRows();

        sal_Int32 nRow = getRow();
        nRow += row;
        if(nRow <= (sal_Int32)m_aSet.size())
            m_aSetIter = m_aSet.begin() + nRow;
        else
            m_aSetIter = m_aSet.begin();
    }
    else if(row > 0)
    {
        if(row >= (sal_Int32)m_aSet.size())
        {
            if(!m_bEnd)
            {
                sal_Bool bNext = sal_True;
                for(sal_Int32 i=m_aSet.size()-1;i < row && bNext;++i)
                    bNext = fetchRow();
            }

            if(row > (sal_Int32)m_aSet.size())
                m_aSetIter = m_aSet.end();  // check again
            else
                m_aSetIter = m_aSet.begin() + row;
        }
        else
            m_aSetIter = m_aSet.begin() + row;
    }

    return m_aSetIter != m_aSet.end() && m_aSetIter != m_aSet.begin();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
{
    if(!rows)
        return sal_True;

    sal_Int32 nCurPos = getRow();
    return absolute(nCurPos+rows);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::previous(  ) throw(SQLException, RuntimeException)
{
    m_bInserted = m_bUpdated = m_bDeleted = sal_False;

    if(m_aSetIter != m_aSet.begin())
        --m_aSetIter;

    return m_aSetIter != m_aSet.begin();
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::refreshRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowUpdated(  ) throw(SQLException, RuntimeException)
{
    return m_bUpdated;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowInserted(  ) throw(SQLException, RuntimeException)
{
    return m_bInserted;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OStaticSet::rowDeleted(  ) throw(SQLException, RuntimeException)
{
    return m_bDeleted;
}
// -------------------------------------------------------------------------
Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& rows,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
    Sequence< sal_Int32 > aRet(rows.getLength());
    const Any* pBegin   = rows.getConstArray();
    const Any* pEnd     = pBegin + rows.getLength();
    for(sal_Int32 i=0;pBegin != pEnd; ++pBegin,++i)
    {
        deleteRow(*(m_aSet.begin() + comphelper::getINT32(*pBegin)),_xTable);
        aRet.getArray()[i] = m_bDeleted;
    }
    return aRet;
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
    OCacheSet::insertRow( _rInsertRow,_xTable);
    if(m_bInserted)
    {
        m_aSet.push_back(new ORowVector< ORowSetValue >(*_rInsertRow)); // we don't know where the new row is so we append it to the current rows
        m_aSetIter = m_aSet.end() - 1;
        (*(*m_aSetIter))[0] = (*_rInsertRow)[0] = getBookmark();
        m_bEnd = sal_False;
    }
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
{
    OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable);
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
{
    OCacheSet::deleteRow(_rDeleteRow,_xTable);
    if(m_bDeleted)
    {
        ORowSetMatrix::iterator aPos = m_aSet.begin()+(*_rDeleteRow)[0].getInt32();
        if(aPos == (m_aSet.end()-1))
            m_aSetIter = m_aSet.end();
        m_aSet.erase(aPos);
    }
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------
void SAL_CALL OStaticSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
{
}
// -------------------------------------------------------------------------

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: services.cxx,v $
 *
 *  $Revision: 1.9 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 13:57:19 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DBA_REGHELPER_HXX_
#include "dba_reghelper.hxx"
#endif

/********************************************************************************************/

using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;

//***************************************************************************************
//
// registry functions
extern "C" void SAL_CALL createRegistryInfo_ODatabaseContext();
//  extern "C" void SAL_CALL createRegistryInfo_ODocumentDefinition();
extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition();
extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition();
extern "C" void SAL_CALL createRegistryInfo_ORowSet();
extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument();
extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource();

//***************************************************************************************
//
// Die vorgeschriebene C-Api muss erfuellt werden!
// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
//
extern "C" void SAL_CALL createRegistryInfo_DBA()
{
    static sal_Bool bInit = sal_False;
    if (!bInit)
    {
        createRegistryInfo_ODatabaseContext();
        //  createRegistryInfo_ODocumentDefinition();
        createRegistryInfo_OCommandDefinition();
        createRegistryInfo_OComponentDefinition();
        createRegistryInfo_ORowSet();
        createRegistryInfo_ODatabaseDocument();
        createRegistryInfo_ODatabaseSource();
        bInit = sal_True;
    }
}

//---------------------------------------------------------------------------------------

extern "C" void SAL_CALL component_getImplementationEnvironment(
                const sal_Char  **ppEnvTypeName,
                uno_Environment **ppEnv
            )
{
    createRegistryInfo_DBA();
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

//---------------------------------------------------------------------------------------
extern "C" sal_Bool SAL_CALL component_writeInfo(
                void* pServiceManager,
                void* pRegistryKey
            )
{
    if (pRegistryKey)
    try
    {
        return ::dbaccess::OModuleRegistration::writeComponentInfos(
            static_cast<XMultiServiceFactory*>(pServiceManager),
            static_cast<XRegistryKey*>(pRegistryKey));
    }
    catch (InvalidRegistryException& )
    {
        OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
    }

    return sal_False;
}

//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
                    const sal_Char* pImplementationName,
                    void* pServiceManager,
                    void* pRegistryKey)
{
    Reference< XInterface > xRet;
    if (pServiceManager && pImplementationName)
    {
        xRet = ::dbaccess::OModuleRegistration::getComponentFactory(
            ::rtl::OUString::createFromAscii(pImplementationName),
            static_cast< XMultiServiceFactory* >(pServiceManager));
    }

    if (xRet.is())
        xRet->acquire();
    return xRet.get();
};
<commit_msg>INTEGRATION: CWS warnings01 (1.9.48); FILE MERGED 2006/03/24 15:35:55 fs 1.9.48.1: #i57457# warning-free code (unxlngi6/.pro + unxsoli4.pro)<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: services.cxx,v $
 *
 *  $Revision: 1.10 $
 *
 *  last change: $Author: hr $ $Date: 2006-06-20 02:48:22 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DBA_REGHELPER_HXX_
#include "dba_reghelper.hxx"
#endif

/********************************************************************************************/

using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;

//***************************************************************************************
//
// registry functions
extern "C" void SAL_CALL createRegistryInfo_ODatabaseContext();
//  extern "C" void SAL_CALL createRegistryInfo_ODocumentDefinition();
extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition();
extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition();
extern "C" void SAL_CALL createRegistryInfo_ORowSet();
extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument();
extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource();

//***************************************************************************************
//
// Die vorgeschriebene C-Api muss erfuellt werden!
// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
//
extern "C" void SAL_CALL createRegistryInfo_DBA()
{
    static sal_Bool bInit = sal_False;
    if (!bInit)
    {
        createRegistryInfo_ODatabaseContext();
        //  createRegistryInfo_ODocumentDefinition();
        createRegistryInfo_OCommandDefinition();
        createRegistryInfo_OComponentDefinition();
        createRegistryInfo_ORowSet();
        createRegistryInfo_ODatabaseDocument();
        createRegistryInfo_ODatabaseSource();
        bInit = sal_True;
    }
}

//---------------------------------------------------------------------------------------

extern "C" void SAL_CALL component_getImplementationEnvironment(
                const sal_Char  **ppEnvTypeName,
                uno_Environment **/*ppEnv*/
            )
{
    createRegistryInfo_DBA();
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

//---------------------------------------------------------------------------------------
extern "C" sal_Bool SAL_CALL component_writeInfo(
                void* pServiceManager,
                void* pRegistryKey
            )
{
    if (pRegistryKey)
    try
    {
        return ::dbaccess::OModuleRegistration::writeComponentInfos(
            static_cast<XMultiServiceFactory*>(pServiceManager),
            static_cast<XRegistryKey*>(pRegistryKey));
    }
    catch (InvalidRegistryException& )
    {
        OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
    }

    return sal_False;
}

//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
                    const sal_Char* pImplementationName,
                    void* pServiceManager,
                    void* /*pRegistryKey*/)
{
    Reference< XInterface > xRet;
    if (pServiceManager && pImplementationName)
    {
        xRet = ::dbaccess::OModuleRegistration::getComponentFactory(
            ::rtl::OUString::createFromAscii(pImplementationName),
            static_cast< XMultiServiceFactory* >(pServiceManager));
    }

    if (xRet.is())
        xRet->acquire();
    return xRet.get();
};
<|endoftext|>


<commit_before><commit_msg>Squashed commit of no_subs_rtbopt3<commit_after><|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: uiservices.cxx,v $
 *
 *  $Revision: 1.21 $
 *
 *  last change: $Author: hr $ $Date: 2006-08-15 10:55:27 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DBU_REGHELPER_HXX_
#include "dbu_reghelper.hxx"
#endif

/********************************************************************************************/

using namespace ::rtl;
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;

//***************************************************************************************
//
// registry functions
extern "C" void SAL_CALL createRegistryInfo_OTableFilterDialog();
extern "C" void SAL_CALL createRegistryInfo_ODataSourcePropertyDialog();
extern "C" void SAL_CALL createRegistryInfo_OSQLMessageDialog();
extern "C" void SAL_CALL createRegistryInfo_OBrowser();
extern "C" void SAL_CALL createRegistryInfo_OFormGridView();
extern "C" void SAL_CALL createRegistryInfo_DBContentLoader();
extern "C" void SAL_CALL writeDBLoaderInfo(void* pRegistryKey);
extern "C" void SAL_CALL createRegistryInfo_OInteractionHandler();
extern "C" void SAL_CALL createRegistryInfo_SbaXGridControl();
extern "C" void SAL_CALL createRegistryInfo_OQueryControl();
extern "C" void SAL_CALL createRegistryInfo_OTableControl();
extern "C" void SAL_CALL createRegistryInfo_ORelationControl();
extern "C" void SAL_CALL createRegistryInfo_ComposerDialogs();
extern "C" void SAL_CALL createRegistryInfo_ODBApplication();
extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog();
extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialog();
extern "C" void SAL_CALL createRegistryInfo_OUserSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup();
extern "C" void SAL_CALL createRegistryInfo_OAdabasSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel();
extern "C" void SAL_CALL createRegistryInfo_OColumnControl();
extern "C" void SAL_CALL createRegistryInfo_OToolboxController();
extern "C" void SAL_CALL createRegistryInfo_OStatusbarController();

//***************************************************************************************
extern "C" void SAL_CALL createRegistryInfo_DBU()
{
    static sal_Bool bInit = sal_False;
    if (!bInit)
    {
        createRegistryInfo_OTableFilterDialog();
        createRegistryInfo_ODataSourcePropertyDialog();
        createRegistryInfo_OSQLMessageDialog();
        createRegistryInfo_OBrowser();
        createRegistryInfo_OFormGridView();
        createRegistryInfo_DBContentLoader();
        createRegistryInfo_OInteractionHandler();
        createRegistryInfo_SbaXGridControl();
        createRegistryInfo_OQueryControl();
        createRegistryInfo_OTableControl();
        createRegistryInfo_ORelationControl();
        createRegistryInfo_ComposerDialogs();
        createRegistryInfo_ODBApplication();
        createRegistryInfo_ODirectSQLDialog();
        createRegistryInfo_OAdvancedSettingsDialog();
        createRegistryInfo_ODBTypeWizDialog();
        createRegistryInfo_ODBTypeWizDialogSetup();
            createRegistryInfo_OUserSettingsDialog();
        createRegistryInfo_OAdabasSettingsDialog();
        createRegistryInfo_OColumnControlModel();
        createRegistryInfo_OColumnControl();
        createRegistryInfo_OToolboxController();
        createRegistryInfo_OStatusbarController();
        bInit = sal_True;
    }
}

//---------------------------------------------------------------------------------------

extern "C" void SAL_CALL component_getImplementationEnvironment(
                const sal_Char  **ppEnvTypeName,
                uno_Environment **/*ppEnv*/
            )
{
    createRegistryInfo_DBU();
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

//---------------------------------------------------------------------------------------
extern "C" sal_Bool SAL_CALL component_writeInfo(
                void* pServiceManager,
                void* pRegistryKey
            )
{
    if (pRegistryKey)
    try
    {
        writeDBLoaderInfo(pRegistryKey);
        return ::dbaui::OModuleRegistration::writeComponentInfos(
            static_cast<XMultiServiceFactory*>(pServiceManager),
            static_cast<XRegistryKey*>(pRegistryKey));
    }
    catch (InvalidRegistryException& )
    {
        OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
    }

    return sal_False;
}

//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
                    const sal_Char* pImplementationName,
                    void* pServiceManager,
                    void* /*pRegistryKey*/)
{
    Reference< XInterface > xRet;
    if (pServiceManager && pImplementationName)
    {
        xRet = ::dbaui::OModuleRegistration::getComponentFactory(
            ::rtl::OUString::createFromAscii(pImplementationName),
            static_cast< XMultiServiceFactory* >(pServiceManager));
    }

    if (xRet.is())
        xRet->acquire();
    return xRet.get();
};
<commit_msg>INTEGRATION: CWS pchfix02 (1.21.4); FILE MERGED 2006/09/01 17:24:35 kaib 1.21.4.1: #i68856# Added header markers and pch files<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: uiservices.cxx,v $
 *
 *  $Revision: 1.22 $
 *
 *  last change: $Author: obo $ $Date: 2006-09-17 07:19:06 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"

#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _DBU_REGHELPER_HXX_
#include "dbu_reghelper.hxx"
#endif

/********************************************************************************************/

using namespace ::rtl;
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;

//***************************************************************************************
//
// registry functions
extern "C" void SAL_CALL createRegistryInfo_OTableFilterDialog();
extern "C" void SAL_CALL createRegistryInfo_ODataSourcePropertyDialog();
extern "C" void SAL_CALL createRegistryInfo_OSQLMessageDialog();
extern "C" void SAL_CALL createRegistryInfo_OBrowser();
extern "C" void SAL_CALL createRegistryInfo_OFormGridView();
extern "C" void SAL_CALL createRegistryInfo_DBContentLoader();
extern "C" void SAL_CALL writeDBLoaderInfo(void* pRegistryKey);
extern "C" void SAL_CALL createRegistryInfo_OInteractionHandler();
extern "C" void SAL_CALL createRegistryInfo_SbaXGridControl();
extern "C" void SAL_CALL createRegistryInfo_OQueryControl();
extern "C" void SAL_CALL createRegistryInfo_OTableControl();
extern "C" void SAL_CALL createRegistryInfo_ORelationControl();
extern "C" void SAL_CALL createRegistryInfo_ComposerDialogs();
extern "C" void SAL_CALL createRegistryInfo_ODBApplication();
extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog();
extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialog();
extern "C" void SAL_CALL createRegistryInfo_OUserSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup();
extern "C" void SAL_CALL createRegistryInfo_OAdabasSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel();
extern "C" void SAL_CALL createRegistryInfo_OColumnControl();
extern "C" void SAL_CALL createRegistryInfo_OToolboxController();
extern "C" void SAL_CALL createRegistryInfo_OStatusbarController();

//***************************************************************************************
extern "C" void SAL_CALL createRegistryInfo_DBU()
{
    static sal_Bool bInit = sal_False;
    if (!bInit)
    {
        createRegistryInfo_OTableFilterDialog();
        createRegistryInfo_ODataSourcePropertyDialog();
        createRegistryInfo_OSQLMessageDialog();
        createRegistryInfo_OBrowser();
        createRegistryInfo_OFormGridView();
        createRegistryInfo_DBContentLoader();
        createRegistryInfo_OInteractionHandler();
        createRegistryInfo_SbaXGridControl();
        createRegistryInfo_OQueryControl();
        createRegistryInfo_OTableControl();
        createRegistryInfo_ORelationControl();
        createRegistryInfo_ComposerDialogs();
        createRegistryInfo_ODBApplication();
        createRegistryInfo_ODirectSQLDialog();
        createRegistryInfo_OAdvancedSettingsDialog();
        createRegistryInfo_ODBTypeWizDialog();
        createRegistryInfo_ODBTypeWizDialogSetup();
            createRegistryInfo_OUserSettingsDialog();
        createRegistryInfo_OAdabasSettingsDialog();
        createRegistryInfo_OColumnControlModel();
        createRegistryInfo_OColumnControl();
        createRegistryInfo_OToolboxController();
        createRegistryInfo_OStatusbarController();
        bInit = sal_True;
    }
}

//---------------------------------------------------------------------------------------

extern "C" void SAL_CALL component_getImplementationEnvironment(
                const sal_Char  **ppEnvTypeName,
                uno_Environment **/*ppEnv*/
            )
{
    createRegistryInfo_DBU();
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

//---------------------------------------------------------------------------------------
extern "C" sal_Bool SAL_CALL component_writeInfo(
                void* pServiceManager,
                void* pRegistryKey
            )
{
    if (pRegistryKey)
    try
    {
        writeDBLoaderInfo(pRegistryKey);
        return ::dbaui::OModuleRegistration::writeComponentInfos(
            static_cast<XMultiServiceFactory*>(pServiceManager),
            static_cast<XRegistryKey*>(pRegistryKey));
    }
    catch (InvalidRegistryException& )
    {
        OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
    }

    return sal_False;
}

//---------------------------------------------------------------------------------------
extern "C" void* SAL_CALL component_getFactory(
                    const sal_Char* pImplementationName,
                    void* pServiceManager,
                    void* /*pRegistryKey*/)
{
    Reference< XInterface > xRet;
    if (pServiceManager && pImplementationName)
    {
        xRet = ::dbaui::OModuleRegistration::getComponentFactory(
            ::rtl::OUString::createFromAscii(pImplementationName),
            static_cast< XMultiServiceFactory* >(pServiceManager));
    }

    if (xRet.is())
        xRet->acquire();
    return xRet.get();
};
<|endoftext|>