Improve SplitSource.php.
This commit is contained in:
parent
d029eff807
commit
9413360255
172
SplitSource.php
172
SplitSource.php
@ -231,27 +231,46 @@ function split_file($file, $chunks, $undo) {
|
|||||||
'std::int32_t' => '',
|
'std::int32_t' => '',
|
||||||
'std::int64_t' => '',
|
'std::int64_t' => '',
|
||||||
'td::unique' => 'algorithm',
|
'td::unique' => 'algorithm',
|
||||||
|
'std::count_if' => 'algorithm',
|
||||||
'std::fill' => 'algorithm',
|
'std::fill' => 'algorithm',
|
||||||
'std::find' => 'algorithm',
|
'std::find' => 'algorithm',
|
||||||
|
'std::is_sorted' => 'algorithm',
|
||||||
|
'std::lower_bound' => 'algorithm',
|
||||||
'std::max' => 'algorithm',
|
'std::max' => 'algorithm',
|
||||||
|
'std::merge' => 'algorithm',
|
||||||
'std::min' => 'algorithm',
|
'std::min' => 'algorithm',
|
||||||
|
'std::partial_sort' => 'algorithm',
|
||||||
|
'std::partition' => 'algorithm',
|
||||||
'std::remove' => 'algorithm',
|
'std::remove' => 'algorithm',
|
||||||
'std::reverse' => 'algorithm',
|
'std::reverse' => 'algorithm',
|
||||||
'std::rotate' => 'algorithm',
|
'std::rotate' => 'algorithm',
|
||||||
'std::sort' => 'algorithm',
|
'std::sort' => 'algorithm',
|
||||||
|
'std::stable_sort' => 'algorithm',
|
||||||
|
'std::upper_bound' => 'algorithm',
|
||||||
'std::abs' => 'cmath',
|
'std::abs' => 'cmath',
|
||||||
|
'std::isfinite' => 'cmath',
|
||||||
|
'std::function' => 'functional',
|
||||||
|
'std::greater' => 'functional',
|
||||||
|
'std::reference_wrapper' => 'functional',
|
||||||
|
'std::make_move_iterator' => 'iterator',
|
||||||
'std::numeric_limits' => 'limits',
|
'std::numeric_limits' => 'limits',
|
||||||
|
'std::map' => 'map',
|
||||||
|
'std::multimap' => 'map',
|
||||||
'std::make_shared' => 'memory',
|
'std::make_shared' => 'memory',
|
||||||
'std::shared_ptr' => 'memory',
|
'std::shared_ptr' => 'memory',
|
||||||
|
'std::multiset' => 'set',
|
||||||
|
'std::set' => 'set',
|
||||||
|
'std::get' => 'tuple',
|
||||||
|
'std::make_tuple' => 'tuple',
|
||||||
'std::tie' => 'tuple',
|
'std::tie' => 'tuple',
|
||||||
'std::tuple' => 'tuple',
|
'std::tuple' => 'tuple',
|
||||||
'std::decay_t' => 'type_traits',
|
'std::decay_t' => 'type_traits',
|
||||||
'std::is_same' => 'type_traits',
|
'std::is_same' => 'type_traits',
|
||||||
|
'std::unordered_map' => 'unordered_map',
|
||||||
|
'std::unordered_set' => 'unordered_set',
|
||||||
'std::make_pair' => 'utility',
|
'std::make_pair' => 'utility',
|
||||||
'std::pair' => 'utility',
|
'std::pair' => 'utility',
|
||||||
'std::swap' => 'utility',
|
'std::swap' => 'utility');
|
||||||
'std::unordered_map' => 'unordered_map',
|
|
||||||
'std::unordered_set' => 'unordered_set');
|
|
||||||
foreach ($type_headers as $type => $header) {
|
foreach ($type_headers as $type => $header) {
|
||||||
if (in_array($type, $std_methods)) {
|
if (in_array($type, $std_methods)) {
|
||||||
$std_methods = array_diff($std_methods, array($type));
|
$std_methods = array_diff($std_methods, array($type));
|
||||||
@ -276,62 +295,115 @@ function split_file($file, $chunks, $undo) {
|
|||||||
|
|
||||||
if (!preg_match('/Td::~?Td/', $new_content)) { // destructor Td::~Td needs to see definitions of all forward-declared classes
|
if (!preg_match('/Td::~?Td/', $new_content)) { // destructor Td::~Td needs to see definitions of all forward-declared classes
|
||||||
$td_methods = array(
|
$td_methods = array(
|
||||||
'account_manager[_(-][^.]|AccountManager[^;>]' => "AccountManager",
|
'AccentColorId' => 'AccentColorId',
|
||||||
'animations_manager[_(-][^.]|AnimationsManager[^;>]' => "AnimationsManager",
|
'account_manager[_(-](?![.]get[(][)])|AccountManager[^;>]' => 'AccountManager',
|
||||||
'attach_menu_manager[_(-][^.]|AttachMenuManager[^;>]' => "AttachMenuManager",
|
'animations_manager[_(-](?![.]get[(][)])|AnimationsManager[^;>]' => 'AnimationsManager',
|
||||||
'audios_manager[_(-][^.]|AudiosManager' => "AudiosManager",
|
'attach_menu_manager[_(-](?![.]get[(][)])|AttachMenuManager[^;>]' => 'AttachMenuManager',
|
||||||
'auth_manager[_(-][^.]|AuthManager' => 'AuthManager',
|
'audios_manager[_(-](?![.]get[(][)])|AudiosManager' => 'AudiosManager',
|
||||||
'autosave_manager[_(-][^.]|AutosaveManager' => 'AutosaveManager',
|
'auth_manager[_(-](?![.]get[(][)])|AuthManager' => 'AuthManager',
|
||||||
'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager",
|
'AutoDownloadSettings|[a-z_]*auto_download_settings' => 'AutoDownloadSettings',
|
||||||
'boost_manager[_(-][^.]|BoostManager' => "BoostManager",
|
'autosave_manager[_(-](?![.]get[(][)])|AutosaveManager' => 'AutosaveManager',
|
||||||
'bot_info_manager[_(-][^.]|BotInfoManager' => "BotInfoManager",
|
'BackgroundId' => 'BackgroundId',
|
||||||
'common_dialog_manager[_(-][^.]|CommonDialogManager' => "CommonDialogManager",
|
'background_manager[_(-](?![.]get[(][)])|BackgroundManager' => 'BackgroundManager',
|
||||||
'contacts_manager[_(-][^.]|ContactsManager([^ ;.]| [^*])' => 'ContactsManager',
|
'BackgroundType' => 'BackgroundType',
|
||||||
'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager',
|
'BotMenuButton|[a-z_]*_menu_button' => 'BotMenuButton',
|
||||||
'dialog_action_manager[_(-][^.]|DialogActionManager' => "DialogActionManager",
|
'boost_manager[_(-](?![.]get[(][)])|BoostManager' => 'BoostManager',
|
||||||
'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager",
|
'bot_info_manager[_(-](?![.]get[(][)])|BotInfoManager' => 'BotInfoManager',
|
||||||
'dialog_invite_link_manager[_(-][^.]|DialogInviteLinkManager' => "DialogInviteLinkManager",
|
'callback_queries_manager[_(-](?![.]get[(][)])|CallbackQueriesManager' => 'CallbackQueriesManager',
|
||||||
'dialog_manager[_(-][^.]|DialogManager' => "DialogManager",
|
'CallId' => 'CallId',
|
||||||
'dialog_participant_manager[_(-][^.]|DialogParticipantManager' => "DialogParticipantManager",
|
'call_manager[_(-](?![.]get[(][)])|CallManager' => 'CallManager',
|
||||||
'documents_manager[_(-][^.]|DocumentsManager' => "DocumentsManager",
|
'ChannelId' => 'ChannelId',
|
||||||
'download_manager[_(-][^.]|DownloadManager' => "DownloadManager",
|
'ChatId' => 'ChatId',
|
||||||
'file_reference_manager[_(-][^.]|FileReferenceManager|file_references[)]' => 'FileReferenceManager',
|
'common_dialog_manager[_(-](?![.]get[(][)])|CommonDialogManager' => 'CommonDialogManager',
|
||||||
'file_manager[_(-][^.]|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager',
|
'contacts_manager[_(-](?![.]get[(][)])|ContactsManager([^ ;.]| [^*])' => 'ContactsManager',
|
||||||
'forum_topic_manager[_(-][^.]|ForumTopicManager' => 'ForumTopicManager',
|
'country_info_manager[_(-](?![.]get[(][)])|CountryInfoManager' => 'CountryInfoManager',
|
||||||
|
'CustomEmojiId' => 'CustomEmojiId',
|
||||||
|
'device_token_manager[_(-](?![.]get[(][)])|DeviceTokenManager' => 'DeviceTokenManager',
|
||||||
|
'DialogAction[^M]' => 'DialogAction',
|
||||||
|
'dialog_action_manager[_(-](?![.]get[(][)])|DialogActionManager' => 'DialogActionManager',
|
||||||
|
'DialogFilter[^A-Z]' => 'DialogFilter',
|
||||||
|
'DialogFilterId' => 'DialogFilterId',
|
||||||
|
'dialog_filter_manager[_(-](?![.]get[(][)])|DialogFilterManager' => 'DialogFilterManager',
|
||||||
|
'DialogId' => 'DialogId',
|
||||||
|
'dialog_invite_link_manager[_(-](?![.]get[(][)])|DialogInviteLinkManager' => 'DialogInviteLinkManager',
|
||||||
|
'DialogListId' => 'DialogListId',
|
||||||
|
'DialogLocation' => 'DialogLocation',
|
||||||
|
'dialog_manager[_(-](?![.]get[(][)])|DialogManager' => 'DialogManager',
|
||||||
|
'DialogParticipantFilter' => 'DialogParticipantFilter',
|
||||||
|
'dialog_participant_manager[_(-](?![.]get[(][)])|DialogParticipantManager' => 'DialogParticipantManager',
|
||||||
|
'DialogSource' => 'DialogSource',
|
||||||
|
'documents_manager[_(-](?![.]get[(][)])|DocumentsManager' => 'DocumentsManager',
|
||||||
|
'download_manager[_(-](?![.]get[(][)])|DownloadManager[^C]' => 'DownloadManager',
|
||||||
|
'DownloadManagerCallback' => 'DownloadManagerCallback',
|
||||||
|
'EmailVerification' => 'EmailVerification',
|
||||||
|
'EmojiGroup' => 'EmojiGroup',
|
||||||
|
'EmojiStatus|[a-z_]*_emoji_status' => 'EmojiStatus',
|
||||||
|
'file_reference_manager[_(-](?![.]get[(][)])|FileReferenceManager|file_references[)]' => 'FileReferenceManager',
|
||||||
|
'file_manager[_(-](?![.]get[(][)])|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager',
|
||||||
|
'FolderId' => 'FolderId',
|
||||||
|
'forum_topic_manager[_(-](?![.]get[(][)])|ForumTopicManager' => 'ForumTopicManager',
|
||||||
|
'game_manager[_(-](?![.]get[(][)])|GameManager' => 'GameManager',
|
||||||
'G[(][)]|Global[^A-Za-z]' => 'Global',
|
'G[(][)]|Global[^A-Za-z]' => 'Global',
|
||||||
'game_manager[_(-][^.]|GameManager' => 'GameManager',
|
'GlobalPrivacySettings' => 'GlobalPrivacySettings',
|
||||||
'group_call_manager[_(-][^.]|GroupCallManager' => 'GroupCallManager',
|
'GroupCallId' => 'GroupCallId',
|
||||||
|
'group_call_manager[_(-](?![.]get[(][)])|GroupCallManager' => 'GroupCallManager',
|
||||||
'HashtagHints' => 'HashtagHints',
|
'HashtagHints' => 'HashtagHints',
|
||||||
'inline_queries_manager[_(-][^.]|InlineQueriesManager' => 'InlineQueriesManager',
|
'inline_queries_manager[_(-](?![.]get[(][)])|InlineQueriesManager' => 'InlineQueriesManager',
|
||||||
'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager',
|
'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager',
|
||||||
'link_manager[_(-][^.]|LinkManager' => 'LinkManager',
|
'link_manager[_(-](?![.]get[(][)])|LinkManager' => 'LinkManager',
|
||||||
'LogeventIdWithGeneration|add_log_event|delete_log_event|get_erase_log_event_promise|parse_time|store_time' => 'logevent/LogEventHelper',
|
'LogeventIdWithGeneration|add_log_event|delete_log_event|get_erase_log_event_promise|parse_time|store_time' => 'logevent/LogEventHelper',
|
||||||
'MessageCopyOptions' => 'MessageCopyOptions',
|
'MessageCopyOptions' => 'MessageCopyOptions',
|
||||||
'message_import_manager[_(-][^.]|MessageImportManager' => 'MessageImportManager',
|
'MessageFullId' => 'MessageFullId',
|
||||||
'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager',
|
'MessageId' => 'MessageId',
|
||||||
'notification_manager[_(-][^.]|NotificationManager|notifications[)]' => 'NotificationManager',
|
'message_import_manager[_(-](?![.]get[(][)])|MessageImportManager' => 'MessageImportManager',
|
||||||
'notification_settings_manager[_(-][^.]|NotificationSettingsManager' => 'NotificationSettingsManager',
|
'MessageLinkInfo' => 'MessageLinkInfo',
|
||||||
'option_manager[_(-][^.]|OptionManager' => "OptionManager",
|
'MessageReaction|UnreadMessageReaction|[a-z_]*message[a-z_]*reaction' => 'MessageReaction',
|
||||||
'phone_number_manager[_(-][^.]|PhoneNumberManager' => "PhoneNumberManager",
|
'[a-z_]*_message_sender' => 'MessageSender',
|
||||||
'poll_manager[_(-][^.]|PollManager' => "PollManager",
|
'messages_manager[_(-](?![.]get[(][)])|MessagesManager' => 'MessagesManager',
|
||||||
'privacy_manager[_(-][^.]|PrivacyManager' => "PrivacyManager",
|
'MessageThreadInfo' => 'MessageThreadInfo',
|
||||||
|
'MessageTtl' => 'MessageTtl',
|
||||||
|
'notification_manager[_(-](?![.]get[(][)])|NotificationManager|notifications[)]' => 'NotificationManager',
|
||||||
|
'notification_settings_manager[_(-](?![.]get[(][)])|NotificationSettingsManager' => 'NotificationSettingsManager',
|
||||||
|
'option_manager[_(-](?![.]get[(][)])|OptionManager' => 'OptionManager',
|
||||||
|
'password_manager[_(-](?![.]get[(][)])|PasswordManager' => 'PasswordManager',
|
||||||
|
'[a-z_]*phone_number_manager[_(-](?![.]get[(][)])|PhoneNumberManager' => 'PhoneNumberManager',
|
||||||
|
'PhotoSizeSource' => 'PhotoSizeSource',
|
||||||
|
'poll_manager[_(-](?![.]get[(][)])|PollManager' => 'PollManager',
|
||||||
|
'privacy_manager[_(-](?![.]get[(][)])|PrivacyManager' => 'PrivacyManager',
|
||||||
'PublicDialogType|get_public_dialog_type' => 'PublicDialogType',
|
'PublicDialogType|get_public_dialog_type' => 'PublicDialogType',
|
||||||
'reaction_manager[_(-][^.]|ReactionManager' => 'ReactionManager',
|
'reaction_manager[_(-](?![.]get[(][)])|ReactionManager' => 'ReactionManager',
|
||||||
|
'ReactionType|[a-z_]*_reaction_type' => 'ReactionType',
|
||||||
|
'RequestActor|RequestOnceActor' => 'RequestActor',
|
||||||
|
'ScopeNotificationSettings|[a-z_]*_scope_notification_settings' => 'ScopeNotificationSettings',
|
||||||
'SecretChatActor' => 'SecretChatActor',
|
'SecretChatActor' => 'SecretChatActor',
|
||||||
'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager',
|
'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager',
|
||||||
'sponsored_message_manager[_(-][^.]|SponsoredMessageManager' => 'SponsoredMessageManager',
|
'secure_manager[_(-](?![.]get[(][)])|SecureManager' => 'SecureManager',
|
||||||
'statistics_manager[_(-][^.]|StatisticsManager' => 'StatisticsManager',
|
'SentEmailCode' => 'SentEmailCode',
|
||||||
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
|
'sponsored_message_manager[_(-](?![.]get[(][)])|SponsoredMessageManager' => 'SponsoredMessageManager',
|
||||||
'story_manager[_(-][^.]|StoryManager' => 'StoryManager',
|
'state_manager[_(-](?![.]get[(][)])|StateManager' => 'StateManager',
|
||||||
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',
|
'statistics_manager[_(-](?![.]get[(][)])|StatisticsManager' => 'StatisticsManager',
|
||||||
'theme_manager[_(-][^.]|ThemeManager' => "ThemeManager",
|
'StickerSetId' => 'StickerSetId',
|
||||||
|
'stickers_manager[_(-](?![.]get[(][)])|StickersManager' => 'StickersManager',
|
||||||
|
'storage_manager[_(-](?![.]get[(][)])|StorageManager' => 'StorageManager',
|
||||||
|
'StoryId' => 'StoryId',
|
||||||
|
'StoryListId' => 'StoryListId',
|
||||||
|
'story_manager[_(-](?![.]get[(][)])|StoryManager' => 'StoryManager',
|
||||||
|
'SuggestedAction|[a-z_]*_suggested_action' => 'SuggestedAction',
|
||||||
|
'td_api' => 'td_api',
|
||||||
|
'td_db[(][)]|TdDb[^A-Za-z]' => 'TdDb',
|
||||||
|
'telegram_api' => 'telegram_api',
|
||||||
|
'theme_manager[_(-](?![.]get[(][)])|ThemeManager' => 'ThemeManager',
|
||||||
'TopDialogCategory|get_top_dialog_category' => 'TopDialogCategory',
|
'TopDialogCategory|get_top_dialog_category' => 'TopDialogCategory',
|
||||||
'top_dialog_manager[_(-][^.]|TopDialogManager' => 'TopDialogManager',
|
'top_dialog_manager[_(-](?![.]get[(][)])|TopDialogManager' => 'TopDialogManager',
|
||||||
'translation_manager[_(-][^.]|TranslationManager' => "TranslationManager",
|
'translation_manager[_(-](?![.]get[(][)])|TranslationManager' => 'TranslationManager',
|
||||||
'transcription_manager[_(-][^.]|TranscriptionManager' => "TranscriptionManager",
|
'transcription_manager[_(-](?![.]get[(][)])|TranscriptionManager' => 'TranscriptionManager',
|
||||||
'updates_manager[_(-][^.]|UpdatesManager|get_difference[)]|updateSentMessage|dummyUpdate' => 'UpdatesManager',
|
'updates_manager[_(-](?![.]get[(][)])|UpdatesManager|get_difference[)]|updateSentMessage|dummyUpdate' => 'UpdatesManager',
|
||||||
|
'UserId' => 'UserId',
|
||||||
|
'video_notes_manager[_(-](?![.]get[(][)])|VideoNotesManager' => 'VideoNotesManager',
|
||||||
|
'videos_manager[_(-](?![.]get[(][)])|VideosManager' => 'VideosManager',
|
||||||
|
'voice_notes_manager[_(-](?![.]get[(][)])|VoiceNotesManager' => 'VoiceNotesManager',
|
||||||
'WebPageId(Hash)?' => 'WebPageId',
|
'WebPageId(Hash)?' => 'WebPageId',
|
||||||
'web_pages_manager[_(-][^.]|WebPagesManager' => 'WebPagesManager');
|
'web_pages_manager[_(-](?![.]get[(][)])|WebPagesManager' => 'WebPagesManager');
|
||||||
|
|
||||||
foreach ($td_methods as $pattern => $header) {
|
foreach ($td_methods as $pattern => $header) {
|
||||||
if (strpos($cpp_name, $header) !== false) {
|
if (strpos($cpp_name, $header) !== false) {
|
||||||
@ -339,7 +411,7 @@ function split_file($file, $chunks, $undo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$include_name = '#include "td/telegram/'.$header.'.h"';
|
$include_name = '#include "td/telegram/'.$header.'.h"';
|
||||||
if (strpos($new_content, $include_name) !== false && preg_match('/'.$pattern.'/', str_replace($include_name, '', $new_content)) === 0) {
|
if (strpos($new_content, $include_name) !== false && preg_match('/[^a-zA-Z0-9_]('.$pattern.')/', str_replace($include_name, '', $new_content)) === 0) {
|
||||||
$new_content = str_replace($include_name, '', $new_content);
|
$new_content = str_replace($include_name, '', $new_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user