text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimaryDark">

        <TextView
            android:id="@+id/tvTitle"
            style="@style/ActionTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="省份列表" />

        <Button
            android:id="@+id/btnTitleBack"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="15dp"
            android:background="@drawable/ic_back" />
    </RelativeLayout>

    <ListView
        android:background="@color/colorWhite"
        android:id="@+id/lvArea"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>


text:
namespace DataConnect.Infrastructure.Fit.RawData
{
    internal class AccelerometerData : BaseRawValue
    {
        public AccelerometerData(long id) : base(id)
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.android.systemui.statusbar.phone;

import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.AlarmManager.AlarmClockInfo;
import android.app.IUserSwitchObserver;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.UserInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.telecom.TelecomManager;
import android.util.Log;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.R;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.BluetoothController.Callback;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.statusbar.policy.SuController;

import cyanogenmod.app.CMStatusBarManager;
import cyanogenmod.app.CustomTile;
import cyanogenmod.providers.CMSettings;

import org.cyanogenmod.internal.util.QSUtils;
import org.cyanogenmod.internal.util.QSUtils.OnQSChanged;
import org.cyanogenmod.internal.util.QSConstants;

import java.util.ArrayList;

/**
 * This class contains all of the policy about which icons are installed in the status
 * bar at boot time.  It goes through the normal API for icons, even though it probably
 * strictly doesn't need to.
 */
public class PhoneStatusBarPolicy implements Callback {
    private static final String TAG = "PhoneStatusBarPolicy";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    private static final String SLOT_CAST = "cast";
    private static final String SLOT_HOTSPOT = "hotspot";
    private static final String SLOT_BLUETOOTH = "bluetooth";
    private static final String SLOT_TTY = "tty";
    private static final String SLOT_ZEN = "zen";
    private static final String SLOT_VOLUME = "volume";
    private static final String SLOT_ALARM_CLOCK = "alarm_clock";
    private static final String SLOT_MANAGED_PROFILE = "managed_profile";
    private static final String SLOT_SU = "su";

    private final Context mContext;
    private final StatusBarManager mService;
    private final Handler mHandler = new Handler();
    private final CastController mCast;
    private final HotspotController mHotspot;
    private final AlarmManager mAlarmManager;
    private final UserInfoController mUserInfoController;
    private boolean mAlarmIconVisible;
    private final SuController mSuController;

    // Assume it's all good unless we hear otherwise.  We don't always seem
    // to get broadcasts that it *is* there.
    IccCardConstants.State mSimState = IccCardConstants.State.READY;

    private boolean mZenVisible;
    private boolean mVolumeVisible;
    private boolean mCurrentUserSetup;

    private int mZen;

    private boolean mManagedProfileFocused = false;
    private boolean mManagedProfileIconVisible = true;

    private boolean mKeyguardVisible = true;
    private BluetoothController mBluetooth;

    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED)) {
                updateAlarm();
            }
            else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION) ||
                    action.equals(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION)) {
                updateVolumeZen();
            }
            else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
                updateSimState(intent);
            }
            else if (action.equals(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED)) {
                updateTTY(intent);
            }
        }
    };

    private Runnable mRemoveCastIconRunnable = new Runnable() {
        @Override
        public void run() {
            if (DEBUG) Log.v(TAG, "updateCast: hiding icon NOW");
            mService.setIconVisibility(SLOT_CAST, false);
        }
    };

    private final OnQSChanged mQSListener = new OnQSChanged() {
        @Override
        public void onQSChanged() {
            processQSChangedLocked();
        }
    };

    public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot,
            UserInfoController userInfoController, BluetoothController bluetooth, SuController su) {
        mContext = context;
        mCast = cast;
        mHotspot = hotspot;
        mBluetooth = bluetooth;
        mBluetooth.addStateChangedCallback(this);
        mService = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE);
        mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        mUserInfoController = userInfoController;
        mSuController = su;

        // listen for broadcasts
        IntentFilter filter = new IntentFilter();
        filter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
        filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
        filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION);
        filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        filter.addAction(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED);
        mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);

        // listen for user / profile change.
        try {
            ActivityManagerNative.getDefault().registerUserSwitchObserver(mUserSwitchListener);
        } catch (RemoteException e) {
            // Ignore
        }

        // TTY status
        mService.setIcon(SLOT_TTY,  R.drawable.stat_sys_tty_mode, 0, null);
        mService.setIconVisibility(SLOT_TTY, false);

        // bluetooth status
        updateBluetooth();

        //Update initial tty mode
        updateTTYMode();

        // Alarm clock
        mService.setIcon(SLOT_ALARM_CLOCK, R.drawable.stat_sys_alarm, 0, null);
        mService.setIconVisibility(SLOT_ALARM_CLOCK, false);
        mAlarmIconObserver.onChange(true);
        mContext.getContentResolver().registerContentObserver(
                CMSettings.System.getUriFor(CMSettings.System.SHOW_ALARM_ICON),
                false, mAlarmIconObserver);

        // zen
        mService.setIcon(SLOT_ZEN, R.drawable.stat_sys_zen_important, 0, null);
        mService.setIconVisibility(SLOT_ZEN, false);

        // volume
        mService.setIcon(SLOT_VOLUME, R.drawable.stat_sys_ringer_vibrate, 0, null);
        mService.setIconVisibility(SLOT_VOLUME, false);
        updateVolumeZen();

        // cast
        mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, null);
        mService.setIconVisibility(SLOT_CAST, false);
        mCast.addCallback(mCastCallback);

        // hotspot
        mService.setIcon(SLOT_HOTSPOT, R.drawable.stat_sys_hotspot, 0,
                mContext.getString(R.string.accessibility_status_bar_hotspot));
        mService.setIconVisibility(SLOT_HOTSPOT, mHotspot.isHotspotEnabled());
        mHotspot.addCallback(mHotspotCallback);

        // su
        mService.setIcon(SLOT_SU, R.drawable.stat_sys_su, 0, null);
        mService.setIconVisibility(SLOT_SU, false);
        mSuController.addCallback(mSuCallback);

        // managed profile
        mService.setIcon(SLOT_MANAGED_PROFILE, R.drawable.stat_sys_managed_profile_status, 0,
                mContext.getString(R.string.accessibility_managed_profile));
        mService.setIconVisibility(SLOT_MANAGED_PROFILE, false);

        QSUtils.registerObserverForQSChanges(mContext, mQSListener);
    }

    private ContentObserver mAlarmIconObserver = new ContentObserver(null) {
        @Override
        public void onChange(boolean selfChange, Uri uri) {
            mAlarmIconVisible = CMSettings.System.getInt(mContext.getContentResolver(),
                    CMSettings.System.SHOW_ALARM_ICON, 1) == 1;
            updateAlarm();
        }

        @Override
        public void onChange(boolean selfChange) {
            onChange(selfChange, null);
        }
    };

    public void setZenMode(int zen) {
        mZen = zen;
        updateVolumeZen();
    }

    private void updateAlarm() {
        final AlarmClockInfo alarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT);
        final boolean hasAlarm = alarm != null && alarm.getTriggerTime() > 0;
        final boolean zenNone = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS;
        mService.setIcon(SLOT_ALARM_CLOCK, zenNone ? R.drawable.stat_sys_alarm_dim
                : R.drawable.stat_sys_alarm, 0, null);
        mService.setIconVisibility(SLOT_ALARM_CLOCK, mCurrentUserSetup && hasAlarm && mAlarmIconVisible);
    }

    private final void updateSimState(Intent intent) {
        String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
        if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
            mSimState = IccCardConstants.State.ABSENT;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) {
            mSimState = IccCardConstants.State.CARD_IO_ERROR;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
            mSimState = IccCardConstants.State.READY;
        }
        else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
            final String lockedReason =
                    intent.getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON);
            if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
                mSimState = IccCardConstants.State.PIN_REQUIRED;
            }
            else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
                mSimState = IccCardConstants.State.PUK_REQUIRED;
            }
            else {
                mSimState = IccCardConstants.State.NETWORK_LOCKED;
            }
        } else {
            mSimState = IccCardConstants.State.UNKNOWN;
        }
    }

    private final void updateVolumeZen() {
        AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);

        boolean zenVisible = false;
        int zenIconId = 0;
        String zenDescription = null;

        boolean volumeVisible = false;
        int volumeIconId = 0;
        String volumeDescription = null;

        if (DndTile.isVisible(mContext) || DndTile.isCombinedIcon(mContext)) {
            zenVisible = mZen != Global.ZEN_MODE_OFF;
            switch(mZen) {
                case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
                    zenIconId = R.drawable.stat_sys_dnd_priority;
                    break;
                case Global.ZEN_MODE_NO_INTERRUPTIONS:
                    zenIconId = R.drawable.stat_sys_dnd_total_silence;
                    break;
                default:
                    zenIconId = R.drawable.stat_sys_dnd;
                    break;
            }
            zenDescription = mContext.getString(R.string.quick_settings_dnd_label);
        } else if (mZen == Global.ZEN_MODE_NO_INTERRUPTIONS) {
            zenVisible = true;
            zenIconId = R.drawable.stat_sys_zen_none;
            zenDescription = mContext.getString(R.string.interruption_level_none);
        } else if (mZen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) {
            zenVisible = true;
            zenIconId = R.drawable.stat_sys_zen_important;
            zenDescription = mContext.getString(R.string.interruption_level_priority);
        }

        if (DndTile.isVisible(mContext) && !DndTile.isCombinedIcon(mContext)
                && audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT) {
            volumeVisible = true;
            volumeIconId = R.drawable.stat_sys_ringer_silent;
            volumeDescription = mContext.getString(R.string.accessibility_ringer_silent);
        } else if (mZen != Global.ZEN_MODE_NO_INTERRUPTIONS && mZen != Global.ZEN_MODE_ALARMS &&
                audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_VIBRATE) {
            volumeVisible = true;
            volumeIconId = R.drawable.stat_sys_ringer_vibrate;
            volumeDescription = mContext.getString(R.string.accessibility_ringer_vibrate);
        }

        if (zenVisible) {
            mService.setIcon(SLOT_ZEN, zenIconId, 0, zenDescription);
        }
        if (zenVisible != mZenVisible) {
            mService.setIconVisibility(SLOT_ZEN, zenVisible);
            mZenVisible = zenVisible;
        }

        if (volumeVisible) {
            mService.setIcon(SLOT_VOLUME, volumeIconId, 0, volumeDescription);
        }
        if (volumeVisible != mVolumeVisible) {
            mService.setIconVisibility(SLOT_VOLUME, volumeVisible);
            mVolumeVisible = volumeVisible;
        }
        updateAlarm();
    }

    @Override
    public void onBluetoothDevicesChanged() {
        updateBluetooth();
    }

    @Override
    public void onBluetoothStateChange(boolean enabled) {
        updateBluetooth();
    }

    private final void updateBluetooth() {
        int iconId = R.drawable.stat_sys_data_bluetooth;
        String contentDescription =
                mContext.getString(R.string.accessibility_quick_settings_bluetooth_on);
        boolean bluetoothEnabled = false;
        if (mBluetooth != null) {
            bluetoothEnabled = mBluetooth.isBluetoothEnabled();
            if (mBluetooth.isBluetoothConnected()) {
                iconId = R.drawable.stat_sys_data_bluetooth_connected;
                contentDescription = mContext.getString(R.string.accessibility_bluetooth_connected);
            }
        }

        mService.setIcon(SLOT_BLUETOOTH, iconId, 0, contentDescription);
        mService.setIconVisibility(SLOT_BLUETOOTH, bluetoothEnabled);
    }

    private final void updateTTY(Intent intent) {
        int currentTtyMode = intent.getIntExtra(TelecomManager.EXTRA_CURRENT_TTY_MODE,
                TelecomManager.TTY_MODE_OFF);
        boolean enabled = currentTtyMode != TelecomManager.TTY_MODE_OFF;

        if (DEBUG) Log.v(TAG, "updateTTY: enabled: " + enabled);

        if (enabled) {
            // TTY is on
            if (DEBUG) Log.v(TAG, "updateTTY: set TTY on");
            mService.setIcon(SLOT_TTY, R.drawable.stat_sys_tty_mode, 0,
                    mContext.getString(R.string.accessibility_tty_enabled));
            mService.setIconVisibility(SLOT_TTY, true);
        } else {
            // TTY is off
            if (DEBUG) Log.v(TAG, "updateTTY: set TTY off");
            mService.setIconVisibility(SLOT_TTY, false);
        }
    }

    private boolean isWiredHeadsetOn() {
        AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
        return audioManager.isWiredHeadsetOn();
    }

    private final void updateTTYMode() {
        int ttyMode = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.PREFERRED_TTY_MODE, TelecomManager.TTY_MODE_OFF);
        boolean enabled = ttyMode != TelecomManager.TTY_MODE_OFF;
        if (DEBUG) Log.v(TAG, "updateTTYMode: enabled: " + enabled);
        if (enabled && isWiredHeadsetOn()) {
            // TTY is on
            if (DEBUG) Log.v(TAG, "updateTTYMode: set TTY on");
            mService.setIcon(SLOT_TTY, R.drawable.stat_sys_tty_mode, 0,
                    mContext.getString(R.string.accessibility_tty_enabled));
            mService.setIconVisibility(SLOT_TTY, true);
        } else {
            // TTY is off
            if (DEBUG) Log.v(TAG, "updateTTYMode: set TTY off");
            mService.setIconVisibility(SLOT_TTY, false);
        }
    }

    private void updateCast() {
        boolean isCasting = false;
        for (CastDevice device : mCast.getCastDevices()) {
            if (device.state == CastDevice.STATE_CONNECTING
                    || device.state == CastDevice.STATE_CONNECTED) {
                isCasting = true;
                break;
            }
        }
        if (DEBUG) Log.v(TAG, "updateCast: isCasting: " + isCasting);
        mHandler.removeCallbacks(mRemoveCastIconRunnable);
        if (isCasting) {
            mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0,
                    mContext.getString(R.string.accessibility_casting));
            mService.setIconVisibility(SLOT_CAST, true);
        } else {
            // don't turn off the screen-record icon for a few seconds, just to make sure the user
            // has seen it
            if (DEBUG) Log.v(TAG, "updateCast: hiding icon in 3 sec...");
            mHandler.postDelayed(mRemoveCastIconRunnable, 3000);
        }
    }

    private void profileChanged(int userId) {
        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        UserInfo user = null;
        if (userId == UserHandle.USER_CURRENT) {
            try {
                user = ActivityManagerNative.getDefault().getCurrentUser();
            } catch (RemoteException e) {
                // Ignore
            }
        } else {
            user = userManager.getUserInfo(userId);
        }

        mManagedProfileFocused = user != null && user.isManagedProfile();
        if (DEBUG) Log.v(TAG, "profileChanged: mManagedProfileFocused: " + mManagedProfileFocused);
        // Actually update the icon later when transition starts.
    }

    private void updateManagedProfile() {
        if (DEBUG) Log.v(TAG, "updateManagedProfile: mManagedProfileFocused: "
                + mManagedProfileFocused
                + " mKeyguardVisible: " + mKeyguardVisible);
        boolean showIcon = mManagedProfileFocused && !mKeyguardVisible;
        if (mManagedProfileIconVisible != showIcon) {
            mService.setIconVisibility(SLOT_MANAGED_PROFILE, showIcon);
            mManagedProfileIconVisible = showIcon;
        }
    }

    private final IUserSwitchObserver.Stub mUserSwitchListener =
            new IUserSwitchObserver.Stub() {
                @Override
                public void onUserSwitching(int newUserId, IRemoteCallback reply) {
                    mUserInfoController.reloadUserInfo();
                }

                @Override
                public void onUserSwitchComplete(int newUserId) throws RemoteException {
                    updateAlarm();
                    profileChanged(newUserId);
                }

                @Override
                public void onForegroundProfileSwitch(int newProfileId) {
                    profileChanged(newProfileId);
                }
            };

    private final HotspotController.Callback mHotspotCallback = new HotspotController.Callback() {
        @Override
        public void onHotspotChanged(boolean enabled) {
            mService.setIconVisibility(SLOT_HOTSPOT, enabled);
        }
    };

    private void updateSu() {
        mService.setIconVisibility(SLOT_SU, mSuController.hasActiveSessions());
        final int userId = UserHandle.myUserId();
        if (isSuEnabledForUser(userId)) {
            publishSuCustomTile();
        } else {
            unpublishSuCustomTile();
        }
    }

    private final CastController.Callback mCastCallback = new CastController.Callback() {
        @Override
        public void onCastDevicesChanged() {
            updateCast();
        }
    };

    public void appTransitionStarting(long startTime, long duration) {
        updateManagedProfile();
    }

    public void setKeyguardShowing(boolean visible) {
        mKeyguardVisible = visible;
        updateManagedProfile();
    }

    public void setCurrentUserSetup(boolean userSetup) {
        if (mCurrentUserSetup == userSetup) return;
        mCurrentUserSetup = userSetup;
        updateAlarm();
    }

    private final SuController.Callback mSuCallback = new SuController.Callback() {
        @Override
        public void onSuSessionsChanged() {
            updateSu();
        }
    };

    private void publishSuCustomTile() {
        // This action should be performed as system
        final int userId = UserHandle.myUserId();
        long token = Binder.clearCallingIdentity();
        try {
            final UserHandle user = new UserHandle(userId);
            final int icon = QSUtils.getDynamicQSTileResIconId(mContext, userId,
                    QSConstants.DYNAMIC_TILE_SU);
            final String contentDesc = QSUtils.getDynamicQSTileLabel(mContext, userId,
                    QSConstants.DYNAMIC_TILE_SU);
            final Context resourceContext = QSUtils.getQSTileContext(mContext, userId);

            CustomTile.ListExpandedStyle style = new CustomTile.ListExpandedStyle();
            ArrayList<CustomTile.ExpandedListItem> items = new ArrayList<>();
            for (String pkg : mSuController.getPackageNamesWithActiveSuSessions()) {
                CustomTile.ExpandedListItem item = new CustomTile.ExpandedListItem();
                int appIconIdentifier = getActiveSuApkDrawableId(pkg);
                if (appIconIdentifier != -1) {
                    item.setExpandedListItemDrawable(appIconIdentifier);
                } else {
                    item.setExpandedListItemDrawable(icon);
                }
                item.setExpandedListItemTitle(getActiveSuApkLabel(pkg));
                item.setExpandedListItemSummary(pkg);
                item.setExpandedListItemOnClickIntent(getCustomTilePendingIntent(pkg));
                items.add(item);
            }
            style.setListItems(items);

            CMStatusBarManager statusBarManager = CMStatusBarManager.getInstance(mContext);
            CustomTile tile = new CustomTile.Builder(resourceContext)
                    .setLabel(contentDesc)
                    .setContentDescription(contentDesc)
                    .setIcon(icon)
                    .setOnSettingsClickIntent(getCustomTileSettingsIntent())
                    .setExpandedStyle(style)
                    .build();
            statusBarManager.publishTileAsUser(QSConstants.DYNAMIC_TILE_SU,
                    PhoneStatusBarPolicy.class.hashCode(), tile, user);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    private void unpublishSuCustomTile() {
        // This action should be performed as system
        final int userId = UserHandle.myUserId();
        long token = Binder.clearCallingIdentity();
        try {
            CMStatusBarManager statusBarManager = CMStatusBarManager.getInstance(mContext);
            statusBarManager.removeTileAsUser(QSConstants.DYNAMIC_TILE_SU,
                    PhoneStatusBarPolicy.class.hashCode(), new UserHandle(userId));
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    private PendingIntent getCustomTilePendingIntent(String pkg) {
        Intent i = new Intent(Intent.ACTION_MAIN);
        i.setPackage(pkg);
        i.addCategory(Intent.CATEGORY_LAUNCHER);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        return PendingIntent.getActivity(mContext, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
    }

    private Intent getCustomTileSettingsIntent() {
        Intent i = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        return i;
    }

    private String getActiveSuApkLabel(String pkg) {
        final PackageManager pm = mContext.getPackageManager();
        ApplicationInfo ai = null;
        try {
            ai = pm.getApplicationInfo(pkg, 0);
        } catch (final NameNotFoundException e) {
            // Ignore
        }
        return (String) (ai != null ? pm.getApplicationLabel(ai) : pkg);
    }

    private int getActiveSuApkDrawableId(String pkg) {
        final PackageManager pm = mContext.getPackageManager();
        ApplicationInfo ai;
        try {
            ai = pm.getApplicationInfo(pkg, 0);
        } catch (final NameNotFoundException e) {
            return -1;
        }
        return ai.icon;
    }

    private boolean isSuEnabledForUser(int userId) {
        final boolean hasSuAccess = mSuController.hasActiveSessions();
        return  (userId == UserHandle.USER_OWNER) && hasSuAccess;
    }

    private void processQSChangedLocked() {
        final int userId = UserHandle.myUserId();
        if (isSuEnabledForUser(userId)) {
            publishSuCustomTile();
        } else {
            unpublishSuCustomTile();
        }
    }
}


text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ash/plugin_vm/plugin_vm_test_helper.h"

#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_model.h"
#include "base/system/sys_info.h"
#include "base/test/scoped_running_on_chromeos.h"
#include "base/time/time.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h"
#include "chrome/browser/ash/login/users/mock_user_manager.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_features.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/testing_profile.h"
#include "components/account_id/account_id.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/user_manager/scoped_user_manager.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace plugin_vm {

namespace {

const char kDiskImageImportCommandUuid[] = "3922722bd7394acf85bf4d5a330d4a47";
const char kDomain[] = "example.com";
const char kDeviceId[] = "device_id";

// Arbitrary container value used for updating the GuestOsRegistryService.
const char kPluginVmContainer[] = "PluginVmContainer";

// For adding a fake shelf item without requiring opening an actual window.
class FakeShelfItemDelegate : public ash::ShelfItemDelegate {
 public:
  explicit FakeShelfItemDelegate(const ash::ShelfID& shelf_id)
      : ShelfItemDelegate(shelf_id) {}

  void ExecuteCommand(bool from_context_menu,
                      int64_t command_id,
                      int32_t event_flags,
                      int64_t display_id) override {}
  void Close() override {
    ChromeShelfController::instance()->ReplaceWithAppShortcutOrRemove(
        ash::ShelfID(kPluginVmShelfAppId));
  }
};

}  // namespace

void SetupConciergeForSuccessfulDiskImageImport(
    ash::FakeConciergeClient* fake_concierge_client_) {
  // Set immediate response for the ImportDiskImage call: will be that "image is
  // in progress":
  vm_tools::concierge::ImportDiskImageResponse import_disk_image_response;
  import_disk_image_response.set_status(
      vm_tools::concierge::DISK_STATUS_IN_PROGRESS);
  import_disk_image_response.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_import_disk_image_response(
      import_disk_image_response);

  // Set a series of signals: one at 50% (in progress) and one at 100%
  // (created):
  std::vector<vm_tools::concierge::DiskImageStatusResponse> signals;
  vm_tools::concierge::DiskImageStatusResponse signal1;
  signal1.set_status(vm_tools::concierge::DISK_STATUS_IN_PROGRESS);
  signal1.set_progress(50);
  signal1.set_command_uuid(kDiskImageImportCommandUuid);
  vm_tools::concierge::DiskImageStatusResponse signal2;
  signal2.set_status(vm_tools::concierge::DISK_STATUS_CREATED);
  signal2.set_progress(100);
  signal2.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_disk_image_status_signals({signal1, signal2});

  // Finally, set a success response for any eventual final call to
  // DiskImageStatus:
  vm_tools::concierge::DiskImageStatusResponse disk_image_status_response;
  disk_image_status_response.set_status(
      vm_tools::concierge::DISK_STATUS_CREATED);
  disk_image_status_response.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_disk_image_status_response(
      disk_image_status_response);
}

void SetupConciergeForFailedDiskImageImport(
    ash::FakeConciergeClient* fake_concierge_client_,
    vm_tools::concierge::DiskImageStatus status) {
  // Set immediate response for the ImportDiskImage call: will be that "image is
  // in progress":
  vm_tools::concierge::ImportDiskImageResponse import_disk_image_response;
  import_disk_image_response.set_status(
      vm_tools::concierge::DISK_STATUS_IN_PROGRESS);
  import_disk_image_response.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_import_disk_image_response(
      import_disk_image_response);

  // Set a series of signals: one at 50% (in progress) and one at 75%
  // (failed):
  std::vector<vm_tools::concierge::DiskImageStatusResponse> signals;
  vm_tools::concierge::DiskImageStatusResponse signal1;
  signal1.set_status(vm_tools::concierge::DISK_STATUS_IN_PROGRESS);
  signal1.set_progress(50);
  signal1.set_command_uuid(kDiskImageImportCommandUuid);
  vm_tools::concierge::DiskImageStatusResponse signal2;
  signal2.set_status(status);
  signal2.set_progress(75);
  signal2.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_disk_image_status_signals({signal1, signal2});

  // Finally, set a failure response for any eventual final call to
  // DiskImageStatus:
  vm_tools::concierge::DiskImageStatusResponse disk_image_status_response;
  disk_image_status_response.set_status(status);
  disk_image_status_response.set_command_uuid(kDiskImageImportCommandUuid);
  fake_concierge_client_->set_disk_image_status_response(
      disk_image_status_response);
}

void SetupConciergeForCancelDiskImageOperation(
    ash::FakeConciergeClient* fake_concierge_client_,
    bool success) {
  vm_tools::concierge::CancelDiskImageResponse cancel_disk_image_response;
  cancel_disk_image_response.set_success(success);
  fake_concierge_client_->set_cancel_disk_image_response(
      cancel_disk_image_response);
}

PluginVmTestHelper::PluginVmTestHelper(TestingProfile* testing_profile)
    : testing_profile_(testing_profile) {
  testing_profile_->ScopedCrosSettingsTestHelper()
      ->ReplaceDeviceSettingsProviderWithStub();

  current_apps_.set_vm_name(kPluginVmName);
  current_apps_.set_container_name(kPluginVmContainer);
  current_apps_.set_vm_type(guest_os::VmType::PLUGIN_VM);
}

PluginVmTestHelper::~PluginVmTestHelper() = default;

void PluginVmTestHelper::SetPolicyRequirementsToAllowPluginVm() {
  testing_profile_->GetPrefs()->SetBoolean(plugin_vm::prefs::kPluginVmAllowed,
                                           true);
  testing_profile_->GetPrefs()->SetString(plugin_vm::prefs::kPluginVmUserId,
                                          "fake-id");
  testing_profile_->ScopedCrosSettingsTestHelper()->SetBoolean(
      ash::kPluginVmAllowed, true);
}

void PluginVmTestHelper::SetUserRequirementsToAllowPluginVm() {
  // User for the profile should be affiliated with the device.
  const AccountId account_id(AccountId::FromUserEmailGaiaId(
      testing_profile_->GetProfileUserName(), "id"));
  auto mock_user_manager =
      std::make_unique<testing::NiceMock<ash::MockUserManager>>();
  mock_user_manager->AddUserWithAffiliationAndType(
      account_id, true, user_manager::USER_TYPE_REGULAR);
  scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>(
      std::move(mock_user_manager));
  running_on_chromeos_ =
      std::make_unique<base::test::ScopedRunningOnChromeOS>();
}

void PluginVmTestHelper::EnablePluginVmFeature() {
  scoped_feature_list_.InitAndEnableFeature(features::kPluginVm);
}

void PluginVmTestHelper::EnterpriseEnrollDevice() {
  testing_profile_->ScopedCrosSettingsTestHelper()
      ->InstallAttributes()
      ->SetCloudManaged(kDomain, kDeviceId);
}

void PluginVmTestHelper::AllowPluginVm() {
  ASSERT_FALSE(PluginVmFeatures::Get()->IsAllowed(testing_profile_));
  SetUserRequirementsToAllowPluginVm();
  EnablePluginVmFeature();
  EnterpriseEnrollDevice();
  SetPolicyRequirementsToAllowPluginVm();
  ASSERT_TRUE(PluginVmFeatures::Get()->IsAllowed(testing_profile_));
}

void PluginVmTestHelper::EnablePluginVm() {
  testing_profile_->GetPrefs()->SetBoolean(
      plugin_vm::prefs::kPluginVmImageExists, true);
}

void PluginVmTestHelper::OpenShelfItem() {
  ash::ShelfID shelf_id(kPluginVmShelfAppId);
  std::unique_ptr<ash::ShelfItemDelegate> delegate =
      std::make_unique<FakeShelfItemDelegate>(shelf_id);
  ChromeShelfController* shelf_controller = ChromeShelfController::instance();
  // Similar logic to AppServiceAppWindowShelfController, for handling pins
  // and spinners.
  if (shelf_controller->GetItem(shelf_id)) {
    shelf_controller->shelf_model()->ReplaceShelfItemDelegate(
        shelf_id, std::move(delegate));
    shelf_controller->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
  } else {
    shelf_controller->CreateAppItem(std::move(delegate), ash::STATUS_RUNNING);
  }
}

void PluginVmTestHelper::CloseShelfItem() {
  ChromeShelfController::instance()->Close(ash::ShelfID(kPluginVmShelfAppId));
}

void PluginVmTestHelper::AddApp(const vm_tools::apps::App& app) {
  for (int i = 0; i < current_apps_.apps_size(); ++i) {
    if (current_apps_.apps(i).desktop_file_id() == app.desktop_file_id()) {
      *current_apps_.mutable_apps(i) = app;
      UpdateRegistry();
      return;
    }
  }
  *current_apps_.add_apps() = app;
  UpdateRegistry();
}

// static
std::string PluginVmTestHelper::GenerateAppId(const std::string& app_name) {
  return guest_os::GuestOsRegistryService::GenerateAppId(
      app_name, /*vm_name=*/kPluginVmName,
      /*container_name=*/kPluginVmContainer);
}

void PluginVmTestHelper::UpdateRegistry() {
  guest_os::GuestOsRegistryServiceFactory::GetForProfile(testing_profile_)
      ->UpdateApplicationList(current_apps_);
}

}  // namespace plugin_vm


text:
import pytest
import subprocess
import json
import sys

from numpy.distutils import _shell_utils

argv_cases = [
    [r'exe'],
    [r'path/exe'],
    [r'path\exe'],
    [r'\\server\path\exe'],
    [r'path to/exe'],
    [r'path to\exe'],

    [r'exe', '--flag'],
    [r'path/exe', '--flag'],
    [r'path\exe', '--flag'],
    [r'path to/exe', '--flag'],
    [r'path to\exe', '--flag'],

    # flags containing literal quotes in their name
    [r'path to/exe', '--flag-"quoted"'],
    [r'path to\exe', '--flag-"quoted"'],
    [r'path to/exe', '"--flag-quoted"'],
    [r'path to\exe', '"--flag-quoted"'],
]

@pytest.fixture(params=[
    _shell_utils.WindowsParser,
    _shell_utils.PosixParser
])
def Parser(request):
    return request.param

@pytest.fixture
def runner(Parser):
    if Parser != _shell_utils.NativeParser:
        pytest.skip('Unable to run with non-native parser')

    if Parser == _shell_utils.WindowsParser:
        return lambda cmd: subprocess.check_output(cmd)
    elif Parser == _shell_utils.PosixParser:
        # posix has no non-shell string parsing
        return lambda cmd: subprocess.check_output(cmd, shell=True)
    else:
        raise NotImplementedError

@pytest.mark.parametrize('argv', argv_cases)
def test_join_matches_subprocess(Parser, runner, argv):
    """
    Test that join produces strings understood by subprocess
    """
    # invoke python to return its arguments as json
    cmd = [
        sys.executable, '-c',
        'import json, sys; print(json.dumps(sys.argv[1:]))'
    ]
    joined = Parser.join(cmd + argv)
    json_out = runner(joined).decode()
    assert json.loads(json_out) == argv

@pytest.mark.parametrize('argv', argv_cases)
def test_roundtrip(Parser, argv):
    """
    Test that split is the inverse operation of join
    """
    try:
        joined = Parser.join(argv)
        assert argv == Parser.split(joined)
    except NotImplementedError:
        pytest.skip("Not implemented")


text:
// Any comments, input: @KevinDockx
// Any issues, requests: https://github.com/KevinDockx/JsonPatch
//
// Enjoy :-)
using Marvin.JsonPatch.Operations;

namespace Marvin.JsonPatch
{
    /// <summary>
    /// Captures error message and the related entity and the operation that caused it.
    /// </summary>
    public class JsonPatchError
    {
        /// <summary>
        /// Initializes a new instance of <see cref="JsonPatchError"/>.
        /// </summary>
        /// <param name="affectedObject">The object that is affected by the error.</param>
        /// <param name="operation">The <see cref="Operation"/> that caused the error.</param>
        /// <param name="errorMessage">The error message.</param>
        public JsonPatchError(
             object affectedObject,
             OperationBase operation,
             string errorMessage)
        {
            AffectedObject = affectedObject;
            Operation = operation;
            ErrorMessage = errorMessage;
        }

        /// <summary>
        /// Gets the object that is affected by the error.
        /// </summary>
        public object AffectedObject { get; private set; }

        /// <summary>
        /// Gets the <see cref="Operation"/> that caused the error.
        /// </summary>
        public OperationBase Operation { get; private set; }

        /// <summary>
        /// Gets the error message.
        /// </summary>
        public string ErrorMessage { get; private set; }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mode PUBLIC
          "-//NetBeans//DTD Mode Properties 2.0//EN"
          "http://www.netbeans.org/dtds/mode-properties2_0.dtd">

<mode version="2.3">
    <name unique="floatingLeftBottom" />
    <kind type="view" />   <!-- modal -->
  <!-- <kind type="editor" /> --> <!-- non-modal -->
  <state type="separated" />
   <constraints>
    <path orientation="horizontal" number="100" weight="0.5"/>
  </constraints>
  <bounds x="7" y="909" width="700" height="400" />
  <frame state="0"/>
    <!-- <active-tc  id="IngestMessageTopComponent" />  -->
    <empty-behavior permanent="true"/>
</mode>


text:
namespace zetasql {

class Coercer;
class Resolver;
class SignatureMatchResult;

// This class perfoms function resolution during ZetaSQL analysis.
// The functions here generally traverse the function expressions recursively,
// constructing and returning the ResolvedFunctionCall nodes bottom-up.
class FunctionResolver {
 public:
  FunctionResolver(Catalog* catalog, TypeFactory* type_factory,
                   Resolver* resolver);
  ~FunctionResolver() {}
  FunctionResolver(const FunctionResolver&) = delete;
  FunctionResolver& operator=(const FunctionResolver&) = delete;

  // Resolves the function call given the <function>, <arguments> expressions,
  // <expected_result_type> and creates a ResolvedFunctionCall.  No special
  // handling is done for aggregate functions - they are resolved exactly like
  // scalar functions. <is_analytic> indicates whether an OVER clause follows
  // this function call.
  // * Takes ownership of the ResolvedExprs in <arguments>.
  // * <named_arguments> is a vector of any named arguments passed into this
  //   function call along with each one's zero-based index of that argument as
  //   resolved in <arguments>. The function resolver refers to them when
  //   matching against function signatures as needed. These parse nodes
  //   should correspond to a subset of <arguments>.
  // * <expected_result_type> is optional and when specified should match the
  //   result_type of the function signature while resolving. Otherwise there is
  //   no match.
  absl::Status ResolveGeneralFunctionCall(
      const ASTNode* ast_location,
      const std::vector<const ASTNode*>& arg_locations,
      const Function* function, ResolvedFunctionCallBase::ErrorMode error_mode,
      bool is_analytic,
      std::vector<std::unique_ptr<const ResolvedExpr>> arguments,
      std::vector<std::pair<const ASTNamedArgument*, int>> named_arguments,
      const Type* expected_result_type,
      std::unique_ptr<ResolvedFunctionCall>* resolved_expr_out);

  // These are the same as previous but they take a (possibly multipart)
  // function name and looks it up in the <resolver_> catalog.  Multipart
  // names are prefixed by their (nested) catalog names.
  absl::Status ResolveGeneralFunctionCall(
      const ASTNode* ast_location,
      const std::vector<const ASTNode*>& arg_locations,
      const std::string& function_name, bool is_analytic,
      std::vector<std::unique_ptr<const ResolvedExpr>> arguments,
      std::vector<std::pair<const ASTNamedArgument*, int>> named_arguments,
      const Type* expected_result_type,
      std::unique_ptr<ResolvedFunctionCall>* resolved_expr_out);
  absl::Status ResolveGeneralFunctionCall(
      const ASTNode* ast_location,
      const std::vector<const ASTNode*>& arg_locations,
      const std::vector<std::string>& function_name_path, bool is_analytic,
      std::vector<std::unique_ptr<const ResolvedExpr>> arguments,
      std::vector<std::pair<const ASTNamedArgument*, int>> named_arguments,
      const Type* expected_result_type,
      std::unique_ptr<ResolvedFunctionCall>* resolved_expr_out);

  // Analyzes the body of a templated SQL function in <function> in the context
  // of the arguments provided for a specific call.
  //
  // See public/templated_sql_function.h for more background
  // templated sql functions.
  //
  // <function> may provide an alternate catalog for resolution.
  // If <function>.resolution_catalog() is set, then the function expression
  // is resolved against it, otherwise this->catalog_ is used.
  //
  // If this analysis succeeds, this method compares the result type against the
  // expected type as specified in the function signature (if present). If the
  // types are not equal, uses this->coercer_ to insert a coercion if the types
  // are compatible or returns an error otherwise.
  //
  // Finally, once this check is complete, this method returns the result type
  // of this function call in <function_call_info>.
  absl::Status ResolveTemplatedSQLFunctionCall(
      const ASTNode* ast_location, const TemplatedSQLFunction& function,
      const AnalyzerOptions& analyzer_options,
      const std::vector<InputArgumentType>& actual_arguments,
      std::shared_ptr<ResolvedFunctionCallInfo>* function_call_info_out);

  // This is a helper method when parsing or analyzing the function's SQL
  // expression.  If 'status' is OK, also returns OK. Otherwise, returns a
  // new error forwarding any nested errors in 'status' obtained from the
  // nested parsing or analysis.
  static absl::Status ForwardNestedResolutionAnalysisError(
      const TemplatedSQLFunction& function, const absl::Status& status,
      ErrorMessageMode mode);

  // Returns a new error message reporting a failure parsing or analyzing the
  // SQL body. If 'message' is not empty, appends it to the end of the error
  // string.
  static absl::Status MakeFunctionExprAnalysisError(
      const TemplatedSQLFunction& function, absl::string_view message = "");

  // Converts <argument> to <target_type> and replaces <argument> with the new
  // expression if successful. If <argument> is a converted literal and
  // <set_has_explicit_type> is true, then the new ResolvedLiteral is marked as
  // having been explicitly cast (and it will thereafter be treated as a
  // non-literal with respect to coercion). <return_null_on_error> indicates
  // whether the cast should return a NULL value of the <target_type> in case of
  // cast failures, which should only be set to true when using SAFE_CAST.
  //
  // Note: <ast_location> is expected to refer to the location of <argument>,
  // and would be more appropriate as type ASTExpression, though this would
  // require refactoring some callers.
  absl::Status AddCastOrConvertLiteral(
      const ASTNode* ast_location,
      const Type* target_type,
      const ResolvedScan* scan,  // May be null
      bool set_has_explicit_type,
      bool return_null_on_error,
      std::unique_ptr<const ResolvedExpr>* argument) const;

  // Map an operator id from the parse tree to a ZetaSQL function name.
  static const std::string& UnaryOperatorToFunctionName(
      ASTUnaryExpression::Op op);
  static const std::string& BinaryOperatorToFunctionName(
      ASTBinaryExpression::Op op);

  // Returns the Coercer from <resolver_>.
  const Coercer& coercer() const;

  // Determines if the function signature matches the argument list, returning
  // a non-templated signature if true.  If <allow_argument_coercion> is TRUE
  // then function arguments can be coerced to the required signature
  // type(s), otherwise they must be an exact match.
  bool SignatureMatches(const std::vector<InputArgumentType>& input_arguments,
                        const FunctionSignature& signature,
                        bool allow_argument_coercion,
                        std::unique_ptr<FunctionSignature>* result_signature,
                        SignatureMatchResult* signature_match_result) const;

  // Perform post-processing checks on CREATE AGGREGATE FUNCTION statements at
  // initial declaration time or when the functions are called later.
  // <expr_info> and <query_info> should be valid at the time that
  // <resolved_expr> is generated. Note that <sql_function_body_location> is
  // optional, and will be used to help construct the error message if present.
  static absl::Status CheckCreateAggregateFunctionProperties(
      const ResolvedExpr& resolved_expr,
      const ASTNode* sql_function_body_location,
      const ExprResolutionInfo* expr_info,
      QueryResolutionInfo* query_info);

  // Iterates through <named_arguments> and compares them against <signature>,
  // rearranging any of <arg_locations>, <expr_args>, <input_arg_types>, and/or
  // <tvf_arg_types> to match the order of the given <named_arguments> or
  // returning an error if an invariant is not satisfied. Sets
  // <named_arguments_match_signature> to true if <named_arguments> are a match
  // for <signature> or false otherwise. In the latter case, if
  // <return_error_if_named_arguments_do_not_match_signature> is true, this
  // method will return a descriptive error message.
  //
  // The <arg_locations>, <expr_args>, <input_arg_types>, and <tvf_arg_types>
  // are all optional and will be ignored if NULL; any combination is
  // acceptable. In practice, (<expr_args>, <input_arg_types>) and
  // <tvf_arg_types> are generally mutually exclusive. If we are resolving a
  // scalar function call, <expr_args> and/or <input_arg_types> are provided.
  // Otherwise, if we are resolving a TVF call, <tvf_arg_types> are provided.
  //
  // If <signature> contains any optional arguments whose values are not
  // provided (either positionally in <expr_args> or <tvf_arg_types> or named
  // in <named_arguments>) then this method may inject suitable default values
  // in <expr_args>, <input_arg_types>, and/or <tvf_arg_types>. Currently this
  // method injects a NULL value for such missing arguments as a default policy.
  absl::Status ProcessNamedArguments(
      const std::string& function_name, const FunctionSignature& signature,
      const ASTNode* ast_location,
      const std::vector<std::pair<const ASTNamedArgument*, int>>&
          named_arguments,
      bool return_error_if_named_arguments_do_not_match_signature,
      bool* named_arguments_match_signature,
      std::vector<const ASTNode*>* arg_locations,
      std::vector<std::unique_ptr<const ResolvedExpr>>* expr_args,
      std::vector<InputArgumentType>* input_arg_types,
      std::vector<ResolvedTVFArg>* tvf_arg_types) const;

 private:
  Catalog* catalog_;           // Not owned.
  TypeFactory* type_factory_;  // Not owned.
  Resolver* resolver_;         // Not owned.

  // Represents the argument types corresponding to a SignatureArgumentKind.
  // There are three possibilities:
  // 1) The object represents an untyped NULL.
  // 2) The object represents an untyped empty array.
  // 3) The object represents a list of typed arguments.
  // An object in state i and can move to state j if i < j.
  //
  // The main purpose of this class is to keep track of the types associated
  // with a templated SignatureArgumentKind in
  // CheckArgumentTypesAndCollectTemplatedArguments(). There, if we encounter a
  // typed argument for a templated SignatureArgumentKind, we add that to the
  // set. But if there are no typed arguments, then we need to know whether
  // there is an untyped NULL or empty array, because that affects the type we
  // will infer for the SignatureArgumentKind.
  class SignatureArgumentKindTypeSet {
   public:
    enum Kind { UNTYPED_NULL, UNTYPED_EMPTY_ARRAY, TYPED_ARGUMENTS };

    // Creates a set with kind UNTYPED_NULL.
    SignatureArgumentKindTypeSet() : kind_(UNTYPED_NULL) {}
    SignatureArgumentKindTypeSet(const SignatureArgumentKindTypeSet&) = delete;
    SignatureArgumentKindTypeSet& operator=(
        const SignatureArgumentKindTypeSet&) = delete;

    Kind kind() const { return kind_; }

    // Changes the set to kind UNTYPED_EMPTY_ARRAY. Cannot be called if
    // InsertTypedArgument() has already been called.
    void SetToUntypedEmptyArray() {
      DCHECK(kind_ != TYPED_ARGUMENTS);
      kind_ = UNTYPED_EMPTY_ARRAY;
    }

    // Changes the set to kind TYPED_ARGUMENTS, and adds a typed argument to
    // the set of typed arguments.
    bool InsertTypedArgument(const InputArgumentType& input_argument) {
      // Typed arguments have precedence over untyped arguments.
      DCHECK(!input_argument.is_untyped());
      kind_ = TYPED_ARGUMENTS;
      return typed_arguments_.Insert(input_argument);
    }

    // Returns the set of typed arguments corresponding to this object. Can only
    // be called if 'kind() == TYPED_ARGUMENTS'.
    const InputArgumentTypeSet& typed_arguments() const {
      DCHECK_EQ(kind_, TYPED_ARGUMENTS);
      return typed_arguments_;
    }

    std::string DebugString() const;

   private:
    Kind kind_;
    // Does not contain any untyped arguments. Only valid if 'kind_' is
    // TYPED_ARGUMENTS.
    InputArgumentTypeSet typed_arguments_;
  };

  // Maps templated arguments (ARG_TYPE_ANY_1, etc.) to a set of input argument
  // types. See CheckArgumentTypesAndCollectTemplatedArguments() for details.
  typedef std::map<SignatureArgumentKind, SignatureArgumentKindTypeSet>
      ArgKindToInputTypesMap;

  // Maps templated arguments (ARG_TYPE_ANY_1, etc.) to the
  // resolved (possibly coerced) Type each resolved to in a particular function
  // call.
  typedef std::map<SignatureArgumentKind, const Type*> ArgKindToResolvedTypeMap;

  static std::string ArgKindToInputTypesMapDebugString(
      const ArgKindToInputTypesMap& map);

  // Returns the concrete argument type for a given <function_argument_type>,
  // using the mapping from templated to concrete argument types in
  // <templated_argument_map>.  Also used for result types.
  bool GetConcreteArgument(
      const FunctionArgumentType& argument, int num_occurrences,
      const ArgKindToResolvedTypeMap& templated_argument_map,
      std::unique_ptr<FunctionArgumentType>* output_argument) const;

  // Returns a list of concrete arguments by calling GetConcreteArgument()
  // on each entry and setting num_occurrences_ with appropriate argument
  // counts.
  FunctionArgumentTypeList GetConcreteArguments(
      const std::vector<InputArgumentType>& input_arguments,
      const FunctionSignature& signature,
      int repetitions,
      int optionals,
      const ArgKindToResolvedTypeMap& templated_argument_map)
        const;

  // Returns a signature that matches the argument type list, returning
  // a concrete FunctionSignature if found.  If not found, returns NULL.
  // The caller takes ownership of the returned FunctionSignature.
  //
  // The <ast_location> and <arg_locations> identify the function call and
  // argument locations for use in error messages. The <named_arguments>
  // optionally identify a list of named arguments provided as part of the
  // function call which may be used to help identify the signature. The pair in
  // each of <named_arguments> comprises a pointer to the ASTNamedArgument
  // object that the parser produced for this named argument reference and also
  // an integer identifying the corresponding argument type by indexing into
  // <input_arguments>.
  zetasql_base::StatusOr<const FunctionSignature*> FindMatchingSignature(
      const Function* function,
      const std::vector<InputArgumentType>& input_arguments,
      const ASTNode* ast_location,
      const std::vector<const ASTNode*>& arg_locations,
      const std::vector<std::pair<const ASTNamedArgument*, int>>&
          named_arguments) const;

  // Determines if the argument list count matches signature, returning the
  // number of times each repeated argument repeats and the number of
  // optional arguments present if true.
  bool SignatureArgumentCountMatches(
      const std::vector<InputArgumentType>& input_arguments,
      const FunctionSignature& signature, int* repetitions,
      int* optionals) const;

  // Determines if non-templated argument types match the signature, and returns
  // related templated argument type information.  <repetitions> identifies the
  // number of times that repeated arguments repeat.  Returns false if argument
  // types (and therefore the signature) do not match.
  //
  // Also populates <templated_argument_map> with a key for every templated
  // SignatureArgumentKind that appears in the signature (including the result
  // type) and <input_arguments>.  The corresponding value is the list of typed
  // arguments that occur for that SignatureArgumentKind. (The list may be empty
  // in the case of untyped arguments.) There is also some special handling for
  // ANY_K: if we see an argument (typed or untyped) for ARRAY_ANY_K, we act as
  // if we also saw the corresponding array element argument for ANY_K, and add
  // an entry to <templated_argument_map> even if ANY_K is not in the signature.
  bool CheckArgumentTypesAndCollectTemplatedArguments(
      const std::vector<InputArgumentType>& input_arguments,
      const FunctionSignature& signature,
      int repetitions,
      bool allow_argument_coercion,
      ArgKindToInputTypesMap* templated_argument_map,
      SignatureMatchResult* signature_match_result) const;

  // This method is only relevant for table-valued functions. It returns true in
  // 'signature_matches' if a relation input argument type matches a signature
  // argument type, and sets information in 'signature_match_result' either way.
  absl::Status CheckRelationArgumentTypes(
      int arg_idx, const InputArgumentType& input_argument,
      const FunctionArgumentType& signature_argument,
      bool allow_argument_coercion,
      SignatureMatchResult* signature_match_result,
      bool* signature_matches) const;

  // Check a literal argument value against value constraints for a given
  // argument, and return an error if any are violated.
  absl::Status CheckArgumentValueConstraints(
      const ASTNode* arg_location, int idx, const Value& value,
      const FunctionArgumentType& concrete_argument,
      const std::function<std::string(int)>& BadArgErrorPrefix) const;

  // Determines the resolved Type related to all of the templated types present
  // in a function signature. <templated_argument_map> must have been populated
  // by CheckArgumentTypesAndCollectTemplatedArguments().
  bool DetermineResolvedTypesForTemplatedArguments(
      const ArgKindToInputTypesMap& templated_argument_map,
      ArgKindToResolvedTypeMap* resolved_templated_arguments) const;

  // Converts <argument_literal> to <target_type> and replaces <coerced_literal>
  // with the new expression if successful. If <set_has_explicit_type> is true,
  // then the new ResolvedLiteral is marked as having been explicitly cast (and
  // it will thereafter be treated as a non-literal with respect to coercion).
  // <return_null_on_error> indicates whether the cast should return a NULL
  // value of the <target_type> in case of cast failures, which should only be
  // set to true when using SAFE_CAST.
  absl::Status ConvertLiteralToType(
      const ASTNode* ast_location, const ResolvedLiteral* argument_literal,
      const Type* target_type, const ResolvedScan* scan,
      bool set_has_explicit_type, bool return_null_on_error,
      std::unique_ptr<const ResolvedLiteral>* converted_literal) const;

  friend class FunctionResolverTest;
};

}  // namespace zetasql

#endif  // ZETASQL_ANALYZER_FUNCTION_RESOLVER_H_


text:
package coveragecalculator

import (
	"fmt"
	"io/ioutil"
	"strings"

	"k8s.io/apimachinery/pkg/util/sets"

	yaml "gopkg.in/yaml.v2"
)

// IgnoredFields encapsulates fields to be ignored in a package for API coverage calculation.
type IgnoredFields struct {
	ignoredFields map[string]sets.String
}

// This type is used for deserialization from the input .yaml file
type inputIgnoredFields struct {
	Package string   `yaml:"package"`
	Type    string   `yaml:"type"`
	Fields  []string `yaml:"fields"`
}

// ReadFromFile is a utility method that can be used by repos to read .yaml input file into
// IgnoredFields type.
func (ig *IgnoredFields) ReadFromFile(filePath string) error {
	data, err := ioutil.ReadFile(filePath)
	if err != nil {
		return fmt.Errorf("Error reading file: %s Error : %v", filePath, err)
	}

	var inputEntries []inputIgnoredFields
	err = yaml.Unmarshal(data, &inputEntries)
	if err != nil {
		return fmt.Errorf("Error unmarshalling ignoredfields input yaml file: %s Content: %s Error: %v", filePath, string(data), err)
	}

	ig.ignoredFields = make(map[string]sets.String)

	for _, entry := range inputEntries {
		if _, ok := ig.ignoredFields[entry.Package]; !ok {
			ig.ignoredFields[entry.Package] = sets.String{}
		}

		for _, field := range entry.Fields {
			ig.ignoredFields[entry.Package].Insert(entry.Type + "." + field)
		}
	}
	return nil
}

// FieldIgnored method given a package, type and field returns true if the field is marked ignored.
func (ig *IgnoredFields) FieldIgnored(packageName string, typeName string, fieldName string) bool {
	if ig.ignoredFields != nil {
		for key, value := range ig.ignoredFields {
			if strings.HasSuffix(packageName, key) {
				if value.Has(typeName + "." + fieldName) {
					return true
				}
			}
		}
	}
	return false
}


text:
<Alloy>
	<Window id="helpImages" class="container">
		<View id="closeScreen">
			<Label id="closeLabel" text="Close">
		</View>
		<ScrollableView id="scrollableView" showPagingControl="true">
		</ScrollableView>
	</Window>
</Alloy>


text:
#pragma once
#include <aws/cloudformation/CloudFormation_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace CloudFormation
{
namespace Model
{

  /**
   *
The Export structure describes the exported output values for a
   * stack.

See Also:
   AWS
   * API Reference

   */
  class AWS_CLOUDFORMATION_API Export
  {
  public:
    Export();
    Export(const Aws::Utils::Xml::XmlNode& xmlNode);
    Export& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
    void OutputToStream(Aws::OStream& oStream, const char* location) const;

    /**
     *
The stack that contains the exported output name and value.

     */
    inline const Aws::String& GetExportingStackId() const{ return m_exportingStackId; }

    /**
     *
The stack that contains the exported output name and value.

     */
    inline void SetExportingStackId(const Aws::String& value) { m_exportingStackIdHasBeenSet = true; m_exportingStackId = value; }

    /**
     *
The stack that contains the exported output name and value.

     */
    inline void SetExportingStackId(Aws::String&& value) { m_exportingStackIdHasBeenSet = true; m_exportingStackId = std::move(value); }

    /**
     *
The stack that contains the exported output name and value.

     */
    inline void SetExportingStackId(const char* value) { m_exportingStackIdHasBeenSet = true; m_exportingStackId.assign(value); }

    /**
     *
The stack that contains the exported output name and value.

     */
    inline Export& WithExportingStackId(const Aws::String& value) { SetExportingStackId(value); return *this;}

    /**
     *
The stack that contains the exported output name and value.

     */
    inline Export& WithExportingStackId(Aws::String&& value) { SetExportingStackId(std::move(value)); return *this;}

    /**
     *
The stack that contains the exported output name and value.

     */
    inline Export& WithExportingStackId(const char* value) { SetExportingStackId(value); return *this;}

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline Export& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline Export& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
The name of exported output value. Use this name and the
     * Fn::ImportValue function to import the associated value into other
     * stacks. The name is defined in the Export field in the associated
     * stack's Outputs section.

     */
    inline Export& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline const Aws::String& GetValue() const{ return m_value; }

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline void SetValue(const Aws::String& value) { m_valueHasBeenSet = true; m_value = value; }

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline void SetValue(Aws::String&& value) { m_valueHasBeenSet = true; m_value = std::move(value); }

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline void SetValue(const char* value) { m_valueHasBeenSet = true; m_value.assign(value); }

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline Export& WithValue(const Aws::String& value) { SetValue(value); return *this;}

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline Export& WithValue(Aws::String&& value) { SetValue(std::move(value)); return *this;}

    /**
     *
The value of the exported output, such as a resource physical ID. This value
     * is defined in the Export field in the associated stack's
     * Outputs section.

     */
    inline Export& WithValue(const char* value) { SetValue(value); return *this;}

  private:

    Aws::String m_exportingStackId;
    bool m_exportingStackIdHasBeenSet;

    Aws::String m_name;
    bool m_nameHasBeenSet;

    Aws::String m_value;
    bool m_valueHasBeenSet;
  };

} // namespace Model
} // namespace CloudFormation
} // namespace Aws


text:
import { h, Component } from 'preact';
import { Modal } from '../util/modal';
import { ResolveData } from './ResolveData';
import { maxLength } from '../util/strings';

export interface KeyValueClasses {
  div?: string;
  key?: string;
  val?: string;
}

export interface IKeyValueRowProps {
  classes: KeyValueClasses;
  modalTitle: string;
  tuple: { key: string; val: any };
}

export class KeyValueRow extends Component<IKeyValueRowProps, {}> {
  render() {
    const { tuple: { key, val }, classes, modalTitle } = this.props;
    const showModal = () => Modal.show(modalTitle, key, val, ResolveData);

    // prettier-ignore
    const renderValue = () => {
      if (val === undefined)                  return undefined;
      if (val === null)                       return null;
      if (typeof val === 'string')            return "{maxLength(100, val)}";
      if (typeof val === 'number')            return {val.toString()};
      if (typeof val === 'boolean')           return {val.toString()};
      if (Array.isArray(val))                 return [Array];
      if (typeof val === 'object')            return [Object];
      if (typeof val.toString === 'function') return {maxLength(100, val.toString())};
    };

    return (

{key}:

{renderValue()}

    );
  }
}

interface Bucket {
  label: string;
  is: (val) => boolean;
  value?: any;
  count: number;
  data: { [key: string]: any };
}

export interface IGroupDefinition {
  value: any;
  label: string;
}

export interface IKeysAndValuesProps {
  data: any;
  classes: KeyValueClasses;
  modalTitle?: string;
  groupedValues?: IGroupDefinition[];
  enableGroupToggle?: boolean;
}

export interface IKeysAndValuesState {
  collapseFalsy: boolean;
}

export class KeysAndValues extends Component<IKeysAndValuesProps, IKeysAndValuesState> {
  public static falsyGroupDefinitions: IGroupDefinition[] = [
    { value: undefined, label: 'undefined' },
    { value: null, label: 'null' },
    { value: '', label: 'empty string' },
  ];
  state = { collapseFalsy: true };

  private makeBuckets(definitions: IGroupDefinition[], data: { [key: string]: any }): Bucket[] {
    const makeBucket = (def: IGroupDefinition): Bucket => ({
      label: def.label,
      is: val => val === def.value,
      value: def.value,
      count: 0,
      data: {},
    });

    let defaultBucket = {
      label: 'default',
      is: () => true,
      count: 0,
      data: {},
    };

    const buckets = definitions.map(makeBucket).concat(defaultBucket);

    Object.keys(data).forEach(key => {
      const bucket = buckets.find(bucket => bucket.is(data[key]));
      bucket.data[key] = data[key];
      bucket.value = data[key];
      bucket.count++;
    });

    return buckets;
  }

  render() {
    const { data, classes, modalTitle } = this.props;

    const groupedValues = this.props.groupedValues || KeysAndValues.falsyGroupDefinitions;
    const enableGroupToggle = this.props.enableGroupToggle || false;

    const isCollapsed = this.state.collapseFalsy;

    const buckets: Bucket[] = this.makeBuckets(groupedValues, data);
    const defaultBucket = buckets.find(bucket => bucket.label === 'default');
    const groupedBuckets = buckets.filter(bucket => !!bucket.count && bucket !== defaultBucket);
    const groupedCount = groupedBuckets.reduce((total, bucket) => (total += bucket.count), 0);

    const tuples = Object.keys(defaultBucket.data).map(key => ({ key, val: defaultBucket.data[key] }));
    const groupedTuples = groupedBuckets.map(bucket => {
      const key = Object.keys(bucket.data)
        .sort()
        .join(', ');
      const val = bucket.value;
      return { key, val };
    });

    const showGroupToggle = enableGroupToggle && groupedCount > 1;

    return (

        {tuples.map(tuple => <KeyValueRow key={tuple.key} tuple={tuple} classes={classes} modalTitle={modalTitle} />)}

        {showGroupToggle &&
          !!groupedTuples.length && (
             this.setState({ collapseFalsy: !isCollapsed })}
              className="uirTranVis_keyValue"
            >
              {isCollapsed ? 'show' : 'hide'} {groupedCount} {groupedBuckets.map(bucket => bucket.label).join(' or ')}{' '}
              parameter values

          )}

        {(!showGroupToggle || !this.state.collapseFalsy) &&
          groupedTuples.map(tuple => (
            <KeyValueRow key={tuple.key} tuple={tuple} classes={classes} modalTitle={modalTitle} />
          ))}

    );
  }
}


text:
//
//  NSAttributedString+FYCategory.h
//  GWIM
//
//  Created by IOS on 15/10/13.
//  Copyright (c) 2015年 绿网天下. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface NSAttributedString (FYCategory)

/**
 *  给某个字符串中的字符标红
 */
- (NSAttributedString *)fy_markString:(NSString *)aString;

@end


text:
<?php

if (!defined('ELK'))
	die('No access...');

/**
 * Class Error context for attachments
 */
class Attachment_Error_Context
{
	/**
	 * Holds our static instance of the class
	 * @var object
	 */
	private static $_context = null;

	/**
	 * Holds all of the attachment ids
	 * @var array
	 */
	private $_attachs = null;

	/**
	 * Holds any errors found
	 * @var Error_Context|null
	 */
	private $_generic_error = null;

	/**
	 * Holds if the error is generic of specific to an attachment
	 * @var string
	 */
	private $_active_attach = null;

	/**
	 * Add attachment
	 *
	 * - Automatically activate the attachments added
	 *
	 * @param string $id
	 * @param string $name
	 */
	public function addAttach($id, $name)
	{
		if (empty($id) || empty($name))
		{
			$this->activate();
			return false;
		}

		if (!isset($this->_attachs[$id]))
			$this->_attachs[$id] = array(
				'name' => $name,
				'error' => Error_Context::context($id, 1),
			);

		$this->activate($id);

		return true;
	}

	/**
	 * Sets the active attach (errors are "attached" to that)
	 *
	 * @param string|null $id A valid attachment, if invalid it defaults to 'generic'
	 */
	public function activate($id = null)
	{
		if (empty($id) || !isset($this->_attachs[$id]))
			$this->_active_attach = 'generic';
		else
			$this->_active_attach = $id;

		return $this;
	}

	/**
	 * Add an error
	 *
	 * @param string $error error code
	 * @param string|null $lang_file = null
	 */
	public function addError($error, $lang_file = null)
	{
		if (empty($error))
			return;

		if ($this->_active_attach == 'generic')
		{
			if (!isset($this->_attachs[$this->_active_attach]))
				$this->_generic_error = Error_Context::context('attach_generic_error', 1);

			$this->_generic_error->addError($error, $lang_file);
			return;
		}

		$this->_attachs[$this->_active_attach]['error']->addError($error, $lang_file);
	}

	/**
	 * Removes an error
	 *
	 * @param string $error error code
	 */
	public function removeError($error)
	{
		if (empty($error))
			return;

		$this->_attachs[$this->_active_attach]['error']->removeError($error);
	}

	/**
	 * If this error context has errors stored.
	 *
	 * @param string|null $attachID
	 * @param int|null $severity the severity level
	 */
	public function hasErrors($attachID = null, $severity = null)
	{
		if ($this->_generic_error !== null)
			if ($this->_generic_error->hasErrors($severity))
				return true;

		if (!empty($this->_attachs))
		{
			if ($attachID !== null)
			{
				if (isset($this->_attachs[$attachID]))
					return $this->_attachs[$attachID]['error']->hasErrors($severity);
			}
			else
			{
				foreach ($this->_attachs as $attach)
					if ($attach['error']->hasErrors($severity))
						return true;
			}
		}
		return false;
	}

	/**
	 * Prepare the errors for display.
	 *
	 * - Return an array containing the error strings
	 * - If severity is null the function returns all the errors
	 *
	 * @param int|null $severity = null the severity level wanted
	 */
	public function prepareErrors($severity = null)
	{
		global $txt;

		$returns = array();

		if ($this->_generic_error !== null)
			$returns['attach_generic'] = array(
				'errors' => $this->_generic_error->prepareErrors($severity),
				'type' => $this->getErrorType(),
				'title' => $txt['attach_error_title'],
			);

		if (!empty($this->_attachs))
			foreach ($this->_attachs as $attachID => $error)
				$returns[$attachID] = array(
					'errors' => $error['error']->prepareErrors($severity),
					'type' => $this->getErrorType(),
					'title' => sprintf($txt['attach_warning'], $error['name']),
				);

		return $returns;
	}

	/**
	 * Return the type of the error
	 */
	public function getErrorType()
	{
		return 1;
	}

	/**
	 * Find and return Attachment_Error_Context instance if it exists,
	 * or create it if it doesn't exist
	 */
	public static function context()
	{
		if (self::$_context === null)
			self::$_context = new Attachment_Error_Context();

		return self::$_context;
	}
}


text:
package org.cthul.parser.api;

import java.util.Collection;
import org.cthul.parser.lexer.api.InputMatch;

/**
 * An input whose elements are already {@link InputMatch}es.
 */
public class TokenInput<T extends InputMatch<?>> extends Input<T> {

    protected final String inputString;
    private final Object[] tokens;

    public TokenInput(String inputString, Object[] tokens) {
        this.inputString = inputString;
        this.tokens = tokens;
    }

    public TokenInput(String inputString, Collection<? extends T> tokens) {
        this.inputString = inputString;
        this.tokens = tokens.toArray(new Object[tokens.size()]);
    }

    @Override
    public String asString() {
        return inputString;
    }

    @Override
    public int getLength() {
        return tokens.length;
    }

    @Override
    @SuppressWarnings("unchecked")
    public T get(int i) {
        return (T) tokens[i];
    }

    @Override
    public int startPosition(int i) {
        if (i >= getLength()) {
            return endPosition(i-1);
        }
        return get(i).getInputStart();
    }

    @Override
    public int endPosition(int i) {
        if (i >= getLength()) {
            return endPosition(i-1);
        }
        return get(i).getInputEnd();
    }

}


text:
.index_box_box{
    width: 100%;
}
.index_navigation{
    height: 80px;
    width: 100%;
    background: #242b3e;
    display: flex;
}
.index_navigation_ul{
    /*flex: 1;*/
    width: 767px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.index_navigation_ul li a{
    color: #ffffff;
    font-size: 18px;
    text-decoration: none;
    letter-spacing: 2px;
}
.index_navigation_ul .head_add_colored a{
    color: #90d5ff;
}
/*banner*/
.index_banner{
    height: 725px;
    width: 100%;
    /*background: url("../images/banner_02.gif") center center;*/
    /*background-size:  100% 725px;*/
    background: url(../images/banner1.jpg) center center;
    background-size: auto 725px;
}
.index_banner_content{
    width: 1405px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.banner_content_title{
    height: 215px;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 3px;
}
.title_word{
    color: #6bcbff;
}
.banner_company_target{
    width: 486px;
    height: 125px;
    border-bottom: 2px solid #f2f1f1;
    font-size: 22px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 2px;
}
.banner_company_target_content{
    height: 6px;
    width: 6px;
    background: #ffffff;
    border-radius: 50%;
    display: inline-block;
    margin: 0px 5px 0px 5px;
}
.banner_company_messages{
    width: 540px;
    height: 110px;
    padding: 26px 0px 26px 0px;
    box-sizing: border-box;
    font-size: 21px;
    color: #ffffff;
    text-indent: 2em;
    line-height: 30px;
    letter-spacing:2px
}
.index_body{
    width: 1405px;
    margin: 0 auto;
}
.index_body_first{
    margin-top: 70px;
}
.index_body_informate{
    width: 100%;
    height: 426px;
    display: flex;
    flex-direction: column;
}
.index_body_informate_resetHeight{
    height: 718px;
}
.index_body_informate_title{
    height: 60px;
    width: 100%;
    border-left: 5px solid #6bcbff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
}
.index_body_title_china{
    font-size: 28px;
    color: #333333;
    padding-left: 25px;
    box-sizing: border-box;
    letter-spacing: 3px;
}
.index_body_title_english{
    font-size: 15px;
    color: #333333;
    font-weight: bold;
    padding-left: 25px;
    box-sizing: border-box;
    padding-bottom: 2px;
}
.index_body_informate_body{
    flex:1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.index_body_informate_body li{
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.index_body_informate_word{
    margin-top: 28px;
    font-size: 18px;
    color: #333333;
    letter-spacing: 2px;
}
.index_body_informate_title_bottom{
    flex: 1;
    width: 100%;
    display: flex;
    /*align-items: center;*/
}
.index_body_informate_left,.index_body_informate_right{
    flex: 1;
    height: 465px;
    margin-top: 90px;
}
.index_body_informate_left_content{
    width: 560px;
    margin: 0 auto;
}
.index_body_informate_left_content .index_body_introduction{
    font-size: 16px;
    line-height: 30px;
    text-indent: 2em;
    color: #4d4d4d;
    letter-spacing: 1px;
}
.index_body_left_uls{
    margin-left: 32px;
}
.index_body_left_uls .uls_add_reset{
    position: relative;
    padding: 0px 0px 0px 28px;
    box-sizing: border-box;
    line-height: 30px;
    font-size: 16px;
    color: #666666;
    letter-spacing: 1px;
}
.index_body_left_uls .uls_add_reset:before{
    content: "";
    height: 7px;
    width: 7px;
    background: #333333;
    border-radius: 50%;
    position: absolute;
    left: 0px;
    top: 12px;
}
.index_body_informate_right{
    background: url("../images/img_03.jpg") center center;
    background-size: cover;
}
.index_body_company_profile{
    width: 100%;
    height: 850px;
    background: url("../images/banner2.jpg") center center;
    background-size: auto 850px;
}
.body_company_profile_box{
    width: 1405px;
    margin: 0 auto;
    padding: 70px 0px 0px 0px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.body_company_profile_word{
    color: #ffffff;
}
.body_company_people{
    height: 580px;
    width: 100%;
    /*background: #cccccc;*/
    padding: 96px 0px 96px 0px;
    box-sizing: border-box;
    display: flex;
}
.body_company_people_left{
    flex: 1;
    height: 392px;
    display: flex;
}
.body_company_people_left_img{
    width: 300px;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.body_company_people_left_img img{
    height: 100%;
    width: auto;
}
.body_company_people_left_message{
    flex: 1;
    margin:0px 70px 0px 27px;
}
.company_people_name{
    font-size: 34px;
    color: #ffffff;
    font-weight: bold;
    letter-spacing: 2px;
}
.company_people_name .name_spell{
    padding-left: 18px;
}
.company_people_position{
    font-size: 26px;
    color: #5da7d5;
    padding-top: 14px;
    box-sizing: border-box;
    letter-spacing: 1px;
}
.body_company_people_left_informated{
    margin-left: 0px;
    color: #cdcfd5;
    text-indent: 2em;
    font-size: 16px;
    line-height: 30px;
    margin-top: 35px;
    letter-spacing: 1px;
}
.body_company_button_box{
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.body_button_view_more{
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    letter-spacing: 2px;
}
.body_botton_view_icon{
    height: 38px;
    width: 38px;
    border-radius: 50%;
    font-size: 24px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5e6477;
    margin-left: 12px;
    cursor: pointer;
}
.index_body_case_show{
    margin-top: 95px;
}
.reset_case_show_height{
    height: 875px;
    width: 100%;
}
.index_body_images_show{
    flex: 1;
    padding: 69px 0px 99px 0px;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
}
.index_body_image_box{
    height: 324px;
    width: 33%;
    overflow: hidden;
    position: relative;
}
.index_body_image_top{
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    /*display: none;*/
}
.index_body_image_top img{
    height: 100%;
    width: auto;
}

.index_body_image_bottom{
    width: 100%;
    height: 100%;
    background-color: rgba(15,99,171,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 0;
}
.index_body_image_bottom:before{
    content: "";
    height: 0px;
    width: 0px;
    border-width: 29px 29px 29px 0px;
    border-color:transparent #6bcbff transparent transparent;
    border-style: solid;
    position: relative;
    right: -220px;
    top: 100px;
}
.body_image_bottom_word{
    font-size: 34px;
    color: #f2f2f2;
    letter-spacing: 2px;
}
.body_image_bottom_word_English{
    font-size: 18px;
    color: #f2f2f2;
    margin-top: 10px;
    letter-spacing: 1px;
}
.body_image_bottom_word_message{
    font-size: 20px;
    color: #f2f2f2;
    margin-top: 26px;
    letter-spacing: 2px;
}
.body_image_bottom_buttons{
    font-size: 16px;
    padding: 10px 7px 10px 7px;
    box-sizing: border-box;
    border: 1px solid #ffffff;
    color: #f2f2f2;
    margin-top: 50px;
    cursor: pointer;
    letter-spacing: 2px;
}
.index_footer{
    height: 400px;
    width: 100%;
    background: #22293a;
}
.index_footer_content{
    width: 1405px;
    height: 100%;
    margin: 0 auto;
}
.index_footer_navigation{
    height: 200px;
    padding: 75px 0px 25px 0px;
    box-sizing: border-box;
    border-bottom: #656a75 1px solid;
    display: flex;
}
.index_footer_navigation_left{
    flex: 1;
    display: flex;
    align-items: flex-end;
}
.footer_message{
    width: 96px;
    font-size: 16px;
    color: #b7b7b7;
    position: relative;
    letter-spacing: 2px;
}
.footer_message:before{
    content:"";
    height: 4px;
    width: 4px;
    border-radius: 50%;
    background: #b7b7b7;
    position: absolute;
    right: 0px;
    top: 6px;
}
.footer_reset_distance{
    margin-left: 20px;
    color: #b7b7b7;
    letter-spacing: 2px;
}
.index_footer_navigation_right{
    height: 100%;
    width: 180px;
    font-size: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #6bcbff;
    letter-spacing: 2px;
}
.index_footer_information{
    height: 200px;
    width: 100%;
    padding: 48px 0px 0px 0px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
}
.index_footer_information_left p{
    color: #b7b7b7;
    font-size: 16px;
    line-height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    letter-spacing: 1px;
}
.footer_icon_second{
    display: inline-block;
    width: 20px;
    height: 16px;
    background: url(../images/footer_icon_07.jpg) center center;
    margin-right: 6px;

}
.footer_icon_third{
    display: inline-block;
    width: 20px;
    height: 18px;
    background: url(../images/footer_icon_08.jpg) center center;
    margin-right: 6px;
}
.index_footer_information_right{
    height: 112px;
    width: 112px;
    background: url(../images/dimensional.jpg) center center;
    background-size: 112px 112px;
}
.footer_reset_firstPage{
    width: 60px;
}


text:
namespace llvm {

class AliasAnalysis;
class DominatorTree;
class Instruction;
class MDNode;
class Pass;
class ReturnInst;
class TargetLibraryInfo;
class TerminatorInst;

/// DeleteDeadBlock - Delete the specified block, which must have no
/// predecessors.
void DeleteDeadBlock(BasicBlock *BB);

/// FoldSingleEntryPHINodes - We know that BB has one predecessor.  If there are
/// any single-entry PHI nodes in it, fold them away.  This handles the case
/// when all entries to the PHI nodes in a block are guaranteed equal, such as
/// when the block has exactly one predecessor.
void FoldSingleEntryPHINodes(BasicBlock *BB, Pass *P = nullptr);

/// DeleteDeadPHIs - Examine each PHI in the given block and delete it if it
/// is dead. Also recursively delete any operands that become dead as
/// a result. This includes tracing the def-use list from the PHI to see if
/// it is ultimately unused or if it reaches an unused cycle. Return true
/// if any PHIs were deleted.
bool DeleteDeadPHIs(BasicBlock *BB, const TargetLibraryInfo *TLI = nullptr);

/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
/// if possible.  The return value indicates success or failure.
bool MergeBlockIntoPredecessor(BasicBlock *BB, Pass *P = nullptr);

// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
// with a value, then remove and delete the original instruction.
//
void ReplaceInstWithValue(BasicBlock::InstListType &BIL,
                          BasicBlock::iterator &BI, Value *V);

// ReplaceInstWithInst - Replace the instruction specified by BI with the
// instruction specified by I.  The original instruction is deleted and BI is
// updated to point to the new instruction.
//
void ReplaceInstWithInst(BasicBlock::InstListType &BIL,
                         BasicBlock::iterator &BI, Instruction *I);

// ReplaceInstWithInst - Replace the instruction specified by From with the
// instruction specified by To.
//
void ReplaceInstWithInst(Instruction *From, Instruction *To);

/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
/// split the critical edge.  This will update DominatorTree and
/// DominatorFrontier information if it is available, thus calling this pass
/// will not invalidate either of them. This returns the new block if the edge
/// was split, null otherwise.
///
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
/// specified successor will be merged into the same critical edge block.
/// This is most commonly interesting with switch instructions, which may
/// have many edges to any one destination.  This ensures that all edges to that
/// dest go to one block instead of each going to a different block, but isn't
/// the standard definition of a "critical edge".
///
/// It is invalid to call this function on a critical edge that starts at an
/// IndirectBrInst.  Splitting these edges will almost always create an invalid
/// program because the address of the new block won't be the one that is jumped
/// to.
///
BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
                              Pass *P = nullptr,
                              bool MergeIdenticalEdges = false,
                              bool DontDeleteUselessPHIs = false,
                              bool SplitLandingPads = false);

inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI,
                                     Pass *P = nullptr) {
  return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P);
}

/// SplitCriticalEdge - If the edge from *PI to BB is not critical, return
/// false.  Otherwise, split all edges between the two blocks and return true.
/// This updates all of the same analyses as the other SplitCriticalEdge
/// function.  If P is specified, it updates the analyses
/// described above.
inline bool SplitCriticalEdge(BasicBlock *Succ, pred_iterator PI,
                              Pass *P = nullptr) {
  bool MadeChange = false;
  TerminatorInst *TI = (*PI)->getTerminator();
  for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
    if (TI->getSuccessor(i) == Succ)
      MadeChange |= !!SplitCriticalEdge(TI, i, P);
  return MadeChange;
}

/// SplitCriticalEdge - If an edge from Src to Dst is critical, split the edge
/// and return true, otherwise return false.  This method requires that there be
/// an edge between the two blocks.  If P is specified, it updates the analyses
/// described above.
inline BasicBlock *SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst,
                                     Pass *P = nullptr,
                                     bool MergeIdenticalEdges = false,
                                     bool DontDeleteUselessPHIs = false) {
  TerminatorInst *TI = Src->getTerminator();
  unsigned i = 0;
  while (1) {
    assert(i != TI->getNumSuccessors() && "Edge doesn't exist!");
    if (TI->getSuccessor(i) == Dst)
      return SplitCriticalEdge(TI, i, P, MergeIdenticalEdges,
                               DontDeleteUselessPHIs);
    ++i;
  }
}

/// SplitEdge -  Split the edge connecting specified block. Pass P must
/// not be NULL.
BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To, Pass *P);

/// SplitBlock - Split the specified block at the specified instruction - every
/// thing before SplitPt stays in Old and everything starting with SplitPt moves
/// to a new block.  The two blocks are joined by an unconditional branch and
/// the loop info is updated.
///
BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P);

/// SplitBlockPredecessors - This method transforms BB by introducing a new
/// basic block into the function, and moving some of the predecessors of BB to
/// be predecessors of the new block.  The new predecessors are indicated by the
/// Preds array, which has NumPreds elements in it.  The new block is given a
/// suffix of 'Suffix'.  This function returns the new block.
///
/// This currently updates the LLVM IR, AliasAnalysis, DominatorTree,
/// DominanceFrontier, LoopInfo, and LCCSA but no other analyses.
/// In particular, it does not preserve LoopSimplify (because it's
/// complicated to handle the case where one of the edges being split
/// is an exit of a loop with other exits).
///
BasicBlock *SplitBlockPredecessors(BasicBlock *BB, ArrayRef<BasicBlock*> Preds,
                                   const char *Suffix, Pass *P = nullptr);

/// SplitLandingPadPredecessors - This method transforms the landing pad,
/// OrigBB, by introducing two new basic blocks into the function. One of those
/// new basic blocks gets the predecessors listed in Preds. The other basic
/// block gets the remaining predecessors of OrigBB. The landingpad instruction
/// OrigBB is clone into both of the new basic blocks. The new blocks are given
/// the suffixes 'Suffix1' and 'Suffix2', and are returned in the NewBBs vector.
///
/// This currently updates the LLVM IR, AliasAnalysis, DominatorTree,
/// DominanceFrontier, LoopInfo, and LCCSA but no other analyses. In particular,
/// it does not preserve LoopSimplify (because it's complicated to handle the
/// case where one of the edges being split is an exit of a loop with other
/// exits).
///
void SplitLandingPadPredecessors(BasicBlock *OrigBB,ArrayRef<BasicBlock*> Preds,
                                 const char *Suffix, const char *Suffix2,
                                 Pass *P, SmallVectorImpl<BasicBlock*> &NewBBs);

/// FoldReturnIntoUncondBranch - This method duplicates the specified return
/// instruction into a predecessor which ends in an unconditional branch. If
/// the return instruction returns a value defined by a PHI, propagate the
/// right value into the return. It returns the new return instruction in the
/// predecessor.
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
                                       BasicBlock *Pred);

/// SplitBlockAndInsertIfThen - Split the containing block at the
/// specified instruction - everything before and including SplitBefore stays
/// in the old basic block, and everything after SplitBefore is moved to a
/// new block. The two blocks are connected by a conditional branch
/// (with value of Cmp being the condition).
/// Before:
///   Head
///   SplitBefore
///   Tail
/// After:
///   Head
///   if (Cond)
///     ThenBlock
///   SplitBefore
///   Tail
///
/// If Unreachable is true, then ThenBlock ends with
/// UnreachableInst, otherwise it branches to Tail.
/// Returns the NewBasicBlock's terminator.
///
/// Updates DT if given.
TerminatorInst *SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore,
                                          bool Unreachable,
                                          MDNode *BranchWeights = nullptr,
                                          DominatorTree *DT = nullptr);

/// SplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen,
/// but also creates the ElseBlock.
/// Before:
///   Head
///   SplitBefore
///   Tail
/// After:
///   Head
///   if (Cond)
///     ThenBlock
///   else
///     ElseBlock
///   SplitBefore
///   Tail
void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
                                   TerminatorInst **ThenTerm,
                                   TerminatorInst **ElseTerm,
                                   MDNode *BranchWeights = nullptr);

///
/// GetIfCondition - Check whether BB is the merge point of a if-region.
/// If so, return the boolean condition that determines which entry into
/// BB will be taken.  Also, return by references the block that will be
/// entered from if the condition is true, and the block that will be
/// entered if the condition is false.
Value *GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue,
                      BasicBlock *&IfFalse);
} // End llvm namespace

#endif