<commit_before>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the  "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* Patch from Trevor Smigiel                                   */
#if !defined(HPUXDEFINITIONS_HEADER_GUARD_1357924680)
#define HPUXDEFINITIONS_HEADER_GUARD_1357924680

// ---------------------------------------------------------------------------
//  A define in the build for each project is also used to control whether
//  the export keyword is from the project's viewpoint or the client's.
//  These defines provide the platform specific keywords that they need
//  to do this.
// ---------------------------------------------------------------------------

#define XALAN_PLATFORM_EXPORT
#define XALAN_PLATFORM_IMPORT
#define XALAN_PLATFORM_EXPORT_FUNCTION(T) T XALAN_PLATFORM_EXPORT
#define XALAN_PLATFORM_IMPORT_FUNCTION(T) T XALAN_PLATFORM_IMPORT

#if defined(_HP_NAMESPACE_STD)
#else
#if defined(RWSTD_MULTI_THREAD) && !defined(__HPACC_THREAD_SAFE_RB_TREE)
#define __HPACC_THREAD_SAFE_RB_TREE
#endif
#define XALAN_NO_STD_ALLOCATORS
#endif

#define XALAN_POSIX2_AVAILABLE
#define XALAN_INLINE_INITIALIZATION

#endif  // HPUXDEFINITIONS_HEADER_GUARD_1357924680

<commit_msg>Remove XALAN_NO_STD_ALLOCATORS<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the  "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* Patch from Trevor Smigiel                                   */
#if !defined(HPUXDEFINITIONS_HEADER_GUARD_1357924680)
#define HPUXDEFINITIONS_HEADER_GUARD_1357924680

// ---------------------------------------------------------------------------
//  A define in the build for each project is also used to control whether
//  the export keyword is from the project's viewpoint or the client's.
//  These defines provide the platform specific keywords that they need
//  to do this.
// ---------------------------------------------------------------------------

#define XALAN_PLATFORM_EXPORT
#define XALAN_PLATFORM_IMPORT
#define XALAN_PLATFORM_EXPORT_FUNCTION(T) T XALAN_PLATFORM_EXPORT
#define XALAN_PLATFORM_IMPORT_FUNCTION(T) T XALAN_PLATFORM_IMPORT

#if defined(_HP_NAMESPACE_STD)
#else
#if defined(RWSTD_MULTI_THREAD) && !defined(__HPACC_THREAD_SAFE_RB_TREE)
#define __HPACC_THREAD_SAFE_RB_TREE
#endif
#endif

#define XALAN_POSIX2_AVAILABLE
#define XALAN_INLINE_INITIALIZATION

#endif  // HPUXDEFINITIONS_HEADER_GUARD_1357924680

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: TableDesignHelpBar.cxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: obo $ $Date: 2006-09-17 07:29:58 $
 *
 *  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 DBAUI_TABLEDESIGNHELPBAR_HXX
#include "TableDesignHelpBar.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _SVEDIT_HXX
#include <svtools/svmedit.hxx>
#endif
#ifndef _DBA_DBACCESS_HELPID_HRC_
#include "dbaccess_helpid.hrc"
#endif
#include <memory>
using namespace dbaui;
#define STANDARD_MARGIN                 6
//==================================================================
// class OTableDesignHelpBar
//==================================================================
DBG_NAME(OTableDesignHelpBar)
//------------------------------------------------------------------------------
OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
     TabPage( pParent, WB_3DLOOK )
{
    DBG_CTOR(OTableDesignHelpBar,NULL);
    m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
    m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
    m_pTextWin->SetReadOnly();
    m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
    m_pTextWin->Show();
}

//------------------------------------------------------------------------------
OTableDesignHelpBar::~OTableDesignHelpBar()
{
    DBG_DTOR(OTableDesignHelpBar,NULL);
    ::std::auto_ptr<Window> aTemp(m_pTextWin);
    m_pTextWin = NULL;
}

//------------------------------------------------------------------------------
void OTableDesignHelpBar::SetHelpText( const String& rText )
{
    DBG_CHKTHIS(OTableDesignHelpBar,NULL);
    if(m_pTextWin)
        m_pTextWin->SetText( rText );
    Invalidate();
}

//------------------------------------------------------------------------------
void OTableDesignHelpBar::Resize()
{
    DBG_CHKTHIS(OTableDesignHelpBar,NULL);
    //////////////////////////////////////////////////////////////////////
    // Abmessungen parent window
    Size aOutputSize( GetOutputSizePixel() );

    //////////////////////////////////////////////////////////////////////
    // TextWin anpassen
    if(m_pTextWin)
        m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
            Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
                 aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );

}

//------------------------------------------------------------------------------
long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
{
    if (rNEvt.GetType() == EVENT_LOSEFOCUS)
        SetHelpText(String());
    return TabPage::PreNotify(rNEvt);
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isCopyAllowed()
{
    return m_pTextWin && m_pTextWin->GetSelected().Len();
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isCutAllowed()
{
    return sal_False;
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isPasteAllowed()
{
    return sal_False;
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::cut()
{
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::copy()
{
    if ( m_pTextWin )
        m_pTextWin->Copy();
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::paste()
{
}

//==================================================================
// class OFieldPropTabCtrl
//==================================================================
DBG_NAME(OFieldPropTabCtrl);
//==================================================================
OFieldPropTabCtrl::OFieldPropTabCtrl( Window* pParent, WinBits nWinStyle ) :
    TabControl( pParent, nWinStyle )
{
    DBG_CTOR(OFieldPropTabCtrl,NULL);
}

//------------------------------------------------------------------------------
OFieldPropTabCtrl::~OFieldPropTabCtrl()
{
    DBG_DTOR(OFieldPropTabCtrl,NULL);
}

<commit_msg>INTEGRATION: CWS dba23a (1.7.72); FILE MERGED 2007/02/26 11:48:21 fs 1.7.72.1: remove unused code Issue number:  #i74804# Submitted by:  jnavrati@openoffice.org Reviewed by:   frank.schoenheit@sun.com<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: TableDesignHelpBar.cxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: kz $ $Date: 2007-05-10 10:41:59 $
 *
 *  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 DBAUI_TABLEDESIGNHELPBAR_HXX
#include "TableDesignHelpBar.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _SVEDIT_HXX
#include <svtools/svmedit.hxx>
#endif
#ifndef _DBA_DBACCESS_HELPID_HRC_
#include "dbaccess_helpid.hrc"
#endif
#include <memory>
using namespace dbaui;
#define STANDARD_MARGIN                 6
//==================================================================
// class OTableDesignHelpBar
//==================================================================
DBG_NAME(OTableDesignHelpBar)
//------------------------------------------------------------------------------
OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
     TabPage( pParent, WB_3DLOOK )
{
    DBG_CTOR(OTableDesignHelpBar,NULL);
    m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
    m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
    m_pTextWin->SetReadOnly();
    m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
    m_pTextWin->Show();
}

//------------------------------------------------------------------------------
OTableDesignHelpBar::~OTableDesignHelpBar()
{
    DBG_DTOR(OTableDesignHelpBar,NULL);
    ::std::auto_ptr<Window> aTemp(m_pTextWin);
    m_pTextWin = NULL;
}

//------------------------------------------------------------------------------
void OTableDesignHelpBar::SetHelpText( const String& rText )
{
    DBG_CHKTHIS(OTableDesignHelpBar,NULL);
    if(m_pTextWin)
        m_pTextWin->SetText( rText );
    Invalidate();
}

//------------------------------------------------------------------------------
void OTableDesignHelpBar::Resize()
{
    DBG_CHKTHIS(OTableDesignHelpBar,NULL);
    //////////////////////////////////////////////////////////////////////
    // Abmessungen parent window
    Size aOutputSize( GetOutputSizePixel() );

    //////////////////////////////////////////////////////////////////////
    // TextWin anpassen
    if(m_pTextWin)
        m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
            Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
                 aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );

}

//------------------------------------------------------------------------------
long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
{
    if (rNEvt.GetType() == EVENT_LOSEFOCUS)
        SetHelpText(String());
    return TabPage::PreNotify(rNEvt);
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isCopyAllowed()
{
    return m_pTextWin && m_pTextWin->GetSelected().Len();
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isCutAllowed()
{
    return sal_False;
}
// -----------------------------------------------------------------------------
sal_Bool OTableDesignHelpBar::isPasteAllowed()
{
    return sal_False;
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::cut()
{
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::copy()
{
    if ( m_pTextWin )
        m_pTextWin->Copy();
}
// -----------------------------------------------------------------------------
void OTableDesignHelpBar::paste()
{
}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: BTables.hxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: vg $ $Date: 2005-03-10 15:34:33 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _CONNECTIVITY_ADABAS_TABLES_HXX_
#define _CONNECTIVITY_ADABAS_TABLES_HXX_

#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
#include "connectivity/sdbcx/VCollection.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#endif
namespace connectivity
{
    namespace adabas
    {
        class OTables : public sdbcx::OCollection
        {
            ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >       m_xMetaData;
            //  OCatalog*                                           m_pParent;
        protected:
            virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
            virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
            virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
            virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
            virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);

            void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
            void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );

            virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject);
        public:
            OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
                const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
                ,m_xMetaData(_rMetaData)
            {}

            // only the name is identical to ::cppu::OComponentHelper
            virtual void SAL_CALL disposing(void);

            // XDrop
            void appendNew(const ::rtl::OUString& _rsNewTable);
            // some helper functions
            /**
                returns a sql string which contains the column definition part for create or alter statements
            */
            static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
            /**
                returns the "not null" part or the default part of the table statement
            */
            static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
            /**
                returns the corresponding typename
                can contain () which have to filled with values
            */
            static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
        };
    }
}
#endif // _CONNECTIVITY_ADABAS_TABLES_HXX_

<commit_msg>INTEGRATION: CWS ooo19126 (1.8.74); FILE MERGED 2005/09/05 17:24:56 rt 1.8.74.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: BTables.hxx,v $
 *
 *  $Revision: 1.9 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 06:46:46 $
 *
 *  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 _CONNECTIVITY_ADABAS_TABLES_HXX_
#define _CONNECTIVITY_ADABAS_TABLES_HXX_

#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
#include "connectivity/sdbcx/VCollection.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#endif
namespace connectivity
{
    namespace adabas
    {
        class OTables : public sdbcx::OCollection
        {
            ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >       m_xMetaData;
            //  OCatalog*                                           m_pParent;
        protected:
            virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
            virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
            virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
            virtual void appendObject( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
            virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);

            void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
            void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );

            virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject);
        public:
            OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
                const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
                ,m_xMetaData(_rMetaData)
            {}

            // only the name is identical to ::cppu::OComponentHelper
            virtual void SAL_CALL disposing(void);

            // XDrop
            void appendNew(const ::rtl::OUString& _rsNewTable);
            // some helper functions
            /**
                returns a sql string which contains the column definition part for create or alter statements
            */
            static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
            /**
                returns the "not null" part or the default part of the table statement
            */
            static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
            /**
                returns the corresponding typename
                can contain () which have to filled with values
            */
            static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
        };
    }
}
#endif // _CONNECTIVITY_ADABAS_TABLES_HXX_

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: parser_s.cxx,v $
 *
 *  $Revision: 1.1 $
 *
 *  last change: $Author: fs $ $Date: 2001-07-25 13:28:40 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
#include <connectivity/virtualdbtools.hxx>
#endif
#ifndef CONNECTIVITY_DBTOOLS_PARSER_SIMPLE_HXX
#include "parser_s.hxx"
#endif
#ifndef CONNECTIVITY_PARSENODE_SIMPLE_HXX
#include "parsenode_s.hxx"
#endif

using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;

//........................................................................
namespace connectivity
{
//........................................................................

    //================================================================
    //= OSimpleSQLParser
    //================================================================
    //----------------------------------------------------------------
    OSimpleSQLParser::OSimpleSQLParser(const Reference< XMultiServiceFactory >& _rxServiceFactory)
        :m_aFullParser(_rxServiceFactory)
    {
    }

    //----------------------------------------------------------------
    oslInterlockedCount SAL_CALL OSimpleSQLParser::acquire()
    {
        return ORefBase::acquire();
    }

    //----------------------------------------------------------------
    oslInterlockedCount SAL_CALL OSimpleSQLParser::release()
    {
        return ORefBase::release();
    }

    //----------------------------------------------------------------
    const OParseContext& OSimpleSQLParser::getContext() const
    {
        return m_aFullParser.getContext();
    }

    //----------------------------------------------------------------
    ::rtl::Reference< simple::ISQLParseNode > OSimpleSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const ::rtl::OUString& rStatement,
        const Reference< XNumberFormatter >& _rxFormatter, const Reference< XPropertySet >& _rxField) const
    {
        OSQLParseNode* pFullNode = const_cast<OSimpleSQLParser*>(this)->m_aFullParser.predicateTree(rErrorMessage, rStatement, _rxFormatter, _rxField);
        return new OSimpleParseNode(pFullNode, sal_True);
    }

//........................................................................
}   // namespace connectivity
//........................................................................

/*************************************************************************
 * history:
 *  $Log: not supported by cvs2svn $
 *
 *  Revision 1.0 24.07.01 16:32:42  fs
 ************************************************************************/

<commit_msg>#90560# no OSimpleParseNode if we do not have a OSQLParseNode<commit_after>/*************************************************************************
 *
 *  $RCSfile: parser_s.cxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: fs $ $Date: 2001-08-06 07:34:54 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
#include <connectivity/virtualdbtools.hxx>
#endif
#ifndef CONNECTIVITY_DBTOOLS_PARSER_SIMPLE_HXX
#include "parser_s.hxx"
#endif
#ifndef CONNECTIVITY_PARSENODE_SIMPLE_HXX
#include "parsenode_s.hxx"
#endif

using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;

//........................................................................
namespace connectivity
{
//........................................................................

    //================================================================
    //= OSimpleSQLParser
    //================================================================
    //----------------------------------------------------------------
    OSimpleSQLParser::OSimpleSQLParser(const Reference< XMultiServiceFactory >& _rxServiceFactory)
        :m_aFullParser(_rxServiceFactory)
    {
    }

    //----------------------------------------------------------------
    oslInterlockedCount SAL_CALL OSimpleSQLParser::acquire()
    {
        return ORefBase::acquire();
    }

    //----------------------------------------------------------------
    oslInterlockedCount SAL_CALL OSimpleSQLParser::release()
    {
        return ORefBase::release();
    }

    //----------------------------------------------------------------
    const OParseContext& OSimpleSQLParser::getContext() const
    {
        return m_aFullParser.getContext();
    }

    //----------------------------------------------------------------
    ::rtl::Reference< simple::ISQLParseNode > OSimpleSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const ::rtl::OUString& rStatement,
        const Reference< XNumberFormatter >& _rxFormatter, const Reference< XPropertySet >& _rxField) const
    {
        OSimpleParseNode* pReturn = NULL;
        OSQLParseNode* pFullNode = const_cast<OSimpleSQLParser*>(this)->m_aFullParser.predicateTree(rErrorMessage, rStatement, _rxFormatter, _rxField);
        if (pFullNode)
            pReturn = new OSimpleParseNode(pFullNode, sal_True);
        return pReturn;
    }

//........................................................................
}   // namespace connectivity
//........................................................................

/*************************************************************************
 * history:
 *  $Log: not supported by cvs2svn $
 *  Revision 1.1  2001/07/25 13:28:40  fs
 *  initial checkin - main factory for load-on-demand usage of OSQLParser
 *
 *
 *  Revision 1.0 24.07.01 16:32:42  fs
 ************************************************************************/

<|endoftext|>


<commit_before>#include <memory>
#include "PPMLoader.hpp"

std::shared_ptr<Image> PPMLoader::load(const char *pathToImage) {
	FILE *file = fopen(pathToImage, "r");

	char magicNumber[8];
	fscanf(file, "%s\n", magicNumber);

	int width, height;
	fscanf(file, "%d %d\n", &width, &height);

	int maxValue;
	fscanf(file, "%d\n", &maxValue);

	auto image = std::make_shared<Image>(width, height);

	size_t index = 0;

	while (1) {
		uint8_t r, g, b;
		int elementsRead = fscanf(file, "%d %d %d", &r, &g, &b);

		if (elementsRead < 3) {
			break;
		}
		image->setValueOnChannel1(index, normalize(r, maxValue, 255));
		image->setValueOnChannel2(index, normalize(g, maxValue, 255));
		image->setValueOnChannel3(index, normalize(b, maxValue, 255));
		index++;
	}
	image->colorSpace = ColorSpaceRGB;
	return image;
}

size_t PPMLoader::normalize(size_t colorValue, int originalMaxValue, int normalizedMaxValue) {
	return (size_t) ((colorValue / (float) originalMaxValue) * normalizedMaxValue);
}
<commit_msg>Replace int_8 with size_t to fix conversion bug<commit_after>#include <memory>
#include "PPMLoader.hpp"

std::shared_ptr<Image> PPMLoader::load(const char *pathToImage) {
	FILE *file = fopen(pathToImage, "r");

	char magicNumber[8];
	fscanf(file, "%s\n", magicNumber);

	int width, height;
	fscanf(file, "%d %d\n", &width, &height);

	int maxValue;
	fscanf(file, "%d\n", &maxValue);

	auto image = std::make_shared<Image>(width, height);

	size_t index = 0;

	while (1) {
		size_t r, g, b;
		int elementsRead = fscanf(file, "%d %d %d", &r, &g, &b);

		if (elementsRead < 3) {
			break;
		}
		image->setValueOnChannel1(index, normalize(r, maxValue, 255));
		image->setValueOnChannel2(index, normalize(g, maxValue, 255));
		image->setValueOnChannel3(index, normalize(b, maxValue, 255));
		index++;
	}
	image->colorSpace = ColorSpaceRGB;
	return image;
}

size_t PPMLoader::normalize(size_t colorValue, int originalMaxValue, int normalizedMaxValue) {
	return (size_t) ((colorValue / (float) originalMaxValue) * normalizedMaxValue);
}
<|endoftext|>


<commit_before>/*
    BMP texture loader
    � Keith O'Conor 2005
    keith.oconor @ {cs.tcd.ie, gmail.com}

    adapted for openFrameworks by Theodore Watson - theo@openframeworks.cc
*/

#include "texture3DS.h"

texture3DS::texture3DS(string filename, const int textureId){

    ofImage img;
    if( !img.loadImage(filename) ){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR:  Could not open %s", filename.c_str());
    }

    m_width     = img.width;
    m_height    = img.height;
    m_bpp       = img.bpp;

    if( m_width <= 0 || m_height <= 0){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR: Something wrong with %s - dimensions less than 0", filename.c_str());

    }

    if(m_bpp != 32 && m_bpp != 24){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR: Invalid texture color depth %s  must be uncompressed 24/32bpp png, jpg, bmp, tga", filename.c_str());
        return;
    }

    // Determine format
    int fileFormat, internalFormat;
    switch(m_bpp){
        case 24:fileFormat = GL_RGB; internalFormat = GL_RGB; break;
        case 32:fileFormat = GL_RGBA; internalFormat = GL_RGBA; break;
        default:
			ofLog(OF_LOG_ERROR, "texture3DS ERROR: Invalid texture color depth %s  must be uncompressed 24/32bpp", filename.c_str());

			return;
            break;
    }

    // FLIP THE PIXELS
    //we need to flip the image vertically
    unsigned char * ptrToPixels = img.getPixels();
    int bytesPP = (m_bpp / 8);

	//this extra allocation is because of a glu bug - http://osdir.com/ml/video.mesa3d.devel/2005-02/msg00035.html
    unsigned char * flippedPixels = new unsigned char[bytesPP * m_width * (m_height+1)];
    unsigned char * ptrToFlipped = flippedPixels;

    int numBytesPerLine = m_width * bytesPP;

    //go to the beginning of the bottom line of pixels of the image
    ptrToPixels += ( numBytesPerLine * (m_height-1) );

    //then step through line at a time copying the whole line from the original
    //to the flipped pixels
    //- the original starts at the bottom and goes up
    //- the flipped starts at the top and goes down
    for(int y = 0; y < m_height; y++){
        memcpy(ptrToFlipped, ptrToPixels, numBytesPerLine * sizeof( char ) );
        ptrToPixels   -= numBytesPerLine;
        ptrToFlipped  += numBytesPerLine;
    }

	// Bind texture ID to load
    glBindTexture(GL_TEXTURE_2D, textureId);

    // Set texture parameters
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

    // Upload texture to card with bound texture ID
    gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat, m_width, m_height, fileFormat, GL_UNSIGNED_BYTE, flippedPixels);

    ofLog(OF_LOG_NOTICE, "texture3DS Texture %s loaded", filename.c_str());
}
<commit_msg>small issue with mipmap mag filter argument. Closes #189<commit_after>/*
    BMP texture loader
    � Keith O'Conor 2005
    keith.oconor @ {cs.tcd.ie, gmail.com}

    adapted for openFrameworks by Theodore Watson - theo@openframeworks.cc
*/

#include "texture3DS.h"

texture3DS::texture3DS(string filename, const int textureId){

    ofImage img;
    if( !img.loadImage(filename) ){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR:  Could not open %s", filename.c_str());
    }

    m_width     = img.width;
    m_height    = img.height;
    m_bpp       = img.bpp;

    if( m_width <= 0 || m_height <= 0){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR: Something wrong with %s - dimensions less than 0", filename.c_str());

    }

    if(m_bpp != 32 && m_bpp != 24){
		ofLog(OF_LOG_ERROR, "texture3DS ERROR: Invalid texture color depth %s  must be uncompressed 24/32bpp png, jpg, bmp, tga", filename.c_str());
        return;
    }

    // Determine format
    int fileFormat, internalFormat;
    switch(m_bpp){
        case 24:fileFormat = GL_RGB; internalFormat = GL_RGB; break;
        case 32:fileFormat = GL_RGBA; internalFormat = GL_RGBA; break;
        default:
			ofLog(OF_LOG_ERROR, "texture3DS ERROR: Invalid texture color depth %s  must be uncompressed 24/32bpp", filename.c_str());

			return;
            break;
    }

    // FLIP THE PIXELS
    //we need to flip the image vertically
    unsigned char * ptrToPixels = img.getPixels();
    int bytesPP = (m_bpp / 8);

	//this extra allocation is because of a glu bug - http://osdir.com/ml/video.mesa3d.devel/2005-02/msg00035.html
    unsigned char * flippedPixels = new unsigned char[bytesPP * m_width * (m_height+1)];
    unsigned char * ptrToFlipped = flippedPixels;

    int numBytesPerLine = m_width * bytesPP;

    //go to the beginning of the bottom line of pixels of the image
    ptrToPixels += ( numBytesPerLine * (m_height-1) );

    //then step through line at a time copying the whole line from the original
    //to the flipped pixels
    //- the original starts at the bottom and goes up
    //- the flipped starts at the top and goes down
    for(int y = 0; y < m_height; y++){
        memcpy(ptrToFlipped, ptrToPixels, numBytesPerLine * sizeof( char ) );
        ptrToPixels   -= numBytesPerLine;
        ptrToFlipped  += numBytesPerLine;
    }

	// Bind texture ID to load
    glBindTexture(GL_TEXTURE_2D, textureId);

    // Set texture parameters
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

    // Upload texture to card with bound texture ID
    gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat, m_width, m_height, fileFormat, GL_UNSIGNED_BYTE, flippedPixels);

    ofLog(OF_LOG_NOTICE, "texture3DS Texture %s loaded", filename.c_str());
}
<|endoftext|>


<commit_before>/*
 * Copyright 1999-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <xalanc/Include/PlatformDefinitions.hpp>

#if defined(XALAN_CLASSIC_IOSTREAMS)
#include <iostream.h>
#else
#include <iostream>
#endif

#include <xercesc/util/PlatformUtils.hpp>

#include <xalanc/XalanTransformer/XalanTransformer.hpp>

#include "XalanMemoryManagerImpl.hpp"

int
main(
			int		argc,
			char*	/* argv */[])
{
	XALAN_USING_STD(cerr)
	XALAN_USING_STD(endl)

	int	theResult = -1;

	if (argc != 1)
	{
		cerr << "Usage: SimpleTransform"
			 << endl
			 << endl;
	}
	else
	{
		try
		{
			XALAN_USING_XERCES(XMLPlatformUtils)

            XALAN_USING_XERCES(XMLUni)

			XALAN_USING_XALAN(XalanTransformer)

            XalanMemoryManagerImpl memoryManager;

			// Call the static initializer for Xerces.
			XMLPlatformUtils::Initialize(
                                    XMLUni::fgXercescDefaultLocale,
                                    0,
                                    0,
                                    &memoryManager );

			// Initialize Xalan.
			XalanTransformer::initialize( memoryManager );

			{
				// Create a XalanTransformer.
				XalanTransformer theXalanTransformer( memoryManager );

				// The assumption is that the executable will be run
				// from same directory as the input files.
				theResult = theXalanTransformer.transform("foo.xml", "foo.xsl", "foo.out");

				if(theResult != 0)
				{
					cerr << "SimpleTransform Error: \n" << theXalanTransformer.getLastError()
						 << endl
						 << endl;
				}
			}

			// Terminate Xalan...
			XalanTransformer::terminate();

			// Terminate Xerces...
			XMLPlatformUtils::Terminate();

			// Clean up the ICU, if it's integrated...
			XalanTransformer::ICUCleanUp();
		}
		catch(...)
		{
			cerr << "Initialization failed!" << endl;
		}
	}

	return theResult;
}
<commit_msg>Include an example of the ICU memory management feature.<commit_after>/*
 * Copyright 1999-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <xalanc/Include/PlatformDefinitions.hpp>

#if defined(XALAN_CLASSIC_IOSTREAMS)
#include <iostream.h>
#else
#include <iostream>
#endif

#include <xercesc/util/PlatformUtils.hpp>

#include <xalanc/XalanTransformer/XalanTransformer.hpp>

#include "XalanMemoryManagerImpl.hpp"

/**
 *  Example of the ICU's customizable memory management which can
 *  be used conjunction with Xalan's pluggable memory management feature.
 */
#if defined(XALAN_USE_ICU)

#include "unicode/uclean.h"

static XalanMemoryManagerImpl  s_memoryManager;

void*
icu_malloc(const void * /* context */, size_t size)
{
    return s_memoryManager.allocate(size);
}

void*
icu_realloc(const void * /* context */, void * mem, size_t size)
{
    s_memoryManager.deallocate(mem);
    return s_memoryManager.allocate(size);
}

void icu_free(const void * /* context */, void * mem)
{
    s_memoryManager.deallocate(mem);
}

#endif

int
main(
			int		argc,
			char*	/* argv */[])
{
	XALAN_USING_STD(cerr)
	XALAN_USING_STD(endl)

	int	theResult = -1;

	if (argc != 1)
	{
		cerr << "Usage: SimpleTransform"
			 << endl
			 << endl;
	}
	else
	{
		try
		{
			XALAN_USING_XERCES(XMLPlatformUtils)

            XALAN_USING_XERCES(XMLUni)

			XALAN_USING_XALAN(XalanTransformer)

            XalanMemoryManagerImpl memoryManager;

#ifdef XALAN_USE_ICU
			UErrorCode status;
			u_setMemoryFunctions(0, icu_malloc, icu_realloc, icu_free, &status);
#endif

			// Call the static initializer for Xerces.
			XMLPlatformUtils::Initialize(
                                    XMLUni::fgXercescDefaultLocale,
                                    0,
                                    0,

                                    &memoryManager );

			// Initialize Xalan.
			XalanTransformer::initialize( memoryManager );

			{
				// Create a XalanTransformer.
				XalanTransformer theXalanTransformer( memoryManager );

				// The assumption is that the executable will be run
				// from same directory as the input files.
				theResult = theXalanTransformer.transform("foo.xml", "foo.xsl", "foo.out");

				if(theResult != 0)
				{
					cerr << "SimpleTransform Error: \n" << theXalanTransformer.getLastError()
						 << endl
						 << endl;
				}
			}

			// Terminate Xalan...
			XalanTransformer::terminate();

			// Terminate Xerces...
			XMLPlatformUtils::Terminate();

			// Clean up the ICU, if it's integrated...
			XalanTransformer::ICUCleanUp();
		}
		catch(...)
		{
			cerr << "Initialization failed!" << endl;
		}
	}

	return theResult;
}
<|endoftext|>


<commit_before>/*
    This file is part of KOrganizer.
    Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/

#include <qtooltip.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qlayout.h>
#include <qwidgetstack.h>
#include <qdatetime.h>

#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>

#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kinputdialog.h>

#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>

#include "koprefs.h"
#include "koglobals.h"

#include "koincidenceeditor.h"
#include "koincidenceeditor.moc"

KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
                                      Calendar *calendar, QWidget *parent ) :
  KDialogBase( Tabbed, caption, Ok | Apply | Cancel | Default | User1, Ok,
               parent, 0, false, false ),
  mSaveTemplateDialog( 0 )
{
  mCalendar = calendar;

  setButtonText( Default, i18n("Template...") );

  QString saveTemplateText;
  if ( KOPrefs::instance()->mCompactDialogs ) {
    showButton( User1, false );
    showButton( Apply, false );
  } else {
    saveTemplateText = i18n("Save as Template...");
  }
  setButtonText( User1, saveTemplateText );

  mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
  KOGlobals::fitDialogToScreen( mCategoryDialog );

  connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));

  connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
  connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
}

KOIncidenceEditor::~KOIncidenceEditor()
{
  delete mCategoryDialog;
}

void KOIncidenceEditor::setupAttendeesTab()
{
  QFrame *topFrame = addPage(i18n("Attendees"));

  QBoxLayout *topLayout = new QVBoxLayout(topFrame);

  mDetails = new KOEditorDetails(spacingHint(),topFrame);
  topLayout->addWidget(mDetails);
}

void KOIncidenceEditor::slotApply()
{
  processInput();
}

void KOIncidenceEditor::slotOk()
{
  if ( processInput() ) accept();
}

void KOIncidenceEditor::updateCategoryConfig()
{
  mCategoryDialog->updateCategoryConfig();
}

void KOIncidenceEditor::slotCancel()
{
  reject();
}

void KOIncidenceEditor::slotLoadTemplate()
{
  kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
}

void KOIncidenceEditor::slotSaveTemplate()
{
  kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
}

void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
{
  if ( !mSaveTemplateDialog ) {
    mSaveTemplateDialog = new SaveTemplateDialog( type, this );
    connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
             SLOT( saveTemplate( const QString & ) ) );
  }
  mSaveTemplateDialog->show();
  mSaveTemplateDialog->raise();
}

void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
                                        const QString &templateName )
{
  if ( !incidence || templateName.isEmpty() ) return;

  QString fileName = "templates/" + incidence->type();
  fileName.append( "/" + templateName );
  fileName = locateLocal( "data", "korganizer/" + fileName );

  CalendarLocal cal;
  cal.addIncidence( incidence );
  ICalFormat format;
  format.save( &cal, fileName );
}

QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
                                         const QStringList &templates )
{
  QString templateName = KInputDialog::getItem( i18n("Load Template"),
      i18n("Select a template to load:"), templates, 0, false );
  if ( templateName.isEmpty() ) return QString::null;

  QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
                                  templateName );

  if ( fileName.isEmpty() ) {
    KMessageBox::error( this, i18n("Unable to find template '%1'.")
                              .arg( fileName ) );
    return QString::null;
  } else {
    ICalFormat format;
    if ( !format.load( cal, fileName ) ) {
      KMessageBox::error( this, i18n("Error loading template file '%1'.")
                                .arg( fileName ) );
      return QString::null;
    }
  }

  return templateName;
}
<commit_msg>Make cancel button of template selection dialog work (#54852)<commit_after>/*
    This file is part of KOrganizer.
    Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/

#include <qtooltip.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qlayout.h>
#include <qwidgetstack.h>
#include <qdatetime.h>

#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>

#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kinputdialog.h>

#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>

#include "koprefs.h"
#include "koglobals.h"

#include "koincidenceeditor.h"
#include "koincidenceeditor.moc"

KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
                                      Calendar *calendar, QWidget *parent ) :
  KDialogBase( Tabbed, caption, Ok | Apply | Cancel | Default | User1, Ok,
               parent, 0, false, false ),
  mSaveTemplateDialog( 0 )
{
  mCalendar = calendar;

  setButtonText( Default, i18n("Template...") );

  QString saveTemplateText;
  if ( KOPrefs::instance()->mCompactDialogs ) {
    showButton( User1, false );
    showButton( Apply, false );
  } else {
    saveTemplateText = i18n("Save as Template...");
  }
  setButtonText( User1, saveTemplateText );

  mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
  KOGlobals::fitDialogToScreen( mCategoryDialog );

  connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));

  connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
  connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
}

KOIncidenceEditor::~KOIncidenceEditor()
{
  delete mCategoryDialog;
}

void KOIncidenceEditor::setupAttendeesTab()
{
  QFrame *topFrame = addPage(i18n("Attendees"));

  QBoxLayout *topLayout = new QVBoxLayout(topFrame);

  mDetails = new KOEditorDetails(spacingHint(),topFrame);
  topLayout->addWidget(mDetails);
}

void KOIncidenceEditor::slotApply()
{
  processInput();
}

void KOIncidenceEditor::slotOk()
{
  if ( processInput() ) accept();
}

void KOIncidenceEditor::updateCategoryConfig()
{
  mCategoryDialog->updateCategoryConfig();
}

void KOIncidenceEditor::slotCancel()
{
  reject();
}

void KOIncidenceEditor::slotLoadTemplate()
{
  kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
}

void KOIncidenceEditor::slotSaveTemplate()
{
  kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
}

void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
{
  if ( !mSaveTemplateDialog ) {
    mSaveTemplateDialog = new SaveTemplateDialog( type, this );
    connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
             SLOT( saveTemplate( const QString & ) ) );
  }
  mSaveTemplateDialog->show();
  mSaveTemplateDialog->raise();
}

void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
                                        const QString &templateName )
{
  if ( !incidence || templateName.isEmpty() ) return;

  QString fileName = "templates/" + incidence->type();
  fileName.append( "/" + templateName );
  fileName = locateLocal( "data", "korganizer/" + fileName );

  CalendarLocal cal;
  cal.addIncidence( incidence );
  ICalFormat format;
  format.save( &cal, fileName );
}

QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
                                         const QStringList &templates )
{
  bool ok = false;
  QString templateName = KInputDialog::getItem( i18n("Load Template"),
      i18n("Select a template to load:"), templates, 0, false, &ok );
  if ( !ok || templateName.isEmpty() ) return QString::null;

  QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
                                  templateName );

  if ( fileName.isEmpty() ) {
    KMessageBox::error( this, i18n("Unable to find template '%1'.")
                              .arg( fileName ) );
    return QString::null;
  } else {
    ICalFormat format;
    if ( !format.load( cal, fileName ) ) {
      KMessageBox::error( this, i18n("Error loading template file '%1'.")
                                .arg( fileName ) );
      return QString::null;
    }
  }

  return templateName;
}
<|endoftext|>


<commit_before>/*
   Copyright (C) 2015 Preet Desai (preet.desai@gmail.com)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#ifndef KS_RECYCLE_INDEX_LIST_HPP
#define KS_RECYCLE_INDEX_LIST_HPP

#include <vector>
#include <algorithm>
#include <ks/KsGlobal.hpp>
#include <ks/KsLog.hpp>

namespace ks
{
    // ============================================================= //

    enum class RecycleIndexListRemovalPolicy : u8 {
        Resize,
        Shrink,
        None
    };

    // ============================================================= //

    // Forward declarations
    template<typename ListT,
             typename IndexT,
             RecycleIndexListRemovalPolicy Policy>
    class RecycleIndexList;

    // ============================================================= //

    namespace rec_idx_list_detail
    {
        using Policy = RecycleIndexListRemovalPolicy;

        template<typename T,typename I,Policy P>
        struct RemoveHelper{};

        template<typename T,typename I>
        struct RemoveHelper<T,I,Policy::Resize>
        {
            static void remove(RecycleIndexList<T,I,Policy::Resize>* list, I index)
            {
                list->m_count--;
                list->m_list[index]=T();
                list->m_list_valid[index]=list->k_invalid;

                // insert in sorted list
                auto ins_avail_it =
                        std::upper_bound(list->m_list_avail.begin(),
                                         list->m_list_avail.end(),
                                         index);

                list->m_list_avail.insert(ins_avail_it,index);

                // trim
                while(list->m_list_valid.back() == list->k_invalid) {
                    list->m_list.pop_back();
                    list->m_list_valid.pop_back();
                    list->m_list_avail.pop_back();

                    if(list->m_list_valid.empty()) {
                        break;
                    }
                }
            }
        };

        template<typename T,typename I>
        struct RemoveHelper<T,I,Policy::None>
        {
            static void remove(RecycleIndexList<T,I,Policy::None>* list, I index)
            {
                list->m_count--;
                list->m_list[index]=T();
                list->m_list_valid[index]=list->k_invalid;

                list->m_list_avail.push_back(index);
            }
        };
    }

    // ============================================================= //
    // ============================================================= //

    template<typename T,
             typename IndexT=uint,
             RecycleIndexListRemovalPolicy PolicyT=
                RecycleIndexListRemovalPolicy::Resize>
    class RecycleIndexList final
    {
        static_assert(std::is_integral<IndexT>::value,
                      "ERROR: ks: RecycleIndexList: "
                      "IndexT must be an integral type");

        template<typename L,
                 typename I,
                 RecycleIndexListRemovalPolicy P>
        friend struct rec_idx_list_detail::RemoveHelper;

    public:
        IndexT Add(T val)
        {
            m_count++;
            if(m_list_avail.empty()) {
                m_list.push_back(std::move(val));
                m_list_valid.push_back(k_valid);
                return (m_list.size()-1);
            }

            auto const index = m_list_avail.back();
            m_list[index] = std::move(val);
            m_list_valid[index] = k_valid;
            m_list_avail.pop_back();

            return index;
        }

        void Remove(IndexT index)
        {
            rec_idx_list_detail::RemoveHelper<
                    T,IndexT,PolicyT>::remove(this,index);
        }

        IndexT PeekNextIndex() const
        {
            if(m_list_avail.empty()) {
                return (static_cast<IndexT>(m_list.size()));
            }

            return (m_list_avail.back());
        }

        void Reserve(uint count)
        {
            m_list.reserve(count);
            m_list_valid.reserve(count);
            m_list_avail.reserve(count);
        }

        void ShrinkToFit()
        {
            m_list.shrink_to_fit();
            m_list_valid.shrink_to_fit();
            m_list_avail.shrink_to_fit();
        }

        void Clear()
        {
            m_list.clear();
            m_list_valid.clear();
            m_list_avail.clear();
        }

        T& Get(IndexT index)
        {
            return m_list[index];
        }

        IndexT GetCount() const
        {
            return m_count;
        }

        bool GetValid(IndexT index)
        {
            return m_list_valid[index];
        }

        T& operator[] (IndexT index)
        {
            return m_list[index];
        }

        std::vector<T>& GetList()
        {
            return m_list;
        }

        std::vector<T> const& GetList() const
        {
            return m_list;
        }

        std::vector<IndexT> const & GetListAvail() const
        {
            return m_list_avail;
        }

    private:
        u8 k_valid{1};
        u8 k_invalid{0};
        IndexT m_count{0};
        std::vector<T> m_list; // sparse
        std::vector<u8> m_list_valid;

        // keep sorted if remove policy is resize
        std::vector<IndexT> m_list_avail;
    };

    // ============================================================= //
}

#endif // KS_RECYCLE_INDEX_LIST_HPP
<commit_msg>Added const element access<commit_after>/*
   Copyright (C) 2015 Preet Desai (preet.desai@gmail.com)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#ifndef KS_RECYCLE_INDEX_LIST_HPP
#define KS_RECYCLE_INDEX_LIST_HPP

#include <vector>
#include <algorithm>
#include <ks/KsGlobal.hpp>
#include <ks/KsLog.hpp>

namespace ks
{
    // ============================================================= //

    enum class RecycleIndexListRemovalPolicy : u8 {
        Resize,
        Shrink,
        None
    };

    // ============================================================= //

    // Forward declarations
    template<typename ListT,
             typename IndexT,
             RecycleIndexListRemovalPolicy Policy>
    class RecycleIndexList;

    // ============================================================= //

    namespace rec_idx_list_detail
    {
        using Policy = RecycleIndexListRemovalPolicy;

        template<typename T,typename I,Policy P>
        struct RemoveHelper{};

        template<typename T,typename I>
        struct RemoveHelper<T,I,Policy::Resize>
        {
            static void remove(RecycleIndexList<T,I,Policy::Resize>* list, I index)
            {
                list->m_count--;
                list->m_list[index]=T();
                list->m_list_valid[index]=list->k_invalid;

                // insert in sorted list
                auto ins_avail_it =
                        std::upper_bound(list->m_list_avail.begin(),
                                         list->m_list_avail.end(),
                                         index);

                list->m_list_avail.insert(ins_avail_it,index);

                // trim
                while(list->m_list_valid.back() == list->k_invalid) {
                    list->m_list.pop_back();
                    list->m_list_valid.pop_back();
                    list->m_list_avail.pop_back();

                    if(list->m_list_valid.empty()) {
                        break;
                    }
                }
            }
        };

        template<typename T,typename I>
        struct RemoveHelper<T,I,Policy::None>
        {
            static void remove(RecycleIndexList<T,I,Policy::None>* list, I index)
            {
                list->m_count--;
                list->m_list[index]=T();
                list->m_list_valid[index]=list->k_invalid;

                list->m_list_avail.push_back(index);
            }
        };
    }

    // ============================================================= //
    // ============================================================= //

    template<typename T,
             typename IndexT=uint,
             RecycleIndexListRemovalPolicy PolicyT=
                RecycleIndexListRemovalPolicy::Resize>
    class RecycleIndexList final
    {
        static_assert(std::is_integral<IndexT>::value,
                      "ERROR: ks: RecycleIndexList: "
                      "IndexT must be an integral type");

        template<typename L,
                 typename I,
                 RecycleIndexListRemovalPolicy P>
        friend struct rec_idx_list_detail::RemoveHelper;

    public:
        IndexT Add(T val)
        {
            m_count++;
            if(m_list_avail.empty()) {
                m_list.push_back(std::move(val));
                m_list_valid.push_back(k_valid);
                return (m_list.size()-1);
            }

            auto const index = m_list_avail.back();
            m_list[index] = std::move(val);
            m_list_valid[index] = k_valid;
            m_list_avail.pop_back();

            return index;
        }

        void Remove(IndexT index)
        {
            rec_idx_list_detail::RemoveHelper<
                    T,IndexT,PolicyT>::remove(this,index);
        }

        IndexT PeekNextIndex() const
        {
            if(m_list_avail.empty()) {
                return (static_cast<IndexT>(m_list.size()));
            }

            return (m_list_avail.back());
        }

        void Reserve(uint count)
        {
            m_list.reserve(count);
            m_list_valid.reserve(count);
            m_list_avail.reserve(count);
        }

        void ShrinkToFit()
        {
            m_list.shrink_to_fit();
            m_list_valid.shrink_to_fit();
            m_list_avail.shrink_to_fit();
        }

        void Clear()
        {
            m_list.clear();
            m_list_valid.clear();
            m_list_avail.clear();
        }

        T& Get(IndexT index)
        {
            return m_list[index];
        }

        T const & Get(IndexT index) const
        {
            return m_list[index];
        }

        IndexT GetCount() const
        {
            return m_count;
        }

        bool GetValid(IndexT index)
        {
            return m_list_valid[index];
        }

        T& operator[] (IndexT index)
        {
            return m_list[index];
        }

        T const & operator[] (IndexT index) const
        {
            return m_list[index];
        }

        std::vector<T>& GetList()
        {
            return m_list;
        }

        std::vector<T> const& GetList() const
        {
            return m_list;
        }

        std::vector<IndexT> const & GetListAvail() const
        {
            return m_list_avail;
        }

    private:
        u8 k_valid{1};
        u8 k_invalid{0};
        IndexT m_count{0};
        std::vector<T> m_list; // sparse
        std::vector<u8> m_list_valid;

        // keep sorted if remove policy is resize
        std::vector<IndexT> m_list_avail;
    };

    // ============================================================= //
}

#endif // KS_RECYCLE_INDEX_LIST_HPP
<|endoftext|>


<commit_before>
#include "ksp_plugin/interface.hpp"

#include <algorithm>

#include "geometry/affine_map.hpp"
#include "geometry/grassmann.hpp"
#include "geometry/named_quantities.hpp"
#include "geometry/orthogonal_map.hpp"
#include "geometry/perspective.hpp"
#include "geometry/rotation.hpp"
#include "geometry/rp2_point.hpp"
#include "glog/logging.h"
#include "journal/method.hpp"
#include "journal/profiles.hpp"
#include "ksp_plugin/frames.hpp"
#include "ksp_plugin/iterators.hpp"
#include "ksp_plugin/renderer.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/rigid_motion.hpp"
#include "quantities/quantities.hpp"
#include "quantities/si.hpp"

namespace principia {
namespace interface {

using geometry::AffineMap;
using geometry::Multivector;
using geometry::OrthogonalMap;
using geometry::Perspective;
using geometry::RigidTransformation;
using geometry::Rotation;
using geometry::RP2Lines;
using ksp_plugin::Camera;
using ksp_plugin::Navigation;
using ksp_plugin::Planetarium;
using ksp_plugin::Renderer;
using ksp_plugin::TypedIterator;
using physics::DiscreteTrajectory;
using quantities::Length;
using quantities::si::ArcMinute;
using quantities::si::Kilo;
using quantities::si::Metre;
using quantities::si::Radian;

namespace {

RP2Lines<Length, Camera> PlotMethodN(
    Planetarium const& planetarium,
    int const method,
    DiscreteTrajectory<Barycentric>::Iterator const& begin,
    DiscreteTrajectory<Barycentric>::Iterator const& end,
    Instant const& now,
    bool const reverse) {
  switch (method) {
    case 0:
      return planetarium.PlotMethod0(begin, end, now, reverse);
    case 1:
      return planetarium.PlotMethod1(begin, end, now, reverse);
    case 2:
      return planetarium.PlotMethod2(begin, end, now, reverse);
    default:
      LOG(FATAL) << "Unexpected method " << method;
      base::noreturn();
  }
}

}  // namespace

Planetarium* __cdecl principia__PlanetariumCreate(
    Plugin const* const plugin,
    XYZ const sun_world_position,
    XYZ const xyz_opengl_camera_x_in_world,
    XYZ const xyz_opengl_camera_y_in_world,
    XYZ const xyz_opengl_camera_z_in_world,
    XYZ const xyz_camera_position_in_world,
    double const focal,
    double const field_of_view) {
  journal::Method<journal::PlanetariumCreate> m({plugin,
                                                 sun_world_position,
                                                 xyz_opengl_camera_x_in_world,
                                                 xyz_opengl_camera_y_in_world,
                                                 xyz_opengl_camera_z_in_world,
                                                 xyz_camera_position_in_world,
                                                 focal,
                                                 field_of_view});
  Renderer const& renderer = CHECK_NOTNULL(plugin)->renderer();

  Multivector<double, World, 1> const opengl_camera_x_in_world(
      FromXYZ(xyz_opengl_camera_x_in_world));
  Multivector<double, World, 1> const opengl_camera_y_in_world(
      FromXYZ(xyz_opengl_camera_y_in_world));
  Multivector<double, World, 2> const opengl_camera_z_in_world(
      FromXYZ(xyz_opengl_camera_z_in_world));
  // Note the minus sign for z below because our convention with respect to the
  // orientation of z is opposite that of OpenGL.
  Rotation<Camera, World> const camera_to_world_rotation(
      opengl_camera_x_in_world,
      opengl_camera_y_in_world,
      -opengl_camera_z_in_world);
  Position<World> const camera_position_in_world =
      FromXYZ<Position<World>>(xyz_camera_position_in_world);

  RigidTransformation<Camera, World> const
      camera_to_world_affine_map(Camera::origin,
                                 camera_position_in_world,
                                 camera_to_world_rotation.Forget());
  RigidTransformation<World, Navigation> const
      world_to_plotting_affine_map =
          renderer.WorldToPlotting(plugin->CurrentTime(),
                                   FromXYZ<Position<World>>(sun_world_position),
                                   plugin->PlanetariumRotation());

  Planetarium::Parameters parameters(
      /*sphere_radius_multiplier=*/1.0,
      /*angular_resolution=*/0.4 * ArcMinute,
      field_of_view * Radian);
  Perspective<Navigation, Camera> perspective(
      world_to_plotting_affine_map * camera_to_world_affine_map,
      focal * Metre);

  return m.Return(plugin->NewPlanetarium(parameters, perspective).release());
}

void __cdecl principia__PlanetariumDelete(
    Planetarium const** const planetarium) {
  journal::Method<journal::PlanetariumDelete> m({planetarium}, {planetarium});
  CHECK_NOTNULL(planetarium);
  TakeOwnership(planetarium);
  return m.Return();
}

Iterator* __cdecl principia__PlanetariumPlotFlightPlanSegment(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid,
    int const index) {
  journal::Method<journal::PlanetariumPlotFlightPlanSegment> m({planetarium,
                                                                plugin,
                                                                method,
                                                                vessel_guid,
                                                                index});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);
  Vessel const& vessel = *plugin->GetVessel(vessel_guid);
  CHECK(vessel.has_flight_plan()) << vessel_guid;
  DiscreteTrajectory<Barycentric>::Iterator segment_begin;
  DiscreteTrajectory<Barycentric>::Iterator segment_end;
  vessel.flight_plan().GetSegment(index, segment_begin, segment_end);
  RP2Lines<Length, Camera> rp2_lines;
  // TODO(egg): this is ugly; we should centralize rendering.
  // If this is a burn and we cannot render the beginning of the burn, we
  // render none of it, otherwise we try to render the Frenet trihedron at the
  // start and we fail.
  if (index % 2 == 0 ||
      segment_begin == segment_end ||
      segment_begin->time >= plugin->renderer().GetPlottingFrame()->t_min()) {
     rp2_lines = PlotMethodN(*planetarium,
                             method,
                             segment_begin,
                             segment_end,
                             plugin->CurrentTime(),
                             /*reverse=*/false);
  }
  return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
}

Iterator* __cdecl principia__PlanetariumPlotPrediction(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid) {
  journal::Method<journal::PlanetariumPlotPrediction> m({planetarium,
                                                         plugin,
                                                         method,
                                                         vessel_guid});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);
  auto const& prediction = plugin->GetVessel(vessel_guid)->prediction();
  auto const rp2_lines = PlotMethodN(*planetarium,
                                     method,
                                     prediction.Fork(),
                                     prediction.end(),
                                     plugin->CurrentTime(),
                                     /*reverse=*/false);
  return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
}

Iterator* __cdecl principia__PlanetariumPlotPsychohistory(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid,
    double const max_history_length) {
  journal::Method<journal::PlanetariumPlotPsychohistory> m(
      {planetarium, plugin, method, vessel_guid, max_history_length});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the psychohistory when there is a target vessel as it is
  // misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& psychohistory = plugin->GetVessel(vessel_guid)->psychohistory();
    auto const rp2_lines =
        PlotMethodN(*planetarium,
                    method,
                    psychohistory.LowerBound(plugin->CurrentTime() -
                                             max_history_length * Second),
                    psychohistory.end(),
                    plugin->CurrentTime(),
                    /*reverse=*/true);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

// Returns an iterator for the rendered past trajectory of the celestial with
// the given index; the trajectory goes back as far as the history of the vessel
// with the given GUID, or, if no vessel is provided, up to |max_history_length|
// seconds before the present time.
Iterator* __cdecl principia__PlanetariumPlotCelestialTrajectoryForPsychohistory(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const celestial_index,
    char const* const vessel_guid,
    double const max_history_length) {
  journal::Method<journal::PlanetariumPlotCelestialTrajectoryForPsychohistory>
      m({planetarium,
         plugin,
         celestial_index,
         vessel_guid,
         max_history_length});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the past when there is a target vessel as it is misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& celestial_trajectory =
        plugin->GetCelestial(celestial_index).trajectory();
    Instant const first_time = std::max(
        plugin->CurrentTime() - max_history_length * Second,
        vessel_guid == nullptr
            ? celestial_trajectory.t_min()
            : plugin->GetVessel(vessel_guid)->psychohistory().t_min());
    auto const rp2_lines =
        planetarium->PlotMethod2(celestial_trajectory,
                                 first_time,
                                 /*last_time=*/plugin->CurrentTime(),
                                 /*now=*/plugin->CurrentTime(),
                                 /*reverse=*/true);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

// Returns an iterator for the rendered future trajectory of the celestial with
// the given index; the trajectory goes as far as the furthest of the final time
// of the prediction or that of the flight plan.
Iterator* __cdecl
principia__PlanetariumPlotCelestialTrajectoryForPredictionOrFlightPlan(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const celestial_index,
    char const* const vessel_guid) {
  journal::Method<
      journal::PlanetariumPlotCelestialTrajectoryForPredictionOrFlightPlan>
      m({planetarium, plugin, celestial_index, vessel_guid});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the past when there is a target vessel as it is misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& vessel = *plugin->GetVessel(vessel_guid);
    Instant const prediction_final_time = vessel.prediction().t_max();
    Instant const final_time =
        vessel.has_flight_plan()
            ? std::max(vessel.flight_plan().actual_final_time(),
                       prediction_final_time)
            : prediction_final_time;
    auto const& celestial_trajectory =
        plugin->GetCelestial(celestial_index).trajectory();
    auto const rp2_lines =
        planetarium->PlotMethod2(celestial_trajectory,
                                 /*first_time=*/plugin->CurrentTime(),
                                 /*last_time=*/final_time,
                                 /*now=*/plugin->CurrentTime(),
                                 /*reverse=*/false);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

}  // namespace interface
}  // namespace principia
<commit_msg>Ancient history<commit_after>
#include "ksp_plugin/interface.hpp"

#include <algorithm>

#include "geometry/affine_map.hpp"
#include "geometry/grassmann.hpp"
#include "geometry/named_quantities.hpp"
#include "geometry/orthogonal_map.hpp"
#include "geometry/perspective.hpp"
#include "geometry/rotation.hpp"
#include "geometry/rp2_point.hpp"
#include "glog/logging.h"
#include "journal/method.hpp"
#include "journal/profiles.hpp"
#include "ksp_plugin/frames.hpp"
#include "ksp_plugin/iterators.hpp"
#include "ksp_plugin/renderer.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/rigid_motion.hpp"
#include "quantities/quantities.hpp"
#include "quantities/si.hpp"

namespace principia {
namespace interface {

using geometry::AffineMap;
using geometry::Multivector;
using geometry::OrthogonalMap;
using geometry::Perspective;
using geometry::RigidTransformation;
using geometry::Rotation;
using geometry::RP2Lines;
using ksp_plugin::Camera;
using ksp_plugin::Navigation;
using ksp_plugin::Planetarium;
using ksp_plugin::Renderer;
using ksp_plugin::TypedIterator;
using physics::DiscreteTrajectory;
using quantities::Length;
using quantities::si::ArcMinute;
using quantities::si::Kilo;
using quantities::si::Metre;
using quantities::si::Radian;

namespace {

RP2Lines<Length, Camera> PlotMethodN(
    Planetarium const& planetarium,
    int const method,
    DiscreteTrajectory<Barycentric>::Iterator const& begin,
    DiscreteTrajectory<Barycentric>::Iterator const& end,
    Instant const& now,
    bool const reverse) {
  switch (method) {
    case 0:
      return planetarium.PlotMethod0(begin, end, now, reverse);
    case 1:
      return planetarium.PlotMethod1(begin, end, now, reverse);
    case 2:
      return planetarium.PlotMethod2(begin, end, now, reverse);
    default:
      LOG(FATAL) << "Unexpected method " << method;
      base::noreturn();
  }
}

}  // namespace

Planetarium* __cdecl principia__PlanetariumCreate(
    Plugin const* const plugin,
    XYZ const sun_world_position,
    XYZ const xyz_opengl_camera_x_in_world,
    XYZ const xyz_opengl_camera_y_in_world,
    XYZ const xyz_opengl_camera_z_in_world,
    XYZ const xyz_camera_position_in_world,
    double const focal,
    double const field_of_view) {
  journal::Method<journal::PlanetariumCreate> m({plugin,
                                                 sun_world_position,
                                                 xyz_opengl_camera_x_in_world,
                                                 xyz_opengl_camera_y_in_world,
                                                 xyz_opengl_camera_z_in_world,
                                                 xyz_camera_position_in_world,
                                                 focal,
                                                 field_of_view});
  Renderer const& renderer = CHECK_NOTNULL(plugin)->renderer();

  Multivector<double, World, 1> const opengl_camera_x_in_world(
      FromXYZ(xyz_opengl_camera_x_in_world));
  Multivector<double, World, 1> const opengl_camera_y_in_world(
      FromXYZ(xyz_opengl_camera_y_in_world));
  Multivector<double, World, 2> const opengl_camera_z_in_world(
      FromXYZ(xyz_opengl_camera_z_in_world));
  // Note the minus sign for z below because our convention with respect to the
  // orientation of z is opposite that of OpenGL.
  Rotation<Camera, World> const camera_to_world_rotation(
      opengl_camera_x_in_world,
      opengl_camera_y_in_world,
      -opengl_camera_z_in_world);
  Position<World> const camera_position_in_world =
      FromXYZ<Position<World>>(xyz_camera_position_in_world);

  RigidTransformation<Camera, World> const
      camera_to_world_affine_map(Camera::origin,
                                 camera_position_in_world,
                                 camera_to_world_rotation.Forget());
  RigidTransformation<World, Navigation> const
      world_to_plotting_affine_map =
          renderer.WorldToPlotting(plugin->CurrentTime(),
                                   FromXYZ<Position<World>>(sun_world_position),
                                   plugin->PlanetariumRotation());

  Planetarium::Parameters parameters(
      /*sphere_radius_multiplier=*/1.0,
      /*angular_resolution=*/0.4 * ArcMinute,
      field_of_view * Radian);
  Perspective<Navigation, Camera> perspective(
      world_to_plotting_affine_map * camera_to_world_affine_map,
      focal * Metre);

  return m.Return(plugin->NewPlanetarium(parameters, perspective).release());
}

void __cdecl principia__PlanetariumDelete(
    Planetarium const** const planetarium) {
  journal::Method<journal::PlanetariumDelete> m({planetarium}, {planetarium});
  CHECK_NOTNULL(planetarium);
  TakeOwnership(planetarium);
  return m.Return();
}

Iterator* __cdecl principia__PlanetariumPlotFlightPlanSegment(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid,
    int const index) {
  journal::Method<journal::PlanetariumPlotFlightPlanSegment> m({planetarium,
                                                                plugin,
                                                                method,
                                                                vessel_guid,
                                                                index});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);
  Vessel const& vessel = *plugin->GetVessel(vessel_guid);
  CHECK(vessel.has_flight_plan()) << vessel_guid;
  DiscreteTrajectory<Barycentric>::Iterator segment_begin;
  DiscreteTrajectory<Barycentric>::Iterator segment_end;
  vessel.flight_plan().GetSegment(index, segment_begin, segment_end);
  RP2Lines<Length, Camera> rp2_lines;
  // TODO(egg): this is ugly; we should centralize rendering.
  // If this is a burn and we cannot render the beginning of the burn, we
  // render none of it, otherwise we try to render the Frenet trihedron at the
  // start and we fail.
  if (index % 2 == 0 ||
      segment_begin == segment_end ||
      segment_begin->time >= plugin->renderer().GetPlottingFrame()->t_min()) {
     rp2_lines = PlotMethodN(*planetarium,
                             method,
                             segment_begin,
                             segment_end,
                             plugin->CurrentTime(),
                             /*reverse=*/false);
  }
  return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
}

Iterator* __cdecl principia__PlanetariumPlotPrediction(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid) {
  journal::Method<journal::PlanetariumPlotPrediction> m({planetarium,
                                                         plugin,
                                                         method,
                                                         vessel_guid});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);
  auto const& prediction = plugin->GetVessel(vessel_guid)->prediction();
  auto const rp2_lines = PlotMethodN(*planetarium,
                                     method,
                                     prediction.Fork(),
                                     prediction.end(),
                                     plugin->CurrentTime(),
                                     /*reverse=*/false);
  return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
}

Iterator* __cdecl principia__PlanetariumPlotPsychohistory(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const method,
    char const* const vessel_guid,
    double const max_history_length) {
  journal::Method<journal::PlanetariumPlotPsychohistory> m(
      {planetarium, plugin, method, vessel_guid, max_history_length});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the psychohistory when there is a target vessel as it is
  // misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& psychohistory = plugin->GetVessel(vessel_guid)->psychohistory();
    auto const rp2_lines =
        PlotMethodN(*planetarium,
                    method,
                    psychohistory.LowerBound(plugin->CurrentTime() -
                                             max_history_length * Second),
                    psychohistory.end(),
                    plugin->CurrentTime(),
                    /*reverse=*/true);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

// Returns an iterator for the rendered past trajectory of the celestial with
// the given index; the trajectory goes back |max_history_length| seconds before
// the present time (or to the earliest time available if the relevant |t_min|
// is more recent).
Iterator* __cdecl principia__PlanetariumPlotCelestialTrajectoryForPsychohistory(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const celestial_index,
    char const* const vessel_guid,
    double const max_history_length) {
  journal::Method<journal::PlanetariumPlotCelestialTrajectoryForPsychohistory>
      m({planetarium,
         plugin,
         celestial_index,
         vessel_guid,
         max_history_length});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the past when there is a target vessel as it is misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& celestial_trajectory =
        plugin->GetCelestial(celestial_index).trajectory();
    Instant const first_time = std::max(
        plugin->CurrentTime() - max_history_length * Second,
            celestial_trajectory.t_min());
    auto const rp2_lines =
        planetarium->PlotMethod2(celestial_trajectory,
                                 first_time,
                                 /*last_time=*/plugin->CurrentTime(),
                                 /*now=*/plugin->CurrentTime(),
                                 /*reverse=*/true);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

// Returns an iterator for the rendered future trajectory of the celestial with
// the given index; the trajectory goes as far as the furthest of the final time
// of the prediction or that of the flight plan.
Iterator* __cdecl
principia__PlanetariumPlotCelestialTrajectoryForPredictionOrFlightPlan(
    Planetarium const* const planetarium,
    Plugin const* const plugin,
    int const celestial_index,
    char const* const vessel_guid) {
  journal::Method<
      journal::PlanetariumPlotCelestialTrajectoryForPredictionOrFlightPlan>
      m({planetarium, plugin, celestial_index, vessel_guid});
  CHECK_NOTNULL(plugin);
  CHECK_NOTNULL(planetarium);

  // Do not plot the past when there is a target vessel as it is misleading.
  if (plugin->renderer().HasTargetVessel()) {
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>({}));
  } else {
    auto const& vessel = *plugin->GetVessel(vessel_guid);
    Instant const prediction_final_time = vessel.prediction().t_max();
    Instant const final_time =
        vessel.has_flight_plan()
            ? std::max(vessel.flight_plan().actual_final_time(),
                       prediction_final_time)
            : prediction_final_time;
    auto const& celestial_trajectory =
        plugin->GetCelestial(celestial_index).trajectory();
    auto const rp2_lines =
        planetarium->PlotMethod2(celestial_trajectory,
                                 /*first_time=*/plugin->CurrentTime(),
                                 /*last_time=*/final_time,
                                 /*now=*/plugin->CurrentTime(),
                                 /*reverse=*/false);
    return m.Return(new TypedIterator<RP2Lines<Length, Camera>>(rp2_lines));
  }
}

}  // namespace interface
}  // namespace principia
<|endoftext|>


<commit_before>/*
 *     Copyright (C) 2007 by Thorsten Staerk <dev@staerk.de>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program 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 General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this program; if not, write to the
 *      Free Software Foundation, Inc.
 *      51 Franklin Street, Fifth Floor
 *      Boston, MA  02110-1301  USA.
 *
 */

#include "ktimetrackerutility.h"

#include <KGlobal>
#include <KLocale>

#include <math.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <fixx11h.h>

QString getFocusWindow()
{
    Display *display = XOpenDisplay( 0 );
    char *name;
    Window window = 0;
    int i = 0;
    XGetInputFocus( display, &window, &i );
    XFetchName( display, window, &name );
    XCloseDisplay( display );
    return QString( name );
}

QString formatTime( double minutes, bool decimal )
{
    kDebug(5970) << "Entering function(minutes=" << minutes << ",decimal=" << decimal << ");";
    QString time;
    if ( decimal )
    {
        time.sprintf( "%.2f", minutes / 60.0 );
        time.replace( '.', KGlobal::locale()->decimalSymbol() );
    }
    else time.sprintf("%s%ld:%02ld",
        (minutes < 0) ? KGlobal::locale()->negativeSign().toUtf8().data() : "",
        labs(minutes / 60), labs(((int) round(minutes)) % 60));
    return time;
}

int desktopcount()
{
    int result;
    #ifdef Q_WS_X11
    result = KWindowSystem::numberOfDesktops();
    #else
    #ifdef __GNUC__
    #warning non-X11 support missing
    #endif
    result = -1;
    #endif
    return result;
}
<commit_msg>Backporting 1075317 Migration from X (XGetInPutFocUs) to KWindowSystem. No idea why the old code stopped working. Purpose: Track time of tasks by title of focus window.<commit_after>/*
 *     Copyright (C) 2007 by Thorsten Staerk <dev@staerk.de>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program 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 General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this program; if not, write to the
 *      Free Software Foundation, Inc.
 *      51 Franklin Street, Fifth Floor
 *      Boston, MA  02110-1301  USA.
 *
 */

#include "ktimetrackerutility.h"

#include <KGlobal>
#include <KLocale>

#include <math.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <fixx11h.h>

QString getFocusWindow()
{
    return KWindowSystem::windowInfo(KWindowSystem::activeWindow(),NET::WMName, 0).name();
}

QString formatTime( double minutes, bool decimal )
{
    kDebug(5970) << "Entering function(minutes=" << minutes << ",decimal=" << decimal << ");";
    QString time;
    if ( decimal )
    {
        time.sprintf( "%.2f", minutes / 60.0 );
        time.replace( '.', KGlobal::locale()->decimalSymbol() );
    }
    else time.sprintf("%s%ld:%02ld",
        (minutes < 0) ? KGlobal::locale()->negativeSign().toUtf8().data() : "",
        labs(minutes / 60), labs(((int) round(minutes)) % 60));
    return time;
}

int desktopcount()
{
    int result;
    #ifdef Q_WS_X11
    result = KWindowSystem::numberOfDesktops();
    #else
    #ifdef __GNUC__
    #warning non-X11 support missing
    #endif
    result = -1;
    #endif
    return result;
}
<|endoftext|>


<commit_before><commit_msg>Expand std_prelude - Accept (with warning) `#![no_std]` and `#![no_core]` at the same time (Fixes #145)<commit_after><|endoftext|>


<commit_before><commit_msg>fs: Factory: Flush the folder cache when refreshing<commit_after><|endoftext|>