<commit_before>#include <stingray/toolkit/Factory.h>

#include <stingray/toolkit/any.h>

#include <stingray/app/Scheduler.h>
#include <stingray/app/application_context/AppChannel.h>
#include <stingray/app/application_context/ChannelList.h>
#include <stingray/app/tests/AutoFilter.h>
#include <stingray/app/zapper/User.h>
#include <stingray/hdmi/IHDMI.h>
#include <stingray/mpeg/Stream.h>
#include <stingray/parentalcontrol/AgeRating.h>
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/Channel.h>
#endif
#include <stingray/records/FileSystemRecord.h>
#include <stingray/scanner/DVBServiceId.h>
#include <stingray/scanner/DefaultDVBTBandInfo.h>
#include <stingray/scanner/DefaultMpegService.h>
#include <stingray/scanner/DefaultMpegStreamDescriptor.h>
#include <stingray/scanner/DefaultScanParams.h>
#include <stingray/scanner/DefaultScanResult.h>
#include <stingray/scanner/DefaultServiceNetworkInfo.h>
#include <stingray/scanner/LcnList.h>
#include <stingray/scanner/OtherTransportInfoEntry.h>
#include <stingray/streams/RecordStreamMetaInfo.h>
#include <stingray/tuners/dvbs/Antenna.h>
#include <stingray/tuners/dvbs/DefaultDVBSTransport.h>
#include <stingray/tuners/dvbs/Satellite.h>
#include <stingray/tuners/dvbt/DefaultDVBTTransport.h>

/* WARNING! This is autogenerated file, DO NOT EDIT! */

namespace stingray { namespace Detail
{
	void Factory::RegisterTypes()
	{
#ifdef BUILD_SHARED_LIB
		/*nothing*/
#else
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::Alarm);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ContinuousScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::DeferredStandby);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::InfiniteScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AppChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(::stingray::Detail::any::ObjectHolder<stingray::app::AppChannelPtr>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelListAutoRemover);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AutoFilter);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::User);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HDMIConfig);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AgeRating);
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuServiceId);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::RadioChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::StreamDescriptor);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::TVChannel);
#endif
		TOOLKIT_REGISTER_CLASS_EXPLICIT(FileSystemRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBServiceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBTBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegRadioChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegService);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegTVChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegAudioStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegPcrStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegSubtitlesStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextBasedSubtitlesStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegVideoStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanResult);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultServiceNetworkInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(GenreChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LcnList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(OtherTransportInfoEntry);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Antenna);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBSTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Satellite);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBTTransport);
#endif
	}
}}
<commit_msg>Refactored IServiceNetworkInfoEntry passing and storing - removed redundant IServiceNetworkInfo. Fixed dependent code.<commit_after>#include <stingray/toolkit/Factory.h>

#include <stingray/toolkit/any.h>

#include <stingray/app/Scheduler.h>
#include <stingray/app/application_context/AppChannel.h>
#include <stingray/app/application_context/ChannelList.h>
#include <stingray/app/tests/AutoFilter.h>
#include <stingray/app/zapper/User.h>
#include <stingray/hdmi/IHDMI.h>
#include <stingray/mpeg/Stream.h>
#include <stingray/parentalcontrol/AgeRating.h>
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/Channel.h>
#endif
#include <stingray/records/FileSystemRecord.h>
#include <stingray/scanner/DVBServiceId.h>
#include <stingray/scanner/DefaultDVBTBandInfo.h>
#include <stingray/scanner/DefaultMpegService.h>
#include <stingray/scanner/DefaultMpegStreamDescriptor.h>
#include <stingray/scanner/DefaultScanParams.h>
#include <stingray/scanner/DefaultScanResult.h>
#include <stingray/scanner/LcnList.h>
#include <stingray/scanner/OtherTransportInfoEntry.h>
#include <stingray/streams/RecordStreamMetaInfo.h>
#include <stingray/tuners/dvbs/Antenna.h>
#include <stingray/tuners/dvbs/DefaultDVBSTransport.h>
#include <stingray/tuners/dvbs/Satellite.h>
#include <stingray/tuners/dvbt/DefaultDVBTTransport.h>

/* WARNING! This is autogenerated file, DO NOT EDIT! */

namespace stingray { namespace Detail
{
	void Factory::RegisterTypes()
	{
#ifdef BUILD_SHARED_LIB
		/*nothing*/
#else
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::Alarm);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ContinuousScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::DeferredStandby);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::InfiniteScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AppChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(::stingray::Detail::any::ObjectHolder<stingray::app::AppChannelPtr>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelListAutoRemover);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AutoFilter);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::User);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HDMIConfig);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AgeRating);
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuServiceId);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::RadioChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::StreamDescriptor);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::TVChannel);
#endif
		TOOLKIT_REGISTER_CLASS_EXPLICIT(FileSystemRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBServiceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBTBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegRadioChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegService);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegTVChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegAudioStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegPcrStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegSubtitlesStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextBasedSubtitlesStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegVideoStreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanResult);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(GenreChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LcnList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(OtherTransportInfoEntry);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Antenna);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBSTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Satellite);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBTTransport);
#endif
	}
}}
<|endoftext|>


<commit_before>#include <stingray/toolkit/Factory.h>

#include <stingray/toolkit/any.h>

#include <stingray/app/RecordErrors.h>
#include <stingray/app/activation_manager/ActivationIntent.h>
#include <stingray/app/application_context/AppChannel.h>
#include <stingray/app/application_context/ChannelList.h>
#include <stingray/app/scheduler/ScheduledEvents.h>
#include <stingray/ca/BasicSubscriptionLease.h>
#include <stingray/ca/BissConditionalAccess.h>
#include <stingray/ca/DreSubscription.h>
#include <stingray/ca/SubscriptionBundle.h>
#include <stingray/crypto/PlainCipherKey.h>
#include <stingray/details/IReceiverTrait.h>
#include <stingray/hdmi/IHDMI.h>
#include <stingray/media/ImageFileMediaData.h>
#include <stingray/media/MediaInfoBase.h>
#include <stingray/media/formats/flv/MediaInfo.h>
#include <stingray/media/formats/mp3/Mp3MediaInfo.h>
#include <stingray/media/formats/mp4/MediaInfo.h>
#include <stingray/media/formats/mp4/Stream.h>
#include <stingray/media/formats/mp4/SubstreamDescriptors.h>
#include <stingray/mpeg/ContentDescription.h>
#include <stingray/mpeg/PvrDescription.h>
#include <stingray/mpeg/Stream.h>
#include <stingray/net/DHCPInterfaceConfiguration.h>
#include <stingray/net/IgnoredInterfaceConfiguration.h>
#include <stingray/net/LinkLocalInterfaceConfiguration.h>
#include <stingray/net/ManualInterfaceConfiguration.h>
#include <stingray/net/NetworkConfiguration.h>
#include <stingray/parentalcontrol/AgeRating.h>
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/Channel.h>
#endif
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/EmuScanPerformerFactory.h>
#endif
#ifdef PLATFORM_MSTAR
#	include <stingray/platform/mstar/crypto/HardwareCipherKey.h>
#endif
#ifdef PLATFORM_OPENSSL
#	include <stingray/platform/openssl/crypto/Certificate.h>
#endif
#ifdef PLATFORM_OPENSSL
#	include <stingray/platform/openssl/crypto/CertificateRevocationList.h>
#endif
#ifdef PLATFORM_OPENSSL
#	include <stingray/platform/openssl/crypto/EvpKey.h>
#endif
#ifdef PLATFORM_STAPI
#	include <stingray/platform/stapi/crypto/HardwareCipherKey.h>
#endif
#include <stingray/pushvod/pushvod_emu/PushVODEmulationMovie.h>
#include <stingray/records/FileSystemRecord.h>
#include <stingray/rpc/UrlObjectId.h>
#include <stingray/scanner/DVBBandInfo.h>
#include <stingray/scanner/DVBServiceId.h>
#include <stingray/scanner/DefaultMpegService.h>
#include <stingray/scanner/DefaultMpegSubstreamDescriptor.h>
#include <stingray/scanner/DefaultScanParams.h>
#include <stingray/scanner/DefaultScanPerformerFactory.h>
#include <stingray/scanner/DreCasGeographicRegion.h>
#include <stingray/scanner/LybidScanParams.h>
#include <stingray/scanner/LybidScanPerformerFactory.h>
#include <stingray/scanner/StreamableServiceMetaInfo.h>
#include <stingray/scanner/TerrestrialScanParams.h>
#include <stingray/scanner/TricolorGeographicRegion.h>
#include <stingray/scanner/TricolorScanParams.h>
#include <stingray/scanner/TricolorScanPerformerFactory.h>
#include <stingray/scanner/lybid/LybidServiceMetaInfo.h>
#include <stingray/scanner/terrestrial/TerrestrialServiceMetaInfo.h>
#include <stingray/scanner/tricolor/AutoCreatedListMetaInfo.h>
#include <stingray/scanner/tricolor/TricolorServiceMetaInfo.h>
#include <stingray/stats/StatisticChannelInfo.h>
#include <stingray/streams/PlaybackStreamContent.h>
#include <stingray/streams/RecordStreamContent.h>
#include <stingray/streams/RecordStreamMetaInfo.h>
#include <stingray/time/BuiltinTimeSourceId.h>
#include <stingray/time/TDTTimeSourceId.h>
#include <stingray/time/TransportsTimeSourceObtainer.h>
#include <stingray/tuners/TunerState.h>
#include <stingray/tuners/dvbc/DVBCTransport.h>
#include <stingray/tuners/dvbs/Antenna.h>
#include <stingray/tuners/dvbs/DefaultDVBSTransport.h>
#include <stingray/tuners/dvbs/Satellite.h>
#include <stingray/tuners/dvbt/DVBTTransport.h>
#include <stingray/tuners/ip/TsOverIpTransport.h>
#include <stingray/update/VersionRequirement.h>
#include <stingray/update/system/CopyFile.h>
#include <stingray/update/system/EraseFlashPartition.h>
#include <stingray/update/system/MountFilesystem.h>
#include <stingray/update/system/MoveFile.h>
#include <stingray/update/system/RemoveFile.h>
#include <stingray/update/system/UnmountFilesystem.h>
#include <stingray/update/system/WriteFlashPartition.h>

/* WARNING! This is autogenerated file, DO NOT EDIT! */

namespace stingray { namespace Detail
{
	void Factory::RegisterTypes()
	{
#ifdef BUILD_SHARED_LIB
		/*nothing*/
#else
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::NoSubscriptionRecordError);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::SimpleRecordError);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ActivationKeyIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::PersonalCodeIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::PlatformNameIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ReceiverTraitIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AppChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::CinemaHallScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ContinuousScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::DeferredStandby);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::InfiniteScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BasicSubscriptionLease);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BasicSubscriptionProvider);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BissSubscription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Dre4Provider);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Dre4Subscription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(SubscriptionBundle);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(PlainCipherKey);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBSReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HouseholdClientTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HouseholdServerTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidOperatorTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(SatIpClientTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorOperatorTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HDMIConfig);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ImageFileMediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ImageFileMediaPreview);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(InMemoryImageMediaPreview);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MediaInfoBase);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(flv::MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Mp3MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Mp4MediaAudioSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Mp4MediaVideoSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::ContentDescription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::PvrDescription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DHCPInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(IgnoredInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LinkLocalInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ManualInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Detail::any::ObjectHolder<NetworkConfigurationStatus>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AgeRating);
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuServiceId);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::RadioChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::SubstreamDescriptor);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::TVChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuScanPerformerFactory);
#endif
#ifdef PLATFORM_MSTAR
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mstar::HardwareCipherKey);
#endif
#ifdef PLATFORM_OPENSSL
		TOOLKIT_REGISTER_CLASS_EXPLICIT(openssl::Certificate);
#endif
#ifdef PLATFORM_OPENSSL
		TOOLKIT_REGISTER_CLASS_EXPLICIT(openssl::CertificateRevocationList);
#endif
#ifdef PLATFORM_OPENSSL
		TOOLKIT_REGISTER_CLASS_EXPLICIT(openssl::EvpKey);
#endif
#ifdef PLATFORM_STAPI
		TOOLKIT_REGISTER_CLASS_EXPLICIT(stapi::HardwareCipherKey);
#endif
		TOOLKIT_REGISTER_CLASS_EXPLICIT(PushVODEmulationMovie);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(FileSystemRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(rpc::UrlObjectId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBServiceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegRadioChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegService);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegTVChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegAudioSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegDataCarouselSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegPcrSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegSubtitlesSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextBasedSubtitlesSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegVideoSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DreCasGeographicRegion);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(StreamableServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TerrestrialScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorGeographicRegion);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TerrestrialServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AutoCreatedListMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Detail::any::ObjectHolder<stingray::StatisticChannelInfo>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(PlaybackStreamContent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamContent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BuiltinTimeSourceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TDTTimeSourceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TransportTimeOffset);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(CircuitedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LockedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(UnlockedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Antenna);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBSTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Satellite);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TsOverIpTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(VersionRequirement);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(CopyFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(EraseFlashPartition);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MountFilesystem);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MoveFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RemoveFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(UnmountFilesystem);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(WriteFlashPartition);
#endif
	}
}}
<commit_msg>update factory classes<commit_after>#include <stingray/toolkit/Factory.h>

#include <stingray/toolkit/any.h>

#include <stingray/app/RecordErrors.h>
#include <stingray/app/activation_manager/ActivationIntent.h>
#include <stingray/app/application_context/AppChannel.h>
#include <stingray/app/application_context/ChannelList.h>
#include <stingray/app/scheduler/ScheduledEvents.h>
#include <stingray/ca/BasicSubscriptionLease.h>
#include <stingray/ca/BissConditionalAccess.h>
#include <stingray/ca/DreSubscription.h>
#include <stingray/ca/SubscriptionBundle.h>
#include <stingray/crypto/SoftwareCipherKey.h>
#include <stingray/details/IReceiverTrait.h>
#include <stingray/hdmi/IHDMI.h>
#include <stingray/media/ImageFileMediaData.h>
#include <stingray/media/MediaInfoBase.h>
#include <stingray/media/formats/flv/MediaInfo.h>
#include <stingray/media/formats/mp3/Mp3MediaInfo.h>
#include <stingray/media/formats/mp4/MediaInfo.h>
#include <stingray/media/formats/mp4/Stream.h>
#include <stingray/media/formats/mp4/SubstreamDescriptors.h>
#include <stingray/mpeg/ContentDescription.h>
#include <stingray/mpeg/PvrDescription.h>
#include <stingray/mpeg/Stream.h>
#include <stingray/net/DHCPInterfaceConfiguration.h>
#include <stingray/net/IgnoredInterfaceConfiguration.h>
#include <stingray/net/LinkLocalInterfaceConfiguration.h>
#include <stingray/net/ManualInterfaceConfiguration.h>
#include <stingray/net/NetworkConfiguration.h>
#include <stingray/parentalcontrol/AgeRating.h>
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/Channel.h>
#endif
#ifdef PLATFORM_EMU
#	include <stingray/platform/emu/scanner/EmuScanPerformerFactory.h>
#endif
#ifdef PLATFORM_MSTAR
#	include <stingray/platform/mstar/crypto/HardwareCipherKey.h>
#endif
#ifdef PLATFORM_STAPI
#	include <stingray/platform/stapi/crypto/HardwareCipherKey.h>
#endif
#include <stingray/pushvod/pushvod_emu/PushVODEmulationMovie.h>
#include <stingray/records/FileSystemRecord.h>
#include <stingray/rpc/UrlObjectId.h>
#include <stingray/scanner/DVBBandInfo.h>
#include <stingray/scanner/DVBServiceId.h>
#include <stingray/scanner/DefaultMpegService.h>
#include <stingray/scanner/DefaultMpegSubstreamDescriptor.h>
#include <stingray/scanner/DefaultScanParams.h>
#include <stingray/scanner/DefaultScanPerformerFactory.h>
#include <stingray/scanner/DreCasGeographicRegion.h>
#include <stingray/scanner/LybidScanParams.h>
#include <stingray/scanner/LybidScanPerformerFactory.h>
#include <stingray/scanner/StreamableServiceMetaInfo.h>
#include <stingray/scanner/TerrestrialScanParams.h>
#include <stingray/scanner/TricolorGeographicRegion.h>
#include <stingray/scanner/TricolorScanParams.h>
#include <stingray/scanner/TricolorScanPerformerFactory.h>
#include <stingray/scanner/lybid/LybidServiceMetaInfo.h>
#include <stingray/scanner/terrestrial/TerrestrialServiceMetaInfo.h>
#include <stingray/scanner/tricolor/AutoCreatedListMetaInfo.h>
#include <stingray/scanner/tricolor/TricolorServiceMetaInfo.h>
#include <stingray/stats/StatisticChannelInfo.h>
#include <stingray/streams/PlaybackStreamContent.h>
#include <stingray/streams/RecordStreamContent.h>
#include <stingray/streams/RecordStreamMetaInfo.h>
#include <stingray/time/BuiltinTimeSourceId.h>
#include <stingray/time/TDTTimeSourceId.h>
#include <stingray/time/TransportsTimeSourceObtainer.h>
#include <stingray/tuners/TunerState.h>
#include <stingray/tuners/dvbc/DVBCTransport.h>
#include <stingray/tuners/dvbs/Antenna.h>
#include <stingray/tuners/dvbs/DefaultDVBSTransport.h>
#include <stingray/tuners/dvbs/Satellite.h>
#include <stingray/tuners/dvbt/DVBTTransport.h>
#include <stingray/tuners/ip/TsOverIpTransport.h>
#include <stingray/update/VersionRequirement.h>
#include <stingray/update/system/CopyFile.h>
#include <stingray/update/system/EraseFlashPartition.h>
#include <stingray/update/system/MountFilesystem.h>
#include <stingray/update/system/MoveFile.h>
#include <stingray/update/system/RemoveFile.h>
#include <stingray/update/system/UnmountFilesystem.h>
#include <stingray/update/system/WriteFlashPartition.h>

/* WARNING! This is autogenerated file, DO NOT EDIT! */

namespace stingray { namespace Detail
{
	void Factory::RegisterTypes()
	{
#ifdef BUILD_SHARED_LIB
		/*nothing*/
#else
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::NoSubscriptionRecordError);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::SimpleRecordError);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ActivationKeyIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::PersonalCodeIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::PlatformNameIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ReceiverTraitIntent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::AppChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ChannelList);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::CinemaHallScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ContinuousScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::DeferredStandby);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::InfiniteScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledEvent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(app::ScheduledViewing);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BasicSubscriptionLease);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BasicSubscriptionProvider);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BissSubscription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Dre4Provider);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Dre4Subscription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(SubscriptionBundle);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(SoftwareCipherKey);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBSReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTReceiverTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HouseholdClientTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HouseholdServerTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidOperatorTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(SatIpClientTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorOperatorTrait);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(HDMIConfig);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ImageFileMediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ImageFileMediaPreview);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(InMemoryImageMediaPreview);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MediaInfoBase);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(flv::MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Mp3MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::MediaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Mp4MediaAudioSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mp4::Mp4MediaVideoSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::ContentDescription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::PvrDescription);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mpeg::Stream);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DHCPInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(IgnoredInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LinkLocalInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(ManualInterfaceConfiguration);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Detail::any::ObjectHolder<NetworkConfigurationStatus>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AgeRating);
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuServiceId);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::RadioChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::SubstreamDescriptor);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::TVChannel);
#endif
#ifdef PLATFORM_EMU
		TOOLKIT_REGISTER_CLASS_EXPLICIT(emu::EmuScanPerformerFactory);
#endif
#ifdef PLATFORM_MSTAR
		TOOLKIT_REGISTER_CLASS_EXPLICIT(mstar::HardwareCipherKey);
#endif
#ifdef PLATFORM_STAPI
		TOOLKIT_REGISTER_CLASS_EXPLICIT(stapi::HardwareCipherKey);
#endif
		TOOLKIT_REGISTER_CLASS_EXPLICIT(PushVODEmulationMovie);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(FileSystemRecord);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(rpc::UrlObjectId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTBandInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBServiceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegRadioChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegService);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultMpegTVChannel);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegAudioSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegDataCarouselSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegPcrSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegSubtitlesSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextBasedSubtitlesSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegTeletextSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MpegVideoSubstreamDescriptor);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DreCasGeographicRegion);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(StreamableServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TerrestrialScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorGeographicRegion);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorScanParams);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorScanPerformerFactory);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LybidServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TerrestrialServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(AutoCreatedListMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TricolorServiceMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Detail::any::ObjectHolder<stingray::StatisticChannelInfo>);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(PlaybackStreamContent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamContent);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RecordStreamMetaInfo);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(BuiltinTimeSourceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TDTTimeSourceId);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TransportTimeOffset);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(CircuitedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(LockedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(UnlockedTunerState);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBCTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Antenna);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DefaultDVBSTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(Satellite);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(DVBTTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(TsOverIpTransport);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(VersionRequirement);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(CopyFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(EraseFlashPartition);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MountFilesystem);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(MoveFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(RemoveFile);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(UnmountFilesystem);
		TOOLKIT_REGISTER_CLASS_EXPLICIT(WriteFlashPartition);
#endif
	}
}}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: editxml.hxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: cl $ $Date: 2001-07-20 13:49:51 $
 *
 *  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 _SVX_EDITXML_HXX
#define _SVX_EDITXML_HXX

class EditEngine;
class SvStream;
struct ESelection;

/** this function exports the selected content of an edit engine into a xml stream*/
extern void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );

/** this function imports xml from the stream into the selected of an edit engine */
extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );

#endif

<commit_msg>INTEGRATION: CWS ooo19126 (1.2.1654); FILE MERGED 2005/09/05 14:25:03 rt 1.2.1654.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: editxml.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 23:13:22 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _SVX_EDITXML_HXX
#define _SVX_EDITXML_HXX

class EditEngine;
class SvStream;
struct ESelection;

/** this function exports the selected content of an edit engine into a xml stream*/
extern void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );

/** this function imports xml from the stream into the selected of an edit engine */
extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );

#endif

<|endoftext|>


<commit_before><commit_msg>fix warnings in glog symbolize<commit_after><|endoftext|>


<commit_before><commit_msg>From Olivier: - in TPad::x3d: delete fViewer3D, if it exists, before creating a new 3D<commit_after><|endoftext|>


<commit_before>//======================================================================
//-----------------------------------------------------------------------
/**
 * @file		iutest_tap_printer_listener_tests.cpp
 * @brief		TAPPrintListener test
 *
 * @author		t.shirayanagi
 * @par			copyright
 * Copyright (C) 2014, Takazumi Shirayanagi\n
 * This software is released under the new BSD License,
 * see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

//======================================================================
// include
#include "iutest.hpp"
#include "../include/listener/iutest_tap_printer.hpp"
#include "iutest_logger_tests.hpp"

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_STRINGSTREAM && IUTEST_HAS_ASSERTION_RETURN
#  define TAP_TEST	1
#else
#  define TAP_TEST	0
#endif

#if TAP_TEST

class FileIO : public ::iutest::StringStreamFile
{
public:
	static ::std::string s_io;

	virtual void Close()
	{
		s_io += ss.str();
	}
};

::std::string FileIO::s_io;

IUTEST_FILESYSTEM_INSTANTIATE(FileIO);

const char tap_test_str[] =
"# Foo started.\n"
"ok 1 - Ok\n"
"# Foo ended.\n"
"1..1\n"
"# Bar started.\n"
"ok 1 # SKIP - DISABLED_Ng\n"
"# Bar ended.\n"
"1..1\n"
;

IUTEST(Foo, Ok)
{
	IUTEST_SUCCEED() << "not show.";
}

IUTEST(Bar, DISABLED_Ng)
{
	IUTEST_FAIL() << "show failed.\n test.";
}

#endif

#ifdef UNICODE
int wmain(int argc, wchar_t* argv[])
#else
int main(int argc, char* argv[])
#endif
{
#if TAP_TEST

	IUTEST_INIT(&argc, argv);
#if defined(OUTPUTXML)
	// 失敗テストを含むので xml 出力しない
	::iutest::IUTEST_FLAG(output) = NULL;
#endif

#if !defined(IUTEST_USE_GTEST)
	::iutest::TAPFileGeneratorListener::SetUp();
#endif

	{
		if( IUTEST_RUN_ALL_TESTS() != 0 ) return 1;

#if !defined(IUTEST_USE_GTEST)
		IUTEST_EXPECT_STREQ(tap_test_str, FileIO::s_io.c_str());
		FileIO::s_io.clear();
#endif
		if( ::iutest::UnitTest::GetInstance()->Failed() ) return 1;
	}

	{
		::iutest::IUTEST_FLAG(filter) = "*Hoge*";
		::iutest::IUTEST_FLAG(also_run_disabled_tests) = false;
		if( IUTEST_RUN_ALL_TESTS() != 0 ) return 1;

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_ASSERTION_RETURN
		IUTEST_EXPECT_STRIN("*Hoge*", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		FileIO::s_io.clear();
#endif
	}

	{
		::iutest::IUTEST_FLAG(filter) = NULL;
		::iutest::IUTEST_FLAG(also_run_disabled_tests) = true;
		if( IUTEST_RUN_ALL_TESTS() == 0 ) return 1;

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_ASSERTION_RETURN
		IUTEST_EXPECT_STRIN("not ok", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		IUTEST_EXPECT_STRIN("show failed., test.", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		FileIO::s_io.clear();
#endif
	}

	printf("*** Successful ***\n");
#else
	(void)argc;
	(void)argv;
	printf("*** TAP_TEST=0 ***\n");
#endif
	return 0;
}
<commit_msg>update r749<commit_after>//======================================================================
//-----------------------------------------------------------------------
/**
 * @file		iutest_tap_printer_listener_tests.cpp
 * @brief		TAPPrintListener test
 *
 * @author		t.shirayanagi
 * @par			copyright
 * Copyright (C) 2014, Takazumi Shirayanagi\n
 * This software is released under the new BSD License,
 * see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

//======================================================================
// include
#include "iutest.hpp"
#include "../include/listener/iutest_tap_printer.hpp"
#include "iutest_logger_tests.hpp"

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_STRINGSTREAM && IUTEST_HAS_ASSERTION_RETURN
#  define TAP_TEST	1
#else
#  define TAP_TEST	0
#endif

#if TAP_TEST

class FileIO : public ::iutest::StringStreamFile
{
public:
	static ::std::string s_io;

	virtual void Close()
	{
		s_io += ss.str();
	}
};

::std::string FileIO::s_io;

IUTEST_FILESYSTEM_INSTANTIATE(FileIO);

const char tap_test_str[] =
"# Foo started.\n"
"ok 1 - Ok\n"
"# Foo ended.\n"
"1..1\n"
"# Bar started.\n"
"ok 1 # SKIP - DISABLED_Ng\n"
"# Bar ended.\n"
"1..1\n"
;

IUTEST(Foo, Ok)
{
	IUTEST_SUCCEED() << "not show.";
}

IUTEST(Bar, DISABLED_Ng)
{
	IUTEST_FAIL() << "show failed.\n test.";
}

#endif

#ifdef UNICODE
int wmain(int argc, wchar_t* argv[])
#else
int main(int argc, char* argv[])
#endif
{
#if TAP_TEST

	IUTEST_INIT(&argc, argv);
	// xml 出力しない
	::iutest::IUTEST_FLAG(output) = NULL;

#if !defined(IUTEST_USE_GTEST)
	::iutest::TAPFileGeneratorListener::SetUp();
#endif

	{
		if( IUTEST_RUN_ALL_TESTS() != 0 ) return 1;

#if !defined(IUTEST_USE_GTEST)
		IUTEST_EXPECT_STREQ(tap_test_str, FileIO::s_io.c_str());
		FileIO::s_io.clear();
#endif
		if( ::iutest::UnitTest::GetInstance()->Failed() ) return 1;
	}

	{
		::iutest::IUTEST_FLAG(filter) = "*Hoge*";
		::iutest::IUTEST_FLAG(also_run_disabled_tests) = false;
		if( IUTEST_RUN_ALL_TESTS() != 0 ) return 1;

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_ASSERTION_RETURN
		IUTEST_EXPECT_STRIN("*Hoge*", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		FileIO::s_io.clear();
#endif
	}

	{
		::iutest::IUTEST_FLAG(filter) = NULL;
		::iutest::IUTEST_FLAG(also_run_disabled_tests) = true;
		if( IUTEST_RUN_ALL_TESTS() == 0 ) return 1;

#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_ASSERTION_RETURN
		IUTEST_EXPECT_STRIN("not ok", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		IUTEST_EXPECT_STRIN("show failed., test.", FileIO::s_io.c_str()) << ::iutest::AssertionReturn<int>(1);
		FileIO::s_io.clear();
#endif
	}

	printf("*** Successful ***\n");
#else
	(void)argc;
	(void)argv;
	printf("*** TAP_TEST=0 ***\n");
#endif
	return 0;
}
<|endoftext|>


<commit_before>#include "benchmark/benchmark_api.h"
#include "test_configs.h"
#include "test_utils.h"

#include<algorithm>
#include<deque>
#include<list>
#include<vector>

// TODO: reverse, rotate, shuffle, lower_bound, upper_bound
// uninitialized_fill, uninitialized_copy
// change data type (int, double, class { int, int }, and compare
// algorithms.

#ifndef NDEBUG
#include<iostream>
template<typename T>
std::ostream& operator<<(std::ostream& os,const std::vector<T>& v)
{
  for(typename std::vector<T>::const_iterator i = v.begin(); i!= v.end(); ++i)
    os<<*i<<' ';
  os<< "\n";
  return os;
}
#endif

template<typename V>
void BM_sort_std(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_random(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end());
  }
  state.SetComplexityN(N);
}

// Sort (a sequence in ascending order) in ascending order.
template<typename V>
void BM_sort_std_ascending(benchmark::State& state) {
  int N = state.range(0);
  using T = typename V::value_type;
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end(), std::less<T>());
  }
  state.SetComplexityN(N);
}

// Sort (a sequence in ascending order) in descending order.
template<typename V>
void BM_sort_std_descending(benchmark::State& state) {
  int N = state.range(0);
  using T = typename V::value_type;
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end(), std::greater<T>());
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_sort_stable(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_random(v);
  while (state.KeepRunning()) {
    std::stable_sort(v.begin(), v.end());
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_search_linear(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    // searching for all the elements.
    for (int i = 0; i < N; ++i) {
      auto j = std::find(v.begin(), v.end(), i);
      benchmark::DoNotOptimize(j);
      assert(std::distance(v.begin(), j) == i); // j is the i-th element in v
    }
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_search_binary(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    // searching for all the elements.
    for (int i = 0; i < N; ++i) {
      auto j = std::lower_bound(v.begin(), v.end(), i);
      benchmark::DoNotOptimize(j);
      assert(std::distance(v.begin(), j) == i); // j is the i-th element in v
    }
  }
  state.SetComplexityN(N);
}

static const int MSize = L1;

#define COMPLEXITY_BENCHMARK_GEN_T(T) \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::vector<T>, MSize); \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::list<T>, MSize); \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::deque<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::list<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::deque<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std_ascending, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std_descending, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_stable, std::vector<T>, MSize);

// TODO: Find a better name for TYPED_BENCHMARK

COMPLEXITY_BENCHMARK_GEN_T(int)
//COMPLEXITY_BENCHMARK_GEN_T(double)
COMPLEXITY_BENCHMARK_GEN_T(aggregate)

BENCHMARK_MAIN()
<commit_msg>adding sorting of std::list with the help of a vector<commit_after>#include "benchmark/benchmark_api.h"
#include "test_configs.h"
#include "test_utils.h"

#include<algorithm>
#include<deque>
#include<list>
#include<vector>

// TODO: reverse, rotate, shuffle, lower_bound, upper_bound
// uninitialized_fill, uninitialized_copy
// change data type (int, double, class { int, int }, and compare
// algorithms.

#ifndef NDEBUG
#include<iostream>
template<typename T>
std::ostream& operator<<(std::ostream& os,const std::vector<T>& v)
{
  for(typename std::vector<T>::const_iterator i = v.begin(); i!= v.end(); ++i)
    os<<*i<<' ';
  os<< "\n";
  return os;
}
#endif

template<typename V>
void BM_sort_std(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_random(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end());
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_sort_std_list_with_vector(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_random(v);
  using T = typename V::value_type;
  // Copy the contents into a vector
  while (state.KeepRunning()) {
    std::vector<T> vec(v.begin(), v.end());
    // Sort the vector
    std::sort(vec.begin(), vec.end());
    // Put the item back in the list
    v.assign(vec.begin(), vec.end());
  }
  state.SetComplexityN(N);
}

// Sort (a sequence in ascending order) in ascending order.
template<typename V>
void BM_sort_std_ascending(benchmark::State& state) {
  int N = state.range(0);
  using T = typename V::value_type;
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end(), std::less<T>());
  }
  state.SetComplexityN(N);
}

// Sort (a sequence in ascending order) in descending order.
template<typename V>
void BM_sort_std_descending(benchmark::State& state) {
  int N = state.range(0);
  using T = typename V::value_type;
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    std::sort(v.begin(), v.end(), std::greater<T>());
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_sort_stable(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_random(v);
  while (state.KeepRunning()) {
    std::stable_sort(v.begin(), v.end());
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_search_linear(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    // searching for all the elements.
    for (int i = 0; i < N; ++i) {
      auto j = std::find(v.begin(), v.end(), i);
      benchmark::DoNotOptimize(j);
      assert(std::distance(v.begin(), j) == i); // j is the i-th element in v
    }
  }
  state.SetComplexityN(N);
}

template<typename V>
void BM_search_binary(benchmark::State& state) {
  int N = state.range(0);
  V v(N);
  fill_seq(v);
  while (state.KeepRunning()) {
    // searching for all the elements.
    for (int i = 0; i < N; ++i) {
      auto j = std::lower_bound(v.begin(), v.end(), i);
      benchmark::DoNotOptimize(j);
      assert(std::distance(v.begin(), j) == i); // j is the i-th element in v
    }
  }
  state.SetComplexityN(N);
}

static const int MSize = L1;

#define COMPLEXITY_BENCHMARK_GEN_T(T) \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::vector<T>, MSize); \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::list<T>, MSize); \
    COMPLEXITY_BENCHMARK_GEN(BM_search_linear, std::deque<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::list<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_search_binary, std::deque<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std_ascending, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_std_descending, std::vector<T>, MSize);\
    COMPLEXITY_BENCHMARK_GEN(BM_sort_stable, std::vector<T>, MSize);

// TODO: Find a better name for TYPED_BENCHMARK

COMPLEXITY_BENCHMARK_GEN_T(int)
//COMPLEXITY_BENCHMARK_GEN_T(double)
COMPLEXITY_BENCHMARK_GEN_T(aggregate)

COMPLEXITY_BENCHMARK_GEN(BM_sort_std_list_with_vector, std::list<int>, MSize);
COMPLEXITY_BENCHMARK_GEN(BM_sort_std_list_with_vector, std::list<aggregate>, MSize);

BENCHMARK_MAIN()
<|endoftext|>


<commit_before>#pragma once

#include <iostream>
#include <unordered_map>
#include <map>
#include <tuple>
#include <type_traits>
#include "base/header.hpp"
#include "base/function_traits.hpp"
#include "base/thread_pool.hpp"
#include "base/logger.hpp"
#include "base/singleton.hpp"
#include "base/serialize_util.hpp"
#include "connection.hpp"

namespace czrpc
{
namespace server
{
class invoker_function
{
public:
    using function_t = std::function<void(const message_ptr&, message_ptr&)>;
    invoker_function() = default;
    invoker_function(const function_t& func) : func_(func) {}

    void operator()(const std::string& call_id, const std::string& message_name,
                    const std::string& body, const connection_ptr& conn)
    {
        try
        {
            message_ptr out_message;
            func_(serialize_util::singleton::get()->deserialize(message_name, body), out_message);
            std::string in_message_name = out_message->GetDescriptor()->full_name();
            std::string in_body = serialize_util::singleton::get()->serialize(out_message);
            if (!in_message_name.empty() && !in_body.empty())
            {
                conn->async_write(response_content{ call_id, in_message_name, in_body });
            }
        }
        catch (std::exception& e)
        {
            log_warn(e.what());
            conn->disconnect();
        }
    }

private:
    function_t func_ = nullptr;
};

class invoker_function_raw
{
public:
    using function_t = std::function<void(const std::string&, std::string&)>;
    invoker_function_raw() = default;
    invoker_function_raw(const function_t& func) : func_(func) {}

    void operator()(const std::string& call_id, const std::string& body, const connection_ptr& conn)
    {
        try
        {
            std::string out_body;
            func_(body, out_body);
            if (!out_body.empty())
            {
                conn->async_write(response_content{ call_id, "", out_body });
            }
        }
        catch (std::exception& e)
        {
            log_warn(e.what());
            conn->disconnect();
        }
    }

private:
    function_t func_ = nullptr;
};

class router
{
    DEFINE_SINGLETON(router);
public:
    router() = default;

    void multithreaded(std::size_t num)
    {
        threadpool_.init_thread_num(num);
    }

    void stop()
    {
        threadpool_.stop();
    }

    template<typename Function>
    void bind(const std::string& protocol, const Function& func)
    {
        bind_non_member_func(protocol, func);
    }

    template<typename Function, typename Self>
    void bind(const std::string& protocol, const Function& func, Self* self)
    {
        bind_member_func(protocol, func, self);
    }

    void unbind(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_.erase(protocol);
    }

    bool is_bind(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        auto iter = invoker_map_.find(protocol);
        if (iter != invoker_map_.end())
        {
            return true;
        }
        return false;
    }

    template<typename Function>
    void bind_raw(const std::string& protocol, const Function& func)
    {
        bind_non_member_func_raw(protocol, func);
    }

    template<typename Function, typename Self>
    void bind_raw(const std::string& protocol, const Function& func, Self* self)
    {
        bind_member_func_raw(protocol, func, self);
    }

    void unbind_raw(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_.erase(protocol);
    }

    bool is_bind_raw(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        auto iter = invoker_raw_map_.find(protocol);
        if (iter != invoker_raw_map_.end())
        {
            return true;
        }
        return false;
    }

    bool route(const request_content& content, const client_flag& flag, const connection_ptr& conn)
    {
        if (flag.type == client_type::rpc_client)
        {
            if (flag.mode == serialize_mode::serialize)
            {
                std::lock_guard<std::mutex> lock(map_mutex_);
                auto iter = invoker_map_.find(content.protocol);
                if (iter == invoker_map_.end())
                {
                    return false;
                }
                threadpool_.add_task(iter->second, content.call_id, content.message_name, content.body, conn);
            }
            else if (flag.mode == serialize_mode::non_serialize)
            {
                std::lock_guard<std::mutex> lock(raw_map_mutex_);
                auto iter = invoker_raw_map_.find(content.protocol);
                if (iter == invoker_raw_map_.end())
                {
                    return false;
                }
                threadpool_.add_task(iter->second, content.call_id, content.body, conn);
            }
            else
            {
                log_warn("Invaild serialize mode: {}", static_cast<unsigned int>(flag.mode));
                return false;
            }
        }
        else if (flag.type == client_type::pub_client)
        {
            threadpool_.add_task(pub_coming_helper_, content.protocol, content.body, flag.mode);
        }
        else if (flag.type == client_type::sub_client)
        {
            threadpool_.add_task(sub_coming_helper_, content.protocol, content.body, conn);
        }
        else
        {
            log_warn("Invaild client type: {}", static_cast<unsigned int>(flag.type));
            return false;
        }

        return true;
    }

private:
    template<typename Function>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(const message_ptr&)>::type>::value>::type
    call(const Function& func, const message_ptr& in_message, message_ptr&)
    {
        func(in_message);
    }

    template<typename Function>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(const message_ptr&)>::type>::value>::type
    call(const Function& func, const message_ptr& in_message, message_ptr& out_message)
    {
        out_message = func(in_message);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(Self, const message_ptr&)>::type>::value>::type
    call_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr&)
    {
        (*self.*func)(in_message);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(Self, const message_ptr&)>::type>::value>::type
    call_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr& out_message)
    {
        out_message = (*self.*func)(in_message);
    }

    template<typename Function>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(const std::string&)>::type>::value>::type
    call_raw(const Function& func, const std::string& body, std::string&)
    {
        func(body);
    }

    template<typename Function>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(const std::string&)>::type>::value>::type
    call_raw(const Function& func, const std::string& body, std::string& out_body)
    {
        out_body = func(body);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(Self, const std::string&)>::type>::value>::type
    call_member_raw(const Function& func, Self* self, const std::string& body, std::string&)
    {
        (*self.*func)(body);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(Self, const std::string&)>::type>::value>::type
    call_member_raw(const Function& func, Self* self, const std::string& body, std::string& out_body)
    {
        out_body = (*self.*func)(body);
    }

private:
    template<typename Function>
    class invoker
    {
    public:
        static void apply(const Function& func, const message_ptr& in_message, message_ptr& out_message)
        {
            try
            {
                call(func, in_message, out_message);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }

        template<typename Self>
        static void apply_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr& out_message)
        {
            try
            {
                call_member(func, self, in_message, out_message);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }
    };

    template<typename Function>
    class invoker_raw
    {
    public:
        static void apply(const Function& func, const std::string& body, std::string& out_body)
        {
            try
            {
                call_raw(func, body, out_body);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }

        template<typename Self>
        static void apply_member(const Function& func, Self* self, const std::string& body, std::string& out_body)
        {
            try
            {
                call_member_raw(func, self, body, out_body);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }
    };

    struct pub_coming_helper
    {
        void operator()(const std::string& topic_name, const std::string& body, serialize_mode mode)
        {
            router::singleton::get()->publisher_coming_(topic_name, body, mode);
        }
    };

    struct sub_coming_helper
    {
        void operator()(const std::string& topic_name, const std::string& body, const connection_ptr& conn)
        {
            router::singleton::get()->subscriber_coming_(topic_name, body, conn);
        }
    };

private:
    template<typename Function>
    void bind_non_member_func(const std::string& protocol, const Function& func)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_[protocol] = { std::bind(&invoker<Function>::apply, func,
                                                std::placeholders::_1, std::placeholders::_2) };
    }

    template<typename Function, typename Self>
    void bind_member_func(const std::string& protocol, const Function& func, Self* self)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_[protocol] = { std::bind(&invoker<Function>::template apply_member<Self>, func, self,
                                                std::placeholders::_1, std::placeholders::_2) };
    }

    template<typename Function>
    void bind_non_member_func_raw(const std::string& protocol, const Function& func)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_[protocol] = { std::bind(&invoker_raw<Function>::apply, func,
                                                std::placeholders::_1, std::placeholders::_2) };
    }

    template<typename Function, typename Self>
    void bind_member_func_raw(const std::string& protocol, const Function& func, Self* self)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_[protocol] = { std::bind(&invoker_raw<Function>::template apply_member<Self>, func, self,
                                                std::placeholders::_1, std::placeholders::_2) };
    }

public:
    using pub_comming_callback = std::function<void(const std::string&, const std::string&, serialize_mode)>;
    using sub_comming_callback = std::function<void(const std::string&, const std::string&, const connection_ptr&)>;
    pub_comming_callback publisher_coming_ = nullptr;
    sub_comming_callback subscriber_coming_ = nullptr;

private:
    thread_pool threadpool_;
    std::unordered_map<std::string, invoker_function> invoker_map_;
    std::unordered_map<std::string, invoker_function_raw> invoker_raw_map_;
    std::mutex map_mutex_;
    std::mutex raw_map_mutex_;
    pub_coming_helper pub_coming_helper_;
    sub_coming_helper sub_coming_helper_;
};

}
}

<commit_msg>update router<commit_after>#pragma once

#include <iostream>
#include <unordered_map>
#include <map>
#include <tuple>
#include <type_traits>
#include "base/header.hpp"
#include "base/function_traits.hpp"
#include "base/thread_pool.hpp"
#include "base/logger.hpp"
#include "base/singleton.hpp"
#include "base/serialize_util.hpp"
#include "connection.hpp"

namespace czrpc
{
namespace server
{
class invoker_function
{
public:
    using function_t = std::function<void(const message_ptr&, message_ptr&)>;
    invoker_function() = default;
    invoker_function(const function_t& func) : func_(func) {}

    void operator()(const std::string& call_id, const std::string& message_name,
                    const std::string& body, const connection_ptr& conn)
    {
        try
        {
            message_ptr out_message;
            func_(serialize_util::singleton::get()->deserialize(message_name, body), out_message);
            std::string in_message_name = out_message->GetDescriptor()->full_name();
            std::string in_body = serialize_util::singleton::get()->serialize(out_message);
            if (!in_message_name.empty() && !in_body.empty())
            {
                conn->async_write(response_content{ call_id, in_message_name, in_body });
            }
        }
        catch (std::exception& e)
        {
            log_warn(e.what());
            conn->disconnect();
        }
    }

private:
    function_t func_ = nullptr;
};

class invoker_function_raw
{
public:
    using function_t = std::function<void(const std::string&, std::string&)>;
    invoker_function_raw() = default;
    invoker_function_raw(const function_t& func) : func_(func) {}

    void operator()(const std::string& call_id, const std::string& body, const connection_ptr& conn)
    {
        try
        {
            std::string out_body;
            func_(body, out_body);
            if (!out_body.empty())
            {
                conn->async_write(response_content{ call_id, "", out_body });
            }
        }
        catch (std::exception& e)
        {
            log_warn(e.what());
            conn->disconnect();
        }
    }

private:
    function_t func_ = nullptr;
};

class router
{
    DEFINE_SINGLETON(router);
public:
    router() = default;

    void multithreaded(std::size_t num)
    {
        threadpool_.init_thread_num(num);
    }

    void stop()
    {
        threadpool_.stop();
    }

    template<typename Function>
    void bind(const std::string& protocol, const Function& func)
    {
        bind_non_member_func(protocol, func);
    }

    template<typename Function, typename Self>
    void bind(const std::string& protocol, const Function& func, Self* self)
    {
        bind_member_func(protocol, func, self);
    }

    void unbind(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_.erase(protocol);
    }

    bool is_bind(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        auto iter = invoker_map_.find(protocol);
        if (iter != invoker_map_.end())
        {
            return true;
        }
        return false;
    }

    template<typename Function>
    void bind_raw(const std::string& protocol, const Function& func)
    {
        bind_non_member_func_raw(protocol, func);
    }

    template<typename Function, typename Self>
    void bind_raw(const std::string& protocol, const Function& func, Self* self)
    {
        bind_member_func_raw(protocol, func, self);
    }

    void unbind_raw(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_.erase(protocol);
    }

    bool is_bind_raw(const std::string& protocol)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        auto iter = invoker_raw_map_.find(protocol);
        if (iter != invoker_raw_map_.end())
        {
            return true;
        }
        return false;
    }

    bool route(const request_content& content, const client_flag& flag, const connection_ptr& conn)
    {
        if (flag.type == client_type::rpc_client)
        {
            if (flag.mode == serialize_mode::serialize)
            {
                std::lock_guard<std::mutex> lock(map_mutex_);
                auto iter = invoker_map_.find(content.protocol);
                if (iter == invoker_map_.end())
                {
                    return false;
                }
                threadpool_.add_task(iter->second, content.call_id, content.message_name, content.body, conn);
            }
            else if (flag.mode == serialize_mode::non_serialize)
            {
                std::lock_guard<std::mutex> lock(raw_map_mutex_);
                auto iter = invoker_raw_map_.find(content.protocol);
                if (iter == invoker_raw_map_.end())
                {
                    return false;
                }
                threadpool_.add_task(iter->second, content.call_id, content.body, conn);
            }
            else
            {
                log_warn("Invaild serialize mode: {}", static_cast<unsigned int>(flag.mode));
                return false;
            }
        }
        else if (flag.type == client_type::pub_client)
        {
            threadpool_.add_task(pub_coming_helper_, content.protocol, content.body, flag.mode);
        }
        else if (flag.type == client_type::sub_client)
        {
            threadpool_.add_task(sub_coming_helper_, content.protocol, content.body, conn);
        }
        else
        {
            log_warn("Invaild client type: {}", static_cast<unsigned int>(flag.type));
            return false;
        }

        return true;
    }

private:
    template<typename Function>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(const message_ptr&)>::type>::value>::type
    call(const Function& func, const message_ptr& in_message, message_ptr&)
    {
        func(in_message);
    }

    template<typename Function>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(const message_ptr&)>::type>::value>::type
    call(const Function& func, const message_ptr& in_message, message_ptr& out_message)
    {
        out_message = func(in_message);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(Self, const message_ptr&)>::type>::value>::type
    call_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr&)
    {
        (*self.*func)(in_message);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(Self, const message_ptr&)>::type>::value>::type
    call_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr& out_message)
    {
        out_message = (*self.*func)(in_message);
    }

    template<typename Function>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(const std::string&)>::type>::value>::type
    call_raw(const Function& func, const std::string& body, std::string&)
    {
        func(body);
    }

    template<typename Function>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(const std::string&)>::type>::value>::type
    call_raw(const Function& func, const std::string& body, std::string& out_body)
    {
        out_body = func(body);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<std::is_void<typename std::result_of<Function(Self, const std::string&)>::type>::value>::type
    call_member_raw(const Function& func, Self* self, const std::string& body, std::string&)
    {
        (*self.*func)(body);
    }

    template<typename Function, typename Self>
    static typename std::enable_if<!std::is_void<typename std::result_of<Function(Self, const std::string&)>::type>::value>::type
    call_member_raw(const Function& func, Self* self, const std::string& body, std::string& out_body)
    {
        out_body = (*self.*func)(body);
    }

private:
    template<typename Function>
    class invoker
    {
    public:
        static void apply(const Function& func, const message_ptr& in_message, message_ptr& out_message)
        {
            try
            {
                call(func, in_message, out_message);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }

        template<typename Self>
        static void apply_member(const Function& func, Self* self, const message_ptr& in_message, message_ptr& out_message)
        {
            try
            {
                call_member(func, self, in_message, out_message);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }
    };

    template<typename Function>
    class invoker_raw
    {
    public:
        static void apply(const Function& func, const std::string& body, std::string& out_body)
        {
            try
            {
                call_raw(func, body, out_body);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }

        template<typename Self>
        static void apply_member(const Function& func, Self* self, const std::string& body, std::string& out_body)
        {
            try
            {
                call_member_raw(func, self, body, out_body);
            }
            catch (std::exception& e)
            {
                log_warn(e.what());
            }
        }
    };

    struct pub_coming_helper
    {
        void operator()(const std::string& topic_name, const std::string& body, serialize_mode mode)
        {
            router::singleton::get()->publisher_coming_(topic_name, body, mode);
        }
    };

    struct sub_coming_helper
    {
        void operator()(const std::string& topic_name, const std::string& body, const connection_ptr& conn)
        {
            router::singleton::get()->subscriber_coming_(topic_name, body, conn);
        }
    };

private:
    template<typename Function>
    void bind_non_member_func(const std::string& protocol, const Function& func)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_.emplace(protocol, invoker_function{ std::bind(&invoker<Function>::apply,
                                                                   func, std::placeholders::_1, std::placeholders::_2) });
    }

    template<typename Function, typename Self>
    void bind_member_func(const std::string& protocol, const Function& func, Self* self)
    {
        std::lock_guard<std::mutex> lock(map_mutex_);
        invoker_map_.emplace(protocol, invoker_function{ std::bind(&invoker<Function>::template apply_member<Self>,
                                                                   func, self, std::placeholders::_1, std::placeholders::_2) });
    }

    template<typename Function>
    void bind_non_member_func_raw(const std::string& protocol, const Function& func)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_.emplace(protocol, invoker_function_raw{ std::bind(&invoker_raw<Function>::apply,
                                                                           func, std::placeholders::_1, std::placeholders::_2) });
    }

    template<typename Function, typename Self>
    void bind_member_func_raw(const std::string& protocol, const Function& func, Self* self)
    {
        std::lock_guard<std::mutex> lock(raw_map_mutex_);
        invoker_raw_map_.emplace(protocol, invoker_function_raw{ std::bind(&invoker_raw<Function>::template apply_member<Self>,
                                                                           func, self, std::placeholders::_1, std::placeholders::_2) });
    }

public:
    using pub_comming_callback = std::function<void(const std::string&, const std::string&, serialize_mode)>;
    using sub_comming_callback = std::function<void(const std::string&, const std::string&, const connection_ptr&)>;
    pub_comming_callback publisher_coming_ = nullptr;
    sub_comming_callback subscriber_coming_ = nullptr;

private:
    thread_pool threadpool_;
    std::unordered_map<std::string, invoker_function> invoker_map_;
    std::unordered_map<std::string, invoker_function_raw> invoker_raw_map_;
    std::mutex map_mutex_;
    std::mutex raw_map_mutex_;
    pub_coming_helper pub_coming_helper_;
    sub_coming_helper sub_coming_helper_;
};

}
}

<|endoftext|>


<commit_before>#include "d2stringtablewidget.h"

#include <QProgressDialog>
#include <QKeyEvent>
#include <QListWidgetItem>
#include <QAction>

#ifndef QT_NO_DEBUG
#include <QDebug>
#endif

D2StringTableWidget::D2StringTableWidget(QWidget *parent) : QTableWidget(parent), _displayRowHex(false), _addToRowValue(true)
{
    setStyleSheet("QTableWidget::item:!active { selection-background-color: #999999 }");
    horizontalHeader()->
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        setSectionsClickable
#else
        setClickable
#endif
        (false);
}

void D2StringTableWidget::keyPressEvent(QKeyEvent *keyEvent)
{
    switch (keyEvent->key())
    {
#ifndef Q_OS_MAC
        case Qt::Key_Enter:  // Return (usual Enter) or Enter (on the numpad)
#endif
        case Qt::Key_Return: // starts editing of the current selected cell
            if (state() != QAbstractItemView::EditingState)
                emit itemDoubleClicked(currentItem());
            break;
        // in-place edit
#ifdef Q_OS_MAC
        case Qt::Key_Enter:
#else
        case Qt::Key_F2:
#endif
            editInPlace();
            break;
        case Qt::Key_Home: // Home or Ctrl+Home goes to the first cell
            if (keyEvent->modifiers() == Qt::NoModifier || keyEvent->modifiers() == Qt::ControlModifier)
                setCurrentCell(0, 0, QItemSelectionModel::ClearAndSelect);
            break;
        case Qt::Key_End: // End or Ctrl+End goes to the last cell
            if (keyEvent->modifiers() == Qt::NoModifier || keyEvent->modifiers() == Qt::ControlModifier)
                setCurrentCell(rowCount() - 1, 1, QItemSelectionModel::ClearAndSelect);
            break;
        default:
            QTableWidget::keyPressEvent(keyEvent);
            break;
    }
}

void D2StringTableWidget::deleteItems(bool isClear)
{
    QList<QTableWidgetSelectionRange> ranges(selectedRanges());
    int elementsToDelete = 0;
    for (int i = 0; i < ranges.size(); i++)
        elementsToDelete += ranges.at(i).rowCount();

    // deleting rows is a long process, so progress dialog is shown
    QProgressDialog progress(tr("Deleting selected rows..."), tr("Cancel"), 0, elementsToDelete, this);
    progress.setWindowModality(Qt::WindowModal);
    for (int i = 0, rowShift = 0; i < ranges.size(); ++i)
    {
        const QTableWidgetSelectionRange &range = ranges.at(i);
        if (isClear) // Only Delete pressed, clears selected items
        {
            for (int j = range.topRow(); j <= range.bottomRow(); ++j)
                for (int k = range.leftColumn(); k <= range.rightColumn(); ++k)
                    item(j, k)->setText(QString());
        }
        else // Shift+Delete pressed, removes selected rows
        {
            for (int k = 0; k < range.rowCount(); ++k)
            {
                progress.setValue((i + 1) * k);
                if (progress.wasCanceled())
                    return;
                removeRow(range.topRow() - rowShift);
            }
            rowShift += range.rowCount();
            emit currentCellChanged(currentRow(), 0, 0, 0);
        }
    }
    progress.setValue(elementsToDelete);

    if (!isClear)
        changeRowHeaderDisplay();
}

void D2StringTableWidget::createRowAt(int row)
{
    insertRow(row);
    setItem(row, 0, new QTableWidgetItem);
    setItem(row, 1, new QTableWidgetItem);
    setCurrentCell(row, 0, QItemSelectionModel::ClearAndSelect);
    emit currentCellChanged(row, 0, 0, 0);
}

void D2StringTableWidget::createNewEntry(int row, const QString &key, const QString &val)
{
    setItem(row, 0, new QTableWidgetItem(key.isEmpty() || key == "\"" ? QString() : key.split('\"', QString::SkipEmptyParts).at(0)));
    setItem(row, 1, new QTableWidgetItem(val.isEmpty() || val == "\"" ? QString() : val.split('\"', QString::SkipEmptyParts).at(0)));
}

void D2StringTableWidget::mousePressEvent(QMouseEvent *mouseEvent)
{
    emit tableGotFocus(parentWidget());
    QTableWidget::mousePressEvent(mouseEvent);

    if (mouseEvent->button() == Qt::RightButton)
        editInPlace();
}

void D2StringTableWidget::clearBackground()
{
    // without blocking cells will become green again immediately
    blockSignals(true);
    foreach (QTableWidgetItem *item, _editedItems)
        item->setBackground(QBrush(Qt::white));
    blockSignals(false);

    _editedItems.clear();
}

void D2StringTableWidget::dropEvent(QDropEvent *event)
{
    QTableWidgetItem *firstDroppedItem = itemAt(event->pos());
    QList<QTableWidgetItem *> droppedItems;
    QStringList oldTexts;
    QTableWidgetSelectionRange range = qobject_cast<QTableWidget *>(event->source())->selectedRanges().at(0);
    for (int i = 0, rows = range.bottomRow() - range.topRow(), cols = range.rightColumn() - range.leftColumn(); i <= rows; ++i)
    {
        for (int j = 0; j <= cols; ++j)
        {
            QTableWidgetItem *anItem = item(firstDroppedItem->row() + i, firstDroppedItem->column() + j);
            droppedItems += anItem;
            oldTexts += anItem->text();
        }
    }

    QTableWidget::dropEvent(event);
    for (int i = 0; i < droppedItems.size(); ++i)
    {
        QTableWidgetItem *anItem = droppedItems.at(i);
        if (anItem->text() != oldTexts.at(i))
            emit itemWasDropped(anItem);
    }
}

void D2StringTableWidget::toggleDisplayHex(bool toggled)
{
    _displayRowHex = toggled;
    changeRowHeaderDisplay();
}

void D2StringTableWidget::changeRowNumberingTo1(bool toggled)
{
    _addToRowValue = toggled;
    changeRowHeaderDisplay();
}

void D2StringTableWidget::changeRowHeaderDisplay()
{
    QStringList rowLabels;
    for (int i = 0; i < rowCount(); ++i)
    {
        int row = i + _addToRowValue;
        QString rowText = QString::number(row);
        if (_displayRowHex)
            rowText += QString(" (0x%2)").arg(row, 0, 16);
#ifdef Q_OS_MAC
        rowText += "  "; // fixes slight text truncation
#endif
        rowLabels += rowText;
    }
    setVerticalHeaderLabels(rowLabels);
}
<commit_msg>fix crash on saving when edited row was removed<commit_after>#include "d2stringtablewidget.h"

#include <QProgressDialog>
#include <QKeyEvent>
#include <QListWidgetItem>
#include <QAction>

#ifndef QT_NO_DEBUG
#include <QDebug>
#endif

D2StringTableWidget::D2StringTableWidget(QWidget *parent) : QTableWidget(parent), _displayRowHex(false), _addToRowValue(true)
{
    setStyleSheet("QTableWidget::item:!active { selection-background-color: #999999 }");
    horizontalHeader()->
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        setSectionsClickable
#else
        setClickable
#endif
        (false);
}

void D2StringTableWidget::keyPressEvent(QKeyEvent *keyEvent)
{
    switch (keyEvent->key())
    {
#ifndef Q_OS_MAC
        case Qt::Key_Enter:  // Return (usual Enter) or Enter (on the numpad)
#endif
        case Qt::Key_Return: // starts editing of the current selected cell
            if (state() != QAbstractItemView::EditingState)
                emit itemDoubleClicked(currentItem());
            break;
        // in-place edit
#ifdef Q_OS_MAC
        case Qt::Key_Enter:
#else
        case Qt::Key_F2:
#endif
            editInPlace();
            break;
        case Qt::Key_Home: // Home or Ctrl+Home goes to the first cell
            if (keyEvent->modifiers() == Qt::NoModifier || keyEvent->modifiers() == Qt::ControlModifier)
                setCurrentCell(0, 0, QItemSelectionModel::ClearAndSelect);
            break;
        case Qt::Key_End: // End or Ctrl+End goes to the last cell
            if (keyEvent->modifiers() == Qt::NoModifier || keyEvent->modifiers() == Qt::ControlModifier)
                setCurrentCell(rowCount() - 1, 1, QItemSelectionModel::ClearAndSelect);
            break;
        default:
            QTableWidget::keyPressEvent(keyEvent);
            break;
    }
}

void D2StringTableWidget::deleteItems(bool isClear)
{
    QList<QTableWidgetSelectionRange> ranges(selectedRanges());
    int elementsToDelete = 0;
    for (int i = 0; i < ranges.size(); i++)
        elementsToDelete += ranges.at(i).rowCount();

    // deleting rows is a long process, so progress dialog is shown
    QProgressDialog progress(tr("Deleting selected rows..."), tr("Cancel"), 0, elementsToDelete, this);
    progress.setWindowModality(Qt::WindowModal);
    for (int i = 0, rowShift = 0; i < ranges.size(); ++i)
    {
        const QTableWidgetSelectionRange &range = ranges.at(i);
        if (isClear) // Only Delete pressed, clears selected items
        {
            for (int j = range.topRow(); j <= range.bottomRow(); ++j)
                for (int k = range.leftColumn(); k <= range.rightColumn(); ++k)
                    item(j, k)->setText(QString());
        }
        else // Shift+Delete pressed, removes selected rows
        {
            for (int k = 0; k < range.rowCount(); ++k)
            {
                progress.setValue((i + 1) * k);
                if (progress.wasCanceled())
                    return;

                int row = range.topRow() - rowShift;
                removeRow(row);
                _editedItems.remove(qMakePair<int, int>(row, 0));
                _editedItems.remove(qMakePair<int, int>(row, 1));
            }
            rowShift += range.rowCount();
            emit currentCellChanged(currentRow(), 0, 0, 0);
        }
    }
    progress.setValue(elementsToDelete);

    if (!isClear)
        changeRowHeaderDisplay();
}

void D2StringTableWidget::createRowAt(int row)
{
    insertRow(row);
    setItem(row, 0, new QTableWidgetItem);
    setItem(row, 1, new QTableWidgetItem);
    setCurrentCell(row, 0, QItemSelectionModel::ClearAndSelect);
    emit currentCellChanged(row, 0, 0, 0);
}

void D2StringTableWidget::createNewEntry(int row, const QString &key, const QString &val)
{
    setItem(row, 0, new QTableWidgetItem(key.isEmpty() || key == "\"" ? QString() : key.split('\"', QString::SkipEmptyParts).at(0)));
    setItem(row, 1, new QTableWidgetItem(val.isEmpty() || val == "\"" ? QString() : val.split('\"', QString::SkipEmptyParts).at(0)));
}

void D2StringTableWidget::mousePressEvent(QMouseEvent *mouseEvent)
{
    emit tableGotFocus(parentWidget());
    QTableWidget::mousePressEvent(mouseEvent);

    if (mouseEvent->button() == Qt::RightButton)
        editInPlace();
}

void D2StringTableWidget::clearBackground()
{
    // without blocking cells will become green again immediately
    blockSignals(true);
    foreach (QTableWidgetItem *item, _editedItems)
        item->setBackground(QBrush(Qt::white));
    blockSignals(false);

    _editedItems.clear();
}

void D2StringTableWidget::dropEvent(QDropEvent *event)
{
    QTableWidgetItem *firstDroppedItem = itemAt(event->pos());
    QList<QTableWidgetItem *> droppedItems;
    QStringList oldTexts;
    QTableWidgetSelectionRange range = qobject_cast<QTableWidget *>(event->source())->selectedRanges().at(0);
    for (int i = 0, rows = range.bottomRow() - range.topRow(), cols = range.rightColumn() - range.leftColumn(); i <= rows; ++i)
    {
        for (int j = 0; j <= cols; ++j)
        {
            QTableWidgetItem *anItem = item(firstDroppedItem->row() + i, firstDroppedItem->column() + j);
            droppedItems += anItem;
            oldTexts += anItem->text();
        }
    }

    QTableWidget::dropEvent(event);
    for (int i = 0; i < droppedItems.size(); ++i)
    {
        QTableWidgetItem *anItem = droppedItems.at(i);
        if (anItem->text() != oldTexts.at(i))
            emit itemWasDropped(anItem);
    }
}

void D2StringTableWidget::toggleDisplayHex(bool toggled)
{
    _displayRowHex = toggled;
    changeRowHeaderDisplay();
}

void D2StringTableWidget::changeRowNumberingTo1(bool toggled)
{
    _addToRowValue = toggled;
    changeRowHeaderDisplay();
}

void D2StringTableWidget::changeRowHeaderDisplay()
{
    QStringList rowLabels;
    for (int i = 0; i < rowCount(); ++i)
    {
        int row = i + _addToRowValue;
        QString rowText = QString::number(row);
        if (_displayRowHex)
            rowText += QString(" (0x%2)").arg(row, 0, 16);
#ifdef Q_OS_MAC
        rowText += "  "; // fixes slight text truncation
#endif
        rowLabels += rowText;
    }
    setVerticalHeaderLabels(rowLabels);
}
<|endoftext|>


<commit_before>#include <csignal>
#include "bvs/bvs.h"

BVS::BVS* bvs;
BVS::Logger logger("Daemon");

void mainSignal(int sig);
void shutdownFunction();
int testLogger();
int testConfig();

/** BVSD namespace, contains only the bvs daemon. */
namespace BVSD
{
/** BVS framework's command line daemon.
 * This is a simple command line daemon. It serves as a client to the BVS
 * framework. It is also intended as a sample client.
 *
 * It is interactive, you can use the following commands by just entering them
 * on the command line and then pressing enter (short versions are also
 * available, enter 'help<enter>' to see them):
 *
 * @li \c run run system until paused.
 * @li \c continue same as run
 * @li \c step advance system by one step.
 * @li \c pause pause(stop) system.
 * @li \c test call test functions.
 * @li \c quit shutdown system and quit.
 * @li \c help show help.
 */
	class BVSD
	{
	};
}

/** Main function, creates interactive loop. */
int main(int argc, char** argv)
{
	signal(SIGINT, mainSignal);

	LOG(2, "starting!");
	bvs = new BVS::BVS(argc, argv, &shutdownFunction);

	LOG(2, "loading modules!");
	bvs->loadModules();

	LOG(2, "connecting modules!");
	bvs->connectAllModules();

	LOG(2, "starting!");
	bvs->start();

	bvs->run();

	std::string input;
	while (input != "q" && input != "quit")
	{
		std::getline(std::cin, input);

		if (input == "r" || input == "run" || input == "c" || input == "continue")
		{
			LOG(2, "RUN!!!");
			bvs->run();
		}
		else if (input.empty() || input == "s" || input == "step")
		{
			LOG(2, "STEP!!!");
			bvs->step();
		}
		else if (input == "p" || input == "pause")
		{
			LOG(2, "PAUSING!!!");
			bvs->pause();
		}
		else if (input == "t" || input == "test")
		{
			testLogger();
			testConfig();
		}
		else if (input.substr(0,2) == "hs" || input.substr(0, 7) == "hotswap")
		{
			size_t delimiter = input.find_first_of(" ");
			input.erase(0, delimiter+1);
			if (input.empty() || delimiter==std::string::npos) std::cout << "ERROR: no module ID given!" << std::endl;
			else bvs->hotSwap(input);
		}
		else if (input == "q" || input == "quit")
		{
			LOG(2, "quitting...");
			bvs->quit();
			LOG(2, "finished!");
		}
		else if (input == "h" || input == "help")
		{
			std::cout << "usage:" << std::endl;
			std::cout << "   r|run            run system until paused" << std::endl;
			std::cout << "   c|continue       same as run" << std::endl;
			std::cout << "   s|step           advance system by one step" << std::endl;
			std::cout << "   p|pause          pause(stop) system" << std::endl;
			std::cout << "   hs|hotswap <arg> HotSwap(TM) <moduleID>" << std::endl;
			std::cout << "   t|test           call test functions" << std::endl;
			std::cout << "   q|quit           shutdown system and quit" << std::endl;
			std::cout << "   h|help           show help" << std::endl;
		}
		else
		{
			std::cout << ">>> unknown command: " << input << std::endl << ">>> for help press 'h<enter>'!" << std::endl;
		}
	}

	delete bvs;

	return 0;
}

void mainSignal(int sig)
{
	LOG(1,"Catched signal: " << sig << " (Ctrl-C), quitting!");
	signal(SIGINT, SIG_DFL);
	bvs->quit();
	exit(0);
}

void shutdownFunction()
{
	LOG(1,"daemon exit caused by bvs shutdown request!");
	bvs->quit();
	exit(0);
}

/** Performs some logger tests.
 * This functions performs some tests on the logger system. Nothing fancy, can
 * be studied to gain some insight into using the logger system.
 */
int testLogger()
{
	LOG(0, "to CLI FILE");
	bvs->disableLogConsole();
	LOG(0, "to FILE only");

	BVS::Logger file("FILE LOG", 3, BVS::Logger::TO_FILE);
	file.out(0) << "FILE ONLY" << std::endl;

	bvs->enableLogConsole();
	BVS::Logger cli("CLI LOG", 3, BVS::Logger::TO_CLI);
	cli.out(0) << "CLI ONLY" << std::endl;

	bvs->disableLogConsole();
	bvs->disableLogFile();
	LOG(0, "NOOP");

	bvs->enableLogConsole();
	LOG(0, "to CLI");

	bvs->disableLogConsole();
	bvs->enableLogFile("BVSLog.txt", true);
	LOG(0, "to FILE AGAIN");

	bvs->enableLogConsole();
	BVS::Logger both("to BOTH", 0, BVS::Logger::TO_CLI_AND_FILE);
	both.out(0) << "to CLI AND FILE" << std::endl;

	return 0;
}

/** Performs some config tests.
 * This functions performs some tests on the config system. Nothing fancy, can
 * be studied to gain some insight into using the config system.
 */
int testConfig()
{
	LOG(0, "testing...");

	int i;
	std::string s;
	bool b;

	bvs->config.getValue("BVS.logVerbosity", i, 0)
		.getValue("BVS.logFile", s, std::string("default"))
		.getValue("BVS.logSystem", b, false);

	LOG(0, "Getting int: " << i);
	LOG(0, "Getting string: " << s);
	LOG(0, "Getting bool: " << b);

	i = bvs->config.getValue<int>("BVS.logVerbosity", 0);
	s = bvs->config.getValue<std::string>("BVS.logFile", std::string("default"));
	b = bvs->config.getValue<bool>("BVS.logSystem", false);

	LOG(0, "Getting int directly: " << i);
	LOG(0, "Getting string directly: " << s);
	LOG(0, "Getting bool directly: " << b);

	std::string empty;
	bvs->config.getValue("this.option.does.not.exist", empty, std::string("empty"));
	LOG(0, "This should be 'empty': " << empty);

	std::vector<std::string> list;
	bvs->config.getValue("BVS.modules", list);
	LOG(0, "List: BVS.modules");
	int count = 0;
	for (auto& it : list)
	{
		(void) it;
		(void) count;
		LOG(0, count++ << ": " << it);
	}

	return 0;
}

<commit_msg>daemon: small fixes for main loop and shutdown<commit_after>#include <csignal>
#include "bvs/bvs.h"

BVS::BVS* bvs;
BVS::Logger logger("Daemon");

void mainSignal(int sig);
void shutdownFunction();
int testLogger();
int testConfig();

/** BVSD namespace, contains only the bvs daemon. */
namespace BVSD
{
/** BVS framework's command line daemon.
 * This is a simple command line daemon. It serves as a client to the BVS
 * framework. It is also intended as a sample client.
 *
 * It is interactive, you can use the following commands by just entering them
 * on the command line and then pressing enter (short versions are also
 * available, enter 'help<enter>' to see them):
 *
 * @li \c run run system until paused.
 * @li \c continue same as run
 * @li \c step advance system by one step.
 * @li \c pause pause(stop) system.
 * @li \c test call test functions.
 * @li \c quit shutdown system and quit.
 * @li \c help show help.
 */
	class BVSD
	{
	};
}

/** Main function, creates interactive loop. */
int main(int argc, char** argv)
{
	signal(SIGINT, mainSignal);

	LOG(2, "starting!");
	bvs = new BVS::BVS(argc, argv, &shutdownFunction);

	LOG(2, "loading modules!");
	bvs->loadModules();

	LOG(2, "connecting modules!");
	bvs->connectAllModules();

	LOG(2, "starting!");
	bvs->start();

	bvs->run();

	std::string input;
	while (true)
	{
		std::getline(std::cin, input);

		if (input == "r" || input == "run" || input == "c" || input == "continue")
		{
			LOG(2, "RUN!!!");
			bvs->run();
		}
		else if (input.empty() || input == "s" || input == "step")
		{
			LOG(2, "STEP!!!");
			bvs->step();
		}
		else if (input == "p" || input == "pause")
		{
			LOG(2, "PAUSING!!!");
			bvs->pause();
		}
		else if (input == "t" || input == "test")
		{
			testLogger();
			testConfig();
		}
		else if (input.substr(0,2) == "hs" || input.substr(0, 7) == "hotswap")
		{
			size_t delimiter = input.find_first_of(" ");
			input.erase(0, delimiter+1);
			if (input.empty() || delimiter==std::string::npos) std::cout << "ERROR: no module ID given!" << std::endl;
			else bvs->hotSwap(input);
		}
		else if (input == "q" || input == "quit")
		{
			LOG(2, "quitting...");
			bvs->quit();
			LOG(2, "finished!");
			break;
		}
		else if (input == "h" || input == "help")
		{
			std::cout << "usage:" << std::endl;
			std::cout << "   r|run            run system until paused" << std::endl;
			std::cout << "   c|continue       same as run" << std::endl;
			std::cout << "   s|step           advance system by one step" << std::endl;
			std::cout << "   p|pause          pause(stop) system" << std::endl;
			std::cout << "   hs|hotswap <arg> HotSwap(TM) <moduleID>" << std::endl;
			std::cout << "   t|test           call test functions" << std::endl;
			std::cout << "   q|quit           shutdown system and quit" << std::endl;
			std::cout << "   h|help           show help" << std::endl;
		}
		else
		{
			std::cout << ">>> unknown command: " << input << std::endl << ">>> for help press 'h<enter>'!" << std::endl;
		}
	}

	delete bvs;

	return 0;
}

void mainSignal(int sig)
{
	LOG(1,"Catched signal: " << sig << " (Ctrl-C), quitting!");
	signal(SIGINT, SIG_DFL);
	bvs->quit();
	delete bvs;
	exit(0);
}

void shutdownFunction()
{
	LOG(1,"daemon exit caused by bvs shutdown request!");
	bvs->quit();
	delete bvs;
	exit(0);
}

/** Performs some logger tests.
 * This functions performs some tests on the logger system. Nothing fancy, can
 * be studied to gain some insight into using the logger system.
 */
int testLogger()
{
	LOG(0, "to CLI FILE");
	bvs->disableLogConsole();
	LOG(0, "to FILE only");

	BVS::Logger file("FILE LOG", 3, BVS::Logger::TO_FILE);
	file.out(0) << "FILE ONLY" << std::endl;

	bvs->enableLogConsole();
	BVS::Logger cli("CLI LOG", 3, BVS::Logger::TO_CLI);
	cli.out(0) << "CLI ONLY" << std::endl;

	bvs->disableLogConsole();
	bvs->disableLogFile();
	LOG(0, "NOOP");

	bvs->enableLogConsole();
	LOG(0, "to CLI");

	bvs->disableLogConsole();
	bvs->enableLogFile("BVSLog.txt", true);
	LOG(0, "to FILE AGAIN");

	bvs->enableLogConsole();
	BVS::Logger both("to BOTH", 0, BVS::Logger::TO_CLI_AND_FILE);
	both.out(0) << "to CLI AND FILE" << std::endl;

	return 0;
}

/** Performs some config tests.
 * This functions performs some tests on the config system. Nothing fancy, can
 * be studied to gain some insight into using the config system.
 */
int testConfig()
{
	LOG(0, "testing...");

	int i;
	std::string s;
	bool b;

	bvs->config.getValue("BVS.logVerbosity", i, 0)
		.getValue("BVS.logFile", s, std::string("default"))
		.getValue("BVS.logSystem", b, false);

	LOG(0, "Getting int: " << i);
	LOG(0, "Getting string: " << s);
	LOG(0, "Getting bool: " << b);

	i = bvs->config.getValue<int>("BVS.logVerbosity", 0);
	s = bvs->config.getValue<std::string>("BVS.logFile", std::string("default"));
	b = bvs->config.getValue<bool>("BVS.logSystem", false);

	LOG(0, "Getting int directly: " << i);
	LOG(0, "Getting string directly: " << s);
	LOG(0, "Getting bool directly: " << b);

	std::string empty;
	bvs->config.getValue("this.option.does.not.exist", empty, std::string("empty"));
	LOG(0, "This should be 'empty': " << empty);

	std::vector<std::string> list;
	bvs->config.getValue("BVS.modules", list);
	LOG(0, "List: BVS.modules");
	int count = 0;
	for (auto& it : list)
	{
		(void) it;
		(void) count;
		LOG(0, count++ << ": " << it);
	}

	return 0;
}

<|endoftext|>


<commit_before>#include "stdio.h"
#include "BVS.h"

int main(int argc, char** argv)
{
    // start BVS
    BVS bvs(argc, argv);
    bvs.enableLogFile("BVSLog.txt");

    BVSLogger logger("BVSDaemon");
    LOG(2, "starting!");

    //LOG(2, "dump all config options!");
    //bvs.config.showOptionStore();

    LOG(2, "loading Modules!");
    bvs.loadModules();

    LOG(2, "run!");
    //bvs.run();

    //std::string s = "core.list";
    //std::vector<int> foo;
    //bvs.config.getValue(s, foo);
    //for (auto it : foo)
    //{
        //std::cout << foo[it] << std::endl;
    //}

    return 0;
}
<commit_msg>daemon: remove comments<commit_after>#include "stdio.h"
#include "BVS.h"

int main(int argc, char** argv)
{
    // start BVS
    BVS bvs(argc, argv);
    bvs.enableLogFile("BVSLog.txt");

    BVSLogger logger("BVSDaemon");
    LOG(2, "starting!");

    //LOG(2, "dump all config options!");
    //bvs.config.showOptionStore();

    LOG(2, "loading Modules!");
    bvs.loadModules();

    LOG(2, "run!");
    //bvs.run();

    return 0;
}
<|endoftext|>