code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 4
991
| language
stringclasses 9
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Filename : long_anisotropically_dense.py
# Author : Stephane Grabli
# Date : 04/08/2005
# Purpose : Selects the lines that are long and have a high anisotropic
# a priori density and uses causal density
# to draw without cluttering. Ideally, half of the
# selected lines are culled using the causal density.
#
# ********************* WARNING *************************************
# ******** The Directional a priori density maps must ******
# ******** have been computed prior to using this style module ******
from freestyle.chainingiterators import ChainSilhouetteIterator
from freestyle.functions import DensityF1D
from freestyle.predicates import (
NotUP1D,
QuantitativeInvisibilityUP1D,
UnaryPredicate1D,
pyHighDensityAnisotropyUP1D,
pyHigherLengthUP1D,
pyLengthBP1D,
)
from freestyle.shaders import (
ConstantColorShader,
ConstantThicknessShader,
SamplingShader,
)
from freestyle.types import IntegrationType, Operators
## custom density predicate
class pyDensityUP1D(UnaryPredicate1D):
def __init__(self, wsize, threshold, integration=IntegrationType.MEAN, sampling=2.0):
UnaryPredicate1D.__init__(self)
self._wsize = wsize
self._threshold = threshold
self._integration = integration
self._func = DensityF1D(self._wsize, self._integration, sampling)
self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling)
def __call__(self, inter):
c = self._func(inter)
m = self._func2(inter)
if c < self._threshold:
return 1
if m > 4*c:
if c < 1.5*self._threshold:
return 1
return 0
Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
Operators.select(pyHigherLengthUP1D(40))
## selects lines having a high anisotropic a priori density
Operators.select(pyHighDensityAnisotropyUP1D(0.3,4))
Operators.sort(pyLengthBP1D())
shaders_list = [
SamplingShader(2.0),
ConstantThicknessShader(2),
ConstantColorShader(0.2,0.2,0.25,1),
]
## uniform culling
Operators.create(pyDensityUP1D(3.0,2.0e-2, IntegrationType.MEAN, 0.1), shaders_list)
| Microvellum/Fluid-Designer | win64-vc/2.78/scripts/freestyle/styles/long_anisotropically_dense.py | Python | gpl-3.0 | 3,125 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = '''
---
module: nxos_install_os
extends_documentation_fragment: nxos
short_description: Set boot options like boot, kickstart image and issu.
description:
- Install an operating system by setting the boot options like boot
image and kickstart image and optionally select to install using
ISSU (In Server Software Upgrade).
notes:
- Tested against the following platforms and images
- N9k 7.0(3)I4(6), 7.0(3)I5(3), 7.0(3)I6(1), 7.0(3)I7(1), 7.0(3)F2(2), 7.0(3)F3(2)
- N3k 6.0(2)A8(6), 6.0(2)A8(8), 7.0(3)I6(1), 7.0(3)I7(1)
- N7k 7.3(0)D1(1), 8.0(1), 8.2(1)
- This module requires both the ANSIBLE_PERSISTENT_CONNECT_TIMEOUT and
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT timers to be set to 600 seconds or higher.
The module will exit if the timers are not set properly.
- Do not include full file paths, just the name of the file(s) stored on
the top level flash directory.
- This module attempts to install the software immediately,
which may trigger a reboot.
- In check mode, the module will indicate if an upgrade is needed and
whether or not the upgrade is disruptive or non-disruptive(ISSU).
author:
- Jason Edelman (@jedelman8)
- Gabriele Gerbibo (@GGabriele)
version_added: 2.2
options:
system_image_file:
description:
- Name of the system (or combined) image file on flash.
required: true
kickstart_image_file:
description:
- Name of the kickstart image file on flash.
(Not required on all Nexus platforms)
issu:
version_added: "2.5"
description:
- Upgrade using In Service Software Upgrade (ISSU).
(Only supported on N9k platforms)
- Selecting 'required' or 'yes' means that upgrades will only
proceed if the switch is capable of ISSU.
- Selecting 'desired' means that upgrades will use ISSU if possible
but will fall back to disruptive upgrade if needed.
- Selecting 'no' means do not use ISSU. Forced disruptive.
choices: ['required','desired', 'yes', 'no']
default: 'no'
'''
EXAMPLES = '''
- name: Install OS on N9k
check_mode: no
nxos_install_os:
system_image_file: nxos.7.0.3.I6.1.bin
issu: desired
- name: Wait for device to come back up with new image
wait_for:
port: 22
state: started
timeout: 500
delay: 60
host: "{{ inventory_hostname }}"
- name: Check installed OS for newly installed version
nxos_command:
commands: ['show version | json']
provider: "{{ connection }}"
register: output
- assert:
that:
- output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I6(1)'
'''
RETURN = '''
install_state:
description: Boot and install information.
returned: always
type: dictionary
sample: {
"install_state": [
"Compatibility check is done:",
"Module bootable Impact Install-type Reason",
"------ -------- -------------- ------------ ------",
" 1 yes non-disruptive reset ",
"Images will be upgraded according to following table:",
"Module Image Running-Version(pri:alt) New-Version Upg-Required",
"------ ---------- ---------------------------------------- -------------------- ------------",
" 1 nxos 7.0(3)I6(1) 7.0(3)I7(1) yes",
" 1 bios v4.4.0(07/12/2017) v4.4.0(07/12/2017) no"
],
}
'''
import re
from time import sleep
from ansible.module_utils.network.nxos.nxos import load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule
# Output options are 'text' or 'json'
def execute_show_command(module, command, output='text'):
cmds = [{
'command': command,
'output': output,
}]
return run_commands(module, cmds)
def get_platform(module):
"""Determine platform type"""
data = execute_show_command(module, 'show inventory', 'json')
pid = data[0]['TABLE_inv']['ROW_inv'][0]['productid']
if re.search(r'N3K', pid):
type = 'N3K'
elif re.search(r'N5K', pid):
type = 'N5K'
elif re.search(r'N6K', pid):
type = 'N6K'
elif re.search(r'N7K', pid):
type = 'N7K'
elif re.search(r'N9K', pid):
type = 'N9K'
else:
type = 'unknown'
return type
def parse_show_install(data):
"""Helper method to parse the output of the 'show install all impact' or
'install all' commands.
Sample Output:
Installer will perform impact only check. Please wait.
Verifying image bootflash:/nxos.7.0.3.F2.2.bin for boot variable "nxos".
[####################] 100% -- SUCCESS
Verifying image type.
[####################] 100% -- SUCCESS
Preparing "bios" version info using image bootflash:/nxos.7.0.3.F2.2.bin.
[####################] 100% -- SUCCESS
Preparing "nxos" version info using image bootflash:/nxos.7.0.3.F2.2.bin.
[####################] 100% -- SUCCESS
Performing module support checks.
[####################] 100% -- SUCCESS
Notifying services about system upgrade.
[####################] 100% -- SUCCESS
Compatibility check is done:
Module bootable Impact Install-type Reason
------ -------- -------------- ------------ ------
8 yes disruptive reset Incompatible image for ISSU
21 yes disruptive reset Incompatible image for ISSU
Images will be upgraded according to following table:
Module Image Running-Version(pri:alt) New-Version Upg-Required
------ ---------- ---------------------------------------- ------------
8 lcn9k 7.0(3)F3(2) 7.0(3)F2(2) yes
8 bios v01.17 v01.17 no
21 lcn9k 7.0(3)F3(2) 7.0(3)F2(2) yes
21 bios v01.70 v01.70 no
"""
if len(data) > 0:
data = massage_install_data(data)
ud = {'raw': data}
ud['processed'] = []
ud['disruptive'] = False
ud['upgrade_needed'] = False
ud['error'] = False
ud['install_in_progress'] = False
ud['server_error'] = False
ud['upgrade_succeeded'] = False
ud['use_impact_data'] = False
# Check for server errors
if isinstance(data, int):
if data == -1:
ud['server_error'] = True
elif data >= 500:
ud['server_error'] = True
elif data == -32603:
ud['server_error'] = True
return ud
else:
ud['list_data'] = data.split('\n')
for x in ud['list_data']:
# Check for errors and exit if found.
if re.search(r'Pre-upgrade check failed', x):
ud['error'] = True
break
if re.search(r'[I|i]nvalid command', x):
ud['error'] = True
break
if re.search(r'No install all data found', x):
ud['error'] = True
break
# Check for potentially transient conditions
if re.search(r'Another install procedure may be in progress', x):
ud['install_in_progress'] = True
break
if re.search(r'Backend processing error', x):
ud['server_error'] = True
break
if re.search(r'^(-1|5\d\d)$', x):
ud['server_error'] = True
break
# Check for messages indicating a successful upgrade.
if re.search(r'Finishing the upgrade', x):
ud['upgrade_succeeded'] = True
break
if re.search(r'Install has been successful', x):
ud['upgrade_succeeded'] = True
break
if re.search(r'Switching over onto standby', x):
ud['upgrade_succeeded'] = True
break
# We get these messages when the upgrade is non-disruptive and
# we loose connection with the switchover but far enough along that
# we can be confident the upgrade succeeded.
if re.search(r'timeout trying to send command: install', x):
ud['upgrade_succeeded'] = True
ud['use_impact_data'] = True
break
if re.search(r'[C|c]onnection failure: timed out', x):
ud['upgrade_succeeded'] = True
ud['use_impact_data'] = True
break
# Begin normal parsing.
if re.search(r'----|Module|Images will|Compatibility', x):
ud['processed'].append(x)
continue
# Check to see if upgrade will be disruptive or non-disruptive and
# build dictionary of individual modules and their status.
# Sample Line:
#
# Module bootable Impact Install-type Reason
# ------ -------- ---------- ------------ ------
# 8 yes disruptive reset Incompatible image
rd = r'(\d+)\s+(\S+)\s+(disruptive|non-disruptive)\s+(\S+)'
mo = re.search(rd, x)
if mo:
ud['processed'].append(x)
key = 'm%s' % mo.group(1)
field = 'disruptive'
if mo.group(3) == 'non-disruptive':
ud[key] = {field: False}
else:
ud[field] = True
ud[key] = {field: True}
field = 'bootable'
if mo.group(2) == 'yes':
ud[key].update({field: True})
else:
ud[key].update({field: False})
continue
# Check to see if switch needs an upgrade and build a dictionary
# of individual modules and their individual upgrade status.
# Sample Line:
#
# Module Image Running-Version(pri:alt) New-Version Upg-Required
# ------ ----- ---------------------------------------- ------------
# 8 lcn9k 7.0(3)F3(2) 7.0(3)F2(2) yes
mo = re.search(r'(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(yes|no)', x)
if mo:
ud['processed'].append(x)
key = 'm%s_%s' % (mo.group(1), mo.group(2))
field = 'upgrade_needed'
if mo.group(5) == 'yes':
ud[field] = True
ud[key] = {field: True}
else:
ud[key] = {field: False}
continue
return ud
def massage_install_data(data):
# Transport cli returns a list containing one result item.
# Transport nxapi returns a list containing two items. The second item
# contains the data we are interested in.
default_error_msg = 'No install all data found'
if len(data) == 1:
result_data = data[0]
elif len(data) == 2:
result_data = data[1]
else:
result_data = default_error_msg
# Further processing may be needed for result_data
if len(data) == 2 and isinstance(data[1], dict):
if 'clierror' in data[1].keys():
result_data = data[1]['clierror']
elif 'code' in data[1].keys() and data[1]['code'] == '500':
# We encountered a backend processing error for nxapi
result_data = data[1]['msg']
else:
result_data = default_error_msg
return result_data
def build_install_cmd_set(issu, image, kick, type):
commands = ['terminal dont-ask']
if re.search(r'required|desired|yes', issu):
issu_cmd = 'non-disruptive'
else:
issu_cmd = ''
if type == 'impact':
rootcmd = 'show install all impact'
else:
rootcmd = 'install all'
if kick is None:
commands.append(
'%s nxos %s %s' % (rootcmd, image, issu_cmd))
else:
commands.append(
'%s system %s kickstart %s' % (rootcmd, image, kick))
return commands
def parse_show_version(data):
version_data = {'raw': data[0].split('\n')}
version_data['version'] = ''
version_data['error'] = False
for x in version_data['raw']:
mo = re.search(r'(kickstart|system|NXOS):\s+version\s+(\S+)', x)
if mo:
version_data['version'] = mo.group(2)
continue
if version_data['version'] == '':
version_data['error'] = True
return version_data
def check_mode_legacy(module, issu, image, kick=None):
"""Some platforms/images/transports don't support the 'install all impact'
command so we need to use a different method."""
current = execute_show_command(module, 'show version', 'json')[0]
# Call parse_show_data on empty string to create the default upgrade
# data stucture dictionary
data = parse_show_install('')
upgrade_msg = 'No upgrade required'
# Process System Image
data['error'] = False
tsver = 'show version image bootflash:%s' % image
target_image = parse_show_version(execute_show_command(module, tsver))
if target_image['error']:
data['error'] = True
data['raw'] = target_image['raw']
if current['kickstart_ver_str'] != target_image['version'] and not data['error']:
data['upgrade_needed'] = True
data['disruptive'] = True
upgrade_msg = 'Switch upgraded: system: %s' % tsver
# Process Kickstart Image
if kick is not None and not data['error']:
tkver = 'show version image bootflash:%s' % kick
target_kick = parse_show_version(execute_show_command(module, tkver))
if target_kick['error']:
data['error'] = True
data['raw'] = target_kick['raw']
if current['kickstart_ver_str'] != target_kick['version'] and not data['error']:
data['upgrade_needed'] = True
data['disruptive'] = True
upgrade_msg = upgrade_msg + ' kickstart: %s' % tkver
data['processed'] = upgrade_msg
return data
def check_mode_nextgen(module, issu, image, kick=None):
"""Use the 'install all impact' command for check_mode"""
opts = {'ignore_timeout': True}
commands = build_install_cmd_set(issu, image, kick, 'impact')
data = parse_show_install(load_config(module, commands, True, opts))
# If an error is encountered when issu is 'desired' then try again
# but set issu to 'no'
if data['error'] and issu == 'desired':
issu = 'no'
commands = build_install_cmd_set(issu, image, kick, 'impact')
# The system may be busy from the previous call to check_mode so loop
# until it's done.
data = check_install_in_progress(module, commands, opts)
if data['server_error']:
data['error'] = True
return data
def check_install_in_progress(module, commands, opts):
for attempt in range(20):
data = parse_show_install(load_config(module, commands, True, opts))
if data['install_in_progress']:
sleep(1)
continue
break
return data
def check_mode(module, issu, image, kick=None):
"""Check switch upgrade impact using 'show install all impact' command"""
data = check_mode_nextgen(module, issu, image, kick)
if data['server_error']:
# We encountered an unrecoverable error in the attempt to get upgrade
# impact data from the 'show install all impact' command.
# Fallback to legacy method.
data = check_mode_legacy(module, issu, image, kick)
return data
def do_install_all(module, issu, image, kick=None):
"""Perform the switch upgrade using the 'install all' command"""
impact_data = check_mode(module, issu, image, kick)
if module.check_mode:
# Check mode set in the playbook so just return the impact data.
msg = '*** SWITCH WAS NOT UPGRADED: IMPACT DATA ONLY ***'
impact_data['processed'].append(msg)
return impact_data
if impact_data['error']:
# Check mode discovered an error so return with this info.
return impact_data
elif not impact_data['upgrade_needed']:
# The switch is already upgraded. Nothing more to do.
return impact_data
else:
# If we get here, check_mode returned no errors and the switch
# needs to be upgraded.
if impact_data['disruptive']:
# Check mode indicated that ISSU is not possible so issue the
# upgrade command without the non-disruptive flag.
issu = 'no'
commands = build_install_cmd_set(issu, image, kick, 'install')
opts = {'ignore_timeout': True}
# The system may be busy from the call to check_mode so loop until
# it's done.
upgrade = check_install_in_progress(module, commands, opts)
# Special case: If we encounter a server error at this stage
# it means the command was sent and the upgrade was started but
# we will need to use the impact data instead of the current install
# data.
if upgrade['server_error']:
upgrade['upgrade_succeeded'] = True
upgrade['use_impact_data'] = True
if upgrade['use_impact_data']:
if upgrade['upgrade_succeeded']:
upgrade = impact_data
upgrade['upgrade_succeeded'] = True
else:
upgrade = impact_data
upgrade['upgrade_succeeded'] = False
if not upgrade['upgrade_succeeded']:
upgrade['error'] = True
return upgrade
def main():
argument_spec = dict(
system_image_file=dict(required=True),
kickstart_image_file=dict(required=False),
issu=dict(choices=['required', 'desired', 'no', 'yes'], default='no'),
)
argument_spec.update(nxos_argument_spec)
module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True)
warnings = list()
check_args(module, warnings)
# Get system_image_file(sif), kickstart_image_file(kif) and
# issu settings from module params.
sif = module.params['system_image_file']
kif = module.params['kickstart_image_file']
issu = module.params['issu']
if kif == 'null' or kif == '':
kif = None
install_result = do_install_all(module, issu, sif, kick=kif)
if install_result['error']:
msg = "Failed to upgrade device using image "
if kif:
msg = msg + "files: kickstart: %s, system: %s" % (kif, sif)
else:
msg = msg + "file: system: %s" % sif
module.fail_json(msg=msg, raw_data=install_result['list_data'])
state = install_result['processed']
changed = install_result['upgrade_needed']
module.exit_json(changed=changed, install_state=state, warnings=warnings)
if __name__ == '__main__':
main()
| hryamzik/ansible | lib/ansible/modules/network/nxos/nxos_install_os.py | Python | gpl-3.0 | 19,714 |
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/paiement_charge.php
* \ingroup tax
* \brief Page to add payment of a tax
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("bills");
$chid=GETPOST("id", 'int');
$action=GETPOST('action', 'alpha');
$amounts = array();
// Security check
$socid=0;
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
}
/*
* Actions
*/
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes'))
{
$error=0;
if ($_POST["cancel"])
{
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
header("Location: ".$loc);
exit;
}
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
if (! $_POST["paiementtype"] > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
$action = 'create';
}
if ($datepaye == '')
{
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
$error++;
$action = 'create';
}
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")), null, 'errors');
$error++;
$action = 'create';
}
if (! $error)
{
$paymentid = 0;
// Read possible payments
foreach ($_POST as $key => $value)
{
if (substr($key,0,7) == 'amount_')
{
$other_chid = substr($key,7);
$amounts[$other_chid] = price2num($_POST[$key]);
}
}
if (count($amounts) <= 0)
{
$error++;
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
$action='create';
}
if (! $error)
{
$db->begin();
// Create a line of payments
$paiement = new PaymentSocialContribution($db);
$paiement->chid = $chid;
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = $_POST["paiementtype"];
$paiement->num_paiement = $_POST["num_paiement"];
$paiement->note = $_POST["note"];
if (! $error)
{
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
if ($paymentid < 0)
{
$error++;
setEventMessages($paiement->error, null, 'errors');
$action='create';
}
}
if (! $error)
{
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)', GETPOST('accountid','int'),'','');
if (! ($result > 0))
{
$error++;
setEventMessages($paiement->error, null, 'errors');
$action='create';
}
}
if (! $error)
{
$db->commit();
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
header('Location: '.$loc);
exit;
}
else
{
$db->rollback();
}
}
}
}
/*
* View
*/
llxHeader();
$form=new Form($db);
// Formulaire de creation d'un paiement de charge
if ($action == 'create')
{
$charge = new ChargeSociales($db);
$charge->fetch($chid);
$charge->accountid=$charge->fk_account?$charge->fk_account:$charge->accountid;
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
$total = $charge->amount;
if (! empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';
print ' });'."\n";
print ' </script>'."\n";
}
print load_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
if ($mesg)
{
print "<div class=\"error\">$mesg</div>";
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$chid.'">';
print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head('', '');
print '<table class="border" width="100%">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
$sql = "SELECT sum(p.amount) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= " WHERE p.fk_charge = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0;
$form->select_date($datepayment,'','','','',"add_payment",1,1);
print "</td>";
print '</tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype");
print "</td>\n";
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
print '</td></tr>';
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>';
print '<td><input name="num_paiement" type="text" value="'.GETPOST('num_paiement').'"></td></tr>'."\n";
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
dol_fiche_end();
/*
* Autres charges impayees
*/
$num = 1;
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
print '<td align="left">'.$langs->trans("DateDue").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$var=true;
$total=0;
$totalrecu=0;
while ($i < $num)
{
$objp = $charge;
print '<tr class="oddeven">';
if ($objp->date_ech > 0)
{
print "<td align=\"left\">".dol_print_date($objp->date_ech,'day')."</td>\n";
}
else
{
print "<td align=\"center\"><b>!!!</b></td>\n";
}
print '<td align="right">'.price($objp->amount)."</td>";
print '<td align="right">'.price($sumpaid)."</td>";
print '<td align="right">'.price($objp->amount - $sumpaid)."</td>";
print '<td align="center">';
if ($sumpaid < $objp->amount)
{
$namef = "amount_".$objp->id;
$nameRemain = "remain_".$objp->id;
if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
$remaintopay=$objp->amount - $sumpaid;
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
}
else
{
print '-';
}
print "</td>";
print "</tr>\n";
$total+=$objp->total;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$i++;
}
if ($i > 1)
{
// Print total
print "<tr ".$bc[!$var].">";
print '<td colspan="2" align="left">'.$langs->trans("Total").':</td>';
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
print '<td align="center"> </td>';
print "</tr>\n";
}
print "</table>";
// Bouton Save payment
print '<br><div class="center"><input type="checkbox" checked name="closepaidcontrib"> '.$langs->trans("ClosePaidContributionsAutomatically");
print '<br><input type="submit" class="button" name="save" value="'.$langs->trans('ToMakePayment').'">';
print ' ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print "</form>\n";
}
llxFooter();
$db->close();
| tomours/dolibarr | htdocs/compta/paiement_charge.php | PHP | gpl-3.0 | 10,955 |
#
# Copyright (C) 1997-2016 JDE Developers Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
# Authors :
# Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
#
import traceback
import jderobot
import threading
import Ice
from .threadSensor import ThreadSensor
from jderobotTypes import NavdataData
class NavData:
def __init__(self, jdrc, prefix):
self.lock = threading.Lock()
try:
ic = jdrc.getIc()
proxyStr = jdrc.getConfig().getProperty(prefix+".Proxy")
base = ic.stringToProxy(proxyStr)
self.proxy = jderobot.NavdataPrx.checkedCast(base)
self.navData = NavdataData()
self.update()
if not self.proxy:
print ('Interface ' + prefix + ' not configured')
except Ice.ConnectionRefusedException:
print(prefix + ': connection refused')
except:
traceback.print_exc()
exit(-1)
def update(self):
if self.hasproxy():
localNavdata = self.proxy.getNavdata()
navdataData = NavdataData()
navdataData.vehicle = localNavdata.vehicle
navdataData.state = localNavdata.state
navdataData.batteryPercent = localNavdata.batteryPercent
navdataData.magX = localNavdata.magX
navdataData.magY = localNavdata.magY
navdataData.magZ = localNavdata.magZ
navdataData.pressure = localNavdata.pressure
navdataData.temp = localNavdata.temp
navdataData.windSpeed = localNavdata.windSpeed
navdataData.windAngle = localNavdata.windAngle
navdataData.windCompAngle = localNavdata.windCompAngle
navdataData.rotX = localNavdata.rotX
navdataData.rotY = localNavdata.rotY
navdataData.rotZ = localNavdata.rotZ
navdataData.altd = localNavdata.altd
navdataData.vx = localNavdata.vx
navdataData.vy = localNavdata.vy
navdataData.vz = localNavdata.vz
navdataData.ax = localNavdata.ax
navdataData.ay = localNavdata.ay
navdataData.az = localNavdata.az
navdataData.tagsCount = localNavdata.tagsCount
navdataData.tagsType = localNavdata.tagsType
navdataData.tagsXc = localNavdata.tagsXc
navdataData.tagsYc = localNavdata.tagsYc
navdataData.tagsWidth = localNavdata.tagsWidth
navdataData.tagsHeight = localNavdata.tagsHeight
navdataData.tagsOrientation = localNavdata.tagsOrientation
navdataData.tagsDistance = localNavdata.tagsDistance
navdataData.timeStamp = localNavdata.tm
self.lock.acquire()
self.navData = navdataData
self.lock.release()
def hasproxy (self):
'''
Returns if proxy has ben created or not.
@return if proxy has ben created or not (Boolean)
'''
return hasattr(self,"proxy") and self.proxy
def getNavdata(self):
if self.hasproxy():
self.lock.acquire()
navData = self.navData
self.lock.release()
return navData
return None
class NavdataIceClient:
def __init__(self,ic,prefix, start = False):
self.navdata = NavData(ic,prefix)
self.kill_event = threading.Event()
self.thread = ThreadSensor(self.navdata, self.kill_event)
self.thread.daemon = True
if start:
self.start()
def start(self):
'''
Starts the client. If client is stopped you can not start again, Threading.Thread raised error
'''
self.kill_event.clear()
self.thread.start()
def stop(self):
'''
Stops the client. If client is stopped you can not start again, Threading.Thread raised error
'''
self.kill_event.set()
def getNavData(self):
return self.navdata.getNavdata()
def hasproxy (self):
'''
Returns if proxy has ben created or not.
@return if proxy has ben created or not (Boolean)
'''
return self.navdata.hasproxy() | fqez/JdeRobot | src/libs/comm_py/comm/ice/navdataIceClient.py | Python | gpl-3.0 | 4,847 |
// -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vim: set ts=2 et sw=2 tw=80:
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
#include "secport.h"
#include "gtest/gtest.h"
#include "prnetdb.h"
#include <stdint.h>
#include <string.h>
#include <string>
namespace nss_test {
// Structures to represent test cases. These are small enough that
// passing by value isn't a problem.
struct Ucs4Case {
PRUint32 c;
const char *utf8;
};
struct Ucs2Case {
PRUint16 c;
const char *utf8;
};
struct Utf16Case {
PRUint32 c;
PRUint16 w[2];
};
struct Utf16BadCase {
PRUint16 w[3];
};
// Test classes for parameterized tests:
class Ucs4Test : public ::testing::TestWithParam<Ucs4Case> {};
class Ucs2Test : public ::testing::TestWithParam<Ucs2Case> {};
class Utf16Test : public ::testing::TestWithParam<Utf16Case> {};
class BadUtf8Test : public ::testing::TestWithParam<const char *> {};
class BadUtf16Test : public ::testing::TestWithParam<Utf16BadCase> {};
class Iso88591Test : public ::testing::TestWithParam<Ucs2Case> {};
// Tests of sec_port_ucs4_utf8_conversion_function, by itself, on
// valid inputs:
TEST_P(Ucs4Test, ToUtf8) {
const Ucs4Case testCase = GetParam();
PRUint32 nc = PR_htonl(testCase.c);
unsigned char utf8[8] = {0};
unsigned int len = 0;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_FALSE, (unsigned char *)&nc, sizeof(nc), utf8, sizeof(utf8), &len);
ASSERT_TRUE(result);
ASSERT_LT(len, sizeof(utf8));
EXPECT_EQ(std::string(testCase.utf8), std::string((char *)utf8, len));
EXPECT_EQ('\0', utf8[len]);
}
TEST_P(Ucs4Test, FromUtf8) {
const Ucs4Case testCase = GetParam();
PRUint32 nc;
unsigned int len = 0;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_TRUE, (unsigned char *)testCase.utf8, strlen(testCase.utf8),
(unsigned char *)&nc, sizeof(nc), &len);
ASSERT_TRUE(result);
ASSERT_EQ(sizeof(nc), len);
EXPECT_EQ(testCase.c, PR_ntohl(nc));
}
TEST_P(Ucs4Test, DestTooSmall) {
const Ucs4Case testCase = GetParam();
PRUint32 nc = PR_htonl(testCase.c);
unsigned char utf8[8];
unsigned char *utf8end = utf8 + sizeof(utf8);
unsigned int len = strlen(testCase.utf8) - 1;
ASSERT_LE(len, sizeof(utf8));
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_FALSE, (unsigned char *)&nc, sizeof(nc), utf8end - len, len, &len);
ASSERT_FALSE(result);
ASSERT_EQ(strlen(testCase.utf8), len);
}
// Tests of sec_port_ucs2_utf8_conversion_function, by itself, on
// valid inputs:
TEST_P(Ucs2Test, ToUtf8) {
const Ucs2Case testCase = GetParam();
PRUint16 nc = PR_htons(testCase.c);
unsigned char utf8[8] = {0};
unsigned int len = 0;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)&nc, sizeof(nc), utf8, sizeof(utf8), &len);
ASSERT_TRUE(result);
ASSERT_LT(len, sizeof(utf8));
EXPECT_EQ(std::string(testCase.utf8), std::string((char *)utf8, len));
EXPECT_EQ('\0', utf8[len]);
}
TEST_P(Ucs2Test, FromUtf8) {
const Ucs2Case testCase = GetParam();
PRUint16 nc;
unsigned int len = 0;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_TRUE, (unsigned char *)testCase.utf8, strlen(testCase.utf8),
(unsigned char *)&nc, sizeof(nc), &len);
ASSERT_EQ(PR_TRUE, result);
ASSERT_EQ(sizeof(nc), len);
EXPECT_EQ(testCase.c, PR_ntohs(nc));
}
TEST_P(Ucs2Test, DestTooSmall) {
const Ucs2Case testCase = GetParam();
PRUint16 nc = PR_htons(testCase.c);
unsigned char utf8[8];
unsigned char *utf8end = utf8 + sizeof(utf8);
unsigned int len = strlen(testCase.utf8) - 1;
ASSERT_LE(len, sizeof(utf8));
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)&nc, sizeof(nc), utf8end - len, len, &len);
ASSERT_EQ(result, PR_FALSE);
ASSERT_EQ(strlen(testCase.utf8), len);
}
// Tests using UTF-16 and UCS-4 conversion together:
TEST_P(Utf16Test, From16To32) {
const Utf16Case testCase = GetParam();
PRUint16 from[2] = {PR_htons(testCase.w[0]), PR_htons(testCase.w[1])};
PRUint32 to;
unsigned char utf8[8];
unsigned int len = 0;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from, sizeof(from), utf8, sizeof(utf8), &len);
ASSERT_EQ(PR_TRUE, result);
result = sec_port_ucs4_utf8_conversion_function(
PR_TRUE, utf8, len, (unsigned char *)&to, sizeof(to), &len);
ASSERT_EQ(PR_TRUE, result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(testCase.c, PR_ntohl(to));
}
TEST_P(Utf16Test, From32To16) {
const Utf16Case testCase = GetParam();
PRUint32 from = PR_htonl(testCase.c);
unsigned char utf8[8];
unsigned int len = 0;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from, sizeof(from), utf8, sizeof(utf8), &len);
ASSERT_EQ(PR_TRUE, result);
const std::string utf8copy((char *)utf8, len);
PRUint16 to[2];
result = sec_port_ucs2_utf8_conversion_function(
PR_TRUE, utf8, len, (unsigned char *)&to, sizeof(to), &len);
ASSERT_EQ(PR_TRUE, result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(testCase.w[0], PR_ntohs(to[0]));
EXPECT_EQ(testCase.w[1], PR_ntohs(to[1]));
}
TEST_P(Utf16Test, SameUtf8) {
const Utf16Case testCase = GetParam();
PRUint32 from32 = PR_htonl(testCase.c);
unsigned char utf8from32[8];
unsigned int lenFrom32 = 0;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from32, sizeof(from32), utf8from32,
sizeof(utf8from32), &lenFrom32);
ASSERT_TRUE(result);
ASSERT_LE(lenFrom32, sizeof(utf8from32));
PRUint16 from16[2] = {PR_htons(testCase.w[0]), PR_htons(testCase.w[1])};
unsigned char utf8from16[8];
unsigned int lenFrom16 = 0;
result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from16, sizeof(from16), utf8from16,
sizeof(utf8from16), &lenFrom16);
ASSERT_TRUE(result);
ASSERT_LE(lenFrom16, sizeof(utf8from16));
EXPECT_EQ(std::string((char *)utf8from32, lenFrom32),
std::string((char *)utf8from16, lenFrom16));
}
// Tests of invalid UTF-8 input:
TEST_P(BadUtf8Test, HasNoUcs2) {
const char *const utf8 = GetParam();
unsigned char destBuf[30];
unsigned int len = 0;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_TRUE, (unsigned char *)utf8, strlen(utf8), destBuf, sizeof(destBuf),
&len);
EXPECT_FALSE(result);
}
TEST_P(BadUtf8Test, HasNoUcs4) {
const char *const utf8 = GetParam();
unsigned char destBuf[30];
unsigned int len = 0;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_TRUE, (unsigned char *)utf8, strlen(utf8), destBuf, sizeof(destBuf),
&len);
EXPECT_FALSE(result);
}
// Tests of invalid UTF-16 input:
TEST_P(BadUtf16Test, HasNoUtf8) {
const Utf16BadCase testCase = GetParam();
Utf16BadCase srcBuf;
unsigned int len;
static const size_t maxLen = PR_ARRAY_SIZE(srcBuf.w);
size_t srcLen = 0;
while (testCase.w[srcLen] != 0) {
srcBuf.w[srcLen] = PR_htons(testCase.w[srcLen]);
srcLen++;
ASSERT_LT(srcLen, maxLen);
}
unsigned char destBuf[18];
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)srcBuf.w, srcLen * sizeof(PRUint16), destBuf,
sizeof(destBuf), &len);
EXPECT_FALSE(result);
}
// Tests of sec_port_iso88591_utf8_conversion_function on valid inputs:
TEST_P(Iso88591Test, ToUtf8) {
const Ucs2Case testCase = GetParam();
unsigned char iso88591 = testCase.c;
unsigned char utf8[3] = {0};
unsigned int len = 0;
ASSERT_EQ(testCase.c, (PRUint16)iso88591);
PRBool result = sec_port_iso88591_utf8_conversion_function(
&iso88591, 1, utf8, sizeof(utf8), &len);
ASSERT_TRUE(result);
ASSERT_LT(len, sizeof(utf8));
EXPECT_EQ(std::string(testCase.utf8), std::string((char *)utf8, len));
EXPECT_EQ(0U, utf8[len]);
}
// Tests for the various representations of NUL (which the above
// NUL-terminated test cases omitted):
TEST(Utf8Zeroes, From32To8) {
unsigned int len;
PRUint32 from = 0;
unsigned char to;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from, sizeof(from), &to, sizeof(to), &len);
ASSERT_TRUE(result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(0U, to);
}
TEST(Utf8Zeroes, From16To8) {
unsigned int len;
PRUint16 from = 0;
unsigned char to;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_FALSE, (unsigned char *)&from, sizeof(from), &to, sizeof(to), &len);
ASSERT_TRUE(result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(0U, to);
}
TEST(Utf8Zeroes, From8To32) {
unsigned int len;
unsigned char from = 0;
PRUint32 to;
PRBool result = sec_port_ucs4_utf8_conversion_function(
PR_TRUE, &from, sizeof(from), (unsigned char *)&to, sizeof(to), &len);
ASSERT_TRUE(result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(0U, to);
}
TEST(Utf8Zeroes, From8To16) {
unsigned int len;
unsigned char from = 0;
PRUint16 to;
PRBool result = sec_port_ucs2_utf8_conversion_function(
PR_TRUE, &from, sizeof(from), (unsigned char *)&to, sizeof(to), &len);
ASSERT_TRUE(result);
ASSERT_EQ(sizeof(to), len);
EXPECT_EQ(0U, to);
}
// UCS-4 <-> UTF-8 cases
const Ucs4Case kUcs4Cases[] = {
{0x00000001, "\x01"},
{0x00000002, "\x02"},
{0x00000003, "\x03"},
{0x00000004, "\x04"},
{0x00000007, "\x07"},
{0x00000008, "\x08"},
{0x0000000F, "\x0F"},
{0x00000010, "\x10"},
{0x0000001F, "\x1F"},
{0x00000020, "\x20"},
{0x0000003F, "\x3F"},
{0x00000040, "\x40"},
{0x0000007F, "\x7F"},
{0x00000080, "\xC2\x80"},
{0x00000081, "\xC2\x81"},
{0x00000082, "\xC2\x82"},
{0x00000084, "\xC2\x84"},
{0x00000088, "\xC2\x88"},
{0x00000090, "\xC2\x90"},
{0x000000A0, "\xC2\xA0"},
{0x000000C0, "\xC3\x80"},
{0x000000FF, "\xC3\xBF"},
{0x00000100, "\xC4\x80"},
{0x00000101, "\xC4\x81"},
{0x00000102, "\xC4\x82"},
{0x00000104, "\xC4\x84"},
{0x00000108, "\xC4\x88"},
{0x00000110, "\xC4\x90"},
{0x00000120, "\xC4\xA0"},
{0x00000140, "\xC5\x80"},
{0x00000180, "\xC6\x80"},
{0x000001FF, "\xC7\xBF"},
{0x00000200, "\xC8\x80"},
{0x00000201, "\xC8\x81"},
{0x00000202, "\xC8\x82"},
{0x00000204, "\xC8\x84"},
{0x00000208, "\xC8\x88"},
{0x00000210, "\xC8\x90"},
{0x00000220, "\xC8\xA0"},
{0x00000240, "\xC9\x80"},
{0x00000280, "\xCA\x80"},
{0x00000300, "\xCC\x80"},
{0x000003FF, "\xCF\xBF"},
{0x00000400, "\xD0\x80"},
{0x00000401, "\xD0\x81"},
{0x00000402, "\xD0\x82"},
{0x00000404, "\xD0\x84"},
{0x00000408, "\xD0\x88"},
{0x00000410, "\xD0\x90"},
{0x00000420, "\xD0\xA0"},
{0x00000440, "\xD1\x80"},
{0x00000480, "\xD2\x80"},
{0x00000500, "\xD4\x80"},
{0x00000600, "\xD8\x80"},
{0x000007FF, "\xDF\xBF"},
{0x00000800, "\xE0\xA0\x80"},
{0x00000801, "\xE0\xA0\x81"},
{0x00000802, "\xE0\xA0\x82"},
{0x00000804, "\xE0\xA0\x84"},
{0x00000808, "\xE0\xA0\x88"},
{0x00000810, "\xE0\xA0\x90"},
{0x00000820, "\xE0\xA0\xA0"},
{0x00000840, "\xE0\xA1\x80"},
{0x00000880, "\xE0\xA2\x80"},
{0x00000900, "\xE0\xA4\x80"},
{0x00000A00, "\xE0\xA8\x80"},
{0x00000C00, "\xE0\xB0\x80"},
{0x00000FFF, "\xE0\xBF\xBF"},
{0x00001000, "\xE1\x80\x80"},
{0x00001001, "\xE1\x80\x81"},
{0x00001002, "\xE1\x80\x82"},
{0x00001004, "\xE1\x80\x84"},
{0x00001008, "\xE1\x80\x88"},
{0x00001010, "\xE1\x80\x90"},
{0x00001020, "\xE1\x80\xA0"},
{0x00001040, "\xE1\x81\x80"},
{0x00001080, "\xE1\x82\x80"},
{0x00001100, "\xE1\x84\x80"},
{0x00001200, "\xE1\x88\x80"},
{0x00001400, "\xE1\x90\x80"},
{0x00001800, "\xE1\xA0\x80"},
{0x00001FFF, "\xE1\xBF\xBF"},
{0x00002000, "\xE2\x80\x80"},
{0x00002001, "\xE2\x80\x81"},
{0x00002002, "\xE2\x80\x82"},
{0x00002004, "\xE2\x80\x84"},
{0x00002008, "\xE2\x80\x88"},
{0x00002010, "\xE2\x80\x90"},
{0x00002020, "\xE2\x80\xA0"},
{0x00002040, "\xE2\x81\x80"},
{0x00002080, "\xE2\x82\x80"},
{0x00002100, "\xE2\x84\x80"},
{0x00002200, "\xE2\x88\x80"},
{0x00002400, "\xE2\x90\x80"},
{0x00002800, "\xE2\xA0\x80"},
{0x00003000, "\xE3\x80\x80"},
{0x00003FFF, "\xE3\xBF\xBF"},
{0x00004000, "\xE4\x80\x80"},
{0x00004001, "\xE4\x80\x81"},
{0x00004002, "\xE4\x80\x82"},
{0x00004004, "\xE4\x80\x84"},
{0x00004008, "\xE4\x80\x88"},
{0x00004010, "\xE4\x80\x90"},
{0x00004020, "\xE4\x80\xA0"},
{0x00004040, "\xE4\x81\x80"},
{0x00004080, "\xE4\x82\x80"},
{0x00004100, "\xE4\x84\x80"},
{0x00004200, "\xE4\x88\x80"},
{0x00004400, "\xE4\x90\x80"},
{0x00004800, "\xE4\xA0\x80"},
{0x00005000, "\xE5\x80\x80"},
{0x00006000, "\xE6\x80\x80"},
{0x00007FFF, "\xE7\xBF\xBF"},
{0x00008000, "\xE8\x80\x80"},
{0x00008001, "\xE8\x80\x81"},
{0x00008002, "\xE8\x80\x82"},
{0x00008004, "\xE8\x80\x84"},
{0x00008008, "\xE8\x80\x88"},
{0x00008010, "\xE8\x80\x90"},
{0x00008020, "\xE8\x80\xA0"},
{0x00008040, "\xE8\x81\x80"},
{0x00008080, "\xE8\x82\x80"},
{0x00008100, "\xE8\x84\x80"},
{0x00008200, "\xE8\x88\x80"},
{0x00008400, "\xE8\x90\x80"},
{0x00008800, "\xE8\xA0\x80"},
{0x00009000, "\xE9\x80\x80"},
{0x0000A000, "\xEA\x80\x80"},
{0x0000C000, "\xEC\x80\x80"},
{0x0000FFFF, "\xEF\xBF\xBF"},
{0x00010000, "\xF0\x90\x80\x80"},
{0x00010001, "\xF0\x90\x80\x81"},
{0x00010002, "\xF0\x90\x80\x82"},
{0x00010004, "\xF0\x90\x80\x84"},
{0x00010008, "\xF0\x90\x80\x88"},
{0x00010010, "\xF0\x90\x80\x90"},
{0x00010020, "\xF0\x90\x80\xA0"},
{0x00010040, "\xF0\x90\x81\x80"},
{0x00010080, "\xF0\x90\x82\x80"},
{0x00010100, "\xF0\x90\x84\x80"},
{0x00010200, "\xF0\x90\x88\x80"},
{0x00010400, "\xF0\x90\x90\x80"},
{0x00010800, "\xF0\x90\xA0\x80"},
{0x00011000, "\xF0\x91\x80\x80"},
{0x00012000, "\xF0\x92\x80\x80"},
{0x00014000, "\xF0\x94\x80\x80"},
{0x00018000, "\xF0\x98\x80\x80"},
{0x0001FFFF, "\xF0\x9F\xBF\xBF"},
{0x00020000, "\xF0\xA0\x80\x80"},
{0x00020001, "\xF0\xA0\x80\x81"},
{0x00020002, "\xF0\xA0\x80\x82"},
{0x00020004, "\xF0\xA0\x80\x84"},
{0x00020008, "\xF0\xA0\x80\x88"},
{0x00020010, "\xF0\xA0\x80\x90"},
{0x00020020, "\xF0\xA0\x80\xA0"},
{0x00020040, "\xF0\xA0\x81\x80"},
{0x00020080, "\xF0\xA0\x82\x80"},
{0x00020100, "\xF0\xA0\x84\x80"},
{0x00020200, "\xF0\xA0\x88\x80"},
{0x00020400, "\xF0\xA0\x90\x80"},
{0x00020800, "\xF0\xA0\xA0\x80"},
{0x00021000, "\xF0\xA1\x80\x80"},
{0x00022000, "\xF0\xA2\x80\x80"},
{0x00024000, "\xF0\xA4\x80\x80"},
{0x00028000, "\xF0\xA8\x80\x80"},
{0x00030000, "\xF0\xB0\x80\x80"},
{0x0003FFFF, "\xF0\xBF\xBF\xBF"},
{0x00040000, "\xF1\x80\x80\x80"},
{0x00040001, "\xF1\x80\x80\x81"},
{0x00040002, "\xF1\x80\x80\x82"},
{0x00040004, "\xF1\x80\x80\x84"},
{0x00040008, "\xF1\x80\x80\x88"},
{0x00040010, "\xF1\x80\x80\x90"},
{0x00040020, "\xF1\x80\x80\xA0"},
{0x00040040, "\xF1\x80\x81\x80"},
{0x00040080, "\xF1\x80\x82\x80"},
{0x00040100, "\xF1\x80\x84\x80"},
{0x00040200, "\xF1\x80\x88\x80"},
{0x00040400, "\xF1\x80\x90\x80"},
{0x00040800, "\xF1\x80\xA0\x80"},
{0x00041000, "\xF1\x81\x80\x80"},
{0x00042000, "\xF1\x82\x80\x80"},
{0x00044000, "\xF1\x84\x80\x80"},
{0x00048000, "\xF1\x88\x80\x80"},
{0x00050000, "\xF1\x90\x80\x80"},
{0x00060000, "\xF1\xA0\x80\x80"},
{0x0007FFFF, "\xF1\xBF\xBF\xBF"},
{0x00080000, "\xF2\x80\x80\x80"},
{0x00080001, "\xF2\x80\x80\x81"},
{0x00080002, "\xF2\x80\x80\x82"},
{0x00080004, "\xF2\x80\x80\x84"},
{0x00080008, "\xF2\x80\x80\x88"},
{0x00080010, "\xF2\x80\x80\x90"},
{0x00080020, "\xF2\x80\x80\xA0"},
{0x00080040, "\xF2\x80\x81\x80"},
{0x00080080, "\xF2\x80\x82\x80"},
{0x00080100, "\xF2\x80\x84\x80"},
{0x00080200, "\xF2\x80\x88\x80"},
{0x00080400, "\xF2\x80\x90\x80"},
{0x00080800, "\xF2\x80\xA0\x80"},
{0x00081000, "\xF2\x81\x80\x80"},
{0x00082000, "\xF2\x82\x80\x80"},
{0x00084000, "\xF2\x84\x80\x80"},
{0x00088000, "\xF2\x88\x80\x80"},
{0x00090000, "\xF2\x90\x80\x80"},
{0x000A0000, "\xF2\xA0\x80\x80"},
{0x000C0000, "\xF3\x80\x80\x80"},
{0x000FFFFF, "\xF3\xBF\xBF\xBF"},
{0x00100000, "\xF4\x80\x80\x80"},
{0x00100001, "\xF4\x80\x80\x81"},
{0x00100002, "\xF4\x80\x80\x82"},
{0x00100004, "\xF4\x80\x80\x84"},
{0x00100008, "\xF4\x80\x80\x88"},
{0x00100010, "\xF4\x80\x80\x90"},
{0x00100020, "\xF4\x80\x80\xA0"},
{0x00100040, "\xF4\x80\x81\x80"},
{0x00100080, "\xF4\x80\x82\x80"},
{0x00100100, "\xF4\x80\x84\x80"},
{0x00100200, "\xF4\x80\x88\x80"},
{0x00100400, "\xF4\x80\x90\x80"},
{0x00100800, "\xF4\x80\xA0\x80"},
{0x00101000, "\xF4\x81\x80\x80"},
{0x00102000, "\xF4\x82\x80\x80"},
{0x00104000, "\xF4\x84\x80\x80"},
{0x00108000, "\xF4\x88\x80\x80"},
{0x0010FFFF, "\xF4\x8F\xBF\xBF"},
};
// UCS-2 <-> UTF-8 cases (divided into ISO-8859-1 vs. not).
const Ucs2Case kIso88591Cases[] = {
{0x0001, "\x01"}, {0x0002, "\x02"}, {0x0003, "\x03"},
{0x0004, "\x04"}, {0x0007, "\x07"}, {0x0008, "\x08"},
{0x000F, "\x0F"}, {0x0010, "\x10"}, {0x001F, "\x1F"},
{0x0020, "\x20"}, {0x003F, "\x3F"}, {0x0040, "\x40"},
{0x007F, "\x7F"},
{0x0080, "\xC2\x80"}, {0x0081, "\xC2\x81"}, {0x0082, "\xC2\x82"},
{0x0084, "\xC2\x84"}, {0x0088, "\xC2\x88"}, {0x0090, "\xC2\x90"},
{0x00A0, "\xC2\xA0"}, {0x00C0, "\xC3\x80"}, {0x00FF, "\xC3\xBF"},
};
const Ucs2Case kUcs2Cases[] = {
{0x0100, "\xC4\x80"}, {0x0101, "\xC4\x81"},
{0x0102, "\xC4\x82"}, {0x0104, "\xC4\x84"},
{0x0108, "\xC4\x88"}, {0x0110, "\xC4\x90"},
{0x0120, "\xC4\xA0"}, {0x0140, "\xC5\x80"},
{0x0180, "\xC6\x80"}, {0x01FF, "\xC7\xBF"},
{0x0200, "\xC8\x80"}, {0x0201, "\xC8\x81"},
{0x0202, "\xC8\x82"}, {0x0204, "\xC8\x84"},
{0x0208, "\xC8\x88"}, {0x0210, "\xC8\x90"},
{0x0220, "\xC8\xA0"}, {0x0240, "\xC9\x80"},
{0x0280, "\xCA\x80"}, {0x0300, "\xCC\x80"},
{0x03FF, "\xCF\xBF"}, {0x0400, "\xD0\x80"},
{0x0401, "\xD0\x81"}, {0x0402, "\xD0\x82"},
{0x0404, "\xD0\x84"}, {0x0408, "\xD0\x88"},
{0x0410, "\xD0\x90"}, {0x0420, "\xD0\xA0"},
{0x0440, "\xD1\x80"}, {0x0480, "\xD2\x80"},
{0x0500, "\xD4\x80"}, {0x0600, "\xD8\x80"},
{0x07FF, "\xDF\xBF"},
{0x0800, "\xE0\xA0\x80"}, {0x0801, "\xE0\xA0\x81"},
{0x0802, "\xE0\xA0\x82"}, {0x0804, "\xE0\xA0\x84"},
{0x0808, "\xE0\xA0\x88"}, {0x0810, "\xE0\xA0\x90"},
{0x0820, "\xE0\xA0\xA0"}, {0x0840, "\xE0\xA1\x80"},
{0x0880, "\xE0\xA2\x80"}, {0x0900, "\xE0\xA4\x80"},
{0x0A00, "\xE0\xA8\x80"}, {0x0C00, "\xE0\xB0\x80"},
{0x0FFF, "\xE0\xBF\xBF"}, {0x1000, "\xE1\x80\x80"},
{0x1001, "\xE1\x80\x81"}, {0x1002, "\xE1\x80\x82"},
{0x1004, "\xE1\x80\x84"}, {0x1008, "\xE1\x80\x88"},
{0x1010, "\xE1\x80\x90"}, {0x1020, "\xE1\x80\xA0"},
{0x1040, "\xE1\x81\x80"}, {0x1080, "\xE1\x82\x80"},
{0x1100, "\xE1\x84\x80"}, {0x1200, "\xE1\x88\x80"},
{0x1400, "\xE1\x90\x80"}, {0x1800, "\xE1\xA0\x80"},
{0x1FFF, "\xE1\xBF\xBF"}, {0x2000, "\xE2\x80\x80"},
{0x2001, "\xE2\x80\x81"}, {0x2002, "\xE2\x80\x82"},
{0x2004, "\xE2\x80\x84"}, {0x2008, "\xE2\x80\x88"},
{0x2010, "\xE2\x80\x90"}, {0x2020, "\xE2\x80\xA0"},
{0x2040, "\xE2\x81\x80"}, {0x2080, "\xE2\x82\x80"},
{0x2100, "\xE2\x84\x80"}, {0x2200, "\xE2\x88\x80"},
{0x2400, "\xE2\x90\x80"}, {0x2800, "\xE2\xA0\x80"},
{0x3000, "\xE3\x80\x80"}, {0x3FFF, "\xE3\xBF\xBF"},
{0x4000, "\xE4\x80\x80"}, {0x4001, "\xE4\x80\x81"},
{0x4002, "\xE4\x80\x82"}, {0x4004, "\xE4\x80\x84"},
{0x4008, "\xE4\x80\x88"}, {0x4010, "\xE4\x80\x90"},
{0x4020, "\xE4\x80\xA0"}, {0x4040, "\xE4\x81\x80"},
{0x4080, "\xE4\x82\x80"}, {0x4100, "\xE4\x84\x80"},
{0x4200, "\xE4\x88\x80"}, {0x4400, "\xE4\x90\x80"},
{0x4800, "\xE4\xA0\x80"}, {0x5000, "\xE5\x80\x80"},
{0x6000, "\xE6\x80\x80"}, {0x7FFF, "\xE7\xBF\xBF"},
{0x8000, "\xE8\x80\x80"}, {0x8001, "\xE8\x80\x81"},
{0x8002, "\xE8\x80\x82"}, {0x8004, "\xE8\x80\x84"},
{0x8008, "\xE8\x80\x88"}, {0x8010, "\xE8\x80\x90"},
{0x8020, "\xE8\x80\xA0"}, {0x8040, "\xE8\x81\x80"},
{0x8080, "\xE8\x82\x80"}, {0x8100, "\xE8\x84\x80"},
{0x8200, "\xE8\x88\x80"}, {0x8400, "\xE8\x90\x80"},
{0x8800, "\xE8\xA0\x80"}, {0x9000, "\xE9\x80\x80"},
{0xA000, "\xEA\x80\x80"}, {0xC000, "\xEC\x80\x80"},
{0xFB01, "\xEF\xAC\x81"}, {0xFFFF, "\xEF\xBF\xBF"}};
// UTF-16 <-> UCS-4 cases
const Utf16Case kUtf16Cases[] = {{0x00010000, {0xD800, 0xDC00}},
{0x00010001, {0xD800, 0xDC01}},
{0x00010002, {0xD800, 0xDC02}},
{0x00010003, {0xD800, 0xDC03}},
{0x00010004, {0xD800, 0xDC04}},
{0x00010007, {0xD800, 0xDC07}},
{0x00010008, {0xD800, 0xDC08}},
{0x0001000F, {0xD800, 0xDC0F}},
{0x00010010, {0xD800, 0xDC10}},
{0x0001001F, {0xD800, 0xDC1F}},
{0x00010020, {0xD800, 0xDC20}},
{0x0001003F, {0xD800, 0xDC3F}},
{0x00010040, {0xD800, 0xDC40}},
{0x0001007F, {0xD800, 0xDC7F}},
{0x00010080, {0xD800, 0xDC80}},
{0x00010081, {0xD800, 0xDC81}},
{0x00010082, {0xD800, 0xDC82}},
{0x00010084, {0xD800, 0xDC84}},
{0x00010088, {0xD800, 0xDC88}},
{0x00010090, {0xD800, 0xDC90}},
{0x000100A0, {0xD800, 0xDCA0}},
{0x000100C0, {0xD800, 0xDCC0}},
{0x000100FF, {0xD800, 0xDCFF}},
{0x00010100, {0xD800, 0xDD00}},
{0x00010101, {0xD800, 0xDD01}},
{0x00010102, {0xD800, 0xDD02}},
{0x00010104, {0xD800, 0xDD04}},
{0x00010108, {0xD800, 0xDD08}},
{0x00010110, {0xD800, 0xDD10}},
{0x00010120, {0xD800, 0xDD20}},
{0x00010140, {0xD800, 0xDD40}},
{0x00010180, {0xD800, 0xDD80}},
{0x000101FF, {0xD800, 0xDDFF}},
{0x00010200, {0xD800, 0xDE00}},
{0x00010201, {0xD800, 0xDE01}},
{0x00010202, {0xD800, 0xDE02}},
{0x00010204, {0xD800, 0xDE04}},
{0x00010208, {0xD800, 0xDE08}},
{0x00010210, {0xD800, 0xDE10}},
{0x00010220, {0xD800, 0xDE20}},
{0x00010240, {0xD800, 0xDE40}},
{0x00010280, {0xD800, 0xDE80}},
{0x00010300, {0xD800, 0xDF00}},
{0x000103FF, {0xD800, 0xDFFF}},
{0x00010400, {0xD801, 0xDC00}},
{0x00010401, {0xD801, 0xDC01}},
{0x00010402, {0xD801, 0xDC02}},
{0x00010404, {0xD801, 0xDC04}},
{0x00010408, {0xD801, 0xDC08}},
{0x00010410, {0xD801, 0xDC10}},
{0x00010420, {0xD801, 0xDC20}},
{0x00010440, {0xD801, 0xDC40}},
{0x00010480, {0xD801, 0xDC80}},
{0x00010500, {0xD801, 0xDD00}},
{0x00010600, {0xD801, 0xDE00}},
{0x000107FF, {0xD801, 0xDFFF}},
{0x00010800, {0xD802, 0xDC00}},
{0x00010801, {0xD802, 0xDC01}},
{0x00010802, {0xD802, 0xDC02}},
{0x00010804, {0xD802, 0xDC04}},
{0x00010808, {0xD802, 0xDC08}},
{0x00010810, {0xD802, 0xDC10}},
{0x00010820, {0xD802, 0xDC20}},
{0x00010840, {0xD802, 0xDC40}},
{0x00010880, {0xD802, 0xDC80}},
{0x00010900, {0xD802, 0xDD00}},
{0x00010A00, {0xD802, 0xDE00}},
{0x00010C00, {0xD803, 0xDC00}},
{0x00010FFF, {0xD803, 0xDFFF}},
{0x00011000, {0xD804, 0xDC00}},
{0x00011001, {0xD804, 0xDC01}},
{0x00011002, {0xD804, 0xDC02}},
{0x00011004, {0xD804, 0xDC04}},
{0x00011008, {0xD804, 0xDC08}},
{0x00011010, {0xD804, 0xDC10}},
{0x00011020, {0xD804, 0xDC20}},
{0x00011040, {0xD804, 0xDC40}},
{0x00011080, {0xD804, 0xDC80}},
{0x00011100, {0xD804, 0xDD00}},
{0x00011200, {0xD804, 0xDE00}},
{0x00011400, {0xD805, 0xDC00}},
{0x00011800, {0xD806, 0xDC00}},
{0x00011FFF, {0xD807, 0xDFFF}},
{0x00012000, {0xD808, 0xDC00}},
{0x00012001, {0xD808, 0xDC01}},
{0x00012002, {0xD808, 0xDC02}},
{0x00012004, {0xD808, 0xDC04}},
{0x00012008, {0xD808, 0xDC08}},
{0x00012010, {0xD808, 0xDC10}},
{0x00012020, {0xD808, 0xDC20}},
{0x00012040, {0xD808, 0xDC40}},
{0x00012080, {0xD808, 0xDC80}},
{0x00012100, {0xD808, 0xDD00}},
{0x00012200, {0xD808, 0xDE00}},
{0x00012400, {0xD809, 0xDC00}},
{0x00012800, {0xD80A, 0xDC00}},
{0x00013000, {0xD80C, 0xDC00}},
{0x00013FFF, {0xD80F, 0xDFFF}},
{0x00014000, {0xD810, 0xDC00}},
{0x00014001, {0xD810, 0xDC01}},
{0x00014002, {0xD810, 0xDC02}},
{0x00014004, {0xD810, 0xDC04}},
{0x00014008, {0xD810, 0xDC08}},
{0x00014010, {0xD810, 0xDC10}},
{0x00014020, {0xD810, 0xDC20}},
{0x00014040, {0xD810, 0xDC40}},
{0x00014080, {0xD810, 0xDC80}},
{0x00014100, {0xD810, 0xDD00}},
{0x00014200, {0xD810, 0xDE00}},
{0x00014400, {0xD811, 0xDC00}},
{0x00014800, {0xD812, 0xDC00}},
{0x00015000, {0xD814, 0xDC00}},
{0x00016000, {0xD818, 0xDC00}},
{0x00017FFF, {0xD81F, 0xDFFF}},
{0x00018000, {0xD820, 0xDC00}},
{0x00018001, {0xD820, 0xDC01}},
{0x00018002, {0xD820, 0xDC02}},
{0x00018004, {0xD820, 0xDC04}},
{0x00018008, {0xD820, 0xDC08}},
{0x00018010, {0xD820, 0xDC10}},
{0x00018020, {0xD820, 0xDC20}},
{0x00018040, {0xD820, 0xDC40}},
{0x00018080, {0xD820, 0xDC80}},
{0x00018100, {0xD820, 0xDD00}},
{0x00018200, {0xD820, 0xDE00}},
{0x00018400, {0xD821, 0xDC00}},
{0x00018800, {0xD822, 0xDC00}},
{0x00019000, {0xD824, 0xDC00}},
{0x0001A000, {0xD828, 0xDC00}},
{0x0001C000, {0xD830, 0xDC00}},
{0x0001FFFF, {0xD83F, 0xDFFF}},
{0x00020000, {0xD840, 0xDC00}},
{0x00020001, {0xD840, 0xDC01}},
{0x00020002, {0xD840, 0xDC02}},
{0x00020004, {0xD840, 0xDC04}},
{0x00020008, {0xD840, 0xDC08}},
{0x00020010, {0xD840, 0xDC10}},
{0x00020020, {0xD840, 0xDC20}},
{0x00020040, {0xD840, 0xDC40}},
{0x00020080, {0xD840, 0xDC80}},
{0x00020100, {0xD840, 0xDD00}},
{0x00020200, {0xD840, 0xDE00}},
{0x00020400, {0xD841, 0xDC00}},
{0x00020800, {0xD842, 0xDC00}},
{0x00021000, {0xD844, 0xDC00}},
{0x00022000, {0xD848, 0xDC00}},
{0x00024000, {0xD850, 0xDC00}},
{0x00028000, {0xD860, 0xDC00}},
{0x0002FFFF, {0xD87F, 0xDFFF}},
{0x00030000, {0xD880, 0xDC00}},
{0x00030001, {0xD880, 0xDC01}},
{0x00030002, {0xD880, 0xDC02}},
{0x00030004, {0xD880, 0xDC04}},
{0x00030008, {0xD880, 0xDC08}},
{0x00030010, {0xD880, 0xDC10}},
{0x00030020, {0xD880, 0xDC20}},
{0x00030040, {0xD880, 0xDC40}},
{0x00030080, {0xD880, 0xDC80}},
{0x00030100, {0xD880, 0xDD00}},
{0x00030200, {0xD880, 0xDE00}},
{0x00030400, {0xD881, 0xDC00}},
{0x00030800, {0xD882, 0xDC00}},
{0x00031000, {0xD884, 0xDC00}},
{0x00032000, {0xD888, 0xDC00}},
{0x00034000, {0xD890, 0xDC00}},
{0x00038000, {0xD8A0, 0xDC00}},
{0x0003FFFF, {0xD8BF, 0xDFFF}},
{0x00040000, {0xD8C0, 0xDC00}},
{0x00040001, {0xD8C0, 0xDC01}},
{0x00040002, {0xD8C0, 0xDC02}},
{0x00040004, {0xD8C0, 0xDC04}},
{0x00040008, {0xD8C0, 0xDC08}},
{0x00040010, {0xD8C0, 0xDC10}},
{0x00040020, {0xD8C0, 0xDC20}},
{0x00040040, {0xD8C0, 0xDC40}},
{0x00040080, {0xD8C0, 0xDC80}},
{0x00040100, {0xD8C0, 0xDD00}},
{0x00040200, {0xD8C0, 0xDE00}},
{0x00040400, {0xD8C1, 0xDC00}},
{0x00040800, {0xD8C2, 0xDC00}},
{0x00041000, {0xD8C4, 0xDC00}},
{0x00042000, {0xD8C8, 0xDC00}},
{0x00044000, {0xD8D0, 0xDC00}},
{0x00048000, {0xD8E0, 0xDC00}},
{0x0004FFFF, {0xD8FF, 0xDFFF}},
{0x00050000, {0xD900, 0xDC00}},
{0x00050001, {0xD900, 0xDC01}},
{0x00050002, {0xD900, 0xDC02}},
{0x00050004, {0xD900, 0xDC04}},
{0x00050008, {0xD900, 0xDC08}},
{0x00050010, {0xD900, 0xDC10}},
{0x00050020, {0xD900, 0xDC20}},
{0x00050040, {0xD900, 0xDC40}},
{0x00050080, {0xD900, 0xDC80}},
{0x00050100, {0xD900, 0xDD00}},
{0x00050200, {0xD900, 0xDE00}},
{0x00050400, {0xD901, 0xDC00}},
{0x00050800, {0xD902, 0xDC00}},
{0x00051000, {0xD904, 0xDC00}},
{0x00052000, {0xD908, 0xDC00}},
{0x00054000, {0xD910, 0xDC00}},
{0x00058000, {0xD920, 0xDC00}},
{0x00060000, {0xD940, 0xDC00}},
{0x00070000, {0xD980, 0xDC00}},
{0x0007FFFF, {0xD9BF, 0xDFFF}},
{0x00080000, {0xD9C0, 0xDC00}},
{0x00080001, {0xD9C0, 0xDC01}},
{0x00080002, {0xD9C0, 0xDC02}},
{0x00080004, {0xD9C0, 0xDC04}},
{0x00080008, {0xD9C0, 0xDC08}},
{0x00080010, {0xD9C0, 0xDC10}},
{0x00080020, {0xD9C0, 0xDC20}},
{0x00080040, {0xD9C0, 0xDC40}},
{0x00080080, {0xD9C0, 0xDC80}},
{0x00080100, {0xD9C0, 0xDD00}},
{0x00080200, {0xD9C0, 0xDE00}},
{0x00080400, {0xD9C1, 0xDC00}},
{0x00080800, {0xD9C2, 0xDC00}},
{0x00081000, {0xD9C4, 0xDC00}},
{0x00082000, {0xD9C8, 0xDC00}},
{0x00084000, {0xD9D0, 0xDC00}},
{0x00088000, {0xD9E0, 0xDC00}},
{0x0008FFFF, {0xD9FF, 0xDFFF}},
{0x00090000, {0xDA00, 0xDC00}},
{0x00090001, {0xDA00, 0xDC01}},
{0x00090002, {0xDA00, 0xDC02}},
{0x00090004, {0xDA00, 0xDC04}},
{0x00090008, {0xDA00, 0xDC08}},
{0x00090010, {0xDA00, 0xDC10}},
{0x00090020, {0xDA00, 0xDC20}},
{0x00090040, {0xDA00, 0xDC40}},
{0x00090080, {0xDA00, 0xDC80}},
{0x00090100, {0xDA00, 0xDD00}},
{0x00090200, {0xDA00, 0xDE00}},
{0x00090400, {0xDA01, 0xDC00}},
{0x00090800, {0xDA02, 0xDC00}},
{0x00091000, {0xDA04, 0xDC00}},
{0x00092000, {0xDA08, 0xDC00}},
{0x00094000, {0xDA10, 0xDC00}},
{0x00098000, {0xDA20, 0xDC00}},
{0x000A0000, {0xDA40, 0xDC00}},
{0x000B0000, {0xDA80, 0xDC00}},
{0x000C0000, {0xDAC0, 0xDC00}},
{0x000D0000, {0xDB00, 0xDC00}},
{0x000FFFFF, {0xDBBF, 0xDFFF}},
{0x0010FFFF, {0xDBFF, 0xDFFF}}
};
// Invalid UTF-8 sequences
const char *const kUtf8BadCases[] = {
"\xC0\x80",
"\xC1\xBF",
"\xE0\x80\x80",
"\xE0\x9F\xBF",
"\xF0\x80\x80\x80",
"\xF0\x8F\xBF\xBF",
"\xF4\x90\x80\x80",
"\xF7\xBF\xBF\xBF",
"\xF8\x80\x80\x80\x80",
"\xF8\x88\x80\x80\x80",
"\xF8\x92\x80\x80\x80",
"\xF8\x9F\xBF\xBF\xBF",
"\xF8\xA0\x80\x80\x80",
"\xF8\xA8\x80\x80\x80",
"\xF8\xB0\x80\x80\x80",
"\xF8\xBF\xBF\xBF\xBF",
"\xF9\x80\x80\x80\x88",
"\xF9\x84\x80\x80\x80",
"\xF9\xBF\xBF\xBF\xBF",
"\xFA\x80\x80\x80\x80",
"\xFA\x90\x80\x80\x80",
"\xFB\xBF\xBF\xBF\xBF",
"\xFC\x84\x80\x80\x80\x81",
"\xFC\x85\x80\x80\x80\x80",
"\xFC\x86\x80\x80\x80\x80",
"\xFC\x87\xBF\xBF\xBF\xBF",
"\xFC\x88\xA0\x80\x80\x80",
"\xFC\x89\x80\x80\x80\x80",
"\xFC\x8A\x80\x80\x80\x80",
"\xFC\x90\x80\x80\x80\x82",
"\xFD\x80\x80\x80\x80\x80",
"\xFD\xBF\xBF\xBF\xBF\xBF",
"\x80",
"\xC3",
"\xC3\xC3\x80",
"\xED\xA0\x80",
"\xED\xBF\x80",
"\xED\xBF\xBF",
"\xED\xA0\x80\xE0\xBF\xBF",
};
// Invalid UTF-16 sequences (0-terminated)
const Utf16BadCase kUtf16BadCases[] = {
// Leading surrogate not followed by trailing surrogate:
{{0xD800, 0, 0}},
{{0xD800, 0x41, 0}},
{{0xD800, 0xfe, 0}},
{{0xD800, 0x3bb, 0}},
{{0xD800, 0xD800, 0}},
{{0xD800, 0xFEFF, 0}},
{{0xD800, 0xFFFD, 0}},
// Trailing surrogate, not preceded by a leading one.
{{0xDC00, 0, 0}},
{{0xDE6D, 0xD834, 0}},
};
// Parameterized test instantiations:
INSTANTIATE_TEST_CASE_P(Ucs4TestCases, Ucs4Test,
::testing::ValuesIn(kUcs4Cases));
INSTANTIATE_TEST_CASE_P(Iso88591TestCases, Ucs2Test,
::testing::ValuesIn(kIso88591Cases));
INSTANTIATE_TEST_CASE_P(Ucs2TestCases, Ucs2Test,
::testing::ValuesIn(kUcs2Cases));
INSTANTIATE_TEST_CASE_P(Utf16TestCases, Utf16Test,
::testing::ValuesIn(kUtf16Cases));
INSTANTIATE_TEST_CASE_P(BadUtf8TestCases, BadUtf8Test,
::testing::ValuesIn(kUtf8BadCases));
INSTANTIATE_TEST_CASE_P(BadUtf16TestCases, BadUtf16Test,
::testing::ValuesIn(kUtf16BadCases));
INSTANTIATE_TEST_CASE_P(Iso88591TestCases, Iso88591Test,
::testing::ValuesIn(kIso88591Cases));
;
} // namespace nss_test
| Yukarumya/Yukarum-Redfoxes | security/nss/gtests/util_gtest/util_utf8_unittest.cc | C++ | mpl-2.0 | 39,251 |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
define([
'intern',
'intern!object',
'intern/chai!assert',
'require',
'intern/node_modules/dojo/node!xmlhttprequest',
'app/bower_components/fxa-js-client/fxa-client',
'tests/lib/helpers',
'tests/functional/lib/helpers',
'tests/functional/lib/fx-desktop'
], function (intern, registerSuite, assert, require, nodeXMLHttpRequest,
FxaClient, TestHelpers, FunctionalHelpers, FxDesktopHelpers) {
var config = intern.config;
var AUTH_SERVER_ROOT = config.fxaAuthRoot;
var SYNC_URL = config.fxaContentRoot + 'signin?context=fx_desktop_v1&service=sync';
var PASSWORD = 'password';
var TOO_YOUNG_YEAR = new Date().getFullYear() - 13;
var OLD_ENOUGH_YEAR = TOO_YOUNG_YEAR - 1;
var email;
var client;
var ANIMATION_DELAY_MS = 1000;
var CHANNEL_DELAY = 4000; // how long it takes for the WebChannel indicator to appear
var TIMEOUT = 90 * 1000;
var listenForSyncCommands = FxDesktopHelpers.listenForFxaCommands;
var testIsBrowserNotifiedOfSyncLogin = FxDesktopHelpers.testIsBrowserNotifiedOfLogin;
/**
* This suite tests the WebChannel functionality for delivering encryption keys
* in the OAuth signin and signup cases. It uses a CustomEvent "WebChannelMessageToChrome"
* to finish OAuth flows
*/
function testIsBrowserNotifiedOfLogin(context, options) {
options = options || {};
return FunctionalHelpers.testIsBrowserNotified(context, 'oauth_complete', function (data) {
assert.ok(data.redirect);
assert.ok(data.code);
assert.ok(data.state);
// All of these flows should produce encryption keys.
assert.ok(data.keys);
assert.equal(data.closeWindow, options.shouldCloseTab);
});
}
function openFxaFromRpAndRequestKeys(context, page, additionalQueryParams) {
var queryParams = '&webChannelId=test&keys=true';
for (var key in additionalQueryParams) {
queryParams += ('&' + key + '=' + additionalQueryParams[key]);
}
return FunctionalHelpers.openFxaFromRp(context, page, queryParams);
}
registerSuite({
name: 'oauth web channel keys',
beforeEach: function () {
email = TestHelpers.createEmail();
client = new FxaClient(AUTH_SERVER_ROOT, {
xhr: nodeXMLHttpRequest.XMLHttpRequest
});
return FunctionalHelpers.clearBrowserState(this, {
contentServer: true,
'123done': true
});
},
'signup, verify same browser, in a different tab, with original tab open': function () {
var self = this;
self.timeout = TIMEOUT;
var messageReceived = false;
return openFxaFromRpAndRequestKeys(self, 'signup')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, OLD_ENOUGH_YEAR);
})
.findByCssSelector('#fxa-confirm-header')
.end()
.then(function () {
return FunctionalHelpers.openVerificationLinkSameBrowser(
self, email, 0);
})
.switchToWindow('newwindow')
.execute(FunctionalHelpers.listenForWebChannelMessage)
// wait for the verified window in the new tab
.findById('fxa-sign-up-complete-header')
.setFindTimeout(CHANNEL_DELAY)
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.end()
.then(function () {
messageReceived = true;
}, function () {
// element was not found
})
.closeCurrentWindow()
// switch to the original window
.switchToWindow('')
.setFindTimeout(CHANNEL_DELAY)
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.then(function () {
messageReceived = true;
}, function () {
// element was not found
})
.then(function () {
assert.isTrue(messageReceived, 'expected to receive a WebChannel event in either tab');
})
.setFindTimeout(config.pageLoadTimeout)
.findById('fxa-sign-up-complete-header')
.end();
},
'signup, verify same browser, original tab closed navigated to another page': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signup')
.then(function () {
return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, OLD_ENOUGH_YEAR);
})
.findByCssSelector('#fxa-confirm-header')
.end()
.then(FunctionalHelpers.openExternalSite(self))
.then(function () {
return FunctionalHelpers.openVerificationLinkSameBrowser(self, email, 0);
})
.switchToWindow('newwindow')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.findById('fxa-sign-up-complete-header')
.end()
.closeCurrentWindow()
// switch to the original window
.switchToWindow('');
},
'signup, verify same browser, replace original tab': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signup')
.then(function () {
return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, OLD_ENOUGH_YEAR);
})
.findByCssSelector('#fxa-confirm-header')
.end()
.then(function () {
return FunctionalHelpers.getVerificationLink(email, 0);
})
.then(function (verificationLink) {
return self.remote.get(require.toUrl(verificationLink))
.execute(FunctionalHelpers.listenForWebChannelMessage);
})
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.findById('fxa-sign-up-complete-header')
.end();
},
'signup, verify different browser, from original tab\'s P.O.V.': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signup')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return FunctionalHelpers.fillOutSignUp(self, email, PASSWORD, OLD_ENOUGH_YEAR);
})
.findByCssSelector('#fxa-confirm-header')
.end()
.then(function () {
return FunctionalHelpers.openVerificationLinkDifferentBrowser(client, email);
})
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.findById('fxa-sign-up-complete-header')
.end();
},
'password reset, verify same browser': function () {
var self = this;
self.timeout = TIMEOUT;
var messageReceived = false;
return openFxaFromRpAndRequestKeys(self, 'signin')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return client.signUp(email, PASSWORD, { preVerified: true });
})
.findByCssSelector('.reset-password')
.click()
.end()
.then(function () {
return FunctionalHelpers.fillOutResetPassword(self, email);
})
.findByCssSelector('#fxa-confirm-reset-password-header')
.end()
.then(function () {
return FunctionalHelpers.openVerificationLinkSameBrowser(
self, email, 0);
})
// Complete the password reset in the new tab
.switchToWindow('newwindow')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return FunctionalHelpers.fillOutCompleteResetPassword(
self, PASSWORD, PASSWORD);
})
// this tab should get the reset password complete header.
.findByCssSelector('#fxa-reset-password-complete-header')
.end()
.setFindTimeout(CHANNEL_DELAY)
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.end()
.then(function () {
messageReceived = true;
}, function () {
// element was not found
})
.sleep(ANIMATION_DELAY_MS)
.findByCssSelector('.error').isDisplayed()
.then(function (isDisplayed) {
assert.isFalse(isDisplayed);
})
.end()
.closeCurrentWindow()
// switch to the original window
.switchToWindow('')
.setFindTimeout(CHANNEL_DELAY)
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.then(function () {
messageReceived = true;
}, function () {
// element was not found
})
.then(function () {
assert.isTrue(messageReceived, 'expected to receive a WebChannel event in either tab');
})
.setFindTimeout(config.pageLoadTimeout)
// the original tab should automatically sign in
.findByCssSelector('#fxa-reset-password-complete-header')
.end();
},
'password reset, verify same browser, original tab closed': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signin')
.then(function () {
return client.signUp(email, PASSWORD, { preVerified: true });
})
.findByCssSelector('.reset-password')
.click()
.end()
.then(function () {
return FunctionalHelpers.fillOutResetPassword(self, email);
})
.findByCssSelector('#fxa-confirm-reset-password-header')
.end()
.then(FunctionalHelpers.openExternalSite(self))
.then(function () {
return FunctionalHelpers.openVerificationLinkSameBrowser(self, email, 0);
})
.switchToWindow('newwindow')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return FunctionalHelpers.fillOutCompleteResetPassword(
self, PASSWORD, PASSWORD);
})
// the tab should automatically sign in
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.findByCssSelector('#fxa-reset-password-complete-header')
.end()
.closeCurrentWindow()
// switch to the original window
.switchToWindow('');
},
'password reset, verify same browser, replace original tab': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signin')
.then(function () {
return client.signUp(email, PASSWORD, { preVerified: true });
})
.findByCssSelector('.reset-password')
.click()
.end()
.then(function () {
return FunctionalHelpers.fillOutResetPassword(self, email);
})
.findByCssSelector('#fxa-confirm-reset-password-header')
.end()
.then(function () {
return FunctionalHelpers.getVerificationLink(email, 0);
})
.then(function (verificationLink) {
return self.remote.get(require.toUrl(verificationLink))
.execute(FunctionalHelpers.listenForWebChannelMessage);
})
.then(function () {
return FunctionalHelpers.fillOutCompleteResetPassword(
self, PASSWORD, PASSWORD);
})
// the tab should automatically sign in
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: false }))
.findByCssSelector('#fxa-reset-password-complete-header')
.end();
},
'password reset, verify in different browser, from the original tab\'s P.O.V.': function () {
var self = this;
self.timeout = TIMEOUT;
return openFxaFromRpAndRequestKeys(self, 'signin')
.execute(FunctionalHelpers.listenForWebChannelMessage)
.then(function () {
return client.signUp(email, PASSWORD, { preVerified: true });
})
.findByCssSelector('.reset-password')
.click()
.end()
.then(function () {
return FunctionalHelpers.fillOutResetPassword(self, email);
})
.findByCssSelector('#fxa-confirm-reset-password-header')
.end()
.then(function () {
return FunctionalHelpers.openPasswordResetLinkDifferentBrowser(
client, email, PASSWORD);
})
// user verified in a new browser, they have to enter
// their updated credentials in the original tab.
.findByCssSelector('#fxa-signin-header')
.end()
.then(FunctionalHelpers.visibleByQSA('.success'))
.end()
.findByCssSelector('#password')
.type(PASSWORD)
.end()
.findByCssSelector('button[type=submit]')
.click()
.end()
// user is signed in
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: true }))
// no screen transition, Loop will close this screen.
.findByCssSelector('#fxa-signin-header')
.end();
},
'signin a verified account and requesting keys after signing in to sync': function () {
var self = this;
self.timeout = TIMEOUT;
return client.signUp(email, PASSWORD, { preVerified: true })
.then(function () {
return self.remote
.get(require.toUrl(SYNC_URL))
.setFindTimeout(intern.config.pageLoadTimeout)
.execute(listenForSyncCommands)
.findByCssSelector('#fxa-signin-header')
.end()
.then(function () {
return FunctionalHelpers.fillOutSignIn(self, email, PASSWORD);
})
.then(function () {
return testIsBrowserNotifiedOfSyncLogin(self, email, { checkVerified: true });
})
.then(function () {
return openFxaFromRpAndRequestKeys(self, 'signin');
})
.findByCssSelector('#fxa-signin-header')
.end()
.execute(FunctionalHelpers.listenForWebChannelMessage)
// In a keyless oauth flow, the user could just click to confirm
// without re-entering their password. Since we need the password
// to derive the keys, this flow must prompt for it.
.findByCssSelector('input[type=password]')
.click()
.clearValue()
.type(PASSWORD)
.end()
.findByCssSelector('button[type="submit"]')
.click()
.end()
.then(testIsBrowserNotifiedOfLogin(self, { shouldCloseTab: true }));
});
}
});
});
| riadhchtara/fxa-password-manager | tests/functional/oauth_webchannel_keys.js | JavaScript | mpl-2.0 | 14,818 |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
define([
'intern',
'intern!object',
'intern/chai!assert',
'require',
'intern/node_modules/dojo/node!xmlhttprequest',
'app/bower_components/fxa-js-client/fxa-client',
'tests/lib/helpers',
'tests/functional/lib/helpers'
], function (intern, registerSuite, assert, require, nodeXMLHttpRequest, FxaClient, TestHelpers, FunctionalHelpers) {
var config = intern.config;
var AUTH_SERVER_ROOT = config.fxaAuthRoot;
var FORCE_AUTH_URL = config.fxaContentRoot + 'force_auth';
var PASSWORD = 'password';
var email;
var client;
function openFxa(context, email) {
return context.remote
.setFindTimeout(intern.config.pageLoadTimeout)
.get(require.toUrl(FORCE_AUTH_URL + '?email=' + email))
.findByCssSelector('#fxa-force-auth-header')
.end();
}
function attemptSignIn(context) {
return context.remote
// user should be at the force-auth screen
.findByCssSelector('#fxa-force-auth-header')
.end()
.findByCssSelector('input[type=password]')
.click()
.type(PASSWORD)
.end()
.findByCssSelector('button[type="submit"]')
.click()
.end();
}
registerSuite({
name: 'force_auth with an existing user',
beforeEach: function () {
email = TestHelpers.createEmail();
client = new FxaClient(AUTH_SERVER_ROOT, {
xhr: nodeXMLHttpRequest.XMLHttpRequest
});
var self = this;
return client.signUp(email, PASSWORD, { preVerified: true })
.then(function () {
// clear localStorage to avoid polluting other tests.
return FunctionalHelpers.clearBrowserState(self);
});
},
'sign in via force-auth': function () {
var self = this;
return openFxa(self, email)
.then(function () {
return attemptSignIn(self);
})
.findById('fxa-settings-header')
.end();
},
'forgot password flow via force-auth goes directly to confirm email screen': function () {
var self = this;
return openFxa(self, email)
.findByCssSelector('.reset-password')
.click()
.end()
.findById('fxa-confirm-reset-password-header')
.end()
// user remembers her password, clicks the "sign in" link. They
// should go back to the /force_auth screen.
.findByClassName('sign-in')
.click()
.end()
.findById('fxa-force-auth-header');
},
'visiting the tos/pp links saves information for return': function () {
var self = this;
return testRepopulateFields.call(self, '/legal/terms', 'fxa-tos-header')
.then(function () {
return testRepopulateFields.call(self, '/legal/privacy', 'fxa-pp-header');
});
}
});
registerSuite({
name: 'force_auth with an unregistered user',
beforeEach: function () {
email = TestHelpers.createEmail();
// clear localStorage to avoid polluting other tests.
return FunctionalHelpers.clearBrowserState(this);
},
'sign in shows an error message': function () {
var self = this;
return openFxa(self, email)
.then(function () {
return attemptSignIn(self);
})
.then(FunctionalHelpers.visibleByQSA('.error'))
.end();
},
'reset password shows an error message': function () {
var self = this;
return openFxa(self, email)
.findByCssSelector('a[href="/confirm_reset_password"]')
.click()
.end()
.then(FunctionalHelpers.visibleByQSA('.error'))
.end();
}
});
function testRepopulateFields(dest, header) {
var self = this;
return openFxa(self, email)
.findByCssSelector('input[type=password]')
.clearValue()
.click()
.type(PASSWORD)
.end()
.findByCssSelector('a[href="' + dest + '"]')
.click()
.end()
.findById(header)
.end()
.findByCssSelector('.back')
.click()
.end()
.findById('fxa-force-auth-header')
.end()
.findByCssSelector('input[type=password]')
.getProperty('value')
.then(function (resultText) {
// check the email address was re-populated
assert.equal(resultText, PASSWORD);
})
.end();
}
});
| riadhchtara/fxa-password-manager | tests/functional/force_auth.js | JavaScript | mpl-2.0 | 4,537 |
# encoding: utf-8
#--
# Copyright (C) 2012-2013 Gitorious AS
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++
class GroupsController < ApplicationController
before_filter :login_required, :except => [:index, :show]
before_filter :find_group_and_ensure_group_adminship, :only => [:edit, :update, :avatar]
before_filter :check_if_only_site_admins_can_create, :only => [:new, :create]
renders_in_global_context
def index
begin
groups, total_pages, page = paginated_groups
rescue RangeError
flash[:error] = "Page #{params[:page] || 1} does not exist"
redirect_to(groups_path, :status => 307) and return
end
render("index", :locals => {
:groups => groups,
:page => page,
:total_pages => total_pages
})
end
def show
group = Team.find_by_name!(params[:id])
events = paginate(:action => "show", :id => params[:id]) do
filter_paginated(params[:page], 30) do |page|
Team.events(group, page)
end
end
return if params.key?(:page) && events.length == 0
render("show", :locals => {
:group => group,
:mainlines => filter(group.repositories.mainlines),
:clones => filter(group.repositories.clones),
:projects => filter(group.projects),
:memberships => Team.memberships(group),
:events => events
})
end
def new
render("new", :locals => { :group => Team.new_group })
end
def edit
render("edit", :locals => { :group => @group })
end
def update
Team.update_group(@group, params)
flash[:success] = 'Team was updated'
redirect_to(group_path(@group))
rescue ActiveRecord::RecordInvalid
render(:action => "edit", :locals => { :group => @group })
end
def create
group = Team.create_group(params, current_user)
group.save!
flash[:success] = I18n.t("groups_controller.group_created")
redirect_to group_path(group)
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotFound
render("new", :locals => { :group => group })
end
def destroy
begin
Team.destroy_group(params[:id], current_user)
flash[:success] = "The team was deleted"
redirect_to(groups_path)
rescue Team::DestroyGroupError => e
flash[:error] = e.message
redirect_to(group_path(params[:id]))
end
end
# DELETE avatar
def avatar
Team.delete_avatar(@group)
flash[:success] = "The team image was deleted"
redirect_to(group_path(@group))
end
protected
def find_group_and_ensure_group_adminship
@group = Team.find_by_name!(params[:id])
unless admin?(current_user, @group)
access_denied and return
end
end
def check_if_only_site_admins_can_create
if Gitorious.restrict_team_creation_to_site_admins?
unless site_admin?(current_user)
flash[:error] = "Only site administrators may create teams"
redirect_to(:action => "index")
return false
end
end
end
def paginated_groups
page = (params[:page] || 1).to_i
groups, pages = JustPaginate.paginate(page, 50, Team.count) do |range|
Team.offset(range.first).limit(range.count).order_by_name
end
[groups, pages, page]
end
end
| SamuelMoraesF/Gitorious | app/controllers/groups_controller.rb | Ruby | agpl-3.0 | 3,916 |
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to use bit.ly URL shortening services.
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Brion Vibber <brion@status.net>
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @copyright 2010 StatusNet, Inc http://status.net/
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
class BitlyUrlPlugin extends UrlShortenerPlugin
{
public $shortenerName = 'bit.ly';
public $serviceUrl = 'http://api.bit.ly/v3/shorten?longUrl=%s';
public $login; // To set a site-default when admins or users don't override it.
public $apiKey;
function onInitializePlugin(){
parent::onInitializePlugin();
if(!isset($this->serviceUrl)){
// TRANS: Exception thrown when bit.ly URL shortening plugin was configured incorrectly.
throw new Exception(_m('You must specify a serviceUrl for bit.ly URL shortening.'));
}
}
/**
* Add bit.ly to the list of available URL shorteners if it's configured,
* otherwise leave it out.
*
* @param array $shorteners
* @return boolean hook return value
*/
function onGetUrlShorteners(&$shorteners)
{
if ($this->getLogin() && $this->getApiKey()) {
return parent::onGetUrlShorteners($shorteners);
}
return true;
}
/**
* Short a URL
* @param url
* @return string shortened version of the url, or null if URL shortening failed
*/
protected function shorten($url) {
common_log(LOG_INFO, "bit.ly call for $url");
$response = $this->query($url);
common_log(LOG_INFO, "bit.ly answer for $url is ".$response->getBody());
return $this->decode($url, $response);
}
/**
* Get the user's or site-wide default bit.ly login name.
*
* @return string
*/
protected function getLogin()
{
$login = common_config('bitly', 'default_login');
if (!$login) {
$login = $this->login;
}
return $login;
}
/**
* Get the user's or site-wide default bit.ly API key.
*
* @return string
*/
protected function getApiKey()
{
$key = common_config('bitly', 'default_apikey');
if (!$key) {
$key = $this->apiKey;
}
return $key;
}
/**
* Inject API key into query before sending out...
*
* @param string $url
* @return HTTPResponse
*/
protected function query($url)
{
// http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten
$params = http_build_query(array(
'login' => $this->getLogin(),
'apiKey' => $this->getApiKey()), '', '&');
$serviceUrl = sprintf($this->serviceUrl, urlencode($url)) . '&' . $params;
$request = HTTPClient::start();
return $request->get($serviceUrl);
}
/**
* JSON decode for API result
*/
protected function decode($url, $response)
{
$msg = "bit.ly returned unknown response with unknown message for $url";
if ($response->isOk()) {
$body = $response->getBody();
common_log(LOG_INFO, $body);
$json = json_decode($body, true);
if ($json['status_code'] == 200) {
if (isset($json['data']['url'])) {
common_log(LOG_INFO, "bit.ly returned ".$json['data']['url']." as short URL for $url");
return $json['data']['url'];
}
$msg = "bit.ly returned ".$json['status_code']." response, but didn't find expected URL $url in $body";
}else{
$msg = "bit.ly returned ".$json['status_code']." response with ".$json['status_txt']." for $url";
}
}
common_log(LOG_ERR, $msg);
return null;
}
function onPluginVersion(array &$versions)
{
$versions[] = array('name' => sprintf('BitlyUrl (%s)', $this->shortenerName),
'version' => GNUSOCIAL_VERSION,
'author' => 'Craig Andrews, Brion Vibber',
'homepage' => 'http://status.net/wiki/Plugin:BitlyUrl',
'rawdescription' =>
// TRANS: Plugin description. %1$s is the URL shortening service base URL (for example "bit.ly").
sprintf(_m('Uses <a href="http://%1$s/">%1$s</a> URL-shortener service.'),
$this->shortenerName));
return true;
}
/**
* Hook for RouterInitialized event.
*
* @param URLMapper $m path-to-action mapper
* @return boolean hook return
*/
public function onRouterInitialized(URLMapper $m)
{
$m->connect('panel/bitly',
array('action' => 'bitlyadminpanel'));
return true;
}
/**
* If the plugin's installed, this should be accessible to admins.
*/
function onAdminPanelCheck($name, &$isOK)
{
if ($name == 'bitly') {
$isOK = true;
return false;
}
return true;
}
/**
* Add the bit.ly admin panel to the list...
*/
function onEndAdminPanelNav($nav)
{
if (AdminPanelAction::canAdmin('bitly')) {
$action_name = $nav->action->trimmed('action');
$nav->out->menuItem(common_local_url('bitlyadminpanel'),
// TRANS: Menu item in administration menus for bit.ly URL shortening settings.
_m('bit.ly'),
// TRANS: Title for menu item in administration menus for bit.ly URL shortening settings.
_m('bit.ly URL shortening.'),
$action_name == 'bitlyadminpanel',
'nav_bitly_admin_panel');
}
return true;
}
/**
* Internal hook point to check the default global credentials so
* the admin form knows if we have a fallback or not.
*
* @param string $login
* @param string $apiKey
* @return boolean hook return value
*/
function onBitlyDefaultCredentials(&$login, &$apiKey)
{
$login = $this->login;
$apiKey = $this->apiKey;
return false;
}
}
| bashrc/gnusocial-debian | src/plugins/BitlyUrl/BitlyUrlPlugin.php | PHP | agpl-3.0 | 7,232 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class EventRegistration(models.Model):
_inherit = 'event.registration'
def _get_lead_description_registration(self, prefix='', line_suffix=''):
"""Add the questions and answers linked to the registrations into the description of the lead."""
reg_description = super(EventRegistration, self)._get_lead_description_registration(prefix=prefix, line_suffix=line_suffix)
if not self.registration_answer_ids:
return reg_description
answer_descriptions = []
for answer in self.registration_answer_ids:
answer_value = answer.value_answer_id.name if answer.question_type == "simple_choice" else answer.value_text_box
answer_value = "\n".join([" %s" % line for line in answer_value.split('\n')])
answer_descriptions.append(" - %s\n%s" % (answer.question_id.title, answer_value))
return "%s\n%s\n%s" % (reg_description, _("Questions"), '\n'.join(answer_descriptions))
def _get_lead_description_fields(self):
res = super(EventRegistration, self)._get_lead_description_fields()
res.append('registration_answer_ids')
return res
| ygol/odoo | addons/website_event_crm_questions/models/event_registration.py | Python | agpl-3.0 | 1,282 |
package info.novatec.inspectit.rcp;
/**
* Defines all the images for the InspectIT UI. Note that all images are automatically added to the
* registry on the inspectIT start up.
*
* Please note that this is NOT all the images available. There are so many additional images that
* you can find at
* https://inspectit-performance.atlassian.net/wiki/display/DEV/Icons+and+banners?preview=%2F5019224
* %2F9109584%2Ffugue-icons-3.5.5.zip
*
* @author Ivan Senic
* @author Stefan Siegl
*/
public interface InspectITImages {
// NOCHKALL: We will not javadoc comment each image.
// images created by us
String IMG_SERVER_ONLINE = InspectITConstants.ICON_PATH_SELFMADE + "server_online.png";
String IMG_SERVER_OFFLINE = InspectITConstants.ICON_PATH_SELFMADE + "server_offline.png";
String IMG_SERVER_ONLINE_SMALL = InspectITConstants.ICON_PATH_SELFMADE + "server_online_16x16.png";
String IMG_SERVER_OFFLINE_SMALL = InspectITConstants.ICON_PATH_SELFMADE + "server_offline_16x16.png";
String IMG_SERVER_REFRESH = InspectITConstants.ICON_PATH_SELFMADE + "server_refresh.png";
String IMG_SERVER_REFRESH_SMALL = InspectITConstants.ICON_PATH_SELFMADE + "server_refresh_16x16.png";
String IMG_SERVER_ADD = InspectITConstants.ICON_PATH_SELFMADE + "server_add.png";
String IMG_RETURN = InspectITConstants.ICON_PATH_SELFMADE + "return.png";
String IMG_PARAMETER = InspectITConstants.ICON_PATH_SELFMADE + "parameter.png";
String IMG_FIELD = InspectITConstants.ICON_PATH_SELFMADE + "field.png";
// images from Eclipse, license EPL 1.0
String IMG_ACTIVITY = InspectITConstants.ICON_PATH_ECLIPSE + "debugtt_obj.gif";
String IMG_ADD = InspectITConstants.ICON_PATH_ECLIPSE + "add_obj.gif";
String IMG_ALERT = InspectITConstants.ICON_PATH_ECLIPSE + "alert_obj.gif";
String IMG_ANNOTATION = InspectITConstants.ICON_PATH_ECLIPSE + "annotation_obj.gif";
String IMG_CALL_HIERARCHY = InspectITConstants.ICON_PATH_ECLIPSE + "call_hierarchy.gif";
String IMG_CHECKMARK = InspectITConstants.ICON_PATH_ECLIPSE + "complete_status.gif";
String IMG_CLASS = InspectITConstants.ICON_PATH_ECLIPSE + "class_obj.gif";
String IMG_CLASS_OVERVIEW = InspectITConstants.ICON_PATH_ECLIPSE + "class_obj.gif";
String IMG_CLOSE = InspectITConstants.ICON_PATH_ECLIPSE + "remove_co.gif";
String IMG_COLLAPSE = InspectITConstants.ICON_PATH_ECLIPSE + "collapseall.gif";
String IMG_COMPILATION_OVERVIEW = InspectITConstants.ICON_PATH_ECLIPSE + "workset.gif";
String IMG_CONFIGURATION = InspectITConstants.ICON_PATH_ECLIPSE + "config_obj.gif";
String IMG_COPY = InspectITConstants.ICON_PATH_ECLIPSE + "copy_edit.gif";
String IMG_DELETE = InspectITConstants.ICON_PATH_ECLIPSE + "delete_obj.gif";
String IMG_DISABLED = InspectITConstants.ICON_PATH_ECLIPSE + "disabled_co.gif";
String IMG_EXCEPTION_SENSOR = InspectITConstants.ICON_PATH_ECLIPSE + "exceptiontracer.gif";
String IMG_EXCEPTION_TREE = InspectITConstants.ICON_PATH_ECLIPSE + "exceptiontree.gif";
String IMG_EXPORT = InspectITConstants.ICON_PATH_ECLIPSE + "export.gif";
String IMG_FILTER = InspectITConstants.ICON_PATH_ECLIPSE + "filter_ps.gif";
String IMG_FOLDER = InspectITConstants.ICON_PATH_ECLIPSE + "prj_obj.gif";
String IMG_FONT = InspectITConstants.ICON_PATH_ECLIPSE + "font.gif";
String IMG_HELP = InspectITConstants.ICON_PATH_ECLIPSE + "help.gif";
String IMG_HTTP = InspectITConstants.ICON_PATH_ECLIPSE + "discovery.gif";
String IMG_HTTP_AGGREGATION_REQUESTMESSAGE = InspectITConstants.ICON_PATH_ECLIPSE + "showcat_co.gif";
String IMG_HTTP_TAGGED = InspectITConstants.ICON_PATH_ECLIPSE + "gel_sc_obj.gif";
String IMG_HOME = InspectITConstants.ICON_PATH_ECLIPSE + "home_nav.gif";
String IMG_IMPORT = InspectITConstants.ICON_PATH_ECLIPSE + "import.gif";
String IMG_INFORMATION = InspectITConstants.ICON_PATH_ECLIPSE + "info_obj.gif";
String IMG_INTERFACE = InspectITConstants.ICON_PATH_ECLIPSE + "int_obj.gif";
String IMG_ITEM_NA_GREY = InspectITConstants.ICON_PATH_ECLIPSE + "remove_exc.gif";
String IMG_LIVE_MODE = InspectITConstants.ICON_PATH_ECLIPSE + "start_task.gif";
String IMG_METHOD_PUBLIC = InspectITConstants.ICON_PATH_ECLIPSE + "methpub_obj.gif";
String IMG_METHOD_PROTECTED = InspectITConstants.ICON_PATH_ECLIPSE + "methpro_obj.gif";
String IMG_METHOD_DEFAULT = InspectITConstants.ICON_PATH_ECLIPSE + "methdef_obj.gif";
String IMG_METHOD_PRIVATE = InspectITConstants.ICON_PATH_ECLIPSE + "methpri_obj.gif";
String IMG_NEXT = InspectITConstants.ICON_PATH_ECLIPSE + "next_nav.gif";
String IMG_OVERLAY_UP = InspectITConstants.ICON_PATH_ECLIPSE + "over_co.gif";
String IMG_PACKAGE = InspectITConstants.ICON_PATH_ECLIPSE + "package_obj.gif";
String IMG_PREVIOUS = InspectITConstants.ICON_PATH_ECLIPSE + "prev_nav.gif";
String IMG_PRIORITY = InspectITConstants.ICON_PATH_ECLIPSE + "ihigh_obj.gif";
String IMG_PROPERTIES = InspectITConstants.ICON_PATH_ECLIPSE + "properties.gif";
String IMG_PROGRESS_VIEW = InspectITConstants.ICON_PATH_ECLIPSE + "pview.gif";
String IMG_READ = InspectITConstants.ICON_PATH_ECLIPSE + "read_obj.gif";
String IMG_REFRESH = InspectITConstants.ICON_PATH_ECLIPSE + "refresh.gif";
String IMG_REMOVE = InspectITConstants.ICON_PATH_ECLIPSE + "remove_correction.gif";
String IMG_RESTART = InspectITConstants.ICON_PATH_ECLIPSE + "term_restart.gif";
String IMG_SEARCH = InspectITConstants.ICON_PATH_ECLIPSE + "insp_sbook.gif";
String IMG_SHOW_ALL = InspectITConstants.ICON_PATH_ECLIPSE + "all_instances.gif";
String IMG_STACKTRACE = InspectITConstants.ICON_PATH_ECLIPSE + "stacktrace.gif";
String IMG_TERMINATE = InspectITConstants.ICON_PATH_ECLIPSE + "terminate_co.gif";
String IMG_TEST_MAPPINGS = InspectITConstants.ICON_PATH_ECLIPSE + "test.gif";
String IMG_THREADS_OVERVIEW = InspectITConstants.ICON_PATH_ECLIPSE + "debugt_obj.gif";
String IMG_TIMESTAMP = InspectITConstants.ICON_PATH_ECLIPSE + "dates.gif";
String IMG_TRASH = InspectITConstants.ICON_PATH_ECLIPSE + "trash.gif";
String IMG_WARNING = InspectITConstants.ICON_PATH_ECLIPSE + "warning_obj.gif";
String IMG_WINDOW = InspectITConstants.ICON_PATH_ECLIPSE + "defaultview_misc.gif";
// wizard banners, all from Eclipse, license EPL 1.0
String IMG_WIZBAN_ADD = InspectITConstants.WIZBAN_ICON_PATH + "add_wiz.png";
String IMG_WIZBAN_DOWNLOAD = InspectITConstants.WIZBAN_ICON_PATH + "download_wiz.png";
String IMG_WIZBAN_EDIT = InspectITConstants.WIZBAN_ICON_PATH + "edit_wiz.png";
String IMG_WIZBAN_ERROR = InspectITConstants.WIZBAN_ICON_PATH + "error_wiz.png";
String IMG_WIZBAN_EXPORT = InspectITConstants.WIZBAN_ICON_PATH + "export_wiz.png";
String IMG_WIZBAN_IMPORT = InspectITConstants.WIZBAN_ICON_PATH + "import_wiz.png";
String IMG_WIZBAN_LABEL = InspectITConstants.WIZBAN_ICON_PATH + "label_wiz.png";
String IMG_WIZBAN_RECORD = InspectITConstants.WIZBAN_ICON_PATH + "record_wiz.png";
String IMG_WIZBAN_SERVER = InspectITConstants.WIZBAN_ICON_PATH + "server_wiz.png";
String IMG_WIZBAN_STORAGE = InspectITConstants.WIZBAN_ICON_PATH + "storage_wiz.png";
String IMG_WIZBAN_UPLOAD = InspectITConstants.WIZBAN_ICON_PATH + "upload_wiz.png";
// images originally from Eclipse we modified (resized, added smth, etc), license EPL 1.0
String IMG_AGENT = InspectITConstants.ICON_PATH_ECLIPSE + "agent.gif";
String IMG_AGENT_ACTIVE = InspectITConstants.ICON_PATH_ECLIPSE + "agent_active.gif";
String IMG_AGENT_NOT_ACTIVE = InspectITConstants.ICON_PATH_ECLIPSE + "agent_na.gif";
String IMG_AGENT_NOT_SENDING = InspectITConstants.ICON_PATH_ECLIPSE + "agent_not_sending.gif";
String IMG_AGENT_NO_KEEPALIVE = InspectITConstants.ICON_PATH_ECLIPSE + "agent_no_keepalive.png";
String IMG_BUFFER_CLEAR = InspectITConstants.ICON_PATH_ECLIPSE + "buffer_clear.gif";
String IMG_BUFFER_COPY = InspectITConstants.ICON_PATH_ECLIPSE + "buffer_copy.gif";
String IMG_BUSINESS = InspectITConstants.ICON_PATH_ECLIPSE + "business.gif";
String IMG_CALENDAR = InspectITConstants.ICON_PATH_ECLIPSE + "calendar.gif";
String IMG_CATALOG = InspectITConstants.ICON_PATH_ECLIPSE + "catalog.gif";
String IMG_CHART_BAR = InspectITConstants.ICON_PATH_ECLIPSE + "graph_bar.gif";
String IMG_CHART_PIE = InspectITConstants.ICON_PATH_ECLIPSE + "graph_pie.gif";
String IMG_CLASS_EXCLUDE = InspectITConstants.ICON_PATH_ECLIPSE + "class_exclude.gif";
String IMG_EDIT = InspectITConstants.ICON_PATH_ECLIPSE + "edit.gif";
String IMG_FLAG = InspectITConstants.ICON_PATH_ECLIPSE + "flag.gif";
String IMG_HTTP_URL = InspectITConstants.ICON_PATH_ECLIPSE + "url.gif";
String IMG_LABEL = InspectITConstants.ICON_PATH_ECLIPSE + "label.gif";
String IMG_LABEL_ADD = InspectITConstants.ICON_PATH_ECLIPSE + "label_add.gif";
String IMG_LABEL_DELETE = InspectITConstants.ICON_PATH_ECLIPSE + "label_delete.gif";
String IMG_LOCATE_IN_HIERARCHY = InspectITConstants.ICON_PATH_ECLIPSE + "locate_in_hierarchy.gif";
String IMG_LOG = InspectITConstants.ICON_PATH_ECLIPSE + "log.gif";
String IMG_METHOD = InspectITConstants.ICON_PATH_ECLIPSE + "method.gif";
String IMG_MESSAGE = InspectITConstants.ICON_PATH_ECLIPSE + "message.gif";
String IMG_NUMBER = InspectITConstants.ICON_PATH_ECLIPSE + "number.gif";
String IMG_OVERLAY_ERROR = InspectITConstants.ICON_PATH_ECLIPSE + "overlay_error.gif";
String IMG_OVERLAY_PRIORITY = InspectITConstants.ICON_PATH_ECLIPSE + "overlay_priority.gif";
String IMG_PREFERENCES = InspectITConstants.ICON_PATH_ECLIPSE + "preferences.gif";
String IMG_RECORD = InspectITConstants.ICON_PATH_ECLIPSE + "record.gif";
String IMG_RECORD_GRAY = InspectITConstants.ICON_PATH_ECLIPSE + "record_gray.gif";
String IMG_RECORD_SCHEDULED = InspectITConstants.ICON_PATH_ECLIPSE + "record_schedule.gif";
String IMG_RECORD_STOP = InspectITConstants.ICON_PATH_ECLIPSE + "record_term.gif";
String IMG_OPTIONS = InspectITConstants.ICON_PATH_ECLIPSE + "options.gif";
String IMG_SERVER_INSTACE = InspectITConstants.ICON_PATH_ECLIPSE + "server_instance.gif";
String IMG_STORAGE = InspectITConstants.ICON_PATH_ECLIPSE + "storage.gif";
String IMG_STORAGE_AVAILABLE = InspectITConstants.ICON_PATH_ECLIPSE + "storage_available.gif";
String IMG_STORAGE_CLOSED = InspectITConstants.ICON_PATH_ECLIPSE + "storage_readable.gif";
String IMG_STORAGE_DOWNLOADED = InspectITConstants.ICON_PATH_ECLIPSE + "storage_download.gif";
String IMG_STORAGE_FINALIZE = InspectITConstants.ICON_PATH_ECLIPSE + "storage_finalize.gif";
String IMG_STORAGE_NOT_AVAILABLE = InspectITConstants.ICON_PATH_ECLIPSE + "storage_na.gif";
String IMG_STORAGE_OPENED = InspectITConstants.ICON_PATH_ECLIPSE + "storage_writable.gif";
String IMG_STORAGE_OVERLAY = InspectITConstants.ICON_PATH_ECLIPSE + "storage_overlay.gif";
String IMG_STORAGE_RECORDING = InspectITConstants.ICON_PATH_ECLIPSE + "storage_recording.gif";
String IMG_STORAGE_UPLOAD = InspectITConstants.ICON_PATH_ECLIPSE + "storage_upload.gif";
String IMG_SUPERCLASS = InspectITConstants.ICON_PATH_ECLIPSE + "class_hierarchy.gif";
String IMG_TIME = InspectITConstants.ICON_PATH_ECLIPSE + "time.gif";
String IMG_TIME_DELTA = InspectITConstants.ICON_PATH_ECLIPSE + "time_delta.gif";
String IMG_TIMEFRAME = InspectITConstants.ICON_PATH_ECLIPSE + "timeframe.gif";
String IMG_TIMER = InspectITConstants.ICON_PATH_ECLIPSE + "method_time.gif";
String IMG_TOOL = InspectITConstants.ICON_PATH_ECLIPSE + "build.gif";
String IMG_TRANSFORM = InspectITConstants.ICON_PATH_ECLIPSE + "transform.gif";
String IMG_USER = InspectITConstants.ICON_PATH_ECLIPSE + "user.gif";
// Fugue set - license Creative Commons v3.0
String IMG_ADDRESSBOOK = InspectITConstants.ICON_PATH_FUGUE + "address-book.png";
String IMG_ADDRESSBOOK_BLUE = InspectITConstants.ICON_PATH_FUGUE + "address-book-blue.png";
String IMG_ADDRESSBOOK_PLUS = InspectITConstants.ICON_PATH_FUGUE + "address-book-plus.png";
String IMG_BLOCK = InspectITConstants.ICON_PATH_FUGUE + "block.png";
String IMG_COMPASS = InspectITConstants.ICON_PATH_FUGUE + "compass.png";
String IMG_CPU_OVERVIEW = InspectITConstants.ICON_PATH_FUGUE + "processor.png";
String IMG_DATABASE = InspectITConstants.ICON_PATH_FUGUE + "database-sql.png";
String IMG_INSTRUMENTATION_BROWSER = InspectITConstants.ICON_PATH_FUGUE + "blue-document-tree.png";
String IMG_INSTRUMENTATION_BROWSER_INACTIVE = InspectITConstants.ICON_PATH_FUGUE + "document-tree.png";
String IMG_INVOCATION = InspectITConstants.ICON_PATH_FUGUE + "arrow-switch.png";
String IMG_MEMORY_OVERVIEW = InspectITConstants.ICON_PATH_FUGUE + "memory.png";
String IMG_SYSTEM_OVERVIEW = InspectITConstants.ICON_PATH_FUGUE + "system-monitor.png";
String IMG_VM_SUMMARY = InspectITConstants.ICON_PATH_FUGUE + "resource-monitor.png";
String IMG_LOGGING_LEVEL = InspectITConstants.ICON_PATH_FUGUE + "traffic-light-single.png";
String IMG_BEAN = InspectITConstants.ICON_PATH_FUGUE + "bean.png";
String IMG_BLUE_DOCUMENT_TABLE = InspectITConstants.ICON_PATH_FUGUE + "blue-document-table.png";
String IMG_BOOK = InspectITConstants.ICON_PATH_FUGUE + "book.png";
String IMG_DUMMY = InspectITConstants.ICON_PATH_FUGUE + "dummy-happy.png";
String IMG_COUNTER = InspectITConstants.ICON_PATH_FUGUE + "counter.png";
// labels just pointing to existing ones
String IMG_ASSIGNEE_LABEL_ICON = IMG_USER;
String IMG_DATE_LABEL_ICON = IMG_CALENDAR;
String IMG_MOUNTEDBY_LABEL_ICON = IMG_READ;
String IMG_RATING_LABEL_ICON = IMG_PRIORITY;
String IMG_STATUS_LABEL_ICON = IMG_ALERT;
String IMG_USECASE_LABEL_ICON = IMG_BUSINESS;
String IMG_USER_LABEL_ICON = IMG_DISABLED;
} | andy32323/inspectIT | inspectIT/src/info/novatec/inspectit/rcp/InspectITImages.java | Java | agpl-3.0 | 13,358 |
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.template;
import java.util.List;
import java.util.StringTokenizer;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* A special Map that executes an XPath against the parent Node as part of the get()
* Map interface implementation.
*
* @author Kevin Roast
*/
public class NamePathResultsMap extends BasePathResultsMap
{
/**
* Constructor
*
* @param parent The parent TemplateNode to execute searches from
* @param services The ServiceRegistry to use
*/
public NamePathResultsMap(TemplateNode parent, ServiceRegistry services)
{
super(parent, services);
}
/**
* @see java.util.Map#get(java.lang.Object)
*/
public Object get(Object key)
{
String path = key.toString();
StringBuilder xpath = new StringBuilder(path.length() << 1);
StringTokenizer t = new StringTokenizer(path, "/");
int count = 0;
QueryParameterDefinition[] params = new QueryParameterDefinition[t.countTokens()];
DataTypeDefinition ddText =
this.services.getDictionaryService().getDataType(DataTypeDefinition.TEXT);
NamespaceService ns = this.services.getNamespaceService();
while (t.hasMoreTokens())
{
if (xpath.length() != 0)
{
xpath.append('/');
}
String strCount = Integer.toString(count);
xpath.append("*[@cm:name=$cm:name")
.append(strCount)
.append(']');
params[count++] = new QueryParameterDefImpl(
QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "name" + strCount, ns),
ddText,
true,
t.nextToken());
}
List<TemplateNode> nodes = getChildrenByXPath(xpath.toString(), params, true);
return (nodes.size() != 0) ? nodes.get(0) : null;
}
}
| fxcebx/community-edition | projects/repository/source/java/org/alfresco/repo/template/NamePathResultsMap.java | Java | lgpl-3.0 | 3,099 |
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.content.caching.quota;
/**
* Disk quota managers for the CachingContentStore must implement this interface.
*
* @author Matt Ward
*/
public interface QuotaManagerStrategy
{
/**
* Called immediately before writing a cache file or (when cacheOnInBound is set to true
* for the CachingContentStore) before handing a ContentWriter to a content producer.
* <p>
* In the latter case, the contentSize will be unknown (0), since the content
* length hasn't been established yet.
*
* @param contentSize The size of the content that will be written or 0 if not known.
* @return true to allow the cache file to be written, false to veto.
*/
boolean beforeWritingCacheFile(long contentSize);
/**
* Called immediately after writing a cache file - specifying the size of the file that was written.
* The return value allows implementations control over whether the new cache file is kept (true) or
* immediately removed (false).
*
* @param contentSize The size of the content that was written.
* @return true to allow the cache file to remain, false to immediately delete.
*/
boolean afterWritingCacheFile(long contentSize);
}
| nguyentienlong/community-edition | projects/repository/source/java/org/alfresco/repo/content/caching/quota/QuotaManagerStrategy.java | Java | lgpl-3.0 | 2,059 |
/**
* JBoss, Home of Professional Open Source
* Copyright Red Hat, Inc., and individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.aerogear.unifiedpush.migrator;
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import com.mysql.management.MysqldResource;
import com.mysql.management.MysqldResourceI;
public class EmbeddedMysqlDatabase {
private MysqldResource mysqldResource;
private String url;
public void start(String databaseName) {
String tmpDir = System.getProperty("java.io.tmpdir");
File baseDir = new File(tmpDir, databaseName);
FileUtils.deleteQuietly(baseDir);
int port = getFreePort();
Map<String, String> databaseOptions = new HashMap<>();
databaseOptions.put(MysqldResourceI.PORT, Integer.toString(port));
mysqldResource = new MysqldResource(baseDir);
mysqldResource.start("mysql", databaseOptions);
url = "jdbc:mysql://localhost:" + port + "/" + databaseName + "?" + "createDatabaseIfNotExist=true";
}
public void close() {
if (mysqldResource != null) {
mysqldResource.shutdown();
FileUtils.deleteQuietly(mysqldResource.getBaseDir());
}
}
public String getUrl() {
return url;
}
private int getFreePort() {
ServerSocket socket = null;
try {
socket = new ServerSocket(0);
return socket.getLocalPort();
} catch (IOException e) {
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
return -1;
}
} | edewit/aerogear-unifiedpush-server | migrator/src/test/java/org/jboss/aerogear/unifiedpush/migrator/EmbeddedMysqlDatabase.java | Java | apache-2.0 | 2,351 |
/*
* Copyright 2009 Mustard Grain, Inc., 2009-2010 LinkedIn, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package voldemort.server.niosocket;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.ClosedByInterruptException;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import voldemort.VoldemortException;
import voldemort.annotations.jmx.JmxGetter;
import voldemort.common.service.ServiceType;
import voldemort.server.AbstractSocketService;
import voldemort.server.StatusManager;
import voldemort.server.protocol.RequestHandlerFactory;
import voldemort.utils.DaemonThreadFactory;
/**
* NioSocketService is an NIO-based socket service, comparable to the
* blocking-IO-based socket service.
* <p/>
* The NIO server is enabled in the server.properties file by setting the
* "enable.nio.connector" property to "true". If you want to adjust the number
* of SelectorManager instances that are used, change "nio.connector.selectors"
* to a positive integer value. Otherwise, the number of selectors will be equal
* to the number of CPUs visible to the JVM.
* <p/>
* This code uses the NIO APIs directly. It would be a good idea to consider
* some of the NIO frameworks to handle this more cleanly, efficiently, and to
* handle corner cases.
*
*
* @see voldemort.server.socket.SocketService
*/
public class NioSocketService extends AbstractSocketService {
private static final int SHUTDOWN_TIMEOUT_MS = 15000;
private final RequestHandlerFactory requestHandlerFactory;
private final ServerSocketChannel serverSocketChannel;
private final InetSocketAddress endpoint;
private final NioSelectorManager[] selectorManagers;
private final ExecutorService selectorManagerThreadPool;
private final int socketBufferSize;
private final int acceptorBacklog;
private final StatusManager statusManager;
private final Thread acceptorThread;
private final Logger logger = Logger.getLogger(getClass());
public NioSocketService(RequestHandlerFactory requestHandlerFactory,
int port,
int socketBufferSize,
int selectors,
String serviceName,
boolean enableJmx,
int acceptorBacklog) {
super(ServiceType.SOCKET, port, serviceName, enableJmx);
this.requestHandlerFactory = requestHandlerFactory;
this.socketBufferSize = socketBufferSize;
this.acceptorBacklog = acceptorBacklog;
try {
this.serverSocketChannel = ServerSocketChannel.open();
} catch(IOException e) {
throw new VoldemortException(e);
}
this.endpoint = new InetSocketAddress(port);
this.selectorManagers = new NioSelectorManager[selectors];
String threadFactoryPrefix = "voldemort-" + serviceName;
this.selectorManagerThreadPool = Executors.newFixedThreadPool(selectorManagers.length,
new DaemonThreadFactory(threadFactoryPrefix));
this.statusManager = new StatusManager((ThreadPoolExecutor) this.selectorManagerThreadPool);
this.acceptorThread = new Thread(new Acceptor(), threadFactoryPrefix + ".Acceptor");
}
@Override
public StatusManager getStatusManager() {
return statusManager;
}
@Override
protected void startInner() {
if(logger.isEnabledFor(Level.INFO))
logger.info("Starting Voldemort NIO socket server (" + serviceName + ") on port "
+ port);
try {
for(int i = 0; i < selectorManagers.length; i++) {
selectorManagers[i] = new NioSelectorManager(endpoint,
requestHandlerFactory,
socketBufferSize);
selectorManagerThreadPool.execute(selectorManagers[i]);
}
serverSocketChannel.socket().bind(endpoint, acceptorBacklog);
serverSocketChannel.socket().setReceiveBufferSize(socketBufferSize);
serverSocketChannel.socket().setReuseAddress(true);
acceptorThread.start();
} catch(Exception e) {
throw new VoldemortException(e);
}
enableJmx(this);
}
@Override
protected void stopInner() {
if(logger.isEnabledFor(Level.INFO))
logger.info("Stopping Voldemort NIO socket server (" + serviceName + ") on port "
+ port);
try {
// Signal the thread to stop accepting new connections...
if(logger.isTraceEnabled())
logger.trace("Interrupted acceptor thread, waiting " + SHUTDOWN_TIMEOUT_MS
+ " ms for termination");
acceptorThread.interrupt();
acceptorThread.join(SHUTDOWN_TIMEOUT_MS);
if(acceptorThread.isAlive()) {
if(logger.isEnabledFor(Level.WARN))
logger.warn("Acceptor thread pool did not stop cleanly after "
+ SHUTDOWN_TIMEOUT_MS + " ms");
}
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
try {
// We close instead of interrupting the thread pool. Why? Because as
// of 0.70, the SelectorManager services RequestHandler in the same
// thread as itself. So, if we interrupt the SelectorManager in the
// thread pool, we interrupt the request. In some RequestHandler
// implementations interruptions are not handled gracefully and/or
// indicate other errors which cause odd side effects. So we
// implement a non-interrupt-based shutdown via close.
for(int i = 0; i < selectorManagers.length; i++) {
try {
selectorManagers[i].close();
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
}
// As per the above comment - we use shutdown and *not* shutdownNow
// to avoid using interrupts to signal shutdown.
selectorManagerThreadPool.shutdown();
if(logger.isTraceEnabled())
logger.trace("Shut down SelectorManager thread pool acceptor, waiting "
+ SHUTDOWN_TIMEOUT_MS + " ms for termination");
boolean terminated = selectorManagerThreadPool.awaitTermination(SHUTDOWN_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
if(!terminated) {
if(logger.isEnabledFor(Level.WARN))
logger.warn("SelectorManager thread pool did not stop cleanly after "
+ SHUTDOWN_TIMEOUT_MS + " ms");
}
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
try {
serverSocketChannel.socket().close();
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
try {
serverSocketChannel.close();
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
}
private class Acceptor implements Runnable {
public void run() {
if(logger.isInfoEnabled())
logger.info("Server now listening for connections on port " + port);
AtomicInteger counter = new AtomicInteger();
while(true) {
if(Thread.currentThread().isInterrupted()) {
if(logger.isInfoEnabled())
logger.info("Acceptor thread interrupted");
break;
}
try {
SocketChannel socketChannel = serverSocketChannel.accept();
if(socketChannel == null) {
if(logger.isEnabledFor(Level.WARN))
logger.warn("Claimed accept but nothing to select");
continue;
}
NioSelectorManager selectorManager = selectorManagers[counter.getAndIncrement()
% selectorManagers.length];
selectorManager.accept(socketChannel);
} catch(ClosedByInterruptException e) {
// If you're *really* interested...
if(logger.isTraceEnabled())
logger.trace("Acceptor thread interrupted, closing");
break;
} catch(Exception e) {
if(logger.isEnabledFor(Level.WARN))
logger.warn(e.getMessage(), e);
}
}
if(logger.isInfoEnabled())
logger.info("Server has stopped listening for connections on port " + port);
}
}
@JmxGetter(name = "numActiveConnections", description = "total number of active connections across selector managers")
public final int getNumActiveConnections() {
int sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getNumActiveConnections();
}
return sum;
}
@JmxGetter(name = "numQueuedConnections", description = "total number of connections pending for registration with selector managers")
public final int getNumQueuedConnections() {
int sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getNumQueuedConnections();
}
return sum;
}
@JmxGetter(name = "selectCountAvg", description = "average number of connections selected in each select() call")
public final double getSelectCountAvg() {
double sum = 0.0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getSelectCountHistogram().getAverage();
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "selectCount99th", description = "99th percentile of number of connections selected in each select() call")
public final double getSelectCount99th() {
double sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getSelectCountHistogram().getQuantile(0.99);
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "selectTimeMsAvg", description = "average time spent in the select() call")
public final double getSelectTimeMsAvg() {
double sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getSelectTimeMsHistogram().getAverage();
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "selectTimeMs99th", description = "99th percentile of time spent in the select() call")
public final double getSelectTimeMs99th() {
double sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getSelectTimeMsHistogram().getQuantile(0.99);
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "processingTimeMsAvg", description = "average time spent processing all read/write requests, in a select() loop")
public final double getProcessingTimeMsAvg() {
double sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getProcessingTimeMsHistogram().getAverage();
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "processingTimeMs99th", description = "99th percentile of time spent processing all the read/write requests, in a select() loop")
public final double getprocessingTimeMs99th() {
double sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getProcessingTimeMsHistogram().getQuantile(0.99);
}
return sum / selectorManagers.length;
}
@JmxGetter(name = "commReadBufferSize", description = "total amount of memory consumed by all the communication read buffers, in bytes")
public final double getCommReadBufferSize() {
long sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getCommBufferSizeStats().getCommReadBufferSizeTracker().longValue();
}
return sum;
}
@JmxGetter(name = "commWriteBufferSize", description = "total amount of memory consumed by all the communication write buffers, in bytes")
public final double getCommWriteBufferSize() {
long sum = 0;
for(NioSelectorManager manager: selectorManagers) {
sum += manager.getCommBufferSizeStats().getCommWriteBufferSizeTracker().longValue();
}
return sum;
}
}
| cshaxu/voldemort | src/java/voldemort/server/niosocket/NioSocketService.java | Java | apache-2.0 | 14,098 |
default[:hannibal][:hbase_version] = '1.1.3'
default[:hannibal][:checksum]["1.1.3"] = '1e4f4030374a34d9f92dc9605505d421615ab12a9e02a10ed690576ab644f705'
default[:hannibal][:download_url] = 'https://github.com/amithkanand/hannibal/releases/download/v.0.12.0-apha'
| http-418/chef-bach | cookbooks/bach_repository/attributes/hannibal.rb | Ruby | apache-2.0 | 263 |
/*
* Zed Attack Proxy (ZAP) and its related class files.
*
* ZAP is an HTTP/HTTPS proxy for assessing web application security.
*
* Copyright 2018 The ZAP Development Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.zap.extension.imagelocationscanner;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.ExtensionAdaptor;
public class ExtensionImageLocationScanner extends ExtensionAdaptor {
@Override
public String getName() {
return "ExtensionImageLocationScanner";
}
@Override
public String getUIName() {
return Constant.messages.getString("imagelocationscanner.ui.name");
}
@Override
public String getDescription() {
return Constant.messages.getString("imagelocationscanner.addon.desc");
}
@Override
public boolean canUnload() {
return true;
}
}
| kingthorin/zap-extensions | addOns/imagelocationscanner/src/main/java/org/zaproxy/zap/extension/imagelocationscanner/ExtensionImageLocationScanner.java | Java | apache-2.0 | 1,403 |
package term // import "github.com/ory/dockertest/docker/pkg/term"
import (
"io"
)
// EscapeError is special error which returned by a TTY proxy reader's Read()
// method in case its detach escape sequence is read.
type EscapeError struct{}
func (EscapeError) Error() string {
return "read escape sequence"
}
// escapeProxy is used only for attaches with a TTY. It is used to proxy
// stdin keypresses from the underlying reader and look for the passed in
// escape key sequence to signal a detach.
type escapeProxy struct {
escapeKeys []byte
escapeKeyPos int
r io.Reader
}
// NewEscapeProxy returns a new TTY proxy reader which wraps the given reader
// and detects when the specified escape keys are read, in which case the Read
// method will return an error of type EscapeError.
func NewEscapeProxy(r io.Reader, escapeKeys []byte) io.Reader {
return &escapeProxy{
escapeKeys: escapeKeys,
r: r,
}
}
func (r *escapeProxy) Read(buf []byte) (int, error) {
nr, err := r.r.Read(buf)
preserve := func() {
// this preserves the original key presses in the passed in buffer
nr += r.escapeKeyPos
preserve := make([]byte, 0, r.escapeKeyPos+len(buf))
preserve = append(preserve, r.escapeKeys[:r.escapeKeyPos]...)
preserve = append(preserve, buf...)
r.escapeKeyPos = 0
copy(buf[0:nr], preserve)
}
if nr != 1 || err != nil {
if r.escapeKeyPos > 0 {
preserve()
}
return nr, err
}
if buf[0] != r.escapeKeys[r.escapeKeyPos] {
if r.escapeKeyPos > 0 {
preserve()
}
return nr, nil
}
if r.escapeKeyPos == len(r.escapeKeys)-1 {
return 0, EscapeError{}
}
// Looks like we've got an escape key, but we need to match again on the next
// read.
// Store the current escape key we found so we can look for the next one on
// the next read.
// Since this is an escape key, make sure we don't let the caller read it
// If later on we find that this is not the escape sequence, we'll add the
// keys back
r.escapeKeyPos++
return nr - r.escapeKeyPos, nil
}
| Mainflux/mainflux-lite | vendor/github.com/ory/dockertest/docker/pkg/term/proxy.go | GO | apache-2.0 | 2,026 |
/*
* Copyright (c) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.api.client.extensions.java6.auth.oauth2;
import com.google.api.client.auth.oauth2.AuthorizationCodeFlow;
import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.auth.oauth2.TokenResponse;
import com.google.api.client.util.Preconditions;
import java.awt.Desktop;
import java.awt.Desktop.Action;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* OAuth 2.0 authorization code flow for an installed Java application that persists end-user
* credentials.
*
* <p>
* Implementation is thread-safe.
* </p>
*
* @since 1.11
* @author Yaniv Inbar
*/
public class AuthorizationCodeInstalledApp {
/** Authorization code flow. */
private final AuthorizationCodeFlow flow;
/** Verification code receiver. */
private final VerificationCodeReceiver receiver;
private static final Logger LOGGER =
Logger.getLogger(AuthorizationCodeInstalledApp.class.getName());
/**
* @param flow authorization code flow
* @param receiver verification code receiver
*/
public AuthorizationCodeInstalledApp(
AuthorizationCodeFlow flow, VerificationCodeReceiver receiver) {
this.flow = Preconditions.checkNotNull(flow);
this.receiver = Preconditions.checkNotNull(receiver);
}
/**
* Authorizes the installed application to access user's protected data.
*
* @param userId user ID or {@code null} if not using a persisted credential store
* @return credential
*/
public Credential authorize(String userId) throws IOException {
try {
Credential credential = flow.loadCredential(userId);
if (credential != null
&& (credential.getRefreshToken() != null || credential.getExpiresInSeconds() > 60)) {
return credential;
}
// open in browser
String redirectUri = receiver.getRedirectUri();
AuthorizationCodeRequestUrl authorizationUrl =
flow.newAuthorizationUrl().setRedirectUri(redirectUri);
onAuthorization(authorizationUrl);
// receive authorization code and exchange it for an access token
String code = receiver.waitForCode();
TokenResponse response = flow.newTokenRequest(code).setRedirectUri(redirectUri).execute();
// store credential and return it
return flow.createAndStoreCredential(response, userId);
} finally {
receiver.stop();
}
}
/**
* Handles user authorization by redirecting to the OAuth 2.0 authorization server.
*
* <p>
* Default implementation is to call {@code browse(authorizationUrl.build())}. Subclasses may
* override to provide optional parameters such as the recommended state parameter. Sample
* implementation:
* </p>
*
* <pre>
@Override
protected void onAuthorization(AuthorizationCodeRequestUrl authorizationUrl) throws IOException {
authorizationUrl.setState("xyz");
super.onAuthorization(authorizationUrl);
}
* </pre>
*
* @param authorizationUrl authorization URL
* @throws IOException I/O exception
*/
protected void onAuthorization(AuthorizationCodeRequestUrl authorizationUrl) throws IOException {
browse(authorizationUrl.build());
}
/**
* Open a browser at the given URL using {@link Desktop} if available, or alternatively output the
* URL to {@link System#out} for command-line applications.
*
* @param url URL to browse
*/
public static void browse(String url) {
Preconditions.checkNotNull(url);
// Ask user to open in their browser using copy-paste
System.out.println("Please open the following address in your browser:");
System.out.println(" " + url);
// Attempt to open it in the browser
try {
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Action.BROWSE)) {
System.out.println("Attempting to open that address in the default browser now...");
desktop.browse(URI.create(url));
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Unable to open browser", e);
} catch (InternalError e) {
// A bug in a JRE can cause Desktop.isDesktopSupported() to throw an
// InternalError rather than returning false. The error reads,
// "Can't connect to X11 window server using ':0.0' as the value of the
// DISPLAY variable." The exact error message may vary slightly.
LOGGER.log(Level.WARNING, "Unable to open browser", e);
}
}
/** Returns the authorization code flow. */
public final AuthorizationCodeFlow getFlow() {
return flow;
}
/** Returns the verification code receiver. */
public final VerificationCodeReceiver getReceiver() {
return receiver;
}
}
| anishalex/youlog | oauthComponents/google-oauth-java-client-dev/google-oauth-client-java6/src/main/java/com/google/api/client/extensions/java6/auth/oauth2/AuthorizationCodeInstalledApp.java | Java | apache-2.0 | 5,421 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from airflow.contrib.hooks.aws_hook import AwsHook
from airflow.contrib.operators.sagemaker_base_operator import SageMakerBaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.exceptions import AirflowException
class SageMakerTuningOperator(SageMakerBaseOperator):
"""
Initiate a SageMaker hyperparameter tuning job.
This operator returns The ARN of the tuning job created in Amazon SageMaker.
:param config: The configuration necessary to start a tuning job (templated).
For details of the configuration parameter see
:py:meth:`SageMaker.Client.create_hyper_parameter_tuning_job`
:type config: dict
:param aws_conn_id: The AWS connection ID to use.
:type aws_conn_id: str
:param wait_for_completion: Set to True to wait until the tuning job finishes.
:type wait_for_completion: bool
:param check_interval: If wait is set to True, the time interval, in seconds,
that this operation waits to check the status of the tuning job.
:type check_interval: int
:param max_ingestion_time: If wait is set to True, the operation fails
if the tuning job doesn't finish within max_ingestion_time seconds. If you
set this parameter to None, the operation does not timeout.
:type max_ingestion_time: int
"""
integer_fields = [
['HyperParameterTuningJobConfig', 'ResourceLimits', 'MaxNumberOfTrainingJobs'],
['HyperParameterTuningJobConfig', 'ResourceLimits', 'MaxParallelTrainingJobs'],
['TrainingJobDefinition', 'ResourceConfig', 'InstanceCount'],
['TrainingJobDefinition', 'ResourceConfig', 'VolumeSizeInGB'],
['TrainingJobDefinition', 'StoppingCondition', 'MaxRuntimeInSeconds']
]
@apply_defaults
def __init__(self,
config,
wait_for_completion=True,
check_interval=30,
max_ingestion_time=None,
*args, **kwargs):
super(SageMakerTuningOperator, self).__init__(config=config,
*args, **kwargs)
self.config = config
self.wait_for_completion = wait_for_completion
self.check_interval = check_interval
self.max_ingestion_time = max_ingestion_time
def expand_role(self):
if 'TrainingJobDefinition' in self.config:
config = self.config['TrainingJobDefinition']
if 'RoleArn' in config:
hook = AwsHook(self.aws_conn_id)
config['RoleArn'] = hook.expand_role(config['RoleArn'])
def execute(self, context):
self.preprocess_config()
self.log.info(
'Creating SageMaker Hyper-Parameter Tuning Job %s', self.config['HyperParameterTuningJobName']
)
response = self.hook.create_tuning_job(
self.config,
wait_for_completion=self.wait_for_completion,
check_interval=self.check_interval,
max_ingestion_time=self.max_ingestion_time
)
if response['ResponseMetadata']['HTTPStatusCode'] != 200:
raise AirflowException('Sagemaker Tuning Job creation failed: %s' % response)
else:
return {
'Tuning': self.hook.describe_tuning_job(
self.config['HyperParameterTuningJobName']
)
}
| malmiron/incubator-airflow | airflow/contrib/operators/sagemaker_tuning_operator.py | Python | apache-2.0 | 4,191 |
// Copyright 2013 Beego Authors
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package session
import (
"fmt"
"strings"
"sync"
"time"
"github.com/Unknwon/com"
"gopkg.in/ini.v1"
"gopkg.in/redis.v2"
"github.com/macaron-contrib/session"
)
// RedisStore represents a redis session store implementation.
type RedisStore struct {
c *redis.Client
sid string
duration time.Duration
lock sync.RWMutex
data map[interface{}]interface{}
}
// NewRedisStore creates and returns a redis session store.
func NewRedisStore(c *redis.Client, sid string, dur time.Duration, kv map[interface{}]interface{}) *RedisStore {
return &RedisStore{
c: c,
sid: sid,
duration: dur,
data: kv,
}
}
// Set sets value to given key in session.
func (s *RedisStore) Set(key, val interface{}) error {
s.lock.Lock()
defer s.lock.Unlock()
s.data[key] = val
return nil
}
// Get gets value by given key in session.
func (s *RedisStore) Get(key interface{}) interface{} {
s.lock.RLock()
defer s.lock.RUnlock()
return s.data[key]
}
// Delete delete a key from session.
func (s *RedisStore) Delete(key interface{}) error {
s.lock.Lock()
defer s.lock.Unlock()
delete(s.data, key)
return nil
}
// ID returns current session ID.
func (s *RedisStore) ID() string {
return s.sid
}
// Release releases resource and save data to provider.
func (s *RedisStore) Release() error {
data, err := session.EncodeGob(s.data)
if err != nil {
return err
}
return s.c.SetEx(s.sid, s.duration, string(data)).Err()
}
// Flush deletes all session data.
func (s *RedisStore) Flush() error {
s.lock.Lock()
defer s.lock.Unlock()
s.data = make(map[interface{}]interface{})
return nil
}
// RedisProvider represents a redis session provider implementation.
type RedisProvider struct {
c *redis.Client
duration time.Duration
}
// Init initializes redis session provider.
// configs: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
func (p *RedisProvider) Init(maxlifetime int64, configs string) (err error) {
p.duration, err = time.ParseDuration(fmt.Sprintf("%ds", maxlifetime))
if err != nil {
return err
}
cfg, err := ini.Load([]byte(strings.Replace(configs, ",", "\n", -1)))
if err != nil {
return err
}
opt := &redis.Options{
Network: "tcp",
}
for k, v := range cfg.Section("").KeysHash() {
switch k {
case "network":
opt.Network = v
case "addr":
opt.Addr = v
case "password":
opt.Password = v
case "db":
opt.DB = com.StrTo(v).MustInt64()
case "pool_size":
opt.PoolSize = com.StrTo(v).MustInt()
case "idle_timeout":
opt.IdleTimeout, err = time.ParseDuration(v + "s")
if err != nil {
return fmt.Errorf("error parsing idle timeout: %v", err)
}
default:
return fmt.Errorf("session/redis: unsupported option '%s'", k)
}
}
p.c = redis.NewClient(opt)
return p.c.Ping().Err()
}
// Read returns raw session store by session ID.
func (p *RedisProvider) Read(sid string) (session.RawStore, error) {
if !p.Exist(sid) {
if err := p.c.Set(sid, "").Err(); err != nil {
return nil, err
}
}
var kv map[interface{}]interface{}
kvs, err := p.c.Get(sid).Result()
if err != nil {
return nil, err
}
if len(kvs) == 0 {
kv = make(map[interface{}]interface{})
} else {
kv, err = session.DecodeGob([]byte(kvs))
if err != nil {
return nil, err
}
}
return NewRedisStore(p.c, sid, p.duration, kv), nil
}
// Exist returns true if session with given ID exists.
func (p *RedisProvider) Exist(sid string) bool {
has, err := p.c.Exists(sid).Result()
return err == nil && has
}
// Destory deletes a session by session ID.
func (p *RedisProvider) Destory(sid string) error {
return p.c.Del(sid).Err()
}
// Regenerate regenerates a session store from old session ID to new one.
func (p *RedisProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error) {
if p.Exist(sid) {
return nil, fmt.Errorf("new sid '%s' already exists", sid)
} else if !p.Exist(oldsid) {
// Make a fake old session.
if err = p.c.SetEx(oldsid, p.duration, "").Err(); err != nil {
return nil, err
}
}
if err = p.c.Rename(oldsid, sid).Err(); err != nil {
return nil, err
}
var kv map[interface{}]interface{}
kvs, err := p.c.Get(sid).Result()
if err != nil {
return nil, err
}
if len(kvs) == 0 {
kv = make(map[interface{}]interface{})
} else {
kv, err = session.DecodeGob([]byte(kvs))
if err != nil {
return nil, err
}
}
return NewRedisStore(p.c, sid, p.duration, kv), nil
}
// Count counts and returns number of sessions.
func (p *RedisProvider) Count() int {
return int(p.c.DbSize().Val())
}
// GC calls GC to clean expired sessions.
func (_ *RedisProvider) GC() {}
func init() {
session.Register("redis", &RedisProvider{})
}
| ksx123/session | redis/redis.go | GO | apache-2.0 | 5,335 |
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v7.internal.view.menu;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.v4.internal.view.SupportMenuItem;
import android.support.v4.view.ActionProvider;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.view.CollapsibleActionView;
import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.FrameLayout;
import java.lang.reflect.Method;
/**
* @hide
*/
public class MenuItemWrapperICS extends BaseMenuWrapper<android.view.MenuItem> implements SupportMenuItem {
static final String LOG_TAG = "MenuItemWrapper";
private final boolean mEmulateProviderVisibilityOverride;
// Tracks the last requested visibility
private boolean mLastRequestVisible;
// Reflection Method to call setExclusiveCheckable
private Method mSetExclusiveCheckableMethod;
MenuItemWrapperICS(android.view.MenuItem object, boolean emulateProviderVisibilityOverride) {
super(object);
mLastRequestVisible = object.isVisible();
mEmulateProviderVisibilityOverride = emulateProviderVisibilityOverride;
}
MenuItemWrapperICS(android.view.MenuItem object) {
this(object, true);
}
@Override
public int getItemId() {
return mWrappedObject.getItemId();
}
@Override
public int getGroupId() {
return mWrappedObject.getGroupId();
}
@Override
public int getOrder() {
return mWrappedObject.getOrder();
}
@Override
public MenuItem setTitle(CharSequence title) {
mWrappedObject.setTitle(title);
return this;
}
@Override
public MenuItem setTitle(int title) {
mWrappedObject.setTitle(title);
return this;
}
@Override
public CharSequence getTitle() {
return mWrappedObject.getTitle();
}
@Override
public MenuItem setTitleCondensed(CharSequence title) {
mWrappedObject.setTitleCondensed(title);
return this;
}
@Override
public CharSequence getTitleCondensed() {
return mWrappedObject.getTitleCondensed();
}
@Override
public MenuItem setIcon(Drawable icon) {
mWrappedObject.setIcon(icon);
return this;
}
@Override
public MenuItem setIcon(int iconRes) {
mWrappedObject.setIcon(iconRes);
return this;
}
@Override
public Drawable getIcon() {
return mWrappedObject.getIcon();
}
@Override
public MenuItem setIntent(Intent intent) {
mWrappedObject.setIntent(intent);
return this;
}
@Override
public Intent getIntent() {
return mWrappedObject.getIntent();
}
@Override
public MenuItem setShortcut(char numericChar, char alphaChar) {
mWrappedObject.setShortcut(numericChar, alphaChar);
return this;
}
@Override
public MenuItem setNumericShortcut(char numericChar) {
mWrappedObject.setNumericShortcut(numericChar);
return this;
}
@Override
public char getNumericShortcut() {
return mWrappedObject.getNumericShortcut();
}
@Override
public MenuItem setAlphabeticShortcut(char alphaChar) {
mWrappedObject.setAlphabeticShortcut(alphaChar);
return this;
}
@Override
public char getAlphabeticShortcut() {
return mWrappedObject.getAlphabeticShortcut();
}
@Override
public MenuItem setCheckable(boolean checkable) {
mWrappedObject.setCheckable(checkable);
return this;
}
@Override
public boolean isCheckable() {
return mWrappedObject.isCheckable();
}
@Override
public MenuItem setChecked(boolean checked) {
mWrappedObject.setChecked(checked);
return this;
}
@Override
public boolean isChecked() {
return mWrappedObject.isChecked();
}
@Override
public MenuItem setVisible(boolean visible) {
if (mEmulateProviderVisibilityOverride) {
mLastRequestVisible = visible;
// If we need to be visible, we need to check whether the ActionProvider overrides it
if (checkActionProviderOverrideVisibility()) {
return this;
}
}
return wrappedSetVisible(visible);
}
@Override
public boolean isVisible() {
return mWrappedObject.isVisible();
}
@Override
public MenuItem setEnabled(boolean enabled) {
mWrappedObject.setEnabled(enabled);
return this;
}
@Override
public boolean isEnabled() {
return mWrappedObject.isEnabled();
}
@Override
public boolean hasSubMenu() {
return mWrappedObject.hasSubMenu();
}
@Override
public SubMenu getSubMenu() {
return getSubMenuWrapper(mWrappedObject.getSubMenu());
}
@Override
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) {
mWrappedObject.setOnMenuItemClickListener(menuItemClickListener != null ?
new OnMenuItemClickListenerWrapper(menuItemClickListener) : null);
return this;
}
@Override
public ContextMenu.ContextMenuInfo getMenuInfo() {
return mWrappedObject.getMenuInfo();
}
@Override
public void setShowAsAction(int actionEnum) {
mWrappedObject.setShowAsAction(actionEnum);
}
@Override
public MenuItem setShowAsActionFlags(int actionEnum) {
mWrappedObject.setShowAsActionFlags(actionEnum);
return this;
}
@Override
public MenuItem setActionView(View view) {
if (view instanceof CollapsibleActionView) {
view = new CollapsibleActionViewWrapper(view);
}
mWrappedObject.setActionView(view);
return this;
}
@Override
public MenuItem setActionView(int resId) {
// Make framework menu item inflate the view
mWrappedObject.setActionView(resId);
View actionView = mWrappedObject.getActionView();
if (actionView instanceof CollapsibleActionView) {
// If the inflated Action View is support-collapsible, wrap it
mWrappedObject.setActionView(new CollapsibleActionViewWrapper(actionView));
}
return this;
}
@Override
public View getActionView() {
View actionView = mWrappedObject.getActionView();
if (actionView instanceof CollapsibleActionViewWrapper) {
return ((CollapsibleActionViewWrapper) actionView).getWrappedView();
}
return actionView;
}
@Override
public MenuItem setActionProvider(android.view.ActionProvider provider) {
mWrappedObject.setActionProvider(provider);
if (provider != null && mEmulateProviderVisibilityOverride) {
checkActionProviderOverrideVisibility();
}
return this;
}
@Override
public android.view.ActionProvider getActionProvider() {
return mWrappedObject.getActionProvider();
}
@Override
public boolean expandActionView() {
return mWrappedObject.expandActionView();
}
@Override
public boolean collapseActionView() {
return mWrappedObject.collapseActionView();
}
@Override
public boolean isActionViewExpanded() {
return mWrappedObject.isActionViewExpanded();
}
@Override
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener listener) {
mWrappedObject.setOnActionExpandListener(listener);
return this;
}
@Override
public SupportMenuItem setSupportOnActionExpandListener(
MenuItemCompat.OnActionExpandListener listener) {
mWrappedObject.setOnActionExpandListener(listener != null ?
new OnActionExpandListenerWrapper(listener) : null);
return null;
}
@Override
public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
mWrappedObject.setActionProvider(actionProvider != null ?
createActionProviderWrapper(actionProvider) : null);
return this;
}
@Override
public ActionProvider getSupportActionProvider() {
ActionProviderWrapper providerWrapper =
(ActionProviderWrapper) mWrappedObject.getActionProvider();
return providerWrapper != null ? providerWrapper.mInner : null;
}
public void setExclusiveCheckable(boolean checkable) {
try {
if (mSetExclusiveCheckableMethod == null) {
mSetExclusiveCheckableMethod = mWrappedObject.getClass()
.getDeclaredMethod("setExclusiveCheckable", Boolean.TYPE);
}
mSetExclusiveCheckableMethod.invoke(mWrappedObject, checkable);
} catch (Exception e) {
Log.w(LOG_TAG, "Error while calling setExclusiveCheckable", e);
}
}
ActionProviderWrapper createActionProviderWrapper(ActionProvider provider) {
return new ActionProviderWrapper(provider);
}
/**
* @return true if the ActionProvider has overriden the visibility
*/
final boolean checkActionProviderOverrideVisibility() {
if (mLastRequestVisible) {
ActionProvider provider = getSupportActionProvider();
if (provider != null && provider.overridesItemVisibility() && !provider.isVisible()) {
wrappedSetVisible(false);
return true;
}
}
return false;
}
final MenuItem wrappedSetVisible(boolean visible) {
return mWrappedObject.setVisible(visible);
}
private class OnMenuItemClickListenerWrapper extends BaseWrapper<OnMenuItemClickListener>
implements android.view.MenuItem.OnMenuItemClickListener {
OnMenuItemClickListenerWrapper(OnMenuItemClickListener object) {
super(object);
}
@Override
public boolean onMenuItemClick(android.view.MenuItem item) {
return mWrappedObject.onMenuItemClick(getMenuItemWrapper(item));
}
}
private class OnActionExpandListenerWrapper extends BaseWrapper<MenuItemCompat.OnActionExpandListener>
implements android.view.MenuItem.OnActionExpandListener {
OnActionExpandListenerWrapper(MenuItemCompat.OnActionExpandListener object) {
super(object);
}
@Override
public boolean onMenuItemActionExpand(android.view.MenuItem item) {
return mWrappedObject.onMenuItemActionExpand(getMenuItemWrapper(item));
}
@Override
public boolean onMenuItemActionCollapse(android.view.MenuItem item) {
return mWrappedObject.onMenuItemActionCollapse(getMenuItemWrapper(item));
}
}
class ActionProviderWrapper extends android.view.ActionProvider {
final ActionProvider mInner;
public ActionProviderWrapper(ActionProvider inner) {
super(inner.getContext());
mInner = inner;
if (mEmulateProviderVisibilityOverride) {
mInner.setVisibilityListener(new ActionProvider.VisibilityListener() {
@Override
public void onActionProviderVisibilityChanged(boolean isVisible) {
if (mInner.overridesItemVisibility() && mLastRequestVisible) {
wrappedSetVisible(isVisible);
}
}
});
}
}
@Override
public View onCreateActionView() {
if (mEmulateProviderVisibilityOverride) {
// This is a convenient place to hook in and check if we need to override the
// visibility after being created.
checkActionProviderOverrideVisibility();
}
return mInner.onCreateActionView();
}
@Override
public boolean onPerformDefaultAction() {
return mInner.onPerformDefaultAction();
}
@Override
public boolean hasSubMenu() {
return mInner.hasSubMenu();
}
@Override
public void onPrepareSubMenu(android.view.SubMenu subMenu) {
mInner.onPrepareSubMenu(getSubMenuWrapper(subMenu));
}
}
static class CollapsibleActionViewWrapper extends FrameLayout
implements android.view.CollapsibleActionView {
final CollapsibleActionView mWrappedView;
CollapsibleActionViewWrapper(View actionView) {
super(actionView.getContext());
mWrappedView = (CollapsibleActionView) actionView;
addView(actionView);
}
@Override
public void onActionViewExpanded() {
mWrappedView.onActionViewExpanded();
}
@Override
public void onActionViewCollapsed() {
mWrappedView.onActionViewCollapsed();
}
View getWrappedView() {
return (View) mWrappedView;
}
}
}
| JSDemos/android-sdk-20 | src/android/support/v7/internal/view/menu/MenuItemWrapperICS.java | Java | apache-2.0 | 13,747 |
package costmanagementapi
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/azure-sdk-for-go/services/preview/costmanagement/mgmt/2019-10-01/costmanagement"
"github.com/Azure/go-autorest/autorest"
)
// DimensionsClientAPI contains the set of methods on the DimensionsClient type.
type DimensionsClientAPI interface {
ListByScope(ctx context.Context, scope string, filter string, expand string, skiptoken string, top *int32) (result costmanagement.DimensionsListResult, err error)
}
var _ DimensionsClientAPI = (*costmanagement.DimensionsClient)(nil)
// QueryClientAPI contains the set of methods on the QueryClient type.
type QueryClientAPI interface {
UsageByScope(ctx context.Context, scope string, parameters costmanagement.QueryDefinition) (result costmanagement.QueryResult, err error)
}
var _ QueryClientAPI = (*costmanagement.QueryClient)(nil)
// ExportsClientAPI contains the set of methods on the ExportsClient type.
type ExportsClientAPI interface {
CreateOrUpdate(ctx context.Context, scope string, exportName string, parameters costmanagement.Export) (result costmanagement.Export, err error)
Delete(ctx context.Context, scope string, exportName string) (result autorest.Response, err error)
Execute(ctx context.Context, scope string, exportName string) (result autorest.Response, err error)
Get(ctx context.Context, scope string, exportName string) (result costmanagement.Export, err error)
GetExecutionHistory(ctx context.Context, scope string, exportName string) (result costmanagement.ExportExecutionListResult, err error)
List(ctx context.Context, scope string) (result costmanagement.ExportListResult, err error)
}
var _ ExportsClientAPI = (*costmanagement.ExportsClient)(nil)
// OperationsClientAPI contains the set of methods on the OperationsClient type.
type OperationsClientAPI interface {
List(ctx context.Context) (result costmanagement.OperationListResultPage, err error)
}
var _ OperationsClientAPI = (*costmanagement.OperationsClient)(nil)
| pweil-/origin | vendor/github.com/Azure/azure-sdk-for-go/services/preview/costmanagement/mgmt/2019-10-01/costmanagement/costmanagementapi/interfaces.go | GO | apache-2.0 | 2,746 |
// mkerrors.sh -Wall -Werror -static -I/tmp/include
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build ppc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
package unix
import "syscall"
const (
AAFS_MAGIC = 0x5a3c69f0
ADFS_SUPER_MAGIC = 0xadf5
AFFS_SUPER_MAGIC = 0xadff
AFS_FS_MAGIC = 0x6b414653
AFS_SUPER_MAGIC = 0x5346414f
AF_ALG = 0x26
AF_APPLETALK = 0x5
AF_ASH = 0x12
AF_ATMPVC = 0x8
AF_ATMSVC = 0x14
AF_AX25 = 0x3
AF_BLUETOOTH = 0x1f
AF_BRIDGE = 0x7
AF_CAIF = 0x25
AF_CAN = 0x1d
AF_DECnet = 0xc
AF_ECONET = 0x13
AF_FILE = 0x1
AF_IB = 0x1b
AF_IEEE802154 = 0x24
AF_INET = 0x2
AF_INET6 = 0xa
AF_IPX = 0x4
AF_IRDA = 0x17
AF_ISDN = 0x22
AF_IUCV = 0x20
AF_KCM = 0x29
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
AF_NETROM = 0x6
AF_NFC = 0x27
AF_PACKET = 0x11
AF_PHONET = 0x23
AF_PPPOX = 0x18
AF_QIPCRTR = 0x2a
AF_RDS = 0x15
AF_ROSE = 0xb
AF_ROUTE = 0x10
AF_RXRPC = 0x21
AF_SECURITY = 0xe
AF_SMC = 0x2b
AF_SNA = 0x16
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0x0
AF_VSOCK = 0x28
AF_WANPIPE = 0x19
AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ANON_INODE_FS_MAGIC = 0x9041934
ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7
ARPHRD_ASH = 0x30d
ARPHRD_ATM = 0x13
ARPHRD_AX25 = 0x3
ARPHRD_BIF = 0x307
ARPHRD_CAIF = 0x336
ARPHRD_CAN = 0x118
ARPHRD_CHAOS = 0x5
ARPHRD_CISCO = 0x201
ARPHRD_CSLIP = 0x101
ARPHRD_CSLIP6 = 0x103
ARPHRD_DDCMP = 0x205
ARPHRD_DLCI = 0xf
ARPHRD_ECONET = 0x30e
ARPHRD_EETHER = 0x2
ARPHRD_ETHER = 0x1
ARPHRD_EUI64 = 0x1b
ARPHRD_FCAL = 0x311
ARPHRD_FCFABRIC = 0x313
ARPHRD_FCPL = 0x312
ARPHRD_FCPP = 0x310
ARPHRD_FDDI = 0x306
ARPHRD_FRAD = 0x302
ARPHRD_HDLC = 0x201
ARPHRD_HIPPI = 0x30c
ARPHRD_HWX25 = 0x110
ARPHRD_IEEE1394 = 0x18
ARPHRD_IEEE802 = 0x6
ARPHRD_IEEE80211 = 0x321
ARPHRD_IEEE80211_PRISM = 0x322
ARPHRD_IEEE80211_RADIOTAP = 0x323
ARPHRD_IEEE802154 = 0x324
ARPHRD_IEEE802154_MONITOR = 0x325
ARPHRD_IEEE802_TR = 0x320
ARPHRD_INFINIBAND = 0x20
ARPHRD_IP6GRE = 0x337
ARPHRD_IPDDP = 0x309
ARPHRD_IPGRE = 0x30a
ARPHRD_IRDA = 0x30f
ARPHRD_LAPB = 0x204
ARPHRD_LOCALTLK = 0x305
ARPHRD_LOOPBACK = 0x304
ARPHRD_METRICOM = 0x17
ARPHRD_NETLINK = 0x338
ARPHRD_NETROM = 0x0
ARPHRD_NONE = 0xfffe
ARPHRD_PHONET = 0x334
ARPHRD_PHONET_PIPE = 0x335
ARPHRD_PIMREG = 0x30b
ARPHRD_PPP = 0x200
ARPHRD_PRONET = 0x4
ARPHRD_RAWHDLC = 0x206
ARPHRD_RAWIP = 0x207
ARPHRD_ROSE = 0x10e
ARPHRD_RSRVD = 0x104
ARPHRD_SIT = 0x308
ARPHRD_SKIP = 0x303
ARPHRD_SLIP = 0x100
ARPHRD_SLIP6 = 0x102
ARPHRD_TUNNEL = 0x300
ARPHRD_TUNNEL6 = 0x301
ARPHRD_VOID = 0xffff
ARPHRD_VSOCKMON = 0x33a
ARPHRD_X25 = 0x10f
AUTOFS_SUPER_MAGIC = 0x187
B0 = 0x0
B1000000 = 0x17
B110 = 0x3
B115200 = 0x11
B1152000 = 0x18
B1200 = 0x9
B134 = 0x4
B150 = 0x5
B1500000 = 0x19
B1800 = 0xa
B19200 = 0xe
B200 = 0x6
B2000000 = 0x1a
B230400 = 0x12
B2400 = 0xb
B2500000 = 0x1b
B300 = 0x7
B3000000 = 0x1c
B3500000 = 0x1d
B38400 = 0xf
B4000000 = 0x1e
B460800 = 0x13
B4800 = 0xc
B50 = 0x1
B500000 = 0x14
B57600 = 0x10
B576000 = 0x15
B600 = 0x8
B75 = 0x2
B921600 = 0x16
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40081270
BLKBSZSET = 0x80081271
BLKFLSBUF = 0x20001261
BLKFRAGET = 0x20001265
BLKFRASET = 0x20001264
BLKGETSIZE = 0x20001260
BLKGETSIZE64 = 0x40081272
BLKPBSZGET = 0x2000127b
BLKRAGET = 0x20001263
BLKRASET = 0x20001262
BLKROGET = 0x2000125e
BLKROSET = 0x2000125d
BLKRRPART = 0x2000125f
BLKSECTGET = 0x20001267
BLKSECTSET = 0x20001266
BLKSSZGET = 0x20001268
BOTHER = 0x1f
BPF_A = 0x10
BPF_ABS = 0x20
BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4
BPF_ALU64 = 0x7
BPF_AND = 0x50
BPF_ANY = 0x0
BPF_ARSH = 0xc0
BPF_B = 0x10
BPF_BUILD_ID_SIZE = 0x14
BPF_CALL = 0x80
BPF_DEVCG_ACC_MKNOD = 0x1
BPF_DEVCG_ACC_READ = 0x2
BPF_DEVCG_ACC_WRITE = 0x4
BPF_DEVCG_DEV_BLOCK = 0x1
BPF_DEVCG_DEV_CHAR = 0x2
BPF_DIV = 0x30
BPF_DW = 0x18
BPF_END = 0xd0
BPF_EXIST = 0x2
BPF_EXIT = 0x90
BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1
BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4
BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2
BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2
BPF_F_CLONE = 0x200
BPF_F_CTXLEN_MASK = 0xfffff00000000
BPF_F_CURRENT_CPU = 0xffffffff
BPF_F_CURRENT_NETNS = -0x1
BPF_F_DONT_FRAGMENT = 0x4
BPF_F_FAST_STACK_CMP = 0x200
BPF_F_HDR_FIELD_MASK = 0xf
BPF_F_INDEX_MASK = 0xffffffff
BPF_F_INGRESS = 0x1
BPF_F_INVALIDATE_HASH = 0x2
BPF_F_LOCK = 0x4
BPF_F_MARK_ENFORCE = 0x40
BPF_F_MARK_MANGLED_0 = 0x20
BPF_F_MMAPABLE = 0x400
BPF_F_NO_COMMON_LRU = 0x2
BPF_F_NO_PREALLOC = 0x1
BPF_F_NUMA_NODE = 0x4
BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TEST_RND_HI32 = 0x4
BPF_F_TEST_STATE_FREQ = 0x8
BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
BPF_JA = 0x0
BPF_JEQ = 0x10
BPF_JGE = 0x30
BPF_JGT = 0x20
BPF_JLE = 0xb0
BPF_JLT = 0xa0
BPF_JMP = 0x5
BPF_JMP32 = 0x6
BPF_JNE = 0x50
BPF_JSET = 0x40
BPF_JSGE = 0x70
BPF_JSGT = 0x60
BPF_JSLE = 0xd0
BPF_JSLT = 0xc0
BPF_K = 0x0
BPF_LD = 0x0
BPF_LDX = 0x1
BPF_LEN = 0x80
BPF_LL_OFF = -0x200000
BPF_LSH = 0x60
BPF_MAJOR_VERSION = 0x1
BPF_MAXINSNS = 0x1000
BPF_MEM = 0x60
BPF_MEMWORDS = 0x10
BPF_MINOR_VERSION = 0x1
BPF_MISC = 0x7
BPF_MOD = 0x90
BPF_MOV = 0xb0
BPF_MSH = 0xa0
BPF_MUL = 0x20
BPF_NEG = 0x80
BPF_NET_OFF = -0x100000
BPF_NOEXIST = 0x1
BPF_OBJ_NAME_LEN = 0x10
BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6
BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0xf
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
BPF_SOCK_OPS_RTT_CB_FLAG = 0x8
BPF_SOCK_OPS_STATE_CB_FLAG = 0x4
BPF_ST = 0x2
BPF_STX = 0x3
BPF_SUB = 0x10
BPF_TAG_SIZE = 0x8
BPF_TAX = 0x0
BPF_TO_BE = 0x8
BPF_TO_LE = 0x0
BPF_TXA = 0x80
BPF_W = 0x0
BPF_X = 0x8
BPF_XADD = 0xc0
BPF_XOR = 0xa0
BRKINT = 0x2
BS0 = 0x0
BS1 = 0x8000
BSDLY = 0x8000
BTRFS_SUPER_MAGIC = 0x9123683e
BTRFS_TEST_MAGIC = 0x73727279
CAN_BCM = 0x2
CAN_EFF_FLAG = 0x80000000
CAN_EFF_ID_BITS = 0x1d
CAN_EFF_MASK = 0x1fffffff
CAN_ERR_FLAG = 0x20000000
CAN_ERR_MASK = 0x1fffffff
CAN_INV_FILTER = 0x20000000
CAN_ISOTP = 0x6
CAN_J1939 = 0x7
CAN_MAX_DLC = 0x8
CAN_MAX_DLEN = 0x8
CAN_MCNET = 0x5
CAN_MTU = 0x10
CAN_NPROTO = 0x8
CAN_RAW = 0x1
CAN_RAW_FILTER_MAX = 0x200
CAN_RTR_FLAG = 0x40000000
CAN_SFF_ID_BITS = 0xb
CAN_SFF_MASK = 0x7ff
CAN_TP16 = 0x3
CAN_TP20 = 0x4
CAP_AUDIT_CONTROL = 0x1e
CAP_AUDIT_READ = 0x25
CAP_AUDIT_WRITE = 0x1d
CAP_BLOCK_SUSPEND = 0x24
CAP_CHOWN = 0x0
CAP_DAC_OVERRIDE = 0x1
CAP_DAC_READ_SEARCH = 0x2
CAP_FOWNER = 0x3
CAP_FSETID = 0x4
CAP_IPC_LOCK = 0xe
CAP_IPC_OWNER = 0xf
CAP_KILL = 0x5
CAP_LAST_CAP = 0x25
CAP_LEASE = 0x1c
CAP_LINUX_IMMUTABLE = 0x9
CAP_MAC_ADMIN = 0x21
CAP_MAC_OVERRIDE = 0x20
CAP_MKNOD = 0x1b
CAP_NET_ADMIN = 0xc
CAP_NET_BIND_SERVICE = 0xa
CAP_NET_BROADCAST = 0xb
CAP_NET_RAW = 0xd
CAP_SETFCAP = 0x1f
CAP_SETGID = 0x6
CAP_SETPCAP = 0x8
CAP_SETUID = 0x7
CAP_SYSLOG = 0x22
CAP_SYS_ADMIN = 0x15
CAP_SYS_BOOT = 0x16
CAP_SYS_CHROOT = 0x12
CAP_SYS_MODULE = 0x10
CAP_SYS_NICE = 0x17
CAP_SYS_PACCT = 0x14
CAP_SYS_PTRACE = 0x13
CAP_SYS_RAWIO = 0x11
CAP_SYS_RESOURCE = 0x18
CAP_SYS_TIME = 0x19
CAP_SYS_TTY_CONFIG = 0x1a
CAP_WAKE_ALARM = 0x23
CBAUD = 0xff
CBAUDEX = 0x0
CFLUSH = 0xf
CGROUP2_SUPER_MAGIC = 0x63677270
CGROUP_SUPER_MAGIC = 0x27e0eb
CIBAUD = 0xff0000
CLOCAL = 0x8000
CLOCK_BOOTTIME = 0x7
CLOCK_BOOTTIME_ALARM = 0x9
CLOCK_DEFAULT = 0x0
CLOCK_EXT = 0x1
CLOCK_INT = 0x2
CLOCK_MONOTONIC = 0x1
CLOCK_MONOTONIC_COARSE = 0x6
CLOCK_MONOTONIC_RAW = 0x4
CLOCK_PROCESS_CPUTIME_ID = 0x2
CLOCK_REALTIME = 0x0
CLOCK_REALTIME_ALARM = 0x8
CLOCK_REALTIME_COARSE = 0x5
CLOCK_TAI = 0xb
CLOCK_THREAD_CPUTIME_ID = 0x3
CLOCK_TXFROMRX = 0x4
CLOCK_TXINT = 0x3
CLONE_ARGS_SIZE_VER0 = 0x40
CLONE_ARGS_SIZE_VER1 = 0x50
CLONE_CHILD_CLEARTID = 0x200000
CLONE_CHILD_SETTID = 0x1000000
CLONE_CLEAR_SIGHAND = 0x100000000
CLONE_DETACHED = 0x400000
CLONE_FILES = 0x400
CLONE_FS = 0x200
CLONE_IO = 0x80000000
CLONE_NEWCGROUP = 0x2000000
CLONE_NEWIPC = 0x8000000
CLONE_NEWNET = 0x40000000
CLONE_NEWNS = 0x20000
CLONE_NEWPID = 0x20000000
CLONE_NEWUSER = 0x10000000
CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800
CLONE_SYSVSEM = 0x40000
CLONE_THREAD = 0x10000
CLONE_UNTRACED = 0x800000
CLONE_VFORK = 0x4000
CLONE_VM = 0x100
CMSPAR = 0x40000000
CODA_SUPER_MAGIC = 0x73757245
CR0 = 0x0
CR1 = 0x1000
CR2 = 0x2000
CR3 = 0x3000
CRAMFS_MAGIC = 0x28cd3d45
CRDLY = 0x3000
CREAD = 0x800
CRTSCTS = 0x80000000
CRYPTO_MAX_NAME = 0x40
CRYPTO_MSG_MAX = 0x15
CRYPTO_NR_MSGTYPES = 0x6
CRYPTO_REPORT_MAXSIZE = 0x160
CS5 = 0x0
CS6 = 0x100
CS7 = 0x200
CS8 = 0x300
CSIGNAL = 0xff
CSIZE = 0x300
CSTART = 0x11
CSTATUS = 0x0
CSTOP = 0x13
CSTOPB = 0x400
CSUSP = 0x1a
DAXFS_MAGIC = 0x64646178
DEBUGFS_MAGIC = 0x64626720
DEVLINK_CMD_ESWITCH_MODE_GET = 0x1d
DEVLINK_CMD_ESWITCH_MODE_SET = 0x1e
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
DEVLINK_GENL_NAME = "devlink"
DEVLINK_GENL_VERSION = 0x1
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
DEVPTS_SUPER_MAGIC = 0x1cd1
DMA_BUF_MAGIC = 0x444d4142
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
DT_FIFO = 0x1
DT_LNK = 0xa
DT_REG = 0x8
DT_SOCK = 0xc
DT_UNKNOWN = 0x0
DT_WHT = 0xe
ECHO = 0x8
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
ECHOKE = 0x1
ECHONL = 0x10
ECHOPRT = 0x20
ECRYPTFS_SUPER_MAGIC = 0xf15f
EFD_CLOEXEC = 0x80000
EFD_NONBLOCK = 0x800
EFD_SEMAPHORE = 0x1
EFIVARFS_MAGIC = 0xde5e81e4
EFS_SUPER_MAGIC = 0x414a53
ENCODING_DEFAULT = 0x0
ENCODING_FM_MARK = 0x3
ENCODING_FM_SPACE = 0x4
ENCODING_MANCHESTER = 0x5
ENCODING_NRZ = 0x1
ENCODING_NRZI = 0x2
EPOLLERR = 0x8
EPOLLET = 0x80000000
EPOLLEXCLUSIVE = 0x10000000
EPOLLHUP = 0x10
EPOLLIN = 0x1
EPOLLMSG = 0x400
EPOLLONESHOT = 0x40000000
EPOLLOUT = 0x4
EPOLLPRI = 0x2
EPOLLRDBAND = 0x80
EPOLLRDHUP = 0x2000
EPOLLRDNORM = 0x40
EPOLLWAKEUP = 0x20000000
EPOLLWRBAND = 0x200
EPOLLWRNORM = 0x100
EPOLL_CLOEXEC = 0x80000
EPOLL_CTL_ADD = 0x1
EPOLL_CTL_DEL = 0x2
EPOLL_CTL_MOD = 0x3
EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2
ETH_P_1588 = 0x88f7
ETH_P_8021AD = 0x88a8
ETH_P_8021AH = 0x88e7
ETH_P_8021Q = 0x8100
ETH_P_80221 = 0x8917
ETH_P_802_2 = 0x4
ETH_P_802_3 = 0x1
ETH_P_802_3_MIN = 0x600
ETH_P_802_EX1 = 0x88b5
ETH_P_AARP = 0x80f3
ETH_P_AF_IUCV = 0xfbfb
ETH_P_ALL = 0x3
ETH_P_AOE = 0x88a2
ETH_P_ARCNET = 0x1a
ETH_P_ARP = 0x806
ETH_P_ATALK = 0x809b
ETH_P_ATMFATE = 0x8884
ETH_P_ATMMPOA = 0x884c
ETH_P_AX25 = 0x2
ETH_P_BATMAN = 0x4305
ETH_P_BPQ = 0x8ff
ETH_P_CAIF = 0xf7
ETH_P_CAN = 0xc
ETH_P_CANFD = 0xd
ETH_P_CONTROL = 0x16
ETH_P_CUST = 0x6006
ETH_P_DDCMP = 0x6
ETH_P_DEC = 0x6000
ETH_P_DIAG = 0x6005
ETH_P_DNA_DL = 0x6001
ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be
ETH_P_ERSPAN2 = 0x22eb
ETH_P_FCOE = 0x8906
ETH_P_FIP = 0x8914
ETH_P_HDLC = 0x19
ETH_P_HSR = 0x892f
ETH_P_IBOE = 0x8915
ETH_P_IEEE802154 = 0xf6
ETH_P_IEEEPUP = 0xa00
ETH_P_IEEEPUPAT = 0xa01
ETH_P_IFE = 0xed3e
ETH_P_IP = 0x800
ETH_P_IPV6 = 0x86dd
ETH_P_IPX = 0x8137
ETH_P_IRDA = 0x17
ETH_P_LAT = 0x6004
ETH_P_LINK_CTL = 0x886c
ETH_P_LLDP = 0x88cc
ETH_P_LOCALTALK = 0x9
ETH_P_LOOP = 0x60
ETH_P_LOOPBACK = 0x9000
ETH_P_MACSEC = 0x88e5
ETH_P_MAP = 0xf9
ETH_P_MOBITEX = 0x15
ETH_P_MPLS_MC = 0x8848
ETH_P_MPLS_UC = 0x8847
ETH_P_MVRP = 0x88f5
ETH_P_NCSI = 0x88f8
ETH_P_NSH = 0x894f
ETH_P_PAE = 0x888e
ETH_P_PAUSE = 0x8808
ETH_P_PHONET = 0xf5
ETH_P_PPPTALK = 0x10
ETH_P_PPP_DISC = 0x8863
ETH_P_PPP_MP = 0x8
ETH_P_PPP_SES = 0x8864
ETH_P_PREAUTH = 0x88c7
ETH_P_PRP = 0x88fb
ETH_P_PUP = 0x200
ETH_P_PUPAT = 0x201
ETH_P_QINQ1 = 0x9100
ETH_P_QINQ2 = 0x9200
ETH_P_QINQ3 = 0x9300
ETH_P_RARP = 0x8035
ETH_P_SCA = 0x6007
ETH_P_SLOW = 0x8809
ETH_P_SNAP = 0x5
ETH_P_TDLS = 0x890d
ETH_P_TEB = 0x6558
ETH_P_TIPC = 0x88ca
ETH_P_TRAILER = 0x1c
ETH_P_TR_802_2 = 0x11
ETH_P_TSN = 0x22f0
ETH_P_WAN_PPP = 0x7
ETH_P_WCCP = 0x883e
ETH_P_X25 = 0x805
ETH_P_XDSA = 0xf8
EXABYTE_ENABLE_NEST = 0xf0
EXT2_SUPER_MAGIC = 0xef53
EXT3_SUPER_MAGIC = 0xef53
EXT4_SUPER_MAGIC = 0xef53
EXTA = 0xe
EXTB = 0xf
EXTPROC = 0x10000000
F2FS_SUPER_MAGIC = 0xf2f52010
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_ATTRIB = 0x4
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_CREATE = 0x100
FAN_DELETE = 0x200
FAN_DELETE_SELF = 0x400
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_INFO_TYPE_FID = 0x1
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_MOVE = 0xc0
FAN_MOVED_FROM = 0x40
FAN_MOVED_TO = 0x80
FAN_MOVE_SELF = 0x800
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_FID = 0x200
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x4000
FFDLY = 0x4000
FLUSHO = 0x800000
FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8
FSCRYPT_KEY_DESC_PREFIX = "fscrypt:"
FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8
FSCRYPT_KEY_IDENTIFIER_SIZE = 0x10
FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY = 0x1
FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS = 0x2
FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR = 0x1
FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER = 0x2
FSCRYPT_KEY_STATUS_ABSENT = 0x1
FSCRYPT_KEY_STATUS_FLAG_ADDED_BY_SELF = 0x1
FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED = 0x3
FSCRYPT_KEY_STATUS_PRESENT = 0x2
FSCRYPT_MAX_KEY_SIZE = 0x40
FSCRYPT_MODE_ADIANTUM = 0x9
FSCRYPT_MODE_AES_128_CBC = 0x5
FSCRYPT_MODE_AES_128_CTS = 0x6
FSCRYPT_MODE_AES_256_CTS = 0x4
FSCRYPT_MODE_AES_256_XTS = 0x1
FSCRYPT_POLICY_FLAGS_PAD_16 = 0x2
FSCRYPT_POLICY_FLAGS_PAD_32 = 0x3
FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0
FSCRYPT_POLICY_FLAGS_PAD_8 = 0x1
FSCRYPT_POLICY_FLAGS_PAD_MASK = 0x3
FSCRYPT_POLICY_FLAGS_VALID = 0xf
FSCRYPT_POLICY_FLAG_DIRECT_KEY = 0x4
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 = 0x8
FSCRYPT_POLICY_V1 = 0x0
FSCRYPT_POLICY_V2 = 0x2
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
FS_ENCRYPTION_MODE_AES_256_CTS = 0x4
FS_ENCRYPTION_MODE_AES_256_GCM = 0x2
FS_ENCRYPTION_MODE_AES_256_XTS = 0x1
FS_ENCRYPTION_MODE_INVALID = 0x0
FS_ENCRYPTION_MODE_SPECK128_256_CTS = 0x8
FS_ENCRYPTION_MODE_SPECK128_256_XTS = 0x7
FS_IOC_ADD_ENCRYPTION_KEY = 0xc0506617
FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a
FS_IOC_GET_ENCRYPTION_POLICY = 0x800c6615
FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616
FS_IOC_GET_ENCRYPTION_PWSALT = 0x80106614
FS_IOC_REMOVE_ENCRYPTION_KEY = 0xc0406618
FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS = 0xc0406619
FS_IOC_SET_ENCRYPTION_POLICY = 0x400c6613
FS_KEY_DESCRIPTOR_SIZE = 0x8
FS_KEY_DESC_PREFIX = "fscrypt:"
FS_KEY_DESC_PREFIX_SIZE = 0x8
FS_MAX_KEY_SIZE = 0x40
FS_POLICY_FLAGS_PAD_16 = 0x2
FS_POLICY_FLAGS_PAD_32 = 0x3
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0xf
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
F_DUPFD_CLOEXEC = 0x406
F_EXLCK = 0x4
F_GETFD = 0x1
F_GETFL = 0x3
F_GETLEASE = 0x401
F_GETLK = 0x5
F_GETLK64 = 0xc
F_GETOWN = 0x9
F_GETOWN_EX = 0x10
F_GETPIPE_SZ = 0x408
F_GETSIG = 0xb
F_GET_FILE_RW_HINT = 0x40d
F_GET_RW_HINT = 0x40b
F_GET_SEALS = 0x40a
F_LOCK = 0x1
F_NOTIFY = 0x402
F_OFD_GETLK = 0x24
F_OFD_SETLK = 0x25
F_OFD_SETLKW = 0x26
F_OK = 0x0
F_RDLCK = 0x0
F_SEAL_FUTURE_WRITE = 0x10
F_SEAL_GROW = 0x4
F_SEAL_SEAL = 0x1
F_SEAL_SHRINK = 0x2
F_SEAL_WRITE = 0x8
F_SETFD = 0x2
F_SETFL = 0x4
F_SETLEASE = 0x400
F_SETLK = 0x6
F_SETLK64 = 0xd
F_SETLKW = 0x7
F_SETLKW64 = 0xe
F_SETOWN = 0x8
F_SETOWN_EX = 0xf
F_SETPIPE_SZ = 0x407
F_SETSIG = 0xa
F_SET_FILE_RW_HINT = 0x40e
F_SET_RW_HINT = 0x40c
F_SHLCK = 0x8
F_TEST = 0x3
F_TLOCK = 0x2
F_ULOCK = 0x0
F_UNLCK = 0x2
F_WRLCK = 0x1
GENL_ADMIN_PERM = 0x1
GENL_CMD_CAP_DO = 0x2
GENL_CMD_CAP_DUMP = 0x4
GENL_CMD_CAP_HASPOL = 0x8
GENL_HDRLEN = 0x4
GENL_ID_CTRL = 0x10
GENL_ID_PMCRAID = 0x12
GENL_ID_VFS_DQUOT = 0x11
GENL_MAX_ID = 0x3ff
GENL_MIN_ID = 0x10
GENL_NAMSIZ = 0x10
GENL_START_ALLOC = 0x13
GENL_UNS_ADMIN_PERM = 0x10
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HDIO_DRIVE_CMD = 0x31f
HDIO_DRIVE_CMD_AEB = 0x31e
HDIO_DRIVE_CMD_HDR_SIZE = 0x4
HDIO_DRIVE_HOB_HDR_SIZE = 0x8
HDIO_DRIVE_RESET = 0x31c
HDIO_DRIVE_TASK = 0x31e
HDIO_DRIVE_TASKFILE = 0x31d
HDIO_DRIVE_TASK_HDR_SIZE = 0x8
HDIO_GETGEO = 0x301
HDIO_GET_32BIT = 0x309
HDIO_GET_ACOUSTIC = 0x30f
HDIO_GET_ADDRESS = 0x310
HDIO_GET_BUSSTATE = 0x31a
HDIO_GET_DMA = 0x30b
HDIO_GET_IDENTITY = 0x30d
HDIO_GET_KEEPSETTINGS = 0x308
HDIO_GET_MULTCOUNT = 0x304
HDIO_GET_NICE = 0x30c
HDIO_GET_NOWERR = 0x30a
HDIO_GET_QDMA = 0x305
HDIO_GET_UNMASKINTR = 0x302
HDIO_GET_WCACHE = 0x30e
HDIO_OBSOLETE_IDENTITY = 0x307
HDIO_SCAN_HWIF = 0x328
HDIO_SET_32BIT = 0x324
HDIO_SET_ACOUSTIC = 0x32c
HDIO_SET_ADDRESS = 0x32f
HDIO_SET_BUSSTATE = 0x32d
HDIO_SET_DMA = 0x326
HDIO_SET_KEEPSETTINGS = 0x323
HDIO_SET_MULTCOUNT = 0x321
HDIO_SET_NICE = 0x329
HDIO_SET_NOWERR = 0x325
HDIO_SET_PIO_MODE = 0x327
HDIO_SET_QDMA = 0x32e
HDIO_SET_UNMASKINTR = 0x322
HDIO_SET_WCACHE = 0x32b
HDIO_SET_XFER = 0x306
HDIO_TRISTATE_HWIF = 0x31b
HDIO_UNREGISTER_HWIF = 0x32a
HOSTFS_SUPER_MAGIC = 0xc0ffee
HPFS_SUPER_MAGIC = 0xf995e849
HUGETLBFS_MAGIC = 0x958458f6
HUPCL = 0x4000
IBSHIFT = 0x10
ICANON = 0x100
ICMPV6_FILTER = 0x1
ICRNL = 0x100
IEXTEN = 0x400
IFA_F_DADFAILED = 0x8
IFA_F_DEPRECATED = 0x20
IFA_F_HOMEADDRESS = 0x10
IFA_F_MANAGETEMPADDR = 0x100
IFA_F_MCAUTOJOIN = 0x400
IFA_F_NODAD = 0x2
IFA_F_NOPREFIXROUTE = 0x200
IFA_F_OPTIMISTIC = 0x4
IFA_F_PERMANENT = 0x80
IFA_F_SECONDARY = 0x1
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
IFF_BROADCAST = 0x2
IFF_DEBUG = 0x4
IFF_DETACH_QUEUE = 0x400
IFF_DORMANT = 0x20000
IFF_DYNAMIC = 0x8000
IFF_ECHO = 0x40000
IFF_LOOPBACK = 0x8
IFF_LOWER_UP = 0x10000
IFF_MASTER = 0x400
IFF_MULTICAST = 0x1000
IFF_MULTI_QUEUE = 0x100
IFF_NAPI = 0x10
IFF_NAPI_FRAGS = 0x20
IFF_NOARP = 0x80
IFF_NOFILTER = 0x1000
IFF_NOTRAILERS = 0x20
IFF_NO_PI = 0x1000
IFF_ONE_QUEUE = 0x2000
IFF_PERSIST = 0x800
IFF_POINTOPOINT = 0x10
IFF_PORTSEL = 0x2000
IFF_PROMISC = 0x100
IFF_RUNNING = 0x40
IFF_SLAVE = 0x800
IFF_TAP = 0x2
IFF_TUN = 0x1
IFF_TUN_EXCL = 0x8000
IFF_UP = 0x1
IFF_VNET_HDR = 0x4000
IFF_VOLATILE = 0x70c5a
IFNAMSIZ = 0x10
IGNBRK = 0x1
IGNCR = 0x80
IGNPAR = 0x4
IMAXBEL = 0x2000
INLCR = 0x40
INPCK = 0x10
IN_ACCESS = 0x1
IN_ALL_EVENTS = 0xfff
IN_ATTRIB = 0x4
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 0x18
IN_CLASSB_HOST = 0xffff
IN_CLASSB_MAX = 0x10000
IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 0x10
IN_CLASSC_HOST = 0xff
IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 0x8
IN_CLOEXEC = 0x80000
IN_CLOSE = 0x18
IN_CLOSE_NOWRITE = 0x10
IN_CLOSE_WRITE = 0x8
IN_CREATE = 0x100
IN_DELETE = 0x200
IN_DELETE_SELF = 0x400
IN_DONT_FOLLOW = 0x2000000
IN_EXCL_UNLINK = 0x4000000
IN_IGNORED = 0x8000
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
IN_MOVED_TO = 0x80
IN_MOVE_SELF = 0x800
IN_NONBLOCK = 0x800
IN_ONESHOT = 0x80000000
IN_ONLYDIR = 0x1000000
IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c
IPPROTO_DCCP = 0x21
IPPROTO_DSTOPTS = 0x3c
IPPROTO_EGP = 0x8
IPPROTO_ENCAP = 0x62
IPPROTO_ESP = 0x32
IPPROTO_FRAGMENT = 0x2c
IPPROTO_GRE = 0x2f
IPPROTO_HOPOPTS = 0x0
IPPROTO_ICMP = 0x1
IPPROTO_ICMPV6 = 0x3a
IPPROTO_IDP = 0x16
IPPROTO_IGMP = 0x2
IPPROTO_IP = 0x0
IPPROTO_IPIP = 0x4
IPPROTO_IPV6 = 0x29
IPPROTO_MH = 0x87
IPPROTO_MPLS = 0x89
IPPROTO_MTP = 0x5c
IPPROTO_NONE = 0x3b
IPPROTO_PIM = 0x67
IPPROTO_PUP = 0xc
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPPROTO_UDPLITE = 0x88
IPV6_2292DSTOPTS = 0x4
IPV6_2292HOPLIMIT = 0x8
IPV6_2292HOPOPTS = 0x3
IPV6_2292PKTINFO = 0x2
IPV6_2292PKTOPTIONS = 0x6
IPV6_2292RTHDR = 0x5
IPV6_ADDRFORM = 0x1
IPV6_ADDR_PREFERENCES = 0x48
IPV6_ADD_MEMBERSHIP = 0x14
IPV6_AUTHHDR = 0xa
IPV6_AUTOFLOWLABEL = 0x46
IPV6_CHECKSUM = 0x7
IPV6_DONTFRAG = 0x3e
IPV6_DROP_MEMBERSHIP = 0x15
IPV6_DSTOPTS = 0x3b
IPV6_FREEBIND = 0x4e
IPV6_HDRINCL = 0x24
IPV6_HOPLIMIT = 0x34
IPV6_HOPOPTS = 0x36
IPV6_IPSEC_POLICY = 0x22
IPV6_JOIN_ANYCAST = 0x1b
IPV6_JOIN_GROUP = 0x14
IPV6_LEAVE_ANYCAST = 0x1c
IPV6_LEAVE_GROUP = 0x15
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
IPV6_NEXTHOP = 0x9
IPV6_ORIGDSTADDR = 0x4a
IPV6_PATHMTU = 0x3d
IPV6_PKTINFO = 0x32
IPV6_PMTUDISC_DO = 0x2
IPV6_PMTUDISC_DONT = 0x0
IPV6_PMTUDISC_INTERFACE = 0x4
IPV6_PMTUDISC_OMIT = 0x5
IPV6_PMTUDISC_PROBE = 0x3
IPV6_PMTUDISC_WANT = 0x1
IPV6_RECVDSTOPTS = 0x3a
IPV6_RECVERR = 0x19
IPV6_RECVFRAGSIZE = 0x4d
IPV6_RECVHOPLIMIT = 0x33
IPV6_RECVHOPOPTS = 0x35
IPV6_RECVORIGDSTADDR = 0x4a
IPV6_RECVPATHMTU = 0x3c
IPV6_RECVPKTINFO = 0x31
IPV6_RECVRTHDR = 0x38
IPV6_RECVTCLASS = 0x42
IPV6_ROUTER_ALERT = 0x16
IPV6_ROUTER_ALERT_ISOLATE = 0x1e
IPV6_RTHDR = 0x39
IPV6_RTHDRDSTOPTS = 0x37
IPV6_RTHDR_LOOSE = 0x0
IPV6_RTHDR_STRICT = 0x1
IPV6_RTHDR_TYPE_0 = 0x0
IPV6_RXDSTOPTS = 0x3b
IPV6_RXHOPOPTS = 0x36
IPV6_TCLASS = 0x43
IPV6_TRANSPARENT = 0x4b
IPV6_UNICAST_HOPS = 0x10
IPV6_UNICAST_IF = 0x4c
IPV6_V6ONLY = 0x1a
IPV6_XFRM_POLICY = 0x23
IP_ADD_MEMBERSHIP = 0x23
IP_ADD_SOURCE_MEMBERSHIP = 0x27
IP_BIND_ADDRESS_NO_PORT = 0x18
IP_BLOCK_SOURCE = 0x26
IP_CHECKSUM = 0x17
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
IP_DROP_MEMBERSHIP = 0x24
IP_DROP_SOURCE_MEMBERSHIP = 0x28
IP_FREEBIND = 0xf
IP_HDRINCL = 0x3
IP_IPSEC_POLICY = 0x10
IP_MAXPACKET = 0xffff
IP_MAX_MEMBERSHIPS = 0x14
IP_MF = 0x2000
IP_MINTTL = 0x15
IP_MSFILTER = 0x29
IP_MSS = 0x240
IP_MTU = 0xe
IP_MTU_DISCOVER = 0xa
IP_MULTICAST_ALL = 0x31
IP_MULTICAST_IF = 0x20
IP_MULTICAST_LOOP = 0x22
IP_MULTICAST_TTL = 0x21
IP_NODEFRAG = 0x16
IP_OFFMASK = 0x1fff
IP_OPTIONS = 0x4
IP_ORIGDSTADDR = 0x14
IP_PASSSEC = 0x12
IP_PKTINFO = 0x8
IP_PKTOPTIONS = 0x9
IP_PMTUDISC = 0xa
IP_PMTUDISC_DO = 0x2
IP_PMTUDISC_DONT = 0x0
IP_PMTUDISC_INTERFACE = 0x4
IP_PMTUDISC_OMIT = 0x5
IP_PMTUDISC_PROBE = 0x3
IP_PMTUDISC_WANT = 0x1
IP_RECVERR = 0xb
IP_RECVFRAGSIZE = 0x19
IP_RECVOPTS = 0x6
IP_RECVORIGDSTADDR = 0x14
IP_RECVRETOPTS = 0x7
IP_RECVTOS = 0xd
IP_RECVTTL = 0xc
IP_RETOPTS = 0x7
IP_RF = 0x8000
IP_ROUTER_ALERT = 0x5
IP_TOS = 0x1
IP_TRANSPARENT = 0x13
IP_TTL = 0x2
IP_UNBLOCK_SOURCE = 0x25
IP_UNICAST_IF = 0x32
IP_XFRM_POLICY = 0x11
ISIG = 0x80
ISOFS_SUPER_MAGIC = 0x9660
ISTRIP = 0x20
IUCLC = 0x1000
IUTF8 = 0x4000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PARISC = 0xf0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CAPABILITIES = 0x1f
KEYCTL_CAPS0_BIG_KEY = 0x10
KEYCTL_CAPS0_CAPABILITIES = 0x1
KEYCTL_CAPS0_DIFFIE_HELLMAN = 0x4
KEYCTL_CAPS0_INVALIDATE = 0x20
KEYCTL_CAPS0_MOVE = 0x80
KEYCTL_CAPS0_PERSISTENT_KEYRINGS = 0x2
KEYCTL_CAPS0_PUBLIC_KEY = 0x8
KEYCTL_CAPS0_RESTRICT_KEYRING = 0x40
KEYCTL_CAPS1_NS_KEYRING_NAME = 0x1
KEYCTL_CAPS1_NS_KEY_TAG = 0x2
KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7
KEYCTL_DESCRIBE = 0x6
KEYCTL_DH_COMPUTE = 0x17
KEYCTL_GET_KEYRING_ID = 0x0
KEYCTL_GET_PERSISTENT = 0x16
KEYCTL_GET_SECURITY = 0x11
KEYCTL_INSTANTIATE = 0xc
KEYCTL_INSTANTIATE_IOV = 0x14
KEYCTL_INVALIDATE = 0x15
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_MOVE = 0x1e
KEYCTL_MOVE_EXCL = 0x1
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
KEYCTL_REVOKE = 0x3
KEYCTL_SEARCH = 0xa
KEYCTL_SESSION_TO_PARENT = 0x12
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
KEY_REQKEY_DEFL_GROUP_KEYRING = 0x6
KEY_REQKEY_DEFL_NO_CHANGE = -0x1
KEY_REQKEY_DEFL_PROCESS_KEYRING = 0x2
KEY_REQKEY_DEFL_REQUESTOR_KEYRING = 0x7
KEY_REQKEY_DEFL_SESSION_KEYRING = 0x3
KEY_REQKEY_DEFL_THREAD_KEYRING = 0x1
KEY_REQKEY_DEFL_USER_KEYRING = 0x4
KEY_REQKEY_DEFL_USER_SESSION_KEYRING = 0x5
KEY_SPEC_GROUP_KEYRING = -0x6
KEY_SPEC_PROCESS_KEYRING = -0x2
KEY_SPEC_REQKEY_AUTH_KEY = -0x7
KEY_SPEC_REQUESTOR_KEYRING = -0x8
KEY_SPEC_SESSION_KEYRING = -0x3
KEY_SPEC_THREAD_KEYRING = -0x1
KEY_SPEC_USER_KEYRING = -0x4
KEY_SPEC_USER_SESSION_KEYRING = -0x5
LINUX_REBOOT_CMD_CAD_OFF = 0x0
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
LINUX_REBOOT_CMD_HALT = 0xcdef0123
LINUX_REBOOT_CMD_KEXEC = 0x45584543
LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc
LINUX_REBOOT_CMD_RESTART = 0x1234567
LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4
LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2
LINUX_REBOOT_MAGIC1 = 0xfee1dead
LINUX_REBOOT_MAGIC2 = 0x28121969
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_COLD = 0x14
MADV_DODUMP = 0x11
MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10
MADV_DONTFORK = 0xa
MADV_DONTNEED = 0x4
MADV_FREE = 0x8
MADV_HUGEPAGE = 0xe
MADV_HWPOISON = 0x64
MADV_KEEPONFORK = 0x13
MADV_MERGEABLE = 0xc
MADV_NOHUGEPAGE = 0xf
MADV_NORMAL = 0x0
MADV_PAGEOUT = 0x15
MADV_RANDOM = 0x1
MADV_REMOVE = 0x9
MADV_SEQUENTIAL = 0x2
MADV_UNMERGEABLE = 0xd
MADV_WILLNEED = 0x3
MADV_WIPEONFORK = 0x12
MAP_ANON = 0x20
MAP_ANONYMOUS = 0x20
MAP_DENYWRITE = 0x800
MAP_EXECUTABLE = 0x1000
MAP_FILE = 0x0
MAP_FIXED = 0x10
MAP_FIXED_NOREPLACE = 0x100000
MAP_GROWSDOWN = 0x100
MAP_HUGETLB = 0x40000
MAP_HUGE_MASK = 0x3f
MAP_HUGE_SHIFT = 0x1a
MAP_LOCKED = 0x80
MAP_NONBLOCK = 0x10000
MAP_NORESERVE = 0x40
MAP_POPULATE = 0x8000
MAP_PRIVATE = 0x2
MAP_SHARED = 0x1
MAP_SHARED_VALIDATE = 0x3
MAP_STACK = 0x20000
MAP_SYNC = 0x80000
MAP_TYPE = 0xf
MCAST_BLOCK_SOURCE = 0x2b
MCAST_EXCLUDE = 0x0
MCAST_INCLUDE = 0x1
MCAST_JOIN_GROUP = 0x2a
MCAST_JOIN_SOURCE_GROUP = 0x2e
MCAST_LEAVE_GROUP = 0x2d
MCAST_LEAVE_SOURCE_GROUP = 0x2f
MCAST_MSFILTER = 0x30
MCAST_UNBLOCK_SOURCE = 0x2c
MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_32MB = 0x64000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_512MB = 0x74000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a
MINIX_SUPER_MAGIC = 0x137f
MINIX_SUPER_MAGIC2 = 0x138f
MNT_DETACH = 0x2
MNT_EXPIRE = 0x4
MNT_FORCE = 0x1
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
MODULE_INIT_IGNORE_VERMAGIC = 0x2
MSDOS_SUPER_MAGIC = 0x4d44
MSG_BATCH = 0x40000
MSG_CMSG_CLOEXEC = 0x40000000
MSG_CONFIRM = 0x800
MSG_CTRUNC = 0x8
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x40
MSG_EOR = 0x80
MSG_ERRQUEUE = 0x2000
MSG_FASTOPEN = 0x20000000
MSG_FIN = 0x200
MSG_MORE = 0x8000
MSG_NOSIGNAL = 0x4000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_PROXY = 0x10
MSG_RST = 0x1000
MSG_SYN = 0x400
MSG_TRUNC = 0x20
MSG_TRYHARD = 0x4
MSG_WAITALL = 0x100
MSG_WAITFORONE = 0x10000
MSG_ZEROCOPY = 0x4000000
MS_ACTIVE = 0x40000000
MS_ASYNC = 0x1
MS_BIND = 0x1000
MS_BORN = 0x20000000
MS_DIRSYNC = 0x80
MS_INVALIDATE = 0x2
MS_I_VERSION = 0x800000
MS_KERNMOUNT = 0x400000
MS_LAZYTIME = 0x2000000
MS_MANDLOCK = 0x40
MS_MGC_MSK = 0xffff0000
MS_MGC_VAL = 0xc0ed0000
MS_MOVE = 0x2000
MS_NOATIME = 0x400
MS_NODEV = 0x4
MS_NODIRATIME = 0x800
MS_NOEXEC = 0x8
MS_NOREMOTELOCK = 0x8000000
MS_NOSEC = 0x10000000
MS_NOSUID = 0x2
MS_NOUSER = -0x80000000
MS_POSIXACL = 0x10000
MS_PRIVATE = 0x40000
MS_RDONLY = 0x1
MS_REC = 0x4000
MS_RELATIME = 0x200000
MS_REMOUNT = 0x20
MS_RMT_MASK = 0x2800051
MS_SHARED = 0x100000
MS_SILENT = 0x8000
MS_SLAVE = 0x80000
MS_STRICTATIME = 0x1000000
MS_SUBMOUNT = 0x4000000
MS_SYNC = 0x4
MS_SYNCHRONOUS = 0x10
MS_UNBINDABLE = 0x20000
MS_VERBOSE = 0x8000
MTD_INODE_FS_MAGIC = 0x11307854
NAME_MAX = 0xff
NCP_SUPER_MAGIC = 0x564c
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
NETLINK_CAP_ACK = 0xa
NETLINK_CONNECTOR = 0xb
NETLINK_CRYPTO = 0x15
NETLINK_DNRTMSG = 0xe
NETLINK_DROP_MEMBERSHIP = 0x2
NETLINK_ECRYPTFS = 0x13
NETLINK_EXT_ACK = 0xb
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
NETLINK_LISTEN_ALL_NSID = 0x8
NETLINK_LIST_MEMBERSHIPS = 0x9
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_RDMA = 0x14
NETLINK_ROUTE = 0x0
NETLINK_RX_RING = 0x6
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
NETLINK_SMC = 0x16
NETLINK_SOCK_DIAG = 0x4
NETLINK_TX_RING = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFDBITS = 0x40
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
NFNLGRP_CONNTRACK_DESTROY = 0x3
NFNLGRP_CONNTRACK_EXP_DESTROY = 0x6
NFNLGRP_CONNTRACK_EXP_NEW = 0x4
NFNLGRP_CONNTRACK_EXP_UPDATE = 0x5
NFNLGRP_CONNTRACK_NEW = 0x1
NFNLGRP_CONNTRACK_UPDATE = 0x2
NFNLGRP_MAX = 0x9
NFNLGRP_NFTABLES = 0x7
NFNLGRP_NFTRACE = 0x9
NFNLGRP_NONE = 0x0
NFNL_BATCH_MAX = 0x1
NFNL_MSG_BATCH_BEGIN = 0x10
NFNL_MSG_BATCH_END = 0x11
NFNL_NFA_NEST = 0x8000
NFNL_SUBSYS_ACCT = 0x7
NFNL_SUBSYS_COUNT = 0xc
NFNL_SUBSYS_CTHELPER = 0x9
NFNL_SUBSYS_CTNETLINK = 0x1
NFNL_SUBSYS_CTNETLINK_EXP = 0x2
NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8
NFNL_SUBSYS_IPSET = 0x6
NFNL_SUBSYS_NFTABLES = 0xa
NFNL_SUBSYS_NFT_COMPAT = 0xb
NFNL_SUBSYS_NONE = 0x0
NFNL_SUBSYS_OSF = 0x5
NFNL_SUBSYS_QUEUE = 0x3
NFNL_SUBSYS_ULOG = 0x4
NFS_SUPER_MAGIC = 0x6969
NILFS_SUPER_MAGIC = 0x3434
NL0 = 0x0
NL1 = 0x100
NL2 = 0x200
NL3 = 0x300
NLA_ALIGNTO = 0x4
NLA_F_NESTED = 0x8000
NLA_F_NET_BYTEORDER = 0x4000
NLA_HDRLEN = 0x4
NLDLY = 0x300
NLMSG_ALIGNTO = 0x4
NLMSG_DONE = 0x3
NLMSG_ERROR = 0x2
NLMSG_HDRLEN = 0x10
NLMSG_MIN_TYPE = 0x10
NLMSG_NOOP = 0x1
NLMSG_OVERRUN = 0x4
NLM_F_ACK = 0x4
NLM_F_ACK_TLVS = 0x200
NLM_F_APPEND = 0x800
NLM_F_ATOMIC = 0x400
NLM_F_CAPPED = 0x100
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
NLM_F_DUMP_FILTERED = 0x20
NLM_F_DUMP_INTR = 0x10
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
NLM_F_MATCH = 0x200
NLM_F_MULTI = 0x2
NLM_F_NONREC = 0x100
NLM_F_REPLACE = 0x100
NLM_F_REQUEST = 0x1
NLM_F_ROOT = 0x100
NOFLSH = 0x80000000
NSFS_MAGIC = 0x6e736673
NS_GET_NSTYPE = 0x2000b703
NS_GET_OWNER_UID = 0x2000b704
NS_GET_PARENT = 0x2000b702
NS_GET_USERNS = 0x2000b701
OCFS2_SUPER_MAGIC = 0x7461636f
OCRNL = 0x8
OFDEL = 0x80
OFILL = 0x40
OLCUC = 0x4
ONLCR = 0x2
ONLRET = 0x20
ONOCR = 0x10
OPENPROM_SUPER_MAGIC = 0x9fa1
OPOST = 0x1
OVERLAYFS_SUPER_MAGIC = 0x794c7630
O_ACCMODE = 0x3
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CLOEXEC = 0x80000
O_CREAT = 0x40
O_DIRECT = 0x20000
O_DIRECTORY = 0x4000
O_DSYNC = 0x1000
O_EXCL = 0x80
O_FSYNC = 0x101000
O_LARGEFILE = 0x0
O_NDELAY = 0x800
O_NOATIME = 0x40000
O_NOCTTY = 0x100
O_NOFOLLOW = 0x8000
O_NONBLOCK = 0x800
O_PATH = 0x200000
O_RDONLY = 0x0
O_RDWR = 0x2
O_RSYNC = 0x101000
O_SYNC = 0x101000
O_TMPFILE = 0x404000
O_TRUNC = 0x200
O_WRONLY = 0x1
PACKET_ADD_MEMBERSHIP = 0x1
PACKET_AUXDATA = 0x8
PACKET_BROADCAST = 0x1
PACKET_COPY_THRESH = 0x7
PACKET_DROP_MEMBERSHIP = 0x2
PACKET_FANOUT = 0x12
PACKET_FANOUT_CBPF = 0x6
PACKET_FANOUT_CPU = 0x2
PACKET_FANOUT_DATA = 0x16
PACKET_FANOUT_EBPF = 0x7
PACKET_FANOUT_FLAG_DEFRAG = 0x8000
PACKET_FANOUT_FLAG_ROLLOVER = 0x1000
PACKET_FANOUT_FLAG_UNIQUEID = 0x2000
PACKET_FANOUT_HASH = 0x0
PACKET_FANOUT_LB = 0x1
PACKET_FANOUT_QM = 0x5
PACKET_FANOUT_RND = 0x4
PACKET_FANOUT_ROLLOVER = 0x3
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
PACKET_MR_ALLMULTI = 0x2
PACKET_MR_MULTICAST = 0x0
PACKET_MR_PROMISC = 0x1
PACKET_MR_UNICAST = 0x3
PACKET_MULTICAST = 0x2
PACKET_ORIGDEV = 0x9
PACKET_OTHERHOST = 0x3
PACKET_OUTGOING = 0x4
PACKET_QDISC_BYPASS = 0x14
PACKET_RECV_OUTPUT = 0x3
PACKET_RESERVE = 0xc
PACKET_ROLLOVER_STATS = 0x15
PACKET_RX_RING = 0x5
PACKET_STATISTICS = 0x6
PACKET_TIMESTAMP = 0x11
PACKET_TX_HAS_OFF = 0x13
PACKET_TX_RING = 0xd
PACKET_TX_TIMESTAMP = 0x10
PACKET_USER = 0x6
PACKET_VERSION = 0xa
PACKET_VNET_HDR = 0xf
PARENB = 0x1000
PARITY_CRC16_PR0 = 0x2
PARITY_CRC16_PR0_CCITT = 0x4
PARITY_CRC16_PR1 = 0x3
PARITY_CRC16_PR1_CCITT = 0x5
PARITY_CRC32_PR0_CCITT = 0x6
PARITY_CRC32_PR1_CCITT = 0x7
PARITY_DEFAULT = 0x0
PARITY_NONE = 0x1
PARMRK = 0x8
PARODD = 0x2000
PENDIN = 0x20000000
PERF_EVENT_IOC_DISABLE = 0x20002401
PERF_EVENT_IOC_ENABLE = 0x20002400
PERF_EVENT_IOC_ID = 0x40082407
PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
PERF_EVENT_IOC_PERIOD = 0x80082404
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
PERF_EVENT_IOC_REFRESH = 0x20002402
PERF_EVENT_IOC_RESET = 0x20002403
PERF_EVENT_IOC_SET_BPF = 0x80042408
PERF_EVENT_IOC_SET_FILTER = 0x80082406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPC_CMM_MAGIC = 0xc7571590
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4010743f
PPPIOCGIDLE32 = 0x4008743f
PPPIOCGIDLE64 = 0x4010743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80107446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x8010744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
PROC_SUPER_MAGIC = 0x9fa0
PROT_EXEC = 0x4
PROT_GROWSDOWN = 0x1000000
PROT_GROWSUP = 0x2000000
PROT_NONE = 0x0
PROT_READ = 0x1
PROT_SAO = 0x10
PROT_WRITE = 0x2
PR_CAPBSET_DROP = 0x18
PR_CAPBSET_READ = 0x17
PR_CAP_AMBIENT = 0x2f
PR_CAP_AMBIENT_CLEAR_ALL = 0x4
PR_CAP_AMBIENT_IS_SET = 0x1
PR_CAP_AMBIENT_LOWER = 0x3
PR_CAP_AMBIENT_RAISE = 0x2
PR_ENDIAN_BIG = 0x0
PR_ENDIAN_LITTLE = 0x1
PR_ENDIAN_PPC_LITTLE = 0x2
PR_FPEMU_NOPRINT = 0x1
PR_FPEMU_SIGFPE = 0x2
PR_FP_EXC_ASYNC = 0x2
PR_FP_EXC_DISABLED = 0x0
PR_FP_EXC_DIV = 0x10000
PR_FP_EXC_INV = 0x100000
PR_FP_EXC_NONRECOV = 0x1
PR_FP_EXC_OVF = 0x20000
PR_FP_EXC_PRECISE = 0x3
PR_FP_EXC_RES = 0x80000
PR_FP_EXC_SW_ENABLE = 0x80
PR_FP_EXC_UND = 0x40000
PR_FP_MODE_FR = 0x1
PR_FP_MODE_FRE = 0x2
PR_GET_CHILD_SUBREAPER = 0x25
PR_GET_DUMPABLE = 0x3
PR_GET_ENDIAN = 0x13
PR_GET_FPEMU = 0x9
PR_GET_FPEXC = 0xb
PR_GET_FP_MODE = 0x2e
PR_GET_KEEPCAPS = 0x7
PR_GET_NAME = 0x10
PR_GET_NO_NEW_PRIVS = 0x27
PR_GET_PDEATHSIG = 0x2
PR_GET_SECCOMP = 0x15
PR_GET_SECUREBITS = 0x1b
PR_GET_SPECULATION_CTRL = 0x34
PR_GET_TAGGED_ADDR_CTRL = 0x38
PR_GET_THP_DISABLE = 0x2a
PR_GET_TID_ADDRESS = 0x28
PR_GET_TIMERSLACK = 0x1e
PR_GET_TIMING = 0xd
PR_GET_TSC = 0x19
PR_GET_UNALIGN = 0x5
PR_MCE_KILL = 0x21
PR_MCE_KILL_CLEAR = 0x0
PR_MCE_KILL_DEFAULT = 0x2
PR_MCE_KILL_EARLY = 0x1
PR_MCE_KILL_GET = 0x22
PR_MCE_KILL_LATE = 0x0
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
PR_SET_FPEMU = 0xa
PR_SET_FPEXC = 0xc
PR_SET_FP_MODE = 0x2d
PR_SET_KEEPCAPS = 0x8
PR_SET_MM = 0x23
PR_SET_MM_ARG_END = 0x9
PR_SET_MM_ARG_START = 0x8
PR_SET_MM_AUXV = 0xc
PR_SET_MM_BRK = 0x7
PR_SET_MM_END_CODE = 0x2
PR_SET_MM_END_DATA = 0x4
PR_SET_MM_ENV_END = 0xb
PR_SET_MM_ENV_START = 0xa
PR_SET_MM_EXE_FILE = 0xd
PR_SET_MM_MAP = 0xe
PR_SET_MM_MAP_SIZE = 0xf
PR_SET_MM_START_BRK = 0x6
PR_SET_MM_START_CODE = 0x1
PR_SET_MM_START_DATA = 0x3
PR_SET_MM_START_STACK = 0x5
PR_SET_NAME = 0xf
PR_SET_NO_NEW_PRIVS = 0x26
PR_SET_PDEATHSIG = 0x1
PR_SET_PTRACER = 0x59616d61
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PR_SET_SECCOMP = 0x16
PR_SET_SECUREBITS = 0x1c
PR_SET_SPECULATION_CTRL = 0x35
PR_SET_TAGGED_ADDR_CTRL = 0x37
PR_SET_THP_DISABLE = 0x29
PR_SET_TIMERSLACK = 0x1d
PR_SET_TIMING = 0xe
PR_SET_TSC = 0x1a
PR_SET_UNALIGN = 0x6
PR_SPEC_DISABLE = 0x4
PR_SPEC_DISABLE_NOEXEC = 0x10
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
PR_SVE_GET_VL = 0x33
PR_SVE_SET_VL = 0x32
PR_SVE_SET_VL_ONEXEC = 0x40000
PR_SVE_VL_INHERIT = 0x20000
PR_SVE_VL_LEN_MASK = 0xffff
PR_TAGGED_ADDR_ENABLE = 0x1
PR_TASK_PERF_EVENTS_DISABLE = 0x1f
PR_TASK_PERF_EVENTS_ENABLE = 0x20
PR_TIMING_STATISTICAL = 0x0
PR_TIMING_TIMESTAMP = 0x1
PR_TSC_ENABLE = 0x1
PR_TSC_SIGSEGV = 0x2
PR_UNALIGN_NOPRINT = 0x1
PR_UNALIGN_SIGBUS = 0x2
PSTOREFS_MAGIC = 0x6165676c
PTRACE_ATTACH = 0x10
PTRACE_CONT = 0x7
PTRACE_DETACH = 0x11
PTRACE_EVENTMSG_SYSCALL_ENTRY = 0x1
PTRACE_EVENTMSG_SYSCALL_EXIT = 0x2
PTRACE_EVENT_CLONE = 0x3
PTRACE_EVENT_EXEC = 0x4
PTRACE_EVENT_EXIT = 0x6
PTRACE_EVENT_FORK = 0x1
PTRACE_EVENT_SECCOMP = 0x7
PTRACE_EVENT_STOP = 0x80
PTRACE_EVENT_VFORK = 0x2
PTRACE_EVENT_VFORK_DONE = 0x5
PTRACE_GETEVENTMSG = 0x4201
PTRACE_GETEVRREGS = 0x14
PTRACE_GETFPREGS = 0xe
PTRACE_GETREGS = 0xc
PTRACE_GETREGS64 = 0x16
PTRACE_GETREGSET = 0x4204
PTRACE_GETSIGINFO = 0x4202
PTRACE_GETSIGMASK = 0x420a
PTRACE_GETVRREGS = 0x12
PTRACE_GETVSRREGS = 0x1b
PTRACE_GET_DEBUGREG = 0x19
PTRACE_GET_SYSCALL_INFO = 0x420e
PTRACE_INTERRUPT = 0x4207
PTRACE_KILL = 0x8
PTRACE_LISTEN = 0x4208
PTRACE_O_EXITKILL = 0x100000
PTRACE_O_MASK = 0x3000ff
PTRACE_O_SUSPEND_SECCOMP = 0x200000
PTRACE_O_TRACECLONE = 0x8
PTRACE_O_TRACEEXEC = 0x10
PTRACE_O_TRACEEXIT = 0x40
PTRACE_O_TRACEFORK = 0x2
PTRACE_O_TRACESECCOMP = 0x80
PTRACE_O_TRACESYSGOOD = 0x1
PTRACE_O_TRACEVFORK = 0x4
PTRACE_O_TRACEVFORKDONE = 0x20
PTRACE_PEEKDATA = 0x2
PTRACE_PEEKSIGINFO = 0x4209
PTRACE_PEEKSIGINFO_SHARED = 0x1
PTRACE_PEEKTEXT = 0x1
PTRACE_PEEKUSR = 0x3
PTRACE_POKEDATA = 0x5
PTRACE_POKETEXT = 0x4
PTRACE_POKEUSR = 0x6
PTRACE_SECCOMP_GET_FILTER = 0x420c
PTRACE_SECCOMP_GET_METADATA = 0x420d
PTRACE_SEIZE = 0x4206
PTRACE_SETEVRREGS = 0x15
PTRACE_SETFPREGS = 0xf
PTRACE_SETOPTIONS = 0x4200
PTRACE_SETREGS = 0xd
PTRACE_SETREGS64 = 0x17
PTRACE_SETREGSET = 0x4205
PTRACE_SETSIGINFO = 0x4203
PTRACE_SETSIGMASK = 0x420b
PTRACE_SETVRREGS = 0x13
PTRACE_SETVSRREGS = 0x1c
PTRACE_SET_DEBUGREG = 0x1a
PTRACE_SINGLEBLOCK = 0x100
PTRACE_SINGLESTEP = 0x9
PTRACE_SYSCALL = 0x18
PTRACE_SYSCALL_INFO_ENTRY = 0x1
PTRACE_SYSCALL_INFO_EXIT = 0x2
PTRACE_SYSCALL_INFO_NONE = 0x0
PTRACE_SYSCALL_INFO_SECCOMP = 0x3
PTRACE_SYSEMU = 0x1d
PTRACE_SYSEMU_SINGLESTEP = 0x1e
PTRACE_TRACEME = 0x0
PT_CCR = 0x26
PT_CTR = 0x23
PT_DAR = 0x29
PT_DSCR = 0x2c
PT_DSISR = 0x2a
PT_FPR0 = 0x30
PT_FPSCR = 0x50
PT_LNK = 0x24
PT_MSR = 0x21
PT_NIP = 0x20
PT_ORIG_R3 = 0x22
PT_R0 = 0x0
PT_R1 = 0x1
PT_R10 = 0xa
PT_R11 = 0xb
PT_R12 = 0xc
PT_R13 = 0xd
PT_R14 = 0xe
PT_R15 = 0xf
PT_R16 = 0x10
PT_R17 = 0x11
PT_R18 = 0x12
PT_R19 = 0x13
PT_R2 = 0x2
PT_R20 = 0x14
PT_R21 = 0x15
PT_R22 = 0x16
PT_R23 = 0x17
PT_R24 = 0x18
PT_R25 = 0x19
PT_R26 = 0x1a
PT_R27 = 0x1b
PT_R28 = 0x1c
PT_R29 = 0x1d
PT_R3 = 0x3
PT_R30 = 0x1e
PT_R31 = 0x1f
PT_R4 = 0x4
PT_R5 = 0x5
PT_R6 = 0x6
PT_R7 = 0x7
PT_R8 = 0x8
PT_R9 = 0x9
PT_REGS_COUNT = 0x2c
PT_RESULT = 0x2b
PT_SOFTE = 0x27
PT_TRAP = 0x28
PT_VR0 = 0x52
PT_VRSAVE = 0x94
PT_VSCR = 0x93
PT_VSR0 = 0x96
PT_VSR31 = 0xd4
PT_XER = 0x25
QNX4_SUPER_MAGIC = 0x2f
QNX6_SUPER_MAGIC = 0x68191122
RAMFS_MAGIC = 0x858458f6
RDTGROUP_SUPER_MAGIC = 0x7655821
REISERFS_SUPER_MAGIC = 0x52654973
RENAME_EXCHANGE = 0x2
RENAME_NOREPLACE = 0x1
RENAME_WHITEOUT = 0x4
RLIMIT_AS = 0x9
RLIMIT_CORE = 0x4
RLIMIT_CPU = 0x0
RLIMIT_DATA = 0x2
RLIMIT_FSIZE = 0x1
RLIMIT_LOCKS = 0xa
RLIMIT_MEMLOCK = 0x8
RLIMIT_MSGQUEUE = 0xc
RLIMIT_NICE = 0xd
RLIMIT_NOFILE = 0x7
RLIMIT_NPROC = 0x6
RLIMIT_RSS = 0x5
RLIMIT_RTPRIO = 0xe
RLIMIT_RTTIME = 0xf
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
RTAX_FASTOPEN_NO_COOKIE = 0x11
RTAX_FEATURES = 0xc
RTAX_FEATURE_ALLFRAG = 0x8
RTAX_FEATURE_ECN = 0x1
RTAX_FEATURE_MASK = 0xf
RTAX_FEATURE_SACK = 0x2
RTAX_FEATURE_TIMESTAMP = 0x4
RTAX_HOPLIMIT = 0xa
RTAX_INITCWND = 0xb
RTAX_INITRWND = 0xe
RTAX_LOCK = 0x1
RTAX_MAX = 0x11
RTAX_MTU = 0x2
RTAX_QUICKACK = 0xf
RTAX_REORDERING = 0x9
RTAX_RTO_MIN = 0xd
RTAX_RTT = 0x4
RTAX_RTTVAR = 0x5
RTAX_SSTHRESH = 0x6
RTAX_UNSPEC = 0x0
RTAX_WINDOW = 0x3
RTA_ALIGNTO = 0x4
RTA_MAX = 0x1e
RTCF_DIRECTSRC = 0x4000000
RTCF_DOREDIRECT = 0x1000000
RTCF_LOG = 0x2000000
RTCF_MASQ = 0x400000
RTCF_NAT = 0x800000
RTCF_VALVE = 0x200000
RTC_AF = 0x20
RTC_AIE_OFF = 0x20007002
RTC_AIE_ON = 0x20007001
RTC_ALM_READ = 0x40247008
RTC_ALM_SET = 0x80247007
RTC_EPOCH_READ = 0x4008700d
RTC_EPOCH_SET = 0x8008700e
RTC_IRQF = 0x80
RTC_IRQP_READ = 0x4008700b
RTC_IRQP_SET = 0x8008700c
RTC_MAX_FREQ = 0x2000
RTC_PF = 0x40
RTC_PIE_OFF = 0x20007006
RTC_PIE_ON = 0x20007005
RTC_PLL_GET = 0x40207011
RTC_PLL_SET = 0x80207012
RTC_RD_TIME = 0x40247009
RTC_SET_TIME = 0x8024700a
RTC_UF = 0x10
RTC_UIE_OFF = 0x20007004
RTC_UIE_ON = 0x20007003
RTC_VL_CLR = 0x20007014
RTC_VL_READ = 0x40047013
RTC_WIE_OFF = 0x20007010
RTC_WIE_ON = 0x2000700f
RTC_WKALM_RD = 0x40287010
RTC_WKALM_SET = 0x8028700f
RTF_ADDRCLASSMASK = 0xf8000000
RTF_ADDRCONF = 0x40000
RTF_ALLONLINK = 0x20000
RTF_BROADCAST = 0x10000000
RTF_CACHE = 0x1000000
RTF_DEFAULT = 0x10000
RTF_DYNAMIC = 0x10
RTF_FLOW = 0x2000000
RTF_GATEWAY = 0x2
RTF_HOST = 0x4
RTF_INTERFACE = 0x40000000
RTF_IRTT = 0x100
RTF_LINKRT = 0x100000
RTF_LOCAL = 0x80000000
RTF_MODIFIED = 0x20
RTF_MSS = 0x40
RTF_MTU = 0x40
RTF_MULTICAST = 0x20000000
RTF_NAT = 0x8000000
RTF_NOFORWARD = 0x1000
RTF_NONEXTHOP = 0x200000
RTF_NOPMTUDISC = 0x4000
RTF_POLICY = 0x4000000
RTF_REINSTATE = 0x8
RTF_REJECT = 0x200
RTF_STATIC = 0x400
RTF_THROW = 0x2000
RTF_UP = 0x1
RTF_WINDOW = 0x80
RTF_XRESOLVE = 0x800
RTM_BASE = 0x10
RTM_DELACTION = 0x31
RTM_DELADDR = 0x15
RTM_DELADDRLABEL = 0x49
RTM_DELCHAIN = 0x65
RTM_DELLINK = 0x11
RTM_DELLINKPROP = 0x6d
RTM_DELMDB = 0x55
RTM_DELNEIGH = 0x1d
RTM_DELNETCONF = 0x51
RTM_DELNEXTHOP = 0x69
RTM_DELNSID = 0x59
RTM_DELQDISC = 0x25
RTM_DELROUTE = 0x19
RTM_DELRULE = 0x21
RTM_DELTCLASS = 0x29
RTM_DELTFILTER = 0x2d
RTM_F_CLONED = 0x200
RTM_F_EQUALIZE = 0x400
RTM_F_FIB_MATCH = 0x2000
RTM_F_LOOKUP_TABLE = 0x1000
RTM_F_NOTIFY = 0x100
RTM_F_PREFIX = 0x800
RTM_GETACTION = 0x32
RTM_GETADDR = 0x16
RTM_GETADDRLABEL = 0x4a
RTM_GETANYCAST = 0x3e
RTM_GETCHAIN = 0x66
RTM_GETDCB = 0x4e
RTM_GETLINK = 0x12
RTM_GETLINKPROP = 0x6e
RTM_GETMDB = 0x56
RTM_GETMULTICAST = 0x3a
RTM_GETNEIGH = 0x1e
RTM_GETNEIGHTBL = 0x42
RTM_GETNETCONF = 0x52
RTM_GETNEXTHOP = 0x6a
RTM_GETNSID = 0x5a
RTM_GETQDISC = 0x26
RTM_GETROUTE = 0x1a
RTM_GETRULE = 0x22
RTM_GETSTATS = 0x5e
RTM_GETTCLASS = 0x2a
RTM_GETTFILTER = 0x2e
RTM_MAX = 0x6f
RTM_NEWACTION = 0x30
RTM_NEWADDR = 0x14
RTM_NEWADDRLABEL = 0x48
RTM_NEWCACHEREPORT = 0x60
RTM_NEWCHAIN = 0x64
RTM_NEWLINK = 0x10
RTM_NEWLINKPROP = 0x6c
RTM_NEWMDB = 0x54
RTM_NEWNDUSEROPT = 0x44
RTM_NEWNEIGH = 0x1c
RTM_NEWNEIGHTBL = 0x40
RTM_NEWNETCONF = 0x50
RTM_NEWNEXTHOP = 0x68
RTM_NEWNSID = 0x58
RTM_NEWPREFIX = 0x34
RTM_NEWQDISC = 0x24
RTM_NEWROUTE = 0x18
RTM_NEWRULE = 0x20
RTM_NEWSTATS = 0x5c
RTM_NEWTCLASS = 0x28
RTM_NEWTFILTER = 0x2c
RTM_NR_FAMILIES = 0x18
RTM_NR_MSGTYPES = 0x60
RTM_SETDCB = 0x4f
RTM_SETLINK = 0x13
RTM_SETNEIGHTBL = 0x43
RTNH_ALIGNTO = 0x4
RTNH_COMPARE_MASK = 0x19
RTNH_F_DEAD = 0x1
RTNH_F_LINKDOWN = 0x10
RTNH_F_OFFLOAD = 0x8
RTNH_F_ONLINK = 0x4
RTNH_F_PERVASIVE = 0x2
RTNH_F_UNRESOLVED = 0x20
RTN_MAX = 0xb
RTPROT_BABEL = 0x2a
RTPROT_BGP = 0xba
RTPROT_BIRD = 0xc
RTPROT_BOOT = 0x3
RTPROT_DHCP = 0x10
RTPROT_DNROUTED = 0xd
RTPROT_EIGRP = 0xc0
RTPROT_GATED = 0x8
RTPROT_ISIS = 0xbb
RTPROT_KERNEL = 0x2
RTPROT_MROUTED = 0x11
RTPROT_MRT = 0xa
RTPROT_NTK = 0xf
RTPROT_OSPF = 0xbc
RTPROT_RA = 0x9
RTPROT_REDIRECT = 0x1
RTPROT_RIP = 0xbd
RTPROT_STATIC = 0x4
RTPROT_UNSPEC = 0x0
RTPROT_XORP = 0xe
RTPROT_ZEBRA = 0xb
RT_CLASS_DEFAULT = 0xfd
RT_CLASS_LOCAL = 0xff
RT_CLASS_MAIN = 0xfe
RT_CLASS_MAX = 0xff
RT_CLASS_UNSPEC = 0x0
RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0
RUSAGE_THREAD = 0x1
RWF_APPEND = 0x10
RWF_DSYNC = 0x2
RWF_HIPRI = 0x1
RWF_NOWAIT = 0x8
RWF_SUPPORTED = 0x1f
RWF_SYNC = 0x4
RWF_WRITE_LIFE_NOT_SET = 0x0
SCM_CREDENTIALS = 0x2
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x1d
SCM_TIMESTAMPING = 0x25
SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
SIOCADDDLCI = 0x8980
SIOCADDMULTI = 0x8931
SIOCADDRT = 0x890b
SIOCATMARK = 0x8905
SIOCBONDCHANGEACTIVE = 0x8995
SIOCBONDENSLAVE = 0x8990
SIOCBONDINFOQUERY = 0x8994
SIOCBONDRELEASE = 0x8991
SIOCBONDSETHWADDR = 0x8992
SIOCBONDSLAVEINFOQUERY = 0x8993
SIOCBRADDBR = 0x89a0
SIOCBRADDIF = 0x89a2
SIOCBRDELBR = 0x89a1
SIOCBRDELIF = 0x89a3
SIOCDARP = 0x8953
SIOCDELDLCI = 0x8981
SIOCDELMULTI = 0x8932
SIOCDELRT = 0x890c
SIOCDEVPRIVATE = 0x89f0
SIOCDIFADDR = 0x8936
SIOCDRARP = 0x8960
SIOCETHTOOL = 0x8946
SIOCGARP = 0x8954
SIOCGETLINKNAME = 0x89e0
SIOCGETNODEID = 0x89e1
SIOCGHWTSTAMP = 0x89b1
SIOCGIFADDR = 0x8915
SIOCGIFBR = 0x8940
SIOCGIFBRDADDR = 0x8919
SIOCGIFCONF = 0x8912
SIOCGIFCOUNT = 0x8938
SIOCGIFDSTADDR = 0x8917
SIOCGIFENCAP = 0x8925
SIOCGIFFLAGS = 0x8913
SIOCGIFHWADDR = 0x8927
SIOCGIFINDEX = 0x8933
SIOCGIFMAP = 0x8970
SIOCGIFMEM = 0x891f
SIOCGIFMETRIC = 0x891d
SIOCGIFMTU = 0x8921
SIOCGIFNAME = 0x8910
SIOCGIFNETMASK = 0x891b
SIOCGIFPFLAGS = 0x8935
SIOCGIFSLAVE = 0x8929
SIOCGIFTXQLEN = 0x8942
SIOCGIFVLAN = 0x8982
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x4004667f
SIOCOUTQ = 0x40047473
SIOCOUTQNSD = 0x894b
SIOCPROTOPRIVATE = 0x89e0
SIOCRTMSG = 0x890d
SIOCSARP = 0x8955
SIOCSHWTSTAMP = 0x89b0
SIOCSIFADDR = 0x8916
SIOCSIFBR = 0x8941
SIOCSIFBRDADDR = 0x891a
SIOCSIFDSTADDR = 0x8918
SIOCSIFENCAP = 0x8926
SIOCSIFFLAGS = 0x8914
SIOCSIFHWADDR = 0x8924
SIOCSIFHWBROADCAST = 0x8937
SIOCSIFLINK = 0x8911
SIOCSIFMAP = 0x8971
SIOCSIFMEM = 0x8920
SIOCSIFMETRIC = 0x891e
SIOCSIFMTU = 0x8922
SIOCSIFNAME = 0x8923
SIOCSIFNETMASK = 0x891c
SIOCSIFPFLAGS = 0x8934
SIOCSIFSLAVE = 0x8930
SIOCSIFTXQLEN = 0x8943
SIOCSIFVLAN = 0x8983
SIOCSMIIREG = 0x8949
SIOCSPGRP = 0x8902
SIOCSRARP = 0x8962
SIOCWANDEV = 0x894a
SMACK_MAGIC = 0x43415d53
SMART_AUTOSAVE = 0xd2
SMART_AUTO_OFFLINE = 0xdb
SMART_DISABLE = 0xd9
SMART_ENABLE = 0xd8
SMART_HCYL_PASS = 0xc2
SMART_IMMEDIATE_OFFLINE = 0xd4
SMART_LCYL_PASS = 0x4f
SMART_READ_LOG_SECTOR = 0xd5
SMART_READ_THRESHOLDS = 0xd1
SMART_READ_VALUES = 0xd0
SMART_SAVE = 0xd3
SMART_STATUS = 0xda
SMART_WRITE_LOG_SECTOR = 0xd6
SMART_WRITE_THRESHOLDS = 0xd7
SMB_SUPER_MAGIC = 0x517b
SOCKFS_MAGIC = 0x534f434b
SOCK_CLOEXEC = 0x80000
SOCK_DCCP = 0x6
SOCK_DGRAM = 0x2
SOCK_IOC_TYPE = 0x89
SOCK_NONBLOCK = 0x800
SOCK_PACKET = 0xa
SOCK_RAW = 0x3
SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5
SOCK_STREAM = 0x1
SOL_AAL = 0x109
SOL_ALG = 0x117
SOL_ATM = 0x108
SOL_CAIF = 0x116
SOL_CAN_BASE = 0x64
SOL_DCCP = 0x10d
SOL_DECNET = 0x105
SOL_ICMPV6 = 0x3a
SOL_IP = 0x0
SOL_IPV6 = 0x29
SOL_IRDA = 0x10a
SOL_IUCV = 0x115
SOL_KCM = 0x119
SOL_LLC = 0x10c
SOL_NETBEUI = 0x10b
SOL_NETLINK = 0x10e
SOL_NFC = 0x118
SOL_PACKET = 0x107
SOL_PNPIPE = 0x113
SOL_PPPOL2TP = 0x111
SOL_RAW = 0xff
SOL_RDS = 0x114
SOL_RXRPC = 0x110
SOL_SOCKET = 0x1
SOL_TCP = 0x6
SOL_TIPC = 0x10f
SOL_TLS = 0x11a
SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x1000
SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32
SO_ATTACH_FILTER = 0x1a
SO_ATTACH_REUSEPORT_CBPF = 0x33
SO_ATTACH_REUSEPORT_EBPF = 0x34
SO_BINDTODEVICE = 0x19
SO_BINDTOIFINDEX = 0x3e
SO_BPF_EXTENSIONS = 0x30
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DEBUG = 0x1
SO_DETACH_BPF = 0x1b
SO_DETACH_FILTER = 0x1b
SO_DETACH_REUSEPORT_BPF = 0x44
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
SO_INCOMING_NAPI_ID = 0x38
SO_KEEPALIVE = 0x9
SO_LINGER = 0xd
SO_LOCK_FILTER = 0x2c
SO_MARK = 0x24
SO_MAX_PACING_RATE = 0x2f
SO_MEMINFO = 0x37
SO_NOFCS = 0x2b
SO_NO_CHECK = 0xb
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
SO_PEERNAME = 0x1c
SO_PEERSEC = 0x1f
SO_PRIORITY = 0xc
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
SO_RCVLOWAT = 0x10
SO_RCVTIMEO = 0x12
SO_RCVTIMEO_NEW = 0x42
SO_RCVTIMEO_OLD = 0x12
SO_REUSEADDR = 0x2
SO_REUSEPORT = 0xf
SO_RXQ_OVFL = 0x28
SO_SECURITY_AUTHENTICATION = 0x16
SO_SECURITY_ENCRYPTION_NETWORK = 0x18
SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
SO_SELECT_ERR_QUEUE = 0x2d
SO_SNDBUF = 0x7
SO_SNDBUFFORCE = 0x20
SO_SNDLOWAT = 0x11
SO_SNDTIMEO = 0x13
SO_SNDTIMEO_NEW = 0x43
SO_SNDTIMEO_OLD = 0x13
SO_TIMESTAMP = 0x1d
SO_TIMESTAMPING = 0x25
SO_TIMESTAMPING_NEW = 0x41
SO_TIMESTAMPING_OLD = 0x25
SO_TIMESTAMPNS = 0x23
SO_TIMESTAMPNS_NEW = 0x40
SO_TIMESTAMPNS_OLD = 0x23
SO_TIMESTAMP_NEW = 0x3f
SO_TIMESTAMP_OLD = 0x1d
SO_TXTIME = 0x3d
SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29
SO_ZEROCOPY = 0x3c
SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4
SPLICE_F_MOVE = 0x1
SPLICE_F_NONBLOCK = 0x2
SQUASHFS_MAGIC = 0x73717368
STACK_END_MAGIC = 0x57ac6e9d
STATX_ALL = 0xfff
STATX_ATIME = 0x20
STATX_ATTR_APPEND = 0x20
STATX_ATTR_AUTOMOUNT = 0x1000
STATX_ATTR_COMPRESSED = 0x4
STATX_ATTR_ENCRYPTED = 0x800
STATX_ATTR_IMMUTABLE = 0x10
STATX_ATTR_NODUMP = 0x40
STATX_ATTR_VERITY = 0x100000
STATX_BASIC_STATS = 0x7ff
STATX_BLOCKS = 0x400
STATX_BTIME = 0x800
STATX_CTIME = 0x80
STATX_GID = 0x10
STATX_INO = 0x100
STATX_MODE = 0x2
STATX_MTIME = 0x40
STATX_NLINK = 0x4
STATX_SIZE = 0x200
STATX_TYPE = 0x1
STATX_UID = 0x8
STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
S_IFCHR = 0x2000
S_IFDIR = 0x4000
S_IFIFO = 0x1000
S_IFLNK = 0xa000
S_IFMT = 0xf000
S_IFREG = 0x8000
S_IFSOCK = 0xc000
S_IREAD = 0x100
S_IRGRP = 0x20
S_IROTH = 0x4
S_IRUSR = 0x100
S_IRWXG = 0x38
S_IRWXO = 0x7
S_IRWXU = 0x1c0
S_ISGID = 0x400
S_ISUID = 0x800
S_ISVTX = 0x200
S_IWGRP = 0x10
S_IWOTH = 0x2
S_IWRITE = 0x80
S_IWUSR = 0x80
S_IXGRP = 0x8
S_IXOTH = 0x1
S_IXUSR = 0x40
TAB0 = 0x0
TAB1 = 0x400
TAB2 = 0x800
TAB3 = 0xc00
TABDLY = 0xc00
TASKSTATS_CMD_ATTR_MAX = 0x4
TASKSTATS_CMD_MAX = 0x2
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x9
TCFLSH = 0x2000741f
TCGETA = 0x40147417
TCGETS = 0x402c7413
TCIFLUSH = 0x0
TCIOFF = 0x2
TCIOFLUSH = 0x2
TCION = 0x3
TCOFLUSH = 0x1
TCOOFF = 0x0
TCOON = 0x1
TCP_BPF_IW = 0x3e9
TCP_BPF_SNDCWND_CLAMP = 0x3ea
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
TCP_COOKIE_MIN = 0x8
TCP_COOKIE_OUT_NEVER = 0x2
TCP_COOKIE_PAIR_SIZE = 0x20
TCP_COOKIE_TRANSACTIONS = 0xf
TCP_CORK = 0x3
TCP_DEFER_ACCEPT = 0x9
TCP_FASTOPEN = 0x17
TCP_FASTOPEN_CONNECT = 0x1e
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
TCP_LINGER2 = 0x8
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_WINSHIFT = 0xe
TCP_MD5SIG = 0xe
TCP_MD5SIG_EXT = 0x20
TCP_MD5SIG_FLAG_PREFIX = 0x1
TCP_MD5SIG_MAXKEYLEN = 0x50
TCP_MSS = 0x200
TCP_MSS_DEFAULT = 0x218
TCP_MSS_DESIRED = 0x4c4
TCP_NODELAY = 0x1
TCP_NOTSENT_LOWAT = 0x19
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
TCP_SAVED_SYN = 0x1c
TCP_SAVE_SYN = 0x1b
TCP_SYNCNT = 0x7
TCP_S_DATA_IN = 0x4
TCP_S_DATA_OUT = 0x8
TCP_THIN_DUPACK = 0x11
TCP_THIN_LINEAR_TIMEOUTS = 0x10
TCP_TIMESTAMP = 0x18
TCP_TX_DELAY = 0x25
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x2000741d
TCSBRKP = 0x5425
TCSETA = 0x80147418
TCSETAF = 0x8014741c
TCSETAW = 0x80147419
TCSETS = 0x802c7414
TCSETSF = 0x802c7416
TCSETSW = 0x802c7415
TCXONC = 0x2000741e
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
TIOCGDEV = 0x40045432
TIOCGETC = 0x40067412
TIOCGETD = 0x5424
TIOCGETP = 0x40067408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x5456
TIOCGLTC = 0x40067474
TIOCGPGRP = 0x40047477
TIOCGPKT = 0x40045438
TIOCGPTLCK = 0x40045439
TIOCGPTN = 0x40045430
TIOCGPTPEER = 0x20005441
TIOCGRS485 = 0x542e
TIOCGSERIAL = 0x541e
TIOCGSID = 0x5429
TIOCGSOFTCAR = 0x5419
TIOCGWINSZ = 0x40087468
TIOCINQ = 0x4004667f
TIOCLINUX = 0x541c
TIOCMBIC = 0x5417
TIOCMBIS = 0x5416
TIOCMGET = 0x5415
TIOCMIWAIT = 0x545c
TIOCMSET = 0x5418
TIOCM_CAR = 0x40
TIOCM_CD = 0x40
TIOCM_CTS = 0x20
TIOCM_DSR = 0x100
TIOCM_DTR = 0x2
TIOCM_LE = 0x1
TIOCM_LOOP = 0x8000
TIOCM_OUT1 = 0x2000
TIOCM_OUT2 = 0x4000
TIOCM_RI = 0x80
TIOCM_RNG = 0x80
TIOCM_RTS = 0x4
TIOCM_SR = 0x10
TIOCM_ST = 0x8
TIOCNOTTY = 0x5422
TIOCNXCL = 0x540d
TIOCOUTQ = 0x40047473
TIOCPKT = 0x5420
TIOCPKT_DATA = 0x0
TIOCPKT_DOSTOP = 0x20
TIOCPKT_FLUSHREAD = 0x1
TIOCPKT_FLUSHWRITE = 0x2
TIOCPKT_IOCTL = 0x40
TIOCPKT_NOSTOP = 0x10
TIOCPKT_START = 0x8
TIOCPKT_STOP = 0x4
TIOCSBRK = 0x5427
TIOCSCTTY = 0x540e
TIOCSERCONFIG = 0x5453
TIOCSERGETLSR = 0x5459
TIOCSERGETMULTI = 0x545a
TIOCSERGSTRUCT = 0x5458
TIOCSERGWILD = 0x5454
TIOCSERSETMULTI = 0x545b
TIOCSERSWILD = 0x5455
TIOCSER_TEMT = 0x1
TIOCSETC = 0x80067411
TIOCSETD = 0x5423
TIOCSETN = 0x8006740a
TIOCSETP = 0x80067409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSLTC = 0x80067475
TIOCSPGRP = 0x80047476
TIOCSPTLCK = 0x80045431
TIOCSRS485 = 0x542f
TIOCSSERIAL = 0x541f
TIOCSSOFTCAR = 0x541a
TIOCSTART = 0x2000746e
TIOCSTI = 0x5412
TIOCSTOP = 0x2000746f
TIOCSWINSZ = 0x80087467
TIOCVHANGUP = 0x5437
TIPC_ADDR_ID = 0x3
TIPC_ADDR_MCAST = 0x1
TIPC_ADDR_NAME = 0x2
TIPC_ADDR_NAMESEQ = 0x1
TIPC_AEAD_ALG_NAME = 0x20
TIPC_AEAD_KEYLEN_MAX = 0x24
TIPC_AEAD_KEYLEN_MIN = 0x14
TIPC_AEAD_KEY_SIZE_MAX = 0x48
TIPC_CFG_SRV = 0x0
TIPC_CLUSTER_BITS = 0xc
TIPC_CLUSTER_MASK = 0xfff000
TIPC_CLUSTER_OFFSET = 0xc
TIPC_CLUSTER_SIZE = 0xfff
TIPC_CONN_SHUTDOWN = 0x5
TIPC_CONN_TIMEOUT = 0x82
TIPC_CRITICAL_IMPORTANCE = 0x3
TIPC_DESTNAME = 0x3
TIPC_DEST_DROPPABLE = 0x81
TIPC_ERRINFO = 0x1
TIPC_ERR_NO_NAME = 0x1
TIPC_ERR_NO_NODE = 0x3
TIPC_ERR_NO_PORT = 0x2
TIPC_ERR_OVERLOAD = 0x4
TIPC_GROUP_JOIN = 0x87
TIPC_GROUP_LEAVE = 0x88
TIPC_GROUP_LOOPBACK = 0x1
TIPC_GROUP_MEMBER_EVTS = 0x2
TIPC_HIGH_IMPORTANCE = 0x2
TIPC_IMPORTANCE = 0x7f
TIPC_LINK_STATE = 0x2
TIPC_LOW_IMPORTANCE = 0x0
TIPC_MAX_BEARER_NAME = 0x20
TIPC_MAX_IF_NAME = 0x10
TIPC_MAX_LINK_NAME = 0x44
TIPC_MAX_MEDIA_NAME = 0x10
TIPC_MAX_USER_MSG_SIZE = 0x101d0
TIPC_MCAST_BROADCAST = 0x85
TIPC_MCAST_REPLICAST = 0x86
TIPC_MEDIUM_IMPORTANCE = 0x1
TIPC_NODEID_LEN = 0x10
TIPC_NODELAY = 0x8a
TIPC_NODE_BITS = 0xc
TIPC_NODE_MASK = 0xfff
TIPC_NODE_OFFSET = 0x0
TIPC_NODE_RECVQ_DEPTH = 0x83
TIPC_NODE_SIZE = 0xfff
TIPC_NODE_STATE = 0x0
TIPC_OK = 0x0
TIPC_PUBLISHED = 0x1
TIPC_RESERVED_TYPES = 0x40
TIPC_RETDATA = 0x2
TIPC_SERVICE_ADDR = 0x2
TIPC_SERVICE_RANGE = 0x1
TIPC_SOCKET_ADDR = 0x3
TIPC_SOCK_RECVQ_DEPTH = 0x84
TIPC_SOCK_RECVQ_USED = 0x89
TIPC_SRC_DROPPABLE = 0x80
TIPC_SUBSCR_TIMEOUT = 0x3
TIPC_SUB_CANCEL = 0x4
TIPC_SUB_PORTS = 0x1
TIPC_SUB_SERVICE = 0x2
TIPC_TOP_SRV = 0x1
TIPC_WAIT_FOREVER = 0xffffffff
TIPC_WITHDRAWN = 0x2
TIPC_ZONE_BITS = 0x8
TIPC_ZONE_CLUSTER_MASK = 0xfffff000
TIPC_ZONE_MASK = 0xff000000
TIPC_ZONE_OFFSET = 0x18
TIPC_ZONE_SCOPE = 0x1
TIPC_ZONE_SIZE = 0xff
TMPFS_MAGIC = 0x1021994
TOSTOP = 0x400000
TPACKET_ALIGNMENT = 0x10
TPACKET_HDRLEN = 0x34
TP_STATUS_AVAILABLE = 0x0
TP_STATUS_BLK_TMO = 0x20
TP_STATUS_COPY = 0x2
TP_STATUS_CSUMNOTREADY = 0x8
TP_STATUS_CSUM_VALID = 0x80
TP_STATUS_KERNEL = 0x0
TP_STATUS_LOSING = 0x4
TP_STATUS_SENDING = 0x2
TP_STATUS_SEND_REQUEST = 0x1
TP_STATUS_TS_RAW_HARDWARE = 0x80000000
TP_STATUS_TS_SOFTWARE = 0x20000000
TP_STATUS_TS_SYS_HARDWARE = 0x40000000
TP_STATUS_USER = 0x1
TP_STATUS_VLAN_TPID_VALID = 0x40
TP_STATUS_VLAN_VALID = 0x10
TP_STATUS_WRONG_FORMAT = 0x4
TRACEFS_MAGIC = 0x74726163
TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2
TUNGETSNDBUF = 0x400454d3
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
TUNSETIFF = 0x800454ca
TUNSETIFINDEX = 0x800454da
TUNSETLINK = 0x800454cd
TUNSETNOCSUM = 0x800454c8
TUNSETOFFLOAD = 0x800454d0
TUNSETOWNER = 0x800454cc
TUNSETPERSIST = 0x800454cb
TUNSETQUEUE = 0x800454d9
TUNSETSNDBUF = 0x800454d4
TUNSETSTEERINGEBPF = 0x400454e0
TUNSETTXFILTER = 0x800454d1
TUNSETVNETBE = 0x800454de
TUNSETVNETHDRSZ = 0x800454d8
TUNSETVNETLE = 0x800454dc
UBI_IOCATT = 0x80186f40
UBI_IOCDET = 0x80046f41
UBI_IOCEBCH = 0x80044f02
UBI_IOCEBER = 0x80044f01
UBI_IOCEBISMAP = 0x40044f05
UBI_IOCEBMAP = 0x80084f03
UBI_IOCEBUNMAP = 0x80044f04
UBI_IOCMKVOL = 0x80986f00
UBI_IOCRMVOL = 0x80046f01
UBI_IOCRNVOL = 0x91106f03
UBI_IOCRPEB = 0x80046f04
UBI_IOCRSVOL = 0x800c6f02
UBI_IOCSETVOLPROP = 0x80104f06
UBI_IOCSPEB = 0x80046f05
UBI_IOCVOLCRBLK = 0x80804f07
UBI_IOCVOLRMBLK = 0x20004f08
UBI_IOCVOLUP = 0x80084f00
UDF_SUPER_MAGIC = 0x15013346
UMOUNT_NOFOLLOW = 0x8
USBDEVICE_SUPER_MAGIC = 0x9fa2
UTIME_NOW = 0x3fffffff
UTIME_OMIT = 0x3ffffffe
V9FS_MAGIC = 0x1021997
VDISCARD = 0x10
VEOF = 0x4
VEOL = 0x6
VEOL2 = 0x8
VERASE = 0x2
VINTR = 0x0
VKILL = 0x3
VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x5
VM_SOCKETS_INVALID_VERSION = 0xffffffff
VQUIT = 0x1
VREPRINT = 0xb
VSTART = 0xd
VSTOP = 0xe
VSUSP = 0xc
VSWTC = 0x9
VT0 = 0x0
VT1 = 0x10000
VTDLY = 0x10000
VTIME = 0x7
VWERASE = 0xa
WALL = 0x40000000
WCLONE = 0x80000000
WCONTINUED = 0x8
WDIOC_GETBOOTSTATUS = 0x40045702
WDIOC_GETPRETIMEOUT = 0x40045709
WDIOC_GETSTATUS = 0x40045701
WDIOC_GETSUPPORT = 0x40285700
WDIOC_GETTEMP = 0x40045703
WDIOC_GETTIMELEFT = 0x4004570a
WDIOC_GETTIMEOUT = 0x40045707
WDIOC_KEEPALIVE = 0x40045705
WDIOC_SETOPTIONS = 0x40045704
WDIOC_SETPRETIMEOUT = 0xc0045708
WDIOC_SETTIMEOUT = 0xc0045706
WEXITED = 0x4
WIN_ACKMEDIACHANGE = 0xdb
WIN_CHECKPOWERMODE1 = 0xe5
WIN_CHECKPOWERMODE2 = 0x98
WIN_DEVICE_RESET = 0x8
WIN_DIAGNOSE = 0x90
WIN_DOORLOCK = 0xde
WIN_DOORUNLOCK = 0xdf
WIN_DOWNLOAD_MICROCODE = 0x92
WIN_FLUSH_CACHE = 0xe7
WIN_FLUSH_CACHE_EXT = 0xea
WIN_FORMAT = 0x50
WIN_GETMEDIASTATUS = 0xda
WIN_IDENTIFY = 0xec
WIN_IDENTIFY_DMA = 0xee
WIN_IDLEIMMEDIATE = 0xe1
WIN_INIT = 0x60
WIN_MEDIAEJECT = 0xed
WIN_MULTREAD = 0xc4
WIN_MULTREAD_EXT = 0x29
WIN_MULTWRITE = 0xc5
WIN_MULTWRITE_EXT = 0x39
WIN_NOP = 0x0
WIN_PACKETCMD = 0xa0
WIN_PIDENTIFY = 0xa1
WIN_POSTBOOT = 0xdc
WIN_PREBOOT = 0xdd
WIN_QUEUED_SERVICE = 0xa2
WIN_READ = 0x20
WIN_READDMA = 0xc8
WIN_READDMA_EXT = 0x25
WIN_READDMA_ONCE = 0xc9
WIN_READDMA_QUEUED = 0xc7
WIN_READDMA_QUEUED_EXT = 0x26
WIN_READ_BUFFER = 0xe4
WIN_READ_EXT = 0x24
WIN_READ_LONG = 0x22
WIN_READ_LONG_ONCE = 0x23
WIN_READ_NATIVE_MAX = 0xf8
WIN_READ_NATIVE_MAX_EXT = 0x27
WIN_READ_ONCE = 0x21
WIN_RECAL = 0x10
WIN_RESTORE = 0x10
WIN_SECURITY_DISABLE = 0xf6
WIN_SECURITY_ERASE_PREPARE = 0xf3
WIN_SECURITY_ERASE_UNIT = 0xf4
WIN_SECURITY_FREEZE_LOCK = 0xf5
WIN_SECURITY_SET_PASS = 0xf1
WIN_SECURITY_UNLOCK = 0xf2
WIN_SEEK = 0x70
WIN_SETFEATURES = 0xef
WIN_SETIDLE1 = 0xe3
WIN_SETIDLE2 = 0x97
WIN_SETMULT = 0xc6
WIN_SET_MAX = 0xf9
WIN_SET_MAX_EXT = 0x37
WIN_SLEEPNOW1 = 0xe6
WIN_SLEEPNOW2 = 0x99
WIN_SMART = 0xb0
WIN_SPECIFY = 0x91
WIN_SRST = 0x8
WIN_STANDBY = 0xe2
WIN_STANDBY2 = 0x96
WIN_STANDBYNOW1 = 0xe0
WIN_STANDBYNOW2 = 0x94
WIN_VERIFY = 0x40
WIN_VERIFY_EXT = 0x42
WIN_VERIFY_ONCE = 0x41
WIN_WRITE = 0x30
WIN_WRITEDMA = 0xca
WIN_WRITEDMA_EXT = 0x35
WIN_WRITEDMA_ONCE = 0xcb
WIN_WRITEDMA_QUEUED = 0xcc
WIN_WRITEDMA_QUEUED_EXT = 0x36
WIN_WRITE_BUFFER = 0xe8
WIN_WRITE_EXT = 0x34
WIN_WRITE_LONG = 0x32
WIN_WRITE_LONG_ONCE = 0x33
WIN_WRITE_ONCE = 0x31
WIN_WRITE_SAME = 0xe9
WIN_WRITE_VERIFY = 0x3c
WNOHANG = 0x1
WNOTHREAD = 0x20000000
WNOWAIT = 0x1000000
WORDSIZE = 0x40
WSTOPPED = 0x2
WUNTRACED = 0x2
XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2
XCASE = 0x4000
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_OPTIONS = 0x8
XDP_OPTIONS_ZEROCOPY = 0x1
XDP_PACKET_HEADROOM = 0x100
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RING_NEED_WAKEUP = 0x1
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1
XDP_USE_NEED_WAKEUP = 0x8
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0xc00
Z3FOLD_MAGIC = 0x33
ZSMALLOC_MAGIC = 0x58295829
)
// Errors
const (
E2BIG = syscall.Errno(0x7)
EACCES = syscall.Errno(0xd)
EADDRINUSE = syscall.Errno(0x62)
EADDRNOTAVAIL = syscall.Errno(0x63)
EADV = syscall.Errno(0x44)
EAFNOSUPPORT = syscall.Errno(0x61)
EAGAIN = syscall.Errno(0xb)
EALREADY = syscall.Errno(0x72)
EBADE = syscall.Errno(0x34)
EBADF = syscall.Errno(0x9)
EBADFD = syscall.Errno(0x4d)
EBADMSG = syscall.Errno(0x4a)
EBADR = syscall.Errno(0x35)
EBADRQC = syscall.Errno(0x38)
EBADSLT = syscall.Errno(0x39)
EBFONT = syscall.Errno(0x3b)
EBUSY = syscall.Errno(0x10)
ECANCELED = syscall.Errno(0x7d)
ECHILD = syscall.Errno(0xa)
ECHRNG = syscall.Errno(0x2c)
ECOMM = syscall.Errno(0x46)
ECONNABORTED = syscall.Errno(0x67)
ECONNREFUSED = syscall.Errno(0x6f)
ECONNRESET = syscall.Errno(0x68)
EDEADLK = syscall.Errno(0x23)
EDEADLOCK = syscall.Errno(0x3a)
EDESTADDRREQ = syscall.Errno(0x59)
EDOM = syscall.Errno(0x21)
EDOTDOT = syscall.Errno(0x49)
EDQUOT = syscall.Errno(0x7a)
EEXIST = syscall.Errno(0x11)
EFAULT = syscall.Errno(0xe)
EFBIG = syscall.Errno(0x1b)
EHOSTDOWN = syscall.Errno(0x70)
EHOSTUNREACH = syscall.Errno(0x71)
EHWPOISON = syscall.Errno(0x85)
EIDRM = syscall.Errno(0x2b)
EILSEQ = syscall.Errno(0x54)
EINPROGRESS = syscall.Errno(0x73)
EINTR = syscall.Errno(0x4)
EINVAL = syscall.Errno(0x16)
EIO = syscall.Errno(0x5)
EISCONN = syscall.Errno(0x6a)
EISDIR = syscall.Errno(0x15)
EISNAM = syscall.Errno(0x78)
EKEYEXPIRED = syscall.Errno(0x7f)
EKEYREJECTED = syscall.Errno(0x81)
EKEYREVOKED = syscall.Errno(0x80)
EL2HLT = syscall.Errno(0x33)
EL2NSYNC = syscall.Errno(0x2d)
EL3HLT = syscall.Errno(0x2e)
EL3RST = syscall.Errno(0x2f)
ELIBACC = syscall.Errno(0x4f)
ELIBBAD = syscall.Errno(0x50)
ELIBEXEC = syscall.Errno(0x53)
ELIBMAX = syscall.Errno(0x52)
ELIBSCN = syscall.Errno(0x51)
ELNRNG = syscall.Errno(0x30)
ELOOP = syscall.Errno(0x28)
EMEDIUMTYPE = syscall.Errno(0x7c)
EMFILE = syscall.Errno(0x18)
EMLINK = syscall.Errno(0x1f)
EMSGSIZE = syscall.Errno(0x5a)
EMULTIHOP = syscall.Errno(0x48)
ENAMETOOLONG = syscall.Errno(0x24)
ENAVAIL = syscall.Errno(0x77)
ENETDOWN = syscall.Errno(0x64)
ENETRESET = syscall.Errno(0x66)
ENETUNREACH = syscall.Errno(0x65)
ENFILE = syscall.Errno(0x17)
ENOANO = syscall.Errno(0x37)
ENOBUFS = syscall.Errno(0x69)
ENOCSI = syscall.Errno(0x32)
ENODATA = syscall.Errno(0x3d)
ENODEV = syscall.Errno(0x13)
ENOENT = syscall.Errno(0x2)
ENOEXEC = syscall.Errno(0x8)
ENOKEY = syscall.Errno(0x7e)
ENOLCK = syscall.Errno(0x25)
ENOLINK = syscall.Errno(0x43)
ENOMEDIUM = syscall.Errno(0x7b)
ENOMEM = syscall.Errno(0xc)
ENOMSG = syscall.Errno(0x2a)
ENONET = syscall.Errno(0x40)
ENOPKG = syscall.Errno(0x41)
ENOPROTOOPT = syscall.Errno(0x5c)
ENOSPC = syscall.Errno(0x1c)
ENOSR = syscall.Errno(0x3f)
ENOSTR = syscall.Errno(0x3c)
ENOSYS = syscall.Errno(0x26)
ENOTBLK = syscall.Errno(0xf)
ENOTCONN = syscall.Errno(0x6b)
ENOTDIR = syscall.Errno(0x14)
ENOTEMPTY = syscall.Errno(0x27)
ENOTNAM = syscall.Errno(0x76)
ENOTRECOVERABLE = syscall.Errno(0x83)
ENOTSOCK = syscall.Errno(0x58)
ENOTSUP = syscall.Errno(0x5f)
ENOTTY = syscall.Errno(0x19)
ENOTUNIQ = syscall.Errno(0x4c)
ENXIO = syscall.Errno(0x6)
EOPNOTSUPP = syscall.Errno(0x5f)
EOVERFLOW = syscall.Errno(0x4b)
EOWNERDEAD = syscall.Errno(0x82)
EPERM = syscall.Errno(0x1)
EPFNOSUPPORT = syscall.Errno(0x60)
EPIPE = syscall.Errno(0x20)
EPROTO = syscall.Errno(0x47)
EPROTONOSUPPORT = syscall.Errno(0x5d)
EPROTOTYPE = syscall.Errno(0x5b)
ERANGE = syscall.Errno(0x22)
EREMCHG = syscall.Errno(0x4e)
EREMOTE = syscall.Errno(0x42)
EREMOTEIO = syscall.Errno(0x79)
ERESTART = syscall.Errno(0x55)
ERFKILL = syscall.Errno(0x84)
EROFS = syscall.Errno(0x1e)
ESHUTDOWN = syscall.Errno(0x6c)
ESOCKTNOSUPPORT = syscall.Errno(0x5e)
ESPIPE = syscall.Errno(0x1d)
ESRCH = syscall.Errno(0x3)
ESRMNT = syscall.Errno(0x45)
ESTALE = syscall.Errno(0x74)
ESTRPIPE = syscall.Errno(0x56)
ETIME = syscall.Errno(0x3e)
ETIMEDOUT = syscall.Errno(0x6e)
ETOOMANYREFS = syscall.Errno(0x6d)
ETXTBSY = syscall.Errno(0x1a)
EUCLEAN = syscall.Errno(0x75)
EUNATCH = syscall.Errno(0x31)
EUSERS = syscall.Errno(0x57)
EWOULDBLOCK = syscall.Errno(0xb)
EXDEV = syscall.Errno(0x12)
EXFULL = syscall.Errno(0x36)
)
// Signals
const (
SIGABRT = syscall.Signal(0x6)
SIGALRM = syscall.Signal(0xe)
SIGBUS = syscall.Signal(0x7)
SIGCHLD = syscall.Signal(0x11)
SIGCLD = syscall.Signal(0x11)
SIGCONT = syscall.Signal(0x12)
SIGFPE = syscall.Signal(0x8)
SIGHUP = syscall.Signal(0x1)
SIGILL = syscall.Signal(0x4)
SIGINT = syscall.Signal(0x2)
SIGIO = syscall.Signal(0x1d)
SIGIOT = syscall.Signal(0x6)
SIGKILL = syscall.Signal(0x9)
SIGPIPE = syscall.Signal(0xd)
SIGPOLL = syscall.Signal(0x1d)
SIGPROF = syscall.Signal(0x1b)
SIGPWR = syscall.Signal(0x1e)
SIGQUIT = syscall.Signal(0x3)
SIGSEGV = syscall.Signal(0xb)
SIGSTKFLT = syscall.Signal(0x10)
SIGSTOP = syscall.Signal(0x13)
SIGSYS = syscall.Signal(0x1f)
SIGTERM = syscall.Signal(0xf)
SIGTRAP = syscall.Signal(0x5)
SIGTSTP = syscall.Signal(0x14)
SIGTTIN = syscall.Signal(0x15)
SIGTTOU = syscall.Signal(0x16)
SIGURG = syscall.Signal(0x17)
SIGUSR1 = syscall.Signal(0xa)
SIGUSR2 = syscall.Signal(0xc)
SIGVTALRM = syscall.Signal(0x1a)
SIGWINCH = syscall.Signal(0x1c)
SIGXCPU = syscall.Signal(0x18)
SIGXFSZ = syscall.Signal(0x19)
)
// Error table
var errorList = [...]struct {
num syscall.Errno
name string
desc string
}{
{1, "EPERM", "operation not permitted"},
{2, "ENOENT", "no such file or directory"},
{3, "ESRCH", "no such process"},
{4, "EINTR", "interrupted system call"},
{5, "EIO", "input/output error"},
{6, "ENXIO", "no such device or address"},
{7, "E2BIG", "argument list too long"},
{8, "ENOEXEC", "exec format error"},
{9, "EBADF", "bad file descriptor"},
{10, "ECHILD", "no child processes"},
{11, "EAGAIN", "resource temporarily unavailable"},
{12, "ENOMEM", "cannot allocate memory"},
{13, "EACCES", "permission denied"},
{14, "EFAULT", "bad address"},
{15, "ENOTBLK", "block device required"},
{16, "EBUSY", "device or resource busy"},
{17, "EEXIST", "file exists"},
{18, "EXDEV", "invalid cross-device link"},
{19, "ENODEV", "no such device"},
{20, "ENOTDIR", "not a directory"},
{21, "EISDIR", "is a directory"},
{22, "EINVAL", "invalid argument"},
{23, "ENFILE", "too many open files in system"},
{24, "EMFILE", "too many open files"},
{25, "ENOTTY", "inappropriate ioctl for device"},
{26, "ETXTBSY", "text file busy"},
{27, "EFBIG", "file too large"},
{28, "ENOSPC", "no space left on device"},
{29, "ESPIPE", "illegal seek"},
{30, "EROFS", "read-only file system"},
{31, "EMLINK", "too many links"},
{32, "EPIPE", "broken pipe"},
{33, "EDOM", "numerical argument out of domain"},
{34, "ERANGE", "numerical result out of range"},
{35, "EDEADLK", "resource deadlock avoided"},
{36, "ENAMETOOLONG", "file name too long"},
{37, "ENOLCK", "no locks available"},
{38, "ENOSYS", "function not implemented"},
{39, "ENOTEMPTY", "directory not empty"},
{40, "ELOOP", "too many levels of symbolic links"},
{42, "ENOMSG", "no message of desired type"},
{43, "EIDRM", "identifier removed"},
{44, "ECHRNG", "channel number out of range"},
{45, "EL2NSYNC", "level 2 not synchronized"},
{46, "EL3HLT", "level 3 halted"},
{47, "EL3RST", "level 3 reset"},
{48, "ELNRNG", "link number out of range"},
{49, "EUNATCH", "protocol driver not attached"},
{50, "ENOCSI", "no CSI structure available"},
{51, "EL2HLT", "level 2 halted"},
{52, "EBADE", "invalid exchange"},
{53, "EBADR", "invalid request descriptor"},
{54, "EXFULL", "exchange full"},
{55, "ENOANO", "no anode"},
{56, "EBADRQC", "invalid request code"},
{57, "EBADSLT", "invalid slot"},
{58, "EDEADLOCK", "file locking deadlock error"},
{59, "EBFONT", "bad font file format"},
{60, "ENOSTR", "device not a stream"},
{61, "ENODATA", "no data available"},
{62, "ETIME", "timer expired"},
{63, "ENOSR", "out of streams resources"},
{64, "ENONET", "machine is not on the network"},
{65, "ENOPKG", "package not installed"},
{66, "EREMOTE", "object is remote"},
{67, "ENOLINK", "link has been severed"},
{68, "EADV", "advertise error"},
{69, "ESRMNT", "srmount error"},
{70, "ECOMM", "communication error on send"},
{71, "EPROTO", "protocol error"},
{72, "EMULTIHOP", "multihop attempted"},
{73, "EDOTDOT", "RFS specific error"},
{74, "EBADMSG", "bad message"},
{75, "EOVERFLOW", "value too large for defined data type"},
{76, "ENOTUNIQ", "name not unique on network"},
{77, "EBADFD", "file descriptor in bad state"},
{78, "EREMCHG", "remote address changed"},
{79, "ELIBACC", "can not access a needed shared library"},
{80, "ELIBBAD", "accessing a corrupted shared library"},
{81, "ELIBSCN", ".lib section in a.out corrupted"},
{82, "ELIBMAX", "attempting to link in too many shared libraries"},
{83, "ELIBEXEC", "cannot exec a shared library directly"},
{84, "EILSEQ", "invalid or incomplete multibyte or wide character"},
{85, "ERESTART", "interrupted system call should be restarted"},
{86, "ESTRPIPE", "streams pipe error"},
{87, "EUSERS", "too many users"},
{88, "ENOTSOCK", "socket operation on non-socket"},
{89, "EDESTADDRREQ", "destination address required"},
{90, "EMSGSIZE", "message too long"},
{91, "EPROTOTYPE", "protocol wrong type for socket"},
{92, "ENOPROTOOPT", "protocol not available"},
{93, "EPROTONOSUPPORT", "protocol not supported"},
{94, "ESOCKTNOSUPPORT", "socket type not supported"},
{95, "ENOTSUP", "operation not supported"},
{96, "EPFNOSUPPORT", "protocol family not supported"},
{97, "EAFNOSUPPORT", "address family not supported by protocol"},
{98, "EADDRINUSE", "address already in use"},
{99, "EADDRNOTAVAIL", "cannot assign requested address"},
{100, "ENETDOWN", "network is down"},
{101, "ENETUNREACH", "network is unreachable"},
{102, "ENETRESET", "network dropped connection on reset"},
{103, "ECONNABORTED", "software caused connection abort"},
{104, "ECONNRESET", "connection reset by peer"},
{105, "ENOBUFS", "no buffer space available"},
{106, "EISCONN", "transport endpoint is already connected"},
{107, "ENOTCONN", "transport endpoint is not connected"},
{108, "ESHUTDOWN", "cannot send after transport endpoint shutdown"},
{109, "ETOOMANYREFS", "too many references: cannot splice"},
{110, "ETIMEDOUT", "connection timed out"},
{111, "ECONNREFUSED", "connection refused"},
{112, "EHOSTDOWN", "host is down"},
{113, "EHOSTUNREACH", "no route to host"},
{114, "EALREADY", "operation already in progress"},
{115, "EINPROGRESS", "operation now in progress"},
{116, "ESTALE", "stale file handle"},
{117, "EUCLEAN", "structure needs cleaning"},
{118, "ENOTNAM", "not a XENIX named type file"},
{119, "ENAVAIL", "no XENIX semaphores available"},
{120, "EISNAM", "is a named type file"},
{121, "EREMOTEIO", "remote I/O error"},
{122, "EDQUOT", "disk quota exceeded"},
{123, "ENOMEDIUM", "no medium found"},
{124, "EMEDIUMTYPE", "wrong medium type"},
{125, "ECANCELED", "operation canceled"},
{126, "ENOKEY", "required key not available"},
{127, "EKEYEXPIRED", "key has expired"},
{128, "EKEYREVOKED", "key has been revoked"},
{129, "EKEYREJECTED", "key was rejected by service"},
{130, "EOWNERDEAD", "owner died"},
{131, "ENOTRECOVERABLE", "state not recoverable"},
{132, "ERFKILL", "operation not possible due to RF-kill"},
{133, "EHWPOISON", "memory page has hardware error"},
}
// Signal table
var signalList = [...]struct {
num syscall.Signal
name string
desc string
}{
{1, "SIGHUP", "hangup"},
{2, "SIGINT", "interrupt"},
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/breakpoint trap"},
{6, "SIGABRT", "aborted"},
{7, "SIGBUS", "bus error"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
{10, "SIGUSR1", "user defined signal 1"},
{11, "SIGSEGV", "segmentation fault"},
{12, "SIGUSR2", "user defined signal 2"},
{13, "SIGPIPE", "broken pipe"},
{14, "SIGALRM", "alarm clock"},
{15, "SIGTERM", "terminated"},
{16, "SIGSTKFLT", "stack fault"},
{17, "SIGCHLD", "child exited"},
{18, "SIGCONT", "continued"},
{19, "SIGSTOP", "stopped (signal)"},
{20, "SIGTSTP", "stopped"},
{21, "SIGTTIN", "stopped (tty input)"},
{22, "SIGTTOU", "stopped (tty output)"},
{23, "SIGURG", "urgent I/O condition"},
{24, "SIGXCPU", "CPU time limit exceeded"},
{25, "SIGXFSZ", "file size limit exceeded"},
{26, "SIGVTALRM", "virtual timer expired"},
{27, "SIGPROF", "profiling timer expired"},
{28, "SIGWINCH", "window changed"},
{29, "SIGIO", "I/O possible"},
{30, "SIGPWR", "power failure"},
{31, "SIGSYS", "bad system call"},
}
| cockroachdb/etcd | vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go | GO | apache-2.0 | 166,962 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tinkerpop.gremlin.process.util;
import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.LambdaFilterStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.IdentityStep;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.structure.PropertyType;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
import org.junit.Test;
import org.mockito.Mockito;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class TraversalHelperTest {
@Test
public void shouldNotFindStepOfClassInTraversal() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertThat(TraversalHelper.hasStepOfClass(FilterStep.class, traversal), is(false));
}
@Test
public void shouldFindStepOfClassInTraversal() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new IdentityStep<>(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertThat(TraversalHelper.hasStepOfClass(IdentityStep.class, traversal), is(true));
}
@Test
public void shouldNotFindStepOfAssignableClassInTraversal() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertThat(TraversalHelper.hasStepOfAssignableClass(IdentityStep.class, traversal), is(false));
}
@Test
public void shouldFindStepOfAssignableClassInTraversal() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertThat(TraversalHelper.hasStepOfAssignableClass(FilterStep.class, traversal), is(true));
}
@Test
public void shouldGetTheStepIndex() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
final HasStep hasStep = new HasStep(traversal);
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, hasStep);
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertEquals(1, TraversalHelper.stepIndex(hasStep, traversal));
}
@Test
public void shouldNotFindTheStepIndex() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
final IdentityStep identityStep = new IdentityStep(traversal);
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new HasStep(traversal));
assertEquals(-1, TraversalHelper.stepIndex(identityStep, traversal));
}
@Test
public void shouldInsertBeforeStep() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
final HasStep hasStep = new HasStep(traversal);
final IdentityStep identityStep = new IdentityStep(traversal);
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, hasStep);
traversal.asAdmin().addStep(0, new HasStep(traversal));
TraversalHelper.insertBeforeStep(identityStep, hasStep, traversal);
assertEquals(traversal.asAdmin().getSteps().get(1), identityStep);
assertEquals(4, traversal.asAdmin().getSteps().size());
}
@Test
public void shouldInsertAfterStep() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
final HasStep hasStep = new HasStep(traversal);
final IdentityStep identityStep = new IdentityStep(traversal);
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, hasStep);
traversal.asAdmin().addStep(0, new HasStep(traversal));
TraversalHelper.insertAfterStep(identityStep, hasStep, traversal);
assertEquals(traversal.asAdmin().getSteps().get(2), identityStep);
assertEquals(4, traversal.asAdmin().getSteps().size());
}
@Test
public void shouldReplaceStep() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
final HasStep hasStep = new HasStep(traversal);
final IdentityStep identityStep = new IdentityStep(traversal);
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, hasStep);
traversal.asAdmin().addStep(0, new HasStep(traversal));
TraversalHelper.replaceStep(hasStep, identityStep, traversal);
assertEquals(traversal.asAdmin().getSteps().get(1), identityStep);
assertEquals(3, traversal.asAdmin().getSteps().size());
}
@Test
public void shouldChainTogetherStepsWithNextPreviousInALinkedListStructure() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(new IdentityStep(traversal));
traversal.asAdmin().addStep(new HasStep(traversal));
traversal.asAdmin().addStep(new LambdaFilterStep(traversal, traverser -> true));
validateToyTraversal(traversal);
}
@Test
public void shouldAddStepsCorrectly() {
Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new LambdaFilterStep(traversal, traverser -> true));
traversal.asAdmin().addStep(0, new HasStep(traversal));
traversal.asAdmin().addStep(0, new IdentityStep(traversal));
validateToyTraversal(traversal);
traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(0, new IdentityStep(traversal));
traversal.asAdmin().addStep(1, new HasStep(traversal));
traversal.asAdmin().addStep(2, new LambdaFilterStep(traversal, traverser -> true));
validateToyTraversal(traversal);
}
@Test
public void shouldRemoveStepsCorrectly() {
final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
traversal.asAdmin().addStep(new IdentityStep(traversal));
traversal.asAdmin().addStep(new HasStep(traversal));
traversal.asAdmin().addStep(new LambdaFilterStep(traversal, traverser -> true));
traversal.asAdmin().addStep(new PropertiesStep(traversal, PropertyType.VALUE, "marko"));
traversal.asAdmin().removeStep(3);
validateToyTraversal(traversal);
traversal.asAdmin().addStep(0, new PropertiesStep(traversal, PropertyType.PROPERTY, "marko"));
traversal.asAdmin().removeStep(0);
validateToyTraversal(traversal);
traversal.asAdmin().removeStep(1);
traversal.asAdmin().addStep(1, new HasStep(traversal));
validateToyTraversal(traversal);
}
private static void validateToyTraversal(final Traversal traversal) {
assertEquals(traversal.asAdmin().getSteps().size(), 3);
assertEquals(IdentityStep.class, traversal.asAdmin().getSteps().get(0).getClass());
assertEquals(HasStep.class, traversal.asAdmin().getSteps().get(1).getClass());
assertEquals(LambdaFilterStep.class, traversal.asAdmin().getSteps().get(2).getClass());
// IDENTITY STEP
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(0)).getPreviousStep().getClass());
assertEquals(HasStep.class, ((Step) traversal.asAdmin().getSteps().get(0)).getNextStep().getClass());
assertEquals(LambdaFilterStep.class, ((Step) traversal.asAdmin().getSteps().get(0)).getNextStep().getNextStep().getClass());
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(0)).getNextStep().getNextStep().getNextStep().getClass());
// HAS STEP
assertEquals(IdentityStep.class, ((Step) traversal.asAdmin().getSteps().get(1)).getPreviousStep().getClass());
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(1)).getPreviousStep().getPreviousStep().getClass());
assertEquals(LambdaFilterStep.class, ((Step) traversal.asAdmin().getSteps().get(1)).getNextStep().getClass());
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(1)).getNextStep().getNextStep().getClass());
// FILTER STEP
assertEquals(HasStep.class, ((Step) traversal.asAdmin().getSteps().get(2)).getPreviousStep().getClass());
assertEquals(IdentityStep.class, ((Step) traversal.asAdmin().getSteps().get(2)).getPreviousStep().getPreviousStep().getClass());
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(2)).getPreviousStep().getPreviousStep().getPreviousStep().getClass());
assertEquals(EmptyStep.class, ((Step) traversal.asAdmin().getSteps().get(2)).getNextStep().getClass());
assertEquals(3, traversal.asAdmin().getSteps().size());
}
@Test
public void shouldTruncateLongName() {
Step s = Mockito.mock(Step.class);
Mockito.when(s.toString()).thenReturn("0123456789");
assertEquals("0123...", TraversalHelper.getShortName(s, 7));
}
}
| dalaro/incubator-tinkerpop | gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/util/TraversalHelperTest.java | Java | apache-2.0 | 11,573 |
"""Support for binary sensor using the PiFace Digital I/O module on a RPi."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.components import rpi_pfio
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
CONF_INVERT_LOGIC = 'invert_logic'
CONF_PORTS = 'ports'
CONF_SETTLE_TIME = 'settle_time'
DEFAULT_INVERT_LOGIC = False
DEFAULT_SETTLE_TIME = 20
PORT_SCHEMA = vol.Schema({
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_SETTLE_TIME, default=DEFAULT_SETTLE_TIME):
cv.positive_int,
vol.Optional(CONF_INVERT_LOGIC, default=DEFAULT_INVERT_LOGIC): cv.boolean,
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_PORTS, default={}): vol.Schema({
cv.positive_int: PORT_SCHEMA,
})
})
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the PiFace Digital Input devices."""
binary_sensors = []
ports = config.get(CONF_PORTS)
for port, port_entity in ports.items():
name = port_entity.get(CONF_NAME)
settle_time = port_entity[CONF_SETTLE_TIME] / 1000
invert_logic = port_entity[CONF_INVERT_LOGIC]
binary_sensors.append(RPiPFIOBinarySensor(
hass, port, name, settle_time, invert_logic))
add_entities(binary_sensors, True)
rpi_pfio.activate_listener(hass)
class RPiPFIOBinarySensor(BinarySensorDevice):
"""Represent a binary sensor that a PiFace Digital Input."""
def __init__(self, hass, port, name, settle_time, invert_logic):
"""Initialize the RPi binary sensor."""
self._port = port
self._name = name or DEVICE_DEFAULT_NAME
self._invert_logic = invert_logic
self._state = None
def read_pfio(port):
"""Read state from PFIO."""
self._state = rpi_pfio.read_input(self._port)
self.schedule_update_ha_state()
rpi_pfio.edge_detect(hass, self._port, read_pfio, settle_time)
@property
def should_poll(self):
"""No polling needed."""
return False
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def is_on(self):
"""Return the state of the entity."""
return self._state != self._invert_logic
def update(self):
"""Update the PFIO state."""
self._state = rpi_pfio.read_input(self._port)
| MartinHjelmare/home-assistant | homeassistant/components/rpi_pfio/binary_sensor.py | Python | apache-2.0 | 2,581 |
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.security.rest.action.apikey;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequest;
import org.elasticsearch.xpack.core.security.action.CreateApiKeyRequestBuilder;
import java.io.IOException;
import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
/**
* Rest action to create an API key
*/
public final class RestCreateApiKeyAction extends ApiKeyBaseRestHandler {
/**
* @param settings the node's settings
* @param licenseState the license state that will be used to determine if
* security is licensed
*/
public RestCreateApiKeyAction(Settings settings, XPackLicenseState licenseState) {
super(settings, licenseState);
}
@Override
public List<Route> routes() {
return List.of(
new Route(POST, "/_security/api_key"),
new Route(PUT, "/_security/api_key"));
}
@Override
public String getName() {
return "xpack_security_create_api_key";
}
@Override
protected RestChannelConsumer innerPrepareRequest(final RestRequest request, final NodeClient client) throws IOException {
String refresh = request.param("refresh");
CreateApiKeyRequestBuilder builder = new CreateApiKeyRequestBuilder(client)
.source(request.requiredContent(), request.getXContentType())
.setRefreshPolicy((refresh != null) ?
WriteRequest.RefreshPolicy.parse(request.param("refresh")) : CreateApiKeyRequest.DEFAULT_REFRESH_POLICY);
return channel -> builder.execute(new RestToXContentListener<>(channel));
}
}
| gingerwizard/elasticsearch | x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestCreateApiKeyAction.java | Java | apache-2.0 | 2,255 |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/descriptor.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include <google/protobuf/descriptor.pb.h>
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
class FileDescriptorSetDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorSet> {
} _FileDescriptorSet_default_instance_;
class FileDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorProto> {
} _FileDescriptorProto_default_instance_;
class DescriptorProto_ExtensionRangeDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ExtensionRange> {
} _DescriptorProto_ExtensionRange_default_instance_;
class DescriptorProto_ReservedRangeDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ReservedRange> {
} _DescriptorProto_ReservedRange_default_instance_;
class DescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto> {
} _DescriptorProto_default_instance_;
class FieldDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<FieldDescriptorProto> {
} _FieldDescriptorProto_default_instance_;
class OneofDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<OneofDescriptorProto> {
} _OneofDescriptorProto_default_instance_;
class EnumDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto> {
} _EnumDescriptorProto_default_instance_;
class EnumValueDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<EnumValueDescriptorProto> {
} _EnumValueDescriptorProto_default_instance_;
class ServiceDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<ServiceDescriptorProto> {
} _ServiceDescriptorProto_default_instance_;
class MethodDescriptorProtoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<MethodDescriptorProto> {
} _MethodDescriptorProto_default_instance_;
class FileOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<FileOptions> {
} _FileOptions_default_instance_;
class MessageOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<MessageOptions> {
} _MessageOptions_default_instance_;
class FieldOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<FieldOptions> {
} _FieldOptions_default_instance_;
class OneofOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<OneofOptions> {
} _OneofOptions_default_instance_;
class EnumOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<EnumOptions> {
} _EnumOptions_default_instance_;
class EnumValueOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<EnumValueOptions> {
} _EnumValueOptions_default_instance_;
class ServiceOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<ServiceOptions> {
} _ServiceOptions_default_instance_;
class MethodOptionsDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<MethodOptions> {
} _MethodOptions_default_instance_;
class UninterpretedOption_NamePartDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption_NamePart> {
} _UninterpretedOption_NamePart_default_instance_;
class UninterpretedOptionDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption> {
} _UninterpretedOption_default_instance_;
class SourceCodeInfo_LocationDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo_Location> {
} _SourceCodeInfo_Location_default_instance_;
class SourceCodeInfoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo> {
} _SourceCodeInfo_default_instance_;
class GeneratedCodeInfo_AnnotationDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo_Annotation> {
} _GeneratedCodeInfo_Annotation_default_instance_;
class GeneratedCodeInfoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo> {
} _GeneratedCodeInfo_default_instance_;
namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto {
namespace {
::google::protobuf::Metadata file_level_metadata[25];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6];
} // namespace
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
const TableStruct::entries[] = {
{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
};
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
const TableStruct::aux[] = {
::google::protobuf::internal::AuxillaryParseTableField(),
};
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
TableStruct::schema[] = {
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
{ NULL, NULL, 0, -1, -1, false },
};
const ::google::protobuf::uint32 TableStruct::offsets[] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, file_),
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, package_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, dependency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, public_dependency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, weak_dependency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, message_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, enum_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, service_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, extension_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, options_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, source_code_info_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, syntax_),
0,
1,
~0u,
~0u,
~0u,
~0u,
~0u,
~0u,
~0u,
3,
4,
2,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, start_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, end_),
0,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, start_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, end_),
0,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, field_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, nested_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, enum_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_range_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, oneof_decl_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, options_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_range_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_name_),
0,
~0u,
~0u,
~0u,
~0u,
~0u,
~0u,
1,
~0u,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, number_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, label_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, extendee_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, default_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, oneof_index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, json_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, options_),
0,
6,
8,
9,
2,
1,
3,
7,
4,
5,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, options_),
0,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, options_),
0,
~0u,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, number_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, options_),
0,
2,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, method_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, options_),
0,
~0u,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, input_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, output_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, options_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, client_streaming_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, server_streaming_),
0,
1,
2,
3,
4,
5,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generate_equals_and_hash_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_string_check_utf8_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, optimize_for_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, go_package_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, swift_prefix_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_class_prefix_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_),
0,
1,
7,
8,
9,
15,
2,
10,
11,
12,
13,
14,
3,
4,
5,
6,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, message_set_wire_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, no_standard_descriptor_accessor_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, map_entry_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, uninterpreted_option_),
0,
1,
2,
3,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, ctype_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, packed_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, jstype_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, lazy_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, weak_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, uninterpreted_option_),
0,
1,
5,
2,
3,
4,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, uninterpreted_option_),
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, allow_alias_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, uninterpreted_option_),
0,
1,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, uninterpreted_option_),
0,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, uninterpreted_option_),
0,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _extensions_),
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, deprecated_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, idempotency_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, uninterpreted_option_),
0,
1,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, name_part_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, is_extension_),
0,
1,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, identifier_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, positive_int_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, negative_int_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, double_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, string_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, aggregate_value_),
~0u,
0,
3,
4,
5,
1,
2,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, path_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, span_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_comments_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, trailing_comments_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_detached_comments_),
~0u,
~0u,
0,
1,
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, location_),
~0u,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, path_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, source_file_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, begin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_),
~0u,
0,
1,
2,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, annotation_),
~0u,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] = {
{ 0, 6, sizeof(FileDescriptorSet)},
{ 7, 24, sizeof(FileDescriptorProto)},
{ 36, 43, sizeof(DescriptorProto_ExtensionRange)},
{ 45, 52, sizeof(DescriptorProto_ReservedRange)},
{ 54, 69, sizeof(DescriptorProto)},
{ 79, 94, sizeof(FieldDescriptorProto)},
{ 104, 111, sizeof(OneofDescriptorProto)},
{ 113, 121, sizeof(EnumDescriptorProto)},
{ 124, 132, sizeof(EnumValueDescriptorProto)},
{ 135, 143, sizeof(ServiceDescriptorProto)},
{ 146, 157, sizeof(MethodDescriptorProto)},
{ 163, 185, sizeof(FileOptions)},
{ 202, 212, sizeof(MessageOptions)},
{ 217, 229, sizeof(FieldOptions)},
{ 236, 242, sizeof(OneofOptions)},
{ 243, 251, sizeof(EnumOptions)},
{ 254, 261, sizeof(EnumValueOptions)},
{ 263, 270, sizeof(ServiceOptions)},
{ 272, 280, sizeof(MethodOptions)},
{ 283, 290, sizeof(UninterpretedOption_NamePart)},
{ 292, 304, sizeof(UninterpretedOption)},
{ 311, 321, sizeof(SourceCodeInfo_Location)},
{ 326, 332, sizeof(SourceCodeInfo)},
{ 333, 342, sizeof(GeneratedCodeInfo_Annotation)},
{ 346, 352, sizeof(GeneratedCodeInfo)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorSet_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ExtensionRange_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ReservedRange_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_FieldDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_OneofDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_EnumDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_MethodDescriptorProto_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_FileOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_MessageOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_FieldOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_OneofOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_EnumOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_MethodOptions_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_NamePart_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_Location_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_Annotation_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_default_instance_),
};
namespace {
void protobuf_AssignDescriptors() {
AddDescriptors();
::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
"google/protobuf/descriptor.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
}
void protobuf_AssignDescriptorsOnce() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 25);
}
} // namespace
void TableStruct::Shutdown() {
_FileDescriptorSet_default_instance_.Shutdown();
delete file_level_metadata[0].reflection;
_FileDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[1].reflection;
_DescriptorProto_ExtensionRange_default_instance_.Shutdown();
delete file_level_metadata[2].reflection;
_DescriptorProto_ReservedRange_default_instance_.Shutdown();
delete file_level_metadata[3].reflection;
_DescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[4].reflection;
_FieldDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[5].reflection;
_OneofDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[6].reflection;
_EnumDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[7].reflection;
_EnumValueDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[8].reflection;
_ServiceDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[9].reflection;
_MethodDescriptorProto_default_instance_.Shutdown();
delete file_level_metadata[10].reflection;
_FileOptions_default_instance_.Shutdown();
delete file_level_metadata[11].reflection;
_MessageOptions_default_instance_.Shutdown();
delete file_level_metadata[12].reflection;
_FieldOptions_default_instance_.Shutdown();
delete file_level_metadata[13].reflection;
_OneofOptions_default_instance_.Shutdown();
delete file_level_metadata[14].reflection;
_EnumOptions_default_instance_.Shutdown();
delete file_level_metadata[15].reflection;
_EnumValueOptions_default_instance_.Shutdown();
delete file_level_metadata[16].reflection;
_ServiceOptions_default_instance_.Shutdown();
delete file_level_metadata[17].reflection;
_MethodOptions_default_instance_.Shutdown();
delete file_level_metadata[18].reflection;
_UninterpretedOption_NamePart_default_instance_.Shutdown();
delete file_level_metadata[19].reflection;
_UninterpretedOption_default_instance_.Shutdown();
delete file_level_metadata[20].reflection;
_SourceCodeInfo_Location_default_instance_.Shutdown();
delete file_level_metadata[21].reflection;
_SourceCodeInfo_default_instance_.Shutdown();
delete file_level_metadata[22].reflection;
_GeneratedCodeInfo_Annotation_default_instance_.Shutdown();
delete file_level_metadata[23].reflection;
_GeneratedCodeInfo_default_instance_.Shutdown();
delete file_level_metadata[24].reflection;
}
void TableStruct::InitDefaultsImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::internal::InitProtobufDefaults();
_FileDescriptorSet_default_instance_.DefaultConstruct();
_FileDescriptorProto_default_instance_.DefaultConstruct();
_DescriptorProto_ExtensionRange_default_instance_.DefaultConstruct();
_DescriptorProto_ReservedRange_default_instance_.DefaultConstruct();
_DescriptorProto_default_instance_.DefaultConstruct();
_FieldDescriptorProto_default_instance_.DefaultConstruct();
_OneofDescriptorProto_default_instance_.DefaultConstruct();
_EnumDescriptorProto_default_instance_.DefaultConstruct();
_EnumValueDescriptorProto_default_instance_.DefaultConstruct();
_ServiceDescriptorProto_default_instance_.DefaultConstruct();
_MethodDescriptorProto_default_instance_.DefaultConstruct();
_FileOptions_default_instance_.DefaultConstruct();
_MessageOptions_default_instance_.DefaultConstruct();
_FieldOptions_default_instance_.DefaultConstruct();
_OneofOptions_default_instance_.DefaultConstruct();
_EnumOptions_default_instance_.DefaultConstruct();
_EnumValueOptions_default_instance_.DefaultConstruct();
_ServiceOptions_default_instance_.DefaultConstruct();
_MethodOptions_default_instance_.DefaultConstruct();
_UninterpretedOption_NamePart_default_instance_.DefaultConstruct();
_UninterpretedOption_default_instance_.DefaultConstruct();
_SourceCodeInfo_Location_default_instance_.DefaultConstruct();
_SourceCodeInfo_default_instance_.DefaultConstruct();
_GeneratedCodeInfo_Annotation_default_instance_.DefaultConstruct();
_GeneratedCodeInfo_default_instance_.DefaultConstruct();
_FileDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::FileOptions*>(
::google::protobuf::FileOptions::internal_default_instance());
_FileDescriptorProto_default_instance_.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>(
::google::protobuf::SourceCodeInfo::internal_default_instance());
_DescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>(
::google::protobuf::MessageOptions::internal_default_instance());
_FieldDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>(
::google::protobuf::FieldOptions::internal_default_instance());
_OneofDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>(
::google::protobuf::OneofOptions::internal_default_instance());
_EnumDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>(
::google::protobuf::EnumOptions::internal_default_instance());
_EnumValueDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>(
::google::protobuf::EnumValueOptions::internal_default_instance());
_ServiceDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>(
::google::protobuf::ServiceOptions::internal_default_instance());
_MethodDescriptorProto_default_instance_.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>(
::google::protobuf::MethodOptions::internal_default_instance());
}
void InitDefaults() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
}
void AddDescriptorsImpl() {
InitDefaults();
static const char descriptor[] = {
"\n google/protobuf/descriptor.proto\022\017goog"
"le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file"
"\030\001 \003(\0132$.google.protobuf.FileDescriptorP"
"roto\"\333\003\n\023FileDescriptorProto\022\014\n\004name\030\001 \001"
"(\t\022\017\n\007package\030\002 \001(\t\022\022\n\ndependency\030\003 \003(\t\022"
"\031\n\021public_dependency\030\n \003(\005\022\027\n\017weak_depen"
"dency\030\013 \003(\005\0226\n\014message_type\030\004 \003(\0132 .goog"
"le.protobuf.DescriptorProto\0227\n\tenum_type"
"\030\005 \003(\0132$.google.protobuf.EnumDescriptorP"
"roto\0228\n\007service\030\006 \003(\0132\'.google.protobuf."
"ServiceDescriptorProto\0228\n\textension\030\007 \003("
"\0132%.google.protobuf.FieldDescriptorProto"
"\022-\n\007options\030\010 \001(\0132\034.google.protobuf.File"
"Options\0229\n\020source_code_info\030\t \001(\0132\037.goog"
"le.protobuf.SourceCodeInfo\022\016\n\006syntax\030\014 \001"
"(\t\"\360\004\n\017DescriptorProto\022\014\n\004name\030\001 \001(\t\0224\n\005"
"field\030\002 \003(\0132%.google.protobuf.FieldDescr"
"iptorProto\0228\n\textension\030\006 \003(\0132%.google.p"
"rotobuf.FieldDescriptorProto\0225\n\013nested_t"
"ype\030\003 \003(\0132 .google.protobuf.DescriptorPr"
"oto\0227\n\tenum_type\030\004 \003(\0132$.google.protobuf"
".EnumDescriptorProto\022H\n\017extension_range\030"
"\005 \003(\0132/.google.protobuf.DescriptorProto."
"ExtensionRange\0229\n\noneof_decl\030\010 \003(\0132%.goo"
"gle.protobuf.OneofDescriptorProto\0220\n\007opt"
"ions\030\007 \001(\0132\037.google.protobuf.MessageOpti"
"ons\022F\n\016reserved_range\030\t \003(\0132..google.pro"
"tobuf.DescriptorProto.ReservedRange\022\025\n\rr"
"eserved_name\030\n \003(\t\032,\n\016ExtensionRange\022\r\n\005"
"start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\032+\n\rReservedRang"
"e\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\"\274\005\n\024FieldD"
"escriptorProto\022\014\n\004name\030\001 \001(\t\022\016\n\006number\030\003"
" \001(\005\022:\n\005label\030\004 \001(\0162+.google.protobuf.Fi"
"eldDescriptorProto.Label\0228\n\004type\030\005 \001(\0162*"
".google.protobuf.FieldDescriptorProto.Ty"
"pe\022\021\n\ttype_name\030\006 \001(\t\022\020\n\010extendee\030\002 \001(\t\022"
"\025\n\rdefault_value\030\007 \001(\t\022\023\n\013oneof_index\030\t "
"\001(\005\022\021\n\tjson_name\030\n \001(\t\022.\n\007options\030\010 \001(\0132"
"\035.google.protobuf.FieldOptions\"\266\002\n\004Type\022"
"\017\n\013TYPE_DOUBLE\020\001\022\016\n\nTYPE_FLOAT\020\002\022\016\n\nTYPE"
"_INT64\020\003\022\017\n\013TYPE_UINT64\020\004\022\016\n\nTYPE_INT32\020"
"\005\022\020\n\014TYPE_FIXED64\020\006\022\020\n\014TYPE_FIXED32\020\007\022\r\n"
"\tTYPE_BOOL\020\010\022\017\n\013TYPE_STRING\020\t\022\016\n\nTYPE_GR"
"OUP\020\n\022\020\n\014TYPE_MESSAGE\020\013\022\016\n\nTYPE_BYTES\020\014\022"
"\017\n\013TYPE_UINT32\020\r\022\r\n\tTYPE_ENUM\020\016\022\021\n\rTYPE_"
"SFIXED32\020\017\022\021\n\rTYPE_SFIXED64\020\020\022\017\n\013TYPE_SI"
"NT32\020\021\022\017\n\013TYPE_SINT64\020\022\"C\n\005Label\022\022\n\016LABE"
"L_OPTIONAL\020\001\022\022\n\016LABEL_REQUIRED\020\002\022\022\n\016LABE"
"L_REPEATED\020\003\"T\n\024OneofDescriptorProto\022\014\n\004"
"name\030\001 \001(\t\022.\n\007options\030\002 \001(\0132\035.google.pro"
"tobuf.OneofOptions\"\214\001\n\023EnumDescriptorPro"
"to\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002 \003(\0132).google"
".protobuf.EnumValueDescriptorProto\022-\n\007op"
"tions\030\003 \001(\0132\034.google.protobuf.EnumOption"
"s\"l\n\030EnumValueDescriptorProto\022\014\n\004name\030\001 "
"\001(\t\022\016\n\006number\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!.g"
"oogle.protobuf.EnumValueOptions\"\220\001\n\026Serv"
"iceDescriptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006meth"
"od\030\002 \003(\0132&.google.protobuf.MethodDescrip"
"torProto\0220\n\007options\030\003 \001(\0132\037.google.proto"
"buf.ServiceOptions\"\301\001\n\025MethodDescriptorP"
"roto\022\014\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t\022\023"
"\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.g"
"oogle.protobuf.MethodOptions\022\037\n\020client_s"
"treaming\030\005 \001(\010:\005false\022\037\n\020server_streamin"
"g\030\006 \001(\010:\005false\"\264\005\n\013FileOptions\022\024\n\014java_p"
"ackage\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001"
"(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false\022)"
"\n\035java_generate_equals_and_hash\030\024 \001(\010B\002\030"
"\001\022%\n\026java_string_check_utf8\030\033 \001(\010:\005false"
"\022F\n\014optimize_for\030\t \001(\0162).google.protobuf"
".FileOptions.OptimizeMode:\005SPEED\022\022\n\ngo_p"
"ackage\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 \001("
"\010:\005false\022$\n\025java_generic_services\030\021 \001(\010:"
"\005false\022\"\n\023py_generic_services\030\022 \001(\010:\005fal"
"se\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enab"
"le_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pre"
"fix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014s"
"wift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( "
"\001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo"
"gle.protobuf.UninterpretedOption\":\n\014Opti"
"mizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LI"
"TE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016Messag"
"eOptions\022&\n\027message_set_wire_format\030\001 \001("
"\010:\005false\022.\n\037no_standard_descriptor_acces"
"sor\030\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005fa"
"lse\022\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterpreted_"
"option\030\347\007 \003(\0132$.google.protobuf.Uninterp"
"retedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014F"
"ieldOptions\022:\n\005ctype\030\001 \001(\0162#.google.prot"
"obuf.FieldOptions.CType:\006STRING\022\016\n\006packe"
"d\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.google.protobu"
"f.FieldOptions.JSType:\tJS_NORMAL\022\023\n\004lazy"
"\030\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false"
"\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_o"
"ption\030\347\007 \003(\0132$.google.protobuf.Uninterpr"
"etedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020"
"\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORM"
"AL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020"
"\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninterpr"
"eted_option\030\347\007 \003(\0132$.google.protobuf.Uni"
"nterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOpti"
"ons\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003"
" \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003"
"(\0132$.google.protobuf.UninterpretedOption"
"*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumValueOptions\022\031\n"
"\ndeprecated\030\001 \001(\010:\005false\022C\n\024uninterprete"
"d_option\030\347\007 \003(\0132$.google.protobuf.Uninte"
"rpretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptio"
"ns\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninter"
"preted_option\030\347\007 \003(\0132$.google.protobuf.U"
"ninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethod"
"Options\022\031\n\ndeprecated\030! \001(\010:\005false\022_\n\021id"
"empotency_level\030\" \001(\0162/.google.protobuf."
"MethodOptions.IdempotencyLevel:\023IDEMPOTE"
"NCY_UNKNOWN\022C\n\024uninterpreted_option\030\347\007 \003"
"(\0132$.google.protobuf.UninterpretedOption"
"\"P\n\020IdempotencyLevel\022\027\n\023IDEMPOTENCY_UNKN"
"OWN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTENT"
"\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022;\n"
"\004name\030\002 \003(\0132-.google.protobuf.Uninterpre"
"tedOption.NamePart\022\030\n\020identifier_value\030\003"
" \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022nega"
"tive_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 \001"
"(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_va"
"lue\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002(\t"
"\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeInf"
"o\022:\n\010location\030\001 \003(\0132(.google.protobuf.So"
"urceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004pa"
"th\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leadin"
"g_comments\030\003 \001(\t\022\031\n\021trailing_comments\030\004 "
"\001(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"\247"
"\001\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\013"
"2-.google.protobuf.GeneratedCodeInfo.Ann"
"otation\032O\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022"
"\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003e"
"nd\030\004 \001(\005B\214\001\n\023com.google.protobufB\020Descri"
"ptorProtosH\001Z>github.com/golang/protobuf"
"/protoc-gen-go/descriptor;descriptor\242\002\003G"
"PB\252\002\032Google.Protobuf.Reflection"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
descriptor, 5591);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
}
void AddDescriptors() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer {
StaticDescriptorInitializer() {
AddDescriptors();
}
} static_descriptor_initializer;
} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto
const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[0];
}
bool FieldDescriptorProto_Type_IsValid(int value) {
switch (value) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_DOUBLE;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FLOAT;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT64;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT64;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT32;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED64;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED32;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BOOL;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_STRING;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_GROUP;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_MESSAGE;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BYTES;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT32;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_ENUM;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED32;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED64;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT32;
const FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT64;
const FieldDescriptorProto_Type FieldDescriptorProto::Type_MIN;
const FieldDescriptorProto_Type FieldDescriptorProto::Type_MAX;
const int FieldDescriptorProto::Type_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Label_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[1];
}
bool FieldDescriptorProto_Label_IsValid(int value) {
switch (value) {
case 1:
case 2:
case 3:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL;
const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED;
const FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED;
const FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN;
const FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX;
const int FieldDescriptorProto::Label_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* FileOptions_OptimizeMode_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[2];
}
bool FileOptions_OptimizeMode_IsValid(int value) {
switch (value) {
case 1:
case 2:
case 3:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const FileOptions_OptimizeMode FileOptions::SPEED;
const FileOptions_OptimizeMode FileOptions::CODE_SIZE;
const FileOptions_OptimizeMode FileOptions::LITE_RUNTIME;
const FileOptions_OptimizeMode FileOptions::OptimizeMode_MIN;
const FileOptions_OptimizeMode FileOptions::OptimizeMode_MAX;
const int FileOptions::OptimizeMode_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* FieldOptions_CType_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[3];
}
bool FieldOptions_CType_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const FieldOptions_CType FieldOptions::STRING;
const FieldOptions_CType FieldOptions::CORD;
const FieldOptions_CType FieldOptions::STRING_PIECE;
const FieldOptions_CType FieldOptions::CType_MIN;
const FieldOptions_CType FieldOptions::CType_MAX;
const int FieldOptions::CType_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* FieldOptions_JSType_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[4];
}
bool FieldOptions_JSType_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const FieldOptions_JSType FieldOptions::JS_NORMAL;
const FieldOptions_JSType FieldOptions::JS_STRING;
const FieldOptions_JSType FieldOptions::JS_NUMBER;
const FieldOptions_JSType FieldOptions::JSType_MIN;
const FieldOptions_JSType FieldOptions::JSType_MAX;
const int FieldOptions::JSType_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* MethodOptions_IdempotencyLevel_descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[5];
}
bool MethodOptions_IdempotencyLevel_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENCY_UNKNOWN;
const MethodOptions_IdempotencyLevel MethodOptions::NO_SIDE_EFFECTS;
const MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENT;
const MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MIN;
const MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MAX;
const int MethodOptions::IdempotencyLevel_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileDescriptorSet::kFileFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FileDescriptorSet::FileDescriptorSet()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorSet)
}
FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
file_(from.file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet)
}
void FileDescriptorSet::SharedCtor() {
_cached_size_ = 0;
}
FileDescriptorSet::~FileDescriptorSet() {
// @@protoc_insertion_point(destructor:google.protobuf.FileDescriptorSet)
SharedDtor();
}
void FileDescriptorSet::SharedDtor() {
}
void FileDescriptorSet::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileDescriptorSet& FileDescriptorSet::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
FileDescriptorSet* FileDescriptorSet::New(::google::protobuf::Arena* arena) const {
FileDescriptorSet* n = new FileDescriptorSet;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void FileDescriptorSet::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet)
file_.Clear();
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool FileDescriptorSet::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorSet)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.FileDescriptorProto file = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_file()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.FileDescriptorSet)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.FileDescriptorSet)
return false;
#undef DO_
}
void FileDescriptorSet::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.FileDescriptorSet)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.FileDescriptorProto file = 1;
for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->file(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.FileDescriptorSet)
}
::google::protobuf::uint8* FileDescriptorSet::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.FileDescriptorProto file = 1;
for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, this->file(i), deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorSet)
return target;
}
size_t FileDescriptorSet::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.FileDescriptorProto file = 1;
{
unsigned int count = this->file_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->file(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FileDescriptorSet::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FileDescriptorSet)
GOOGLE_DCHECK_NE(&from, this);
const FileDescriptorSet* source =
::google::protobuf::internal::DynamicCastToGenerated<const FileDescriptorSet>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FileDescriptorSet)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FileDescriptorSet)
MergeFrom(*source);
}
}
void FileDescriptorSet::MergeFrom(const FileDescriptorSet& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorSet)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
file_.MergeFrom(from.file_);
}
void FileDescriptorSet::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FileDescriptorSet)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FileDescriptorSet::CopyFrom(const FileDescriptorSet& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FileDescriptorSet)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FileDescriptorSet::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->file())) return false;
return true;
}
void FileDescriptorSet::Swap(FileDescriptorSet* other) {
if (other == this) return;
InternalSwap(other);
}
void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) {
file_.InternalSwap(&other->file_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FileDescriptorSet::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// FileDescriptorSet
// repeated .google.protobuf.FileDescriptorProto file = 1;
int FileDescriptorSet::file_size() const {
return file_.size();
}
void FileDescriptorSet::clear_file() {
file_.Clear();
}
const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file)
return file_.Get(index);
}
::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file)
return file_.Mutable(index);
}
::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() {
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file)
return file_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
FileDescriptorSet::mutable_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file)
return &file_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
FileDescriptorSet::file() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file)
return file_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileDescriptorProto::kNameFieldNumber;
const int FileDescriptorProto::kPackageFieldNumber;
const int FileDescriptorProto::kDependencyFieldNumber;
const int FileDescriptorProto::kPublicDependencyFieldNumber;
const int FileDescriptorProto::kWeakDependencyFieldNumber;
const int FileDescriptorProto::kMessageTypeFieldNumber;
const int FileDescriptorProto::kEnumTypeFieldNumber;
const int FileDescriptorProto::kServiceFieldNumber;
const int FileDescriptorProto::kExtensionFieldNumber;
const int FileDescriptorProto::kOptionsFieldNumber;
const int FileDescriptorProto::kSourceCodeInfoFieldNumber;
const int FileDescriptorProto::kSyntaxFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FileDescriptorProto::FileDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorProto)
}
FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
dependency_(from.dependency_),
message_type_(from.message_type_),
enum_type_(from.enum_type_),
service_(from.service_),
extension_(from.extension_),
public_dependency_(from.public_dependency_),
weak_dependency_(from.weak_dependency_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_package()) {
package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_);
}
syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_syntax()) {
syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::FileOptions(*from.options_);
} else {
options_ = NULL;
}
if (from.has_source_code_info()) {
source_code_info_ = new ::google::protobuf::SourceCodeInfo(*from.source_code_info_);
} else {
source_code_info_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto)
}
void FileDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&options_, 0, reinterpret_cast<char*>(&source_code_info_) -
reinterpret_cast<char*>(&options_) + sizeof(source_code_info_));
}
FileDescriptorProto::~FileDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.FileDescriptorProto)
SharedDtor();
}
void FileDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
syntax_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
if (this != internal_default_instance()) {
delete source_code_info_;
}
}
void FileDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileDescriptorProto& FileDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
FileDescriptorProto* FileDescriptorProto::New(::google::protobuf::Arena* arena) const {
FileDescriptorProto* n = new FileDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void FileDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto)
dependency_.Clear();
message_type_.Clear();
enum_type_.Clear();
service_.Clear();
extension_.Clear();
public_dependency_.Clear();
weak_dependency_.Clear();
if (_has_bits_[0 / 32] & 31u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_package()) {
GOOGLE_DCHECK(!package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*package_.UnsafeRawStringPointer())->clear();
}
if (has_syntax()) {
GOOGLE_DCHECK(!syntax_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*syntax_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::FileOptions::Clear();
}
if (has_source_code_info()) {
GOOGLE_DCHECK(source_code_info_ != NULL);
source_code_info_->::google::protobuf::SourceCodeInfo::Clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool FileDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// optional string package = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_package()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->package().data(), this->package().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.package");
} else {
goto handle_unusual;
}
break;
}
// repeated string dependency = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_dependency()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->dependency(this->dependency_size() - 1).data(),
this->dependency(this->dependency_size() - 1).length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.dependency");
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_message_type()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_enum_type()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_service()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension()));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FileOptions options = 8;
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(74u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_source_code_info()));
} else {
goto handle_unusual;
}
break;
}
// repeated int32 public_dependency = 10;
case 10: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(80u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 80u, input, this->mutable_public_dependency())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_public_dependency())));
} else {
goto handle_unusual;
}
break;
}
// repeated int32 weak_dependency = 11;
case 11: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(88u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 88u, input, this->mutable_weak_dependency())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(90u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_weak_dependency())));
} else {
goto handle_unusual;
}
break;
}
// optional string syntax = 12;
case 12: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(98u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_syntax()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->syntax().data(), this->syntax().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.syntax");
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.FileDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.FileDescriptorProto)
return false;
#undef DO_
}
void FileDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.FileDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional string package = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->package().data(), this->package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.package");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->package(), output);
}
// repeated string dependency = 3;
for (int i = 0, n = this->dependency_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->dependency(i).data(), this->dependency(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.dependency");
::google::protobuf::internal::WireFormatLite::WriteString(
3, this->dependency(i), output);
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->message_type(i), output);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->enum_type(i), output);
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
for (unsigned int i = 0, n = this->service_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->service(i), output);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->extension(i), output);
}
// optional .google.protobuf.FileOptions options = 8;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, *this->options_, output);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, *this->source_code_info_, output);
}
// repeated int32 public_dependency = 10;
for (int i = 0, n = this->public_dependency_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32(
10, this->public_dependency(i), output);
}
// repeated int32 weak_dependency = 11;
for (int i = 0, n = this->weak_dependency_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32(
11, this->weak_dependency(i), output);
}
// optional string syntax = 12;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->syntax().data(), this->syntax().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.syntax");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
12, this->syntax(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.FileDescriptorProto)
}
::google::protobuf::uint8* FileDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional string package = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->package().data(), this->package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.package");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->package(), target);
}
// repeated string dependency = 3;
for (int i = 0, n = this->dependency_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->dependency(i).data(), this->dependency(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.dependency");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(3, this->dependency(i), target);
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, this->message_type(i), deterministic, target);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, this->enum_type(i), deterministic, target);
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
for (unsigned int i = 0, n = this->service_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
6, this->service(i), deterministic, target);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
7, this->extension(i), deterministic, target);
}
// optional .google.protobuf.FileOptions options = 8;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
8, *this->options_, deterministic, target);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
9, *this->source_code_info_, deterministic, target);
}
// repeated int32 public_dependency = 10;
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32ToArray(10, this->public_dependency_, target);
// repeated int32 weak_dependency = 11;
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32ToArray(11, this->weak_dependency_, target);
// optional string syntax = 12;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->syntax().data(), this->syntax().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.syntax");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
12, this->syntax(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorProto)
return target;
}
size_t FileDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated string dependency = 3;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->dependency_size());
for (int i = 0, n = this->dependency_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->dependency(i));
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
{
unsigned int count = this->message_type_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->message_type(i));
}
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
{
unsigned int count = this->enum_type_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enum_type(i));
}
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
{
unsigned int count = this->service_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->service(i));
}
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
{
unsigned int count = this->extension_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension(i));
}
}
// repeated int32 public_dependency = 10;
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->public_dependency_);
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->public_dependency_size());
total_size += data_size;
}
// repeated int32 weak_dependency = 11;
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->weak_dependency_);
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->weak_dependency_size());
total_size += data_size;
}
if (_has_bits_[0 / 32] & 31u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional string package = 2;
if (has_package()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->package());
}
// optional string syntax = 12;
if (has_syntax()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->syntax());
}
// optional .google.protobuf.FileOptions options = 8;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (has_source_code_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->source_code_info_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FileDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FileDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const FileDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const FileDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FileDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FileDescriptorProto)
MergeFrom(*source);
}
}
void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
dependency_.MergeFrom(from.dependency_);
message_type_.MergeFrom(from.message_type_);
enum_type_.MergeFrom(from.enum_type_);
service_.MergeFrom(from.service_);
extension_.MergeFrom(from.extension_);
public_dependency_.MergeFrom(from.public_dependency_);
weak_dependency_.MergeFrom(from.weak_dependency_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 31u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
set_has_package();
package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_);
}
if (cached_has_bits & 0x00000004u) {
set_has_syntax();
syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_);
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->::google::protobuf::FileOptions::MergeFrom(from.options());
}
if (cached_has_bits & 0x00000010u) {
mutable_source_code_info()->::google::protobuf::SourceCodeInfo::MergeFrom(from.source_code_info());
}
}
}
void FileDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FileDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FileDescriptorProto::CopyFrom(const FileDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FileDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FileDescriptorProto::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->message_type())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->enum_type())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->service())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->extension())) return false;
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void FileDescriptorProto::Swap(FileDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) {
dependency_.InternalSwap(&other->dependency_);
message_type_.InternalSwap(&other->message_type_);
enum_type_.InternalSwap(&other->enum_type_);
service_.InternalSwap(&other->service_);
extension_.InternalSwap(&other->extension_);
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
name_.Swap(&other->name_);
package_.Swap(&other->package_);
syntax_.Swap(&other->syntax_);
std::swap(options_, other->options_);
std::swap(source_code_info_, other->source_code_info_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FileDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// FileDescriptorProto
// optional string name = 1;
bool FileDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void FileDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void FileDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void FileDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& FileDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name)
return name_.GetNoArena();
}
void FileDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
}
#if LANG_CXX11
void FileDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.name)
}
#endif
void FileDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name)
}
void FileDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name)
}
::std::string* FileDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
}
// optional string package = 2;
bool FileDescriptorProto::has_package() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void FileDescriptorProto::set_has_package() {
_has_bits_[0] |= 0x00000002u;
}
void FileDescriptorProto::clear_has_package() {
_has_bits_[0] &= ~0x00000002u;
}
void FileDescriptorProto::clear_package() {
package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_package();
}
const ::std::string& FileDescriptorProto::package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package)
return package_.GetNoArena();
}
void FileDescriptorProto::set_package(const ::std::string& value) {
set_has_package();
package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
}
#if LANG_CXX11
void FileDescriptorProto::set_package(::std::string&& value) {
set_has_package();
package_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.package)
}
#endif
void FileDescriptorProto::set_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_package();
package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package)
}
void FileDescriptorProto::set_package(const char* value, size_t size) {
set_has_package();
package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package)
}
::std::string* FileDescriptorProto::mutable_package() {
set_has_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package)
return package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileDescriptorProto::release_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package)
clear_has_package();
return package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileDescriptorProto::set_allocated_package(::std::string* package) {
if (package != NULL) {
set_has_package();
} else {
clear_has_package();
}
package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
}
// repeated string dependency = 3;
int FileDescriptorProto::dependency_size() const {
return dependency_.size();
}
void FileDescriptorProto::clear_dependency() {
dependency_.Clear();
}
const ::std::string& FileDescriptorProto::dependency(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency)
return dependency_.Get(index);
}
::std::string* FileDescriptorProto::mutable_dependency(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency)
return dependency_.Mutable(index);
}
void FileDescriptorProto::set_dependency(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency)
dependency_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void FileDescriptorProto::set_dependency(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency)
dependency_.Mutable(index)->assign(std::move(value));
}
#endif
void FileDescriptorProto::set_dependency(int index, const char* value) {
GOOGLE_DCHECK(value != NULL);
dependency_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.dependency)
}
void FileDescriptorProto::set_dependency(int index, const char* value, size_t size) {
dependency_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.dependency)
}
::std::string* FileDescriptorProto::add_dependency() {
// @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency)
return dependency_.Add();
}
void FileDescriptorProto::add_dependency(const ::std::string& value) {
dependency_.Add()->assign(value);
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency)
}
#if LANG_CXX11
void FileDescriptorProto::add_dependency(::std::string&& value) {
dependency_.Add(std::move(value));
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency)
}
#endif
void FileDescriptorProto::add_dependency(const char* value) {
GOOGLE_DCHECK(value != NULL);
dependency_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:google.protobuf.FileDescriptorProto.dependency)
}
void FileDescriptorProto::add_dependency(const char* value, size_t size) {
dependency_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:google.protobuf.FileDescriptorProto.dependency)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
FileDescriptorProto::dependency() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.dependency)
return dependency_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
FileDescriptorProto::mutable_dependency() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.dependency)
return &dependency_;
}
// repeated int32 public_dependency = 10;
int FileDescriptorProto::public_dependency_size() const {
return public_dependency_.size();
}
void FileDescriptorProto::clear_public_dependency() {
public_dependency_.Clear();
}
::google::protobuf::int32 FileDescriptorProto::public_dependency(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency)
return public_dependency_.Get(index);
}
void FileDescriptorProto::set_public_dependency(int index, ::google::protobuf::int32 value) {
public_dependency_.Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency)
}
void FileDescriptorProto::add_public_dependency(::google::protobuf::int32 value) {
public_dependency_.Add(value);
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
FileDescriptorProto::public_dependency() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency)
return public_dependency_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
FileDescriptorProto::mutable_public_dependency() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency)
return &public_dependency_;
}
// repeated int32 weak_dependency = 11;
int FileDescriptorProto::weak_dependency_size() const {
return weak_dependency_.size();
}
void FileDescriptorProto::clear_weak_dependency() {
weak_dependency_.Clear();
}
::google::protobuf::int32 FileDescriptorProto::weak_dependency(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency)
return weak_dependency_.Get(index);
}
void FileDescriptorProto::set_weak_dependency(int index, ::google::protobuf::int32 value) {
weak_dependency_.Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency)
}
void FileDescriptorProto::add_weak_dependency(::google::protobuf::int32 value) {
weak_dependency_.Add(value);
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
FileDescriptorProto::weak_dependency() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency)
return weak_dependency_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
FileDescriptorProto::mutable_weak_dependency() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency)
return &weak_dependency_;
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
int FileDescriptorProto::message_type_size() const {
return message_type_.size();
}
void FileDescriptorProto::clear_message_type() {
message_type_.Clear();
}
const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type)
return message_type_.Get(index);
}
::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type)
return message_type_.Mutable(index);
}
::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() {
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type)
return message_type_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
FileDescriptorProto::mutable_message_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type)
return &message_type_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
FileDescriptorProto::message_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type)
return message_type_;
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
int FileDescriptorProto::enum_type_size() const {
return enum_type_.size();
}
void FileDescriptorProto::clear_enum_type() {
enum_type_.Clear();
}
const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type)
return enum_type_.Get(index);
}
::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type)
return enum_type_.Mutable(index);
}
::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() {
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type)
return enum_type_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
FileDescriptorProto::mutable_enum_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type)
return &enum_type_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
FileDescriptorProto::enum_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type)
return enum_type_;
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
int FileDescriptorProto::service_size() const {
return service_.size();
}
void FileDescriptorProto::clear_service() {
service_.Clear();
}
const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service)
return service_.Get(index);
}
::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service)
return service_.Mutable(index);
}
::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() {
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service)
return service_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >*
FileDescriptorProto::mutable_service() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service)
return &service_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >&
FileDescriptorProto::service() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service)
return service_;
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
int FileDescriptorProto::extension_size() const {
return extension_.size();
}
void FileDescriptorProto::clear_extension() {
extension_.Clear();
}
const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension)
return extension_.Get(index);
}
::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension)
return extension_.Mutable(index);
}
::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() {
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension)
return extension_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
FileDescriptorProto::mutable_extension() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension)
return &extension_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
FileDescriptorProto::extension() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension)
return extension_;
}
// optional .google.protobuf.FileOptions options = 8;
bool FileDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void FileDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000008u;
}
void FileDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000008u;
}
void FileDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear();
clear_has_options();
}
const ::google::protobuf::FileOptions& FileDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::FileOptions::internal_default_instance();
}
::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::FileOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options)
return options_;
}
::google::protobuf::FileOptions* FileDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
clear_has_options();
::google::protobuf::FileOptions* temp = options_;
options_ = NULL;
return temp;
}
void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options)
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
bool FileDescriptorProto::has_source_code_info() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void FileDescriptorProto::set_has_source_code_info() {
_has_bits_[0] |= 0x00000010u;
}
void FileDescriptorProto::clear_has_source_code_info() {
_has_bits_[0] &= ~0x00000010u;
}
void FileDescriptorProto::clear_source_code_info() {
if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear();
clear_has_source_code_info();
}
const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info)
return source_code_info_ != NULL ? *source_code_info_
: *::google::protobuf::SourceCodeInfo::internal_default_instance();
}
::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() {
set_has_source_code_info();
if (source_code_info_ == NULL) {
source_code_info_ = new ::google::protobuf::SourceCodeInfo;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info)
return source_code_info_;
}
::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
clear_has_source_code_info();
::google::protobuf::SourceCodeInfo* temp = source_code_info_;
source_code_info_ = NULL;
return temp;
}
void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info) {
delete source_code_info_;
source_code_info_ = source_code_info;
if (source_code_info) {
set_has_source_code_info();
} else {
clear_has_source_code_info();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info)
}
// optional string syntax = 12;
bool FileDescriptorProto::has_syntax() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void FileDescriptorProto::set_has_syntax() {
_has_bits_[0] |= 0x00000004u;
}
void FileDescriptorProto::clear_has_syntax() {
_has_bits_[0] &= ~0x00000004u;
}
void FileDescriptorProto::clear_syntax() {
syntax_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_syntax();
}
const ::std::string& FileDescriptorProto::syntax() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax)
return syntax_.GetNoArena();
}
void FileDescriptorProto::set_syntax(const ::std::string& value) {
set_has_syntax();
syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
}
#if LANG_CXX11
void FileDescriptorProto::set_syntax(::std::string&& value) {
set_has_syntax();
syntax_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.syntax)
}
#endif
void FileDescriptorProto::set_syntax(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_syntax();
syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.syntax)
}
void FileDescriptorProto::set_syntax(const char* value, size_t size) {
set_has_syntax();
syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax)
}
::std::string* FileDescriptorProto::mutable_syntax() {
set_has_syntax();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax)
return syntax_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileDescriptorProto::release_syntax() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax)
clear_has_syntax();
return syntax_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) {
if (syntax != NULL) {
set_has_syntax();
} else {
clear_has_syntax();
}
syntax_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto_ExtensionRange::kStartFieldNumber;
const int DescriptorProto_ExtensionRange::kEndFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ExtensionRange)
}
DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&start_, &from.start_,
reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange)
}
void DescriptorProto_ExtensionRange::SharedCtor() {
_cached_size_ = 0;
::memset(&start_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
}
DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() {
// @@protoc_insertion_point(destructor:google.protobuf.DescriptorProto.ExtensionRange)
SharedDtor();
}
void DescriptorProto_ExtensionRange::SharedDtor() {
}
void DescriptorProto_ExtensionRange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::protobuf::Arena* arena) const {
DescriptorProto_ExtensionRange* n = new DescriptorProto_ExtensionRange;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void DescriptorProto_ExtensionRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
if (_has_bits_[0 / 32] & 3u) {
::memset(&start_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ExtensionRange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional int32 start = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
set_has_start();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &start_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 end = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_end();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &end_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto.ExtensionRange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto.ExtensionRange)
return false;
#undef DO_
}
void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.DescriptorProto.ExtensionRange)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional int32 start = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->start(), output);
}
// optional int32 end = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->end(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.DescriptorProto.ExtensionRange)
}
::google::protobuf::uint8* DescriptorProto_ExtensionRange::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional int32 start = 1;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target);
}
// optional int32 end = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ExtensionRange)
return target;
}
size_t DescriptorProto_ExtensionRange::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 3u) {
// optional int32 start = 1;
if (has_start()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->start());
}
// optional int32 end = 2;
if (has_end()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->end());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DescriptorProto_ExtensionRange::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange)
GOOGLE_DCHECK_NE(&from, this);
const DescriptorProto_ExtensionRange* source =
::google::protobuf::internal::DynamicCastToGenerated<const DescriptorProto_ExtensionRange>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.DescriptorProto.ExtensionRange)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.DescriptorProto.ExtensionRange)
MergeFrom(*source);
}
}
void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRange& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
start_ = from.start_;
}
if (cached_has_bits & 0x00000002u) {
end_ = from.end_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void DescriptorProto_ExtensionRange::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.DescriptorProto.ExtensionRange)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DescriptorProto_ExtensionRange::CopyFrom(const DescriptorProto_ExtensionRange& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.DescriptorProto.ExtensionRange)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DescriptorProto_ExtensionRange::IsInitialized() const {
return true;
}
void DescriptorProto_ExtensionRange::Swap(DescriptorProto_ExtensionRange* other) {
if (other == this) return;
InternalSwap(other);
}
void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* other) {
std::swap(start_, other->start_);
std::swap(end_, other->end_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto_ExtensionRange::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// DescriptorProto_ExtensionRange
// optional int32 start = 1;
bool DescriptorProto_ExtensionRange::has_start() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void DescriptorProto_ExtensionRange::set_has_start() {
_has_bits_[0] |= 0x00000001u;
}
void DescriptorProto_ExtensionRange::clear_has_start() {
_has_bits_[0] &= ~0x00000001u;
}
void DescriptorProto_ExtensionRange::clear_start() {
start_ = 0;
clear_has_start();
}
::google::protobuf::int32 DescriptorProto_ExtensionRange::start() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start)
return start_;
}
void DescriptorProto_ExtensionRange::set_start(::google::protobuf::int32 value) {
set_has_start();
start_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start)
}
// optional int32 end = 2;
bool DescriptorProto_ExtensionRange::has_end() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void DescriptorProto_ExtensionRange::set_has_end() {
_has_bits_[0] |= 0x00000002u;
}
void DescriptorProto_ExtensionRange::clear_has_end() {
_has_bits_[0] &= ~0x00000002u;
}
void DescriptorProto_ExtensionRange::clear_end() {
end_ = 0;
clear_has_end();
}
::google::protobuf::int32 DescriptorProto_ExtensionRange::end() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end)
return end_;
}
void DescriptorProto_ExtensionRange::set_end(::google::protobuf::int32 value) {
set_has_end();
end_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto_ReservedRange::kStartFieldNumber;
const int DescriptorProto_ReservedRange::kEndFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
DescriptorProto_ReservedRange::DescriptorProto_ReservedRange()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ReservedRange)
}
DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorProto_ReservedRange& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&start_, &from.start_,
reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange)
}
void DescriptorProto_ReservedRange::SharedCtor() {
_cached_size_ = 0;
::memset(&start_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
}
DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() {
// @@protoc_insertion_point(destructor:google.protobuf.DescriptorProto.ReservedRange)
SharedDtor();
}
void DescriptorProto_ReservedRange::SharedDtor() {
}
void DescriptorProto_ReservedRange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto_ReservedRange::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto_ReservedRange& DescriptorProto_ReservedRange::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::protobuf::Arena* arena) const {
DescriptorProto_ReservedRange* n = new DescriptorProto_ReservedRange;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void DescriptorProto_ReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
if (_has_bits_[0 / 32] & 3u) {
::memset(&start_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&start_) + sizeof(end_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool DescriptorProto_ReservedRange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto.ReservedRange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional int32 start = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
set_has_start();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &start_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 end = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_end();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &end_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto.ReservedRange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto.ReservedRange)
return false;
#undef DO_
}
void DescriptorProto_ReservedRange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.DescriptorProto.ReservedRange)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional int32 start = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->start(), output);
}
// optional int32 end = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->end(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.DescriptorProto.ReservedRange)
}
::google::protobuf::uint8* DescriptorProto_ReservedRange::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional int32 start = 1;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target);
}
// optional int32 end = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ReservedRange)
return target;
}
size_t DescriptorProto_ReservedRange::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 3u) {
// optional int32 start = 1;
if (has_start()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->start());
}
// optional int32 end = 2;
if (has_end()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->end());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DescriptorProto_ReservedRange::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.DescriptorProto.ReservedRange)
GOOGLE_DCHECK_NE(&from, this);
const DescriptorProto_ReservedRange* source =
::google::protobuf::internal::DynamicCastToGenerated<const DescriptorProto_ReservedRange>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.DescriptorProto.ReservedRange)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.DescriptorProto.ReservedRange)
MergeFrom(*source);
}
}
void DescriptorProto_ReservedRange::MergeFrom(const DescriptorProto_ReservedRange& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ReservedRange)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
start_ = from.start_;
}
if (cached_has_bits & 0x00000002u) {
end_ = from.end_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void DescriptorProto_ReservedRange::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.DescriptorProto.ReservedRange)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DescriptorProto_ReservedRange::CopyFrom(const DescriptorProto_ReservedRange& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.DescriptorProto.ReservedRange)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DescriptorProto_ReservedRange::IsInitialized() const {
return true;
}
void DescriptorProto_ReservedRange::Swap(DescriptorProto_ReservedRange* other) {
if (other == this) return;
InternalSwap(other);
}
void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* other) {
std::swap(start_, other->start_);
std::swap(end_, other->end_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto_ReservedRange::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// DescriptorProto_ReservedRange
// optional int32 start = 1;
bool DescriptorProto_ReservedRange::has_start() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void DescriptorProto_ReservedRange::set_has_start() {
_has_bits_[0] |= 0x00000001u;
}
void DescriptorProto_ReservedRange::clear_has_start() {
_has_bits_[0] &= ~0x00000001u;
}
void DescriptorProto_ReservedRange::clear_start() {
start_ = 0;
clear_has_start();
}
::google::protobuf::int32 DescriptorProto_ReservedRange::start() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start)
return start_;
}
void DescriptorProto_ReservedRange::set_start(::google::protobuf::int32 value) {
set_has_start();
start_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start)
}
// optional int32 end = 2;
bool DescriptorProto_ReservedRange::has_end() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void DescriptorProto_ReservedRange::set_has_end() {
_has_bits_[0] |= 0x00000002u;
}
void DescriptorProto_ReservedRange::clear_has_end() {
_has_bits_[0] &= ~0x00000002u;
}
void DescriptorProto_ReservedRange::clear_end() {
end_ = 0;
clear_has_end();
}
::google::protobuf::int32 DescriptorProto_ReservedRange::end() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end)
return end_;
}
void DescriptorProto_ReservedRange::set_end(::google::protobuf::int32 value) {
set_has_end();
end_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int DescriptorProto::kNameFieldNumber;
const int DescriptorProto::kFieldFieldNumber;
const int DescriptorProto::kExtensionFieldNumber;
const int DescriptorProto::kNestedTypeFieldNumber;
const int DescriptorProto::kEnumTypeFieldNumber;
const int DescriptorProto::kExtensionRangeFieldNumber;
const int DescriptorProto::kOneofDeclFieldNumber;
const int DescriptorProto::kOptionsFieldNumber;
const int DescriptorProto::kReservedRangeFieldNumber;
const int DescriptorProto::kReservedNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
DescriptorProto::DescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto)
}
DescriptorProto::DescriptorProto(const DescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
field_(from.field_),
nested_type_(from.nested_type_),
enum_type_(from.enum_type_),
extension_range_(from.extension_range_),
extension_(from.extension_),
oneof_decl_(from.oneof_decl_),
reserved_range_(from.reserved_range_),
reserved_name_(from.reserved_name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::MessageOptions(*from.options_);
} else {
options_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto)
}
void DescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
DescriptorProto::~DescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.DescriptorProto)
SharedDtor();
}
void DescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void DescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const DescriptorProto& DescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
DescriptorProto* DescriptorProto::New(::google::protobuf::Arena* arena) const {
DescriptorProto* n = new DescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void DescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto)
field_.Clear();
nested_type_.Clear();
enum_type_.Clear();
extension_range_.Clear();
extension_.Clear();
oneof_decl_.Clear();
reserved_range_.Clear();
reserved_name_.Clear();
if (_has_bits_[0 / 32] & 3u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::MessageOptions::Clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool DescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.DescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.DescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_field()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_nested_type()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_enum_type()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension_range()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_extension()));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.MessageOptions options = 7;
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_oneof_decl()));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(74u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_reserved_range()));
} else {
goto handle_unusual;
}
break;
}
// repeated string reserved_name = 10;
case 10: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_reserved_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->reserved_name(this->reserved_name_size() - 1).data(),
this->reserved_name(this->reserved_name_size() - 1).length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.DescriptorProto.reserved_name");
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.DescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.DescriptorProto)
return false;
#undef DO_
}
void DescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.DescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.DescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->field(i), output);
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->nested_type(i), output);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->enum_type(i), output);
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->extension_range(i), output);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->extension(i), output);
}
// optional .google.protobuf.MessageOptions options = 7;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, *this->options_, output);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->oneof_decl(i), output);
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, this->reserved_range(i), output);
}
// repeated string reserved_name = 10;
for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->reserved_name(i).data(), this->reserved_name(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.DescriptorProto.reserved_name");
::google::protobuf::internal::WireFormatLite::WriteString(
10, this->reserved_name(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.DescriptorProto)
}
::google::protobuf::uint8* DescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.DescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->field(i), deterministic, target);
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, this->nested_type(i), deterministic, target);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, this->enum_type(i), deterministic, target);
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, this->extension_range(i), deterministic, target);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
6, this->extension(i), deterministic, target);
}
// optional .google.protobuf.MessageOptions options = 7;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
7, *this->options_, deterministic, target);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
8, this->oneof_decl(i), deterministic, target);
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
9, this->reserved_range(i), deterministic, target);
}
// repeated string reserved_name = 10;
for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->reserved_name(i).data(), this->reserved_name(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.DescriptorProto.reserved_name");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(10, this->reserved_name(i), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto)
return target;
}
size_t DescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
{
unsigned int count = this->field_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->field(i));
}
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
{
unsigned int count = this->nested_type_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->nested_type(i));
}
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
{
unsigned int count = this->enum_type_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->enum_type(i));
}
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
{
unsigned int count = this->extension_range_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension_range(i));
}
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
{
unsigned int count = this->extension_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->extension(i));
}
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
{
unsigned int count = this->oneof_decl_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->oneof_decl(i));
}
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
{
unsigned int count = this->reserved_range_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->reserved_range(i));
}
}
// repeated string reserved_name = 10;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->reserved_name_size());
for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->reserved_name(i));
}
if (_has_bits_[0 / 32] & 3u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.MessageOptions options = 7;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.DescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const DescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const DescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.DescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.DescriptorProto)
MergeFrom(*source);
}
}
void DescriptorProto::MergeFrom(const DescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
field_.MergeFrom(from.field_);
nested_type_.MergeFrom(from.nested_type_);
enum_type_.MergeFrom(from.enum_type_);
extension_range_.MergeFrom(from.extension_range_);
extension_.MergeFrom(from.extension_);
oneof_decl_.MergeFrom(from.oneof_decl_);
reserved_range_.MergeFrom(from.reserved_range_);
reserved_name_.MergeFrom(from.reserved_name_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::MessageOptions::MergeFrom(from.options());
}
}
}
void DescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.DescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DescriptorProto::CopyFrom(const DescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.DescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DescriptorProto::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->field())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->nested_type())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->enum_type())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->extension())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->oneof_decl())) return false;
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void DescriptorProto::Swap(DescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void DescriptorProto::InternalSwap(DescriptorProto* other) {
field_.InternalSwap(&other->field_);
nested_type_.InternalSwap(&other->nested_type_);
enum_type_.InternalSwap(&other->enum_type_);
extension_range_.InternalSwap(&other->extension_range_);
extension_.InternalSwap(&other->extension_);
oneof_decl_.InternalSwap(&other->oneof_decl_);
reserved_range_.InternalSwap(&other->reserved_range_);
reserved_name_.InternalSwap(&other->reserved_name_);
name_.Swap(&other->name_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata DescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// DescriptorProto
// optional string name = 1;
bool DescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void DescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void DescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void DescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& DescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name)
return name_.GetNoArena();
}
void DescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
}
#if LANG_CXX11
void DescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.DescriptorProto.name)
}
#endif
void DescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name)
}
void DescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name)
}
::std::string* DescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* DescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void DescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
int DescriptorProto::field_size() const {
return field_.size();
}
void DescriptorProto::clear_field() {
field_.Clear();
}
const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field)
return field_.Get(index);
}
::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field)
return field_.Mutable(index);
}
::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field)
return field_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
DescriptorProto::mutable_field() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field)
return &field_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
DescriptorProto::field() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field)
return field_;
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
int DescriptorProto::extension_size() const {
return extension_.size();
}
void DescriptorProto::clear_extension() {
extension_.Clear();
}
const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension)
return extension_.Get(index);
}
::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension)
return extension_.Mutable(index);
}
::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension)
return extension_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
DescriptorProto::mutable_extension() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension)
return &extension_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
DescriptorProto::extension() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension)
return extension_;
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
int DescriptorProto::nested_type_size() const {
return nested_type_.size();
}
void DescriptorProto::clear_nested_type() {
nested_type_.Clear();
}
const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type)
return nested_type_.Get(index);
}
::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type)
return nested_type_.Mutable(index);
}
::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type)
return nested_type_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
DescriptorProto::mutable_nested_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type)
return &nested_type_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
DescriptorProto::nested_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type)
return nested_type_;
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
int DescriptorProto::enum_type_size() const {
return enum_type_.size();
}
void DescriptorProto::clear_enum_type() {
enum_type_.Clear();
}
const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type)
return enum_type_.Get(index);
}
::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type)
return enum_type_.Mutable(index);
}
::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type)
return enum_type_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
DescriptorProto::mutable_enum_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type)
return &enum_type_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
DescriptorProto::enum_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type)
return enum_type_;
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
int DescriptorProto::extension_range_size() const {
return extension_range_.size();
}
void DescriptorProto::clear_extension_range() {
extension_range_.Clear();
}
const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range)
return extension_range_.Get(index);
}
::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range)
return extension_range_.Mutable(index);
}
::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range)
return extension_range_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >*
DescriptorProto::mutable_extension_range() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range)
return &extension_range_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >&
DescriptorProto::extension_range() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range)
return extension_range_;
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
int DescriptorProto::oneof_decl_size() const {
return oneof_decl_.size();
}
void DescriptorProto::clear_oneof_decl() {
oneof_decl_.Clear();
}
const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl)
return oneof_decl_.Get(index);
}
::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl)
return oneof_decl_.Mutable(index);
}
::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl)
return oneof_decl_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >*
DescriptorProto::mutable_oneof_decl() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl)
return &oneof_decl_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >&
DescriptorProto::oneof_decl() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl)
return oneof_decl_;
}
// optional .google.protobuf.MessageOptions options = 7;
bool DescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void DescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000002u;
}
void DescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
void DescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear();
clear_has_options();
}
const ::google::protobuf::MessageOptions& DescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::MessageOptions::internal_default_instance();
}
::google::protobuf::MessageOptions* DescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::MessageOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options)
return options_;
}
::google::protobuf::MessageOptions* DescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
clear_has_options();
::google::protobuf::MessageOptions* temp = options_;
options_ = NULL;
return temp;
}
void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options)
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
int DescriptorProto::reserved_range_size() const {
return reserved_range_.size();
}
void DescriptorProto::clear_reserved_range() {
reserved_range_.Clear();
}
const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range)
return reserved_range_.Get(index);
}
::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_range)
return reserved_range_.Mutable(index);
}
::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() {
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range)
return reserved_range_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >*
DescriptorProto::mutable_reserved_range() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range)
return &reserved_range_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >&
DescriptorProto::reserved_range() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_range)
return reserved_range_;
}
// repeated string reserved_name = 10;
int DescriptorProto::reserved_name_size() const {
return reserved_name_.size();
}
void DescriptorProto::clear_reserved_name() {
reserved_name_.Clear();
}
const ::std::string& DescriptorProto::reserved_name(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name)
return reserved_name_.Get(index);
}
::std::string* DescriptorProto::mutable_reserved_name(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name)
return reserved_name_.Mutable(index);
}
void DescriptorProto::set_reserved_name(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name)
reserved_name_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void DescriptorProto::set_reserved_name(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name)
reserved_name_.Mutable(index)->assign(std::move(value));
}
#endif
void DescriptorProto::set_reserved_name(int index, const char* value) {
GOOGLE_DCHECK(value != NULL);
reserved_name_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.reserved_name)
}
void DescriptorProto::set_reserved_name(int index, const char* value, size_t size) {
reserved_name_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.reserved_name)
}
::std::string* DescriptorProto::add_reserved_name() {
// @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name)
return reserved_name_.Add();
}
void DescriptorProto::add_reserved_name(const ::std::string& value) {
reserved_name_.Add()->assign(value);
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name)
}
#if LANG_CXX11
void DescriptorProto::add_reserved_name(::std::string&& value) {
reserved_name_.Add(std::move(value));
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name)
}
#endif
void DescriptorProto::add_reserved_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
reserved_name_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:google.protobuf.DescriptorProto.reserved_name)
}
void DescriptorProto::add_reserved_name(const char* value, size_t size) {
reserved_name_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:google.protobuf.DescriptorProto.reserved_name)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
DescriptorProto::reserved_name() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_name)
return reserved_name_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
DescriptorProto::mutable_reserved_name() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_name)
return &reserved_name_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FieldDescriptorProto::kNameFieldNumber;
const int FieldDescriptorProto::kNumberFieldNumber;
const int FieldDescriptorProto::kLabelFieldNumber;
const int FieldDescriptorProto::kTypeFieldNumber;
const int FieldDescriptorProto::kTypeNameFieldNumber;
const int FieldDescriptorProto::kExtendeeFieldNumber;
const int FieldDescriptorProto::kDefaultValueFieldNumber;
const int FieldDescriptorProto::kOneofIndexFieldNumber;
const int FieldDescriptorProto::kJsonNameFieldNumber;
const int FieldDescriptorProto::kOptionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FieldDescriptorProto::FieldDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FieldDescriptorProto)
}
FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_extendee()) {
extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_);
}
type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_type_name()) {
type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_);
}
default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_default_value()) {
default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_);
}
json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_json_name()) {
json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::FieldOptions(*from.options_);
} else {
options_ = NULL;
}
::memcpy(&number_, &from.number_,
reinterpret_cast<char*>(&type_) -
reinterpret_cast<char*>(&number_) + sizeof(type_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto)
}
void FieldDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&options_, 0, reinterpret_cast<char*>(&oneof_index_) -
reinterpret_cast<char*>(&options_) + sizeof(oneof_index_));
label_ = 1;
type_ = 1;
}
FieldDescriptorProto::~FieldDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.FieldDescriptorProto)
SharedDtor();
}
void FieldDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
extendee_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
default_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
json_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void FieldDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FieldDescriptorProto& FieldDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
FieldDescriptorProto* FieldDescriptorProto::New(::google::protobuf::Arena* arena) const {
FieldDescriptorProto* n = new FieldDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void FieldDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto)
if (_has_bits_[0 / 32] & 63u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_extendee()) {
GOOGLE_DCHECK(!extendee_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*extendee_.UnsafeRawStringPointer())->clear();
}
if (has_type_name()) {
GOOGLE_DCHECK(!type_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*type_name_.UnsafeRawStringPointer())->clear();
}
if (has_default_value()) {
GOOGLE_DCHECK(!default_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*default_value_.UnsafeRawStringPointer())->clear();
}
if (has_json_name()) {
GOOGLE_DCHECK(!json_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*json_name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::FieldOptions::Clear();
}
}
if (_has_bits_[0 / 32] & 192u) {
::memset(&number_, 0, reinterpret_cast<char*>(&oneof_index_) -
reinterpret_cast<char*>(&number_) + sizeof(oneof_index_));
}
if (_has_bits_[8 / 32] & 768u) {
label_ = 1;
type_ = 1;
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool FieldDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FieldDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// optional string extendee = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_extendee()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->extendee().data(), this->extendee().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.extendee");
} else {
goto handle_unusual;
}
break;
}
// optional int32 number = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u)) {
set_has_number();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &number_)));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(32u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::FieldDescriptorProto_Label_IsValid(value)) {
set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value));
} else {
mutable_unknown_fields()->AddVarint(4, value);
}
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(40u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::FieldDescriptorProto_Type_IsValid(value)) {
set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
break;
}
// optional string type_name = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_type_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->type_name().data(), this->type_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.type_name");
} else {
goto handle_unusual;
}
break;
}
// optional string default_value = 7;
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_default_value()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->default_value().data(), this->default_value().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.default_value");
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FieldOptions options = 8;
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
// optional int32 oneof_index = 9;
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(72u)) {
set_has_oneof_index();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &oneof_index_)));
} else {
goto handle_unusual;
}
break;
}
// optional string json_name = 10;
case 10: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_json_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->json_name().data(), this->json_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.json_name");
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.FieldDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.FieldDescriptorProto)
return false;
#undef DO_
}
void FieldDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.FieldDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional string extendee = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->extendee().data(), this->extendee().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.extendee");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->extendee(), output);
}
// optional int32 number = 3;
if (cached_has_bits & 0x00000040u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->number(), output);
}
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
if (cached_has_bits & 0x00000100u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
4, this->label(), output);
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
if (cached_has_bits & 0x00000200u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->type(), output);
}
// optional string type_name = 6;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->type_name().data(), this->type_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.type_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
6, this->type_name(), output);
}
// optional string default_value = 7;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->default_value().data(), this->default_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.default_value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->default_value(), output);
}
// optional .google.protobuf.FieldOptions options = 8;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, *this->options_, output);
}
// optional int32 oneof_index = 9;
if (cached_has_bits & 0x00000080u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(9, this->oneof_index(), output);
}
// optional string json_name = 10;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->json_name().data(), this->json_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.json_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
10, this->json_name(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.FieldDescriptorProto)
}
::google::protobuf::uint8* FieldDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional string extendee = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->extendee().data(), this->extendee().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.extendee");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->extendee(), target);
}
// optional int32 number = 3;
if (cached_has_bits & 0x00000040u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->number(), target);
}
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
if (cached_has_bits & 0x00000100u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
4, this->label(), target);
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
if (cached_has_bits & 0x00000200u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->type(), target);
}
// optional string type_name = 6;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->type_name().data(), this->type_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.type_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
6, this->type_name(), target);
}
// optional string default_value = 7;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->default_value().data(), this->default_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.default_value");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->default_value(), target);
}
// optional .google.protobuf.FieldOptions options = 8;
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
8, *this->options_, deterministic, target);
}
// optional int32 oneof_index = 9;
if (cached_has_bits & 0x00000080u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(9, this->oneof_index(), target);
}
// optional string json_name = 10;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->json_name().data(), this->json_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.json_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
10, this->json_name(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldDescriptorProto)
return target;
}
size_t FieldDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 255u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional string extendee = 2;
if (has_extendee()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->extendee());
}
// optional string type_name = 6;
if (has_type_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->type_name());
}
// optional string default_value = 7;
if (has_default_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->default_value());
}
// optional string json_name = 10;
if (has_json_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->json_name());
}
// optional .google.protobuf.FieldOptions options = 8;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
// optional int32 number = 3;
if (has_number()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->number());
}
// optional int32 oneof_index = 9;
if (has_oneof_index()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->oneof_index());
}
}
if (_has_bits_[8 / 32] & 768u) {
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
if (has_label()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->label());
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
if (has_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FieldDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FieldDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const FieldDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const FieldDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FieldDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FieldDescriptorProto)
MergeFrom(*source);
}
}
void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
set_has_extendee();
extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_);
}
if (cached_has_bits & 0x00000004u) {
set_has_type_name();
type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_);
}
if (cached_has_bits & 0x00000008u) {
set_has_default_value();
default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_);
}
if (cached_has_bits & 0x00000010u) {
set_has_json_name();
json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_);
}
if (cached_has_bits & 0x00000020u) {
mutable_options()->::google::protobuf::FieldOptions::MergeFrom(from.options());
}
if (cached_has_bits & 0x00000040u) {
number_ = from.number_;
}
if (cached_has_bits & 0x00000080u) {
oneof_index_ = from.oneof_index_;
}
_has_bits_[0] |= cached_has_bits;
}
if (cached_has_bits & 768u) {
if (cached_has_bits & 0x00000100u) {
label_ = from.label_;
}
if (cached_has_bits & 0x00000200u) {
type_ = from.type_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void FieldDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FieldDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FieldDescriptorProto::CopyFrom(const FieldDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FieldDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FieldDescriptorProto::IsInitialized() const {
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void FieldDescriptorProto::Swap(FieldDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) {
name_.Swap(&other->name_);
extendee_.Swap(&other->extendee_);
type_name_.Swap(&other->type_name_);
default_value_.Swap(&other->default_value_);
json_name_.Swap(&other->json_name_);
std::swap(options_, other->options_);
std::swap(number_, other->number_);
std::swap(oneof_index_, other->oneof_index_);
std::swap(label_, other->label_);
std::swap(type_, other->type_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata FieldDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// FieldDescriptorProto
// optional string name = 1;
bool FieldDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void FieldDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void FieldDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void FieldDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& FieldDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name)
return name_.GetNoArena();
}
void FieldDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
}
#if LANG_CXX11
void FieldDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.name)
}
#endif
void FieldDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name)
}
void FieldDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name)
}
::std::string* FieldDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FieldDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FieldDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
}
// optional int32 number = 3;
bool FieldDescriptorProto::has_number() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
void FieldDescriptorProto::set_has_number() {
_has_bits_[0] |= 0x00000040u;
}
void FieldDescriptorProto::clear_has_number() {
_has_bits_[0] &= ~0x00000040u;
}
void FieldDescriptorProto::clear_number() {
number_ = 0;
clear_has_number();
}
::google::protobuf::int32 FieldDescriptorProto::number() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number)
return number_;
}
void FieldDescriptorProto::set_number(::google::protobuf::int32 value) {
set_has_number();
number_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number)
}
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
bool FieldDescriptorProto::has_label() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
void FieldDescriptorProto::set_has_label() {
_has_bits_[0] |= 0x00000100u;
}
void FieldDescriptorProto::clear_has_label() {
_has_bits_[0] &= ~0x00000100u;
}
void FieldDescriptorProto::clear_label() {
label_ = 1;
clear_has_label();
}
::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::label() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label)
return static_cast< ::google::protobuf::FieldDescriptorProto_Label >(label_);
}
void FieldDescriptorProto::set_label(::google::protobuf::FieldDescriptorProto_Label value) {
assert(::google::protobuf::FieldDescriptorProto_Label_IsValid(value));
set_has_label();
label_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label)
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
bool FieldDescriptorProto::has_type() const {
return (_has_bits_[0] & 0x00000200u) != 0;
}
void FieldDescriptorProto::set_has_type() {
_has_bits_[0] |= 0x00000200u;
}
void FieldDescriptorProto::clear_has_type() {
_has_bits_[0] &= ~0x00000200u;
}
void FieldDescriptorProto::clear_type() {
type_ = 1;
clear_has_type();
}
::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::type() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type)
return static_cast< ::google::protobuf::FieldDescriptorProto_Type >(type_);
}
void FieldDescriptorProto::set_type(::google::protobuf::FieldDescriptorProto_Type value) {
assert(::google::protobuf::FieldDescriptorProto_Type_IsValid(value));
set_has_type();
type_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type)
}
// optional string type_name = 6;
bool FieldDescriptorProto::has_type_name() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void FieldDescriptorProto::set_has_type_name() {
_has_bits_[0] |= 0x00000004u;
}
void FieldDescriptorProto::clear_has_type_name() {
_has_bits_[0] &= ~0x00000004u;
}
void FieldDescriptorProto::clear_type_name() {
type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_type_name();
}
const ::std::string& FieldDescriptorProto::type_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name)
return type_name_.GetNoArena();
}
void FieldDescriptorProto::set_type_name(const ::std::string& value) {
set_has_type_name();
type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
}
#if LANG_CXX11
void FieldDescriptorProto::set_type_name(::std::string&& value) {
set_has_type_name();
type_name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.type_name)
}
#endif
void FieldDescriptorProto::set_type_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_type_name();
type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name)
}
void FieldDescriptorProto::set_type_name(const char* value, size_t size) {
set_has_type_name();
type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name)
}
::std::string* FieldDescriptorProto::mutable_type_name() {
set_has_type_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name)
return type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FieldDescriptorProto::release_type_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name)
clear_has_type_name();
return type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) {
if (type_name != NULL) {
set_has_type_name();
} else {
clear_has_type_name();
}
type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
}
// optional string extendee = 2;
bool FieldDescriptorProto::has_extendee() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void FieldDescriptorProto::set_has_extendee() {
_has_bits_[0] |= 0x00000002u;
}
void FieldDescriptorProto::clear_has_extendee() {
_has_bits_[0] &= ~0x00000002u;
}
void FieldDescriptorProto::clear_extendee() {
extendee_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_extendee();
}
const ::std::string& FieldDescriptorProto::extendee() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee)
return extendee_.GetNoArena();
}
void FieldDescriptorProto::set_extendee(const ::std::string& value) {
set_has_extendee();
extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
}
#if LANG_CXX11
void FieldDescriptorProto::set_extendee(::std::string&& value) {
set_has_extendee();
extendee_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.extendee)
}
#endif
void FieldDescriptorProto::set_extendee(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_extendee();
extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee)
}
void FieldDescriptorProto::set_extendee(const char* value, size_t size) {
set_has_extendee();
extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee)
}
::std::string* FieldDescriptorProto::mutable_extendee() {
set_has_extendee();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee)
return extendee_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FieldDescriptorProto::release_extendee() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee)
clear_has_extendee();
return extendee_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) {
if (extendee != NULL) {
set_has_extendee();
} else {
clear_has_extendee();
}
extendee_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
}
// optional string default_value = 7;
bool FieldDescriptorProto::has_default_value() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void FieldDescriptorProto::set_has_default_value() {
_has_bits_[0] |= 0x00000008u;
}
void FieldDescriptorProto::clear_has_default_value() {
_has_bits_[0] &= ~0x00000008u;
}
void FieldDescriptorProto::clear_default_value() {
default_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_default_value();
}
const ::std::string& FieldDescriptorProto::default_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value)
return default_value_.GetNoArena();
}
void FieldDescriptorProto::set_default_value(const ::std::string& value) {
set_has_default_value();
default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
}
#if LANG_CXX11
void FieldDescriptorProto::set_default_value(::std::string&& value) {
set_has_default_value();
default_value_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.default_value)
}
#endif
void FieldDescriptorProto::set_default_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_default_value();
default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value)
}
void FieldDescriptorProto::set_default_value(const char* value, size_t size) {
set_has_default_value();
default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value)
}
::std::string* FieldDescriptorProto::mutable_default_value() {
set_has_default_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value)
return default_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FieldDescriptorProto::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value)
clear_has_default_value();
return default_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) {
if (default_value != NULL) {
set_has_default_value();
} else {
clear_has_default_value();
}
default_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
}
// optional int32 oneof_index = 9;
bool FieldDescriptorProto::has_oneof_index() const {
return (_has_bits_[0] & 0x00000080u) != 0;
}
void FieldDescriptorProto::set_has_oneof_index() {
_has_bits_[0] |= 0x00000080u;
}
void FieldDescriptorProto::clear_has_oneof_index() {
_has_bits_[0] &= ~0x00000080u;
}
void FieldDescriptorProto::clear_oneof_index() {
oneof_index_ = 0;
clear_has_oneof_index();
}
::google::protobuf::int32 FieldDescriptorProto::oneof_index() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index)
return oneof_index_;
}
void FieldDescriptorProto::set_oneof_index(::google::protobuf::int32 value) {
set_has_oneof_index();
oneof_index_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index)
}
// optional string json_name = 10;
bool FieldDescriptorProto::has_json_name() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void FieldDescriptorProto::set_has_json_name() {
_has_bits_[0] |= 0x00000010u;
}
void FieldDescriptorProto::clear_has_json_name() {
_has_bits_[0] &= ~0x00000010u;
}
void FieldDescriptorProto::clear_json_name() {
json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_json_name();
}
const ::std::string& FieldDescriptorProto::json_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
return json_name_.GetNoArena();
}
void FieldDescriptorProto::set_json_name(const ::std::string& value) {
set_has_json_name();
json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
}
#if LANG_CXX11
void FieldDescriptorProto::set_json_name(::std::string&& value) {
set_has_json_name();
json_name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.json_name)
}
#endif
void FieldDescriptorProto::set_json_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_json_name();
json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name)
}
void FieldDescriptorProto::set_json_name(const char* value, size_t size) {
set_has_json_name();
json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
}
::std::string* FieldDescriptorProto::mutable_json_name() {
set_has_json_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FieldDescriptorProto::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name)
clear_has_json_name();
return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) {
if (json_name != NULL) {
set_has_json_name();
} else {
clear_has_json_name();
}
json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
}
// optional .google.protobuf.FieldOptions options = 8;
bool FieldDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void FieldDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000020u;
}
void FieldDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000020u;
}
void FieldDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear();
clear_has_options();
}
const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::FieldOptions::internal_default_instance();
}
::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::FieldOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options)
return options_;
}
::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
clear_has_options();
::google::protobuf::FieldOptions* temp = options_;
options_ = NULL;
return temp;
}
void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int OneofDescriptorProto::kNameFieldNumber;
const int OneofDescriptorProto::kOptionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
OneofDescriptorProto::OneofDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.OneofDescriptorProto)
}
OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::OneofOptions(*from.options_);
} else {
options_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto)
}
void OneofDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
OneofDescriptorProto::~OneofDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.OneofDescriptorProto)
SharedDtor();
}
void OneofDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void OneofDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OneofDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const OneofDescriptorProto& OneofDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
OneofDescriptorProto* OneofDescriptorProto::New(::google::protobuf::Arena* arena) const {
OneofDescriptorProto* n = new OneofDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void OneofDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto)
if (_has_bits_[0 / 32] & 3u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::OneofOptions::Clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool OneofDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.OneofDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.OneofDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.OneofOptions options = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.OneofDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.OneofDescriptorProto)
return false;
#undef DO_
}
void OneofDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.OneofDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.OneofDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional .google.protobuf.OneofOptions options = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.OneofDescriptorProto)
}
::google::protobuf::uint8* OneofDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.OneofDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional .google.protobuf.OneofOptions options = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofDescriptorProto)
return target;
}
size_t OneofDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 3u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.OneofOptions options = 2;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void OneofDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.OneofDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const OneofDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const OneofDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.OneofDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.OneofDescriptorProto)
MergeFrom(*source);
}
}
void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::OneofOptions::MergeFrom(from.options());
}
}
}
void OneofDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.OneofDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void OneofDescriptorProto::CopyFrom(const OneofDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.OneofDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool OneofDescriptorProto::IsInitialized() const {
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void OneofDescriptorProto::Swap(OneofDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) {
name_.Swap(&other->name_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata OneofDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// OneofDescriptorProto
// optional string name = 1;
bool OneofDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void OneofDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void OneofDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void OneofDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& OneofDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name)
return name_.GetNoArena();
}
void OneofDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
#if LANG_CXX11
void OneofDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.OneofDescriptorProto.name)
}
#endif
void OneofDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name)
}
void OneofDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name)
}
::std::string* OneofDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* OneofDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void OneofDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
}
// optional .google.protobuf.OneofOptions options = 2;
bool OneofDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void OneofDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000002u;
}
void OneofDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
void OneofDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::OneofOptions::Clear();
clear_has_options();
}
const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::OneofOptions::internal_default_instance();
}
::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::OneofOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options)
return options_;
}
::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
clear_has_options();
::google::protobuf::OneofOptions* temp = options_;
options_ = NULL;
return temp;
}
void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.options)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumDescriptorProto::kNameFieldNumber;
const int EnumDescriptorProto::kValueFieldNumber;
const int EnumDescriptorProto::kOptionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EnumDescriptorProto::EnumDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumDescriptorProto)
}
EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
value_(from.value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::EnumOptions(*from.options_);
} else {
options_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto)
}
void EnumDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
EnumDescriptorProto::~EnumDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.EnumDescriptorProto)
SharedDtor();
}
void EnumDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void EnumDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumDescriptorProto& EnumDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
EnumDescriptorProto* EnumDescriptorProto::New(::google::protobuf::Arena* arena) const {
EnumDescriptorProto* n = new EnumDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void EnumDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto)
value_.Clear();
if (_has_bits_[0 / 32] & 3u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::EnumOptions::Clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool EnumDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.EnumDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_value()));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.EnumOptions options = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.EnumDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.EnumDescriptorProto)
return false;
#undef DO_
}
void EnumDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.EnumDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->value(i), output);
}
// optional .google.protobuf.EnumOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.EnumDescriptorProto)
}
::google::protobuf::uint8* EnumDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->value(i), deterministic, target);
}
// optional .google.protobuf.EnumOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto)
return target;
}
size_t EnumDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
{
unsigned int count = this->value_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->value(i));
}
}
if (_has_bits_[0 / 32] & 3u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.EnumOptions options = 3;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void EnumDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const EnumDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const EnumDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumDescriptorProto)
MergeFrom(*source);
}
}
void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
value_.MergeFrom(from.value_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::EnumOptions::MergeFrom(from.options());
}
}
}
void EnumDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void EnumDescriptorProto::CopyFrom(const EnumDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EnumDescriptorProto::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->value())) return false;
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void EnumDescriptorProto::Swap(EnumDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) {
value_.InternalSwap(&other->value_);
name_.Swap(&other->name_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EnumDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// EnumDescriptorProto
// optional string name = 1;
bool EnumDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void EnumDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void EnumDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void EnumDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& EnumDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name)
return name_.GetNoArena();
}
void EnumDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
}
#if LANG_CXX11
void EnumDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumDescriptorProto.name)
}
#endif
void EnumDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name)
}
void EnumDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name)
}
::std::string* EnumDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* EnumDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void EnumDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
int EnumDescriptorProto::value_size() const {
return value_.size();
}
void EnumDescriptorProto::clear_value() {
value_.Clear();
}
const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value)
return value_.Get(index);
}
::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value)
return value_.Mutable(index);
}
::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() {
// @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value)
return value_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >*
EnumDescriptorProto::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value)
return &value_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >&
EnumDescriptorProto::value() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value)
return value_;
}
// optional .google.protobuf.EnumOptions options = 3;
bool EnumDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void EnumDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000002u;
}
void EnumDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
void EnumDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear();
clear_has_options();
}
const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::EnumOptions::internal_default_instance();
}
::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::EnumOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options)
return options_;
}
::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
clear_has_options();
::google::protobuf::EnumOptions* temp = options_;
options_ = NULL;
return temp;
}
void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumValueDescriptorProto::kNameFieldNumber;
const int EnumValueDescriptorProto::kNumberFieldNumber;
const int EnumValueDescriptorProto::kOptionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EnumValueDescriptorProto::EnumValueDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumValueDescriptorProto)
}
EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::EnumValueOptions(*from.options_);
} else {
options_ = NULL;
}
number_ = from.number_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto)
}
void EnumValueDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&options_, 0, reinterpret_cast<char*>(&number_) -
reinterpret_cast<char*>(&options_) + sizeof(number_));
}
EnumValueDescriptorProto::~EnumValueDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.EnumValueDescriptorProto)
SharedDtor();
}
void EnumValueDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void EnumValueDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
EnumValueDescriptorProto* EnumValueDescriptorProto::New(::google::protobuf::Arena* arena) const {
EnumValueDescriptorProto* n = new EnumValueDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void EnumValueDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto)
if (_has_bits_[0 / 32] & 3u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::EnumValueOptions::Clear();
}
}
number_ = 0;
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool EnumValueDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumValueDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.EnumValueDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// optional int32 number = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_number();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &number_)));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.EnumValueOptions options = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.EnumValueDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.EnumValueDescriptorProto)
return false;
#undef DO_
}
void EnumValueDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.EnumValueDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumValueDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional int32 number = 2;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->number(), output);
}
// optional .google.protobuf.EnumValueOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.EnumValueDescriptorProto)
}
::google::protobuf::uint8* EnumValueDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumValueDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional int32 number = 2;
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->number(), target);
}
// optional .google.protobuf.EnumValueOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueDescriptorProto)
return target;
}
size_t EnumValueDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 7u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.EnumValueOptions options = 3;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
// optional int32 number = 2;
if (has_number()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->number());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void EnumValueDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumValueDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const EnumValueDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const EnumValueDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumValueDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumValueDescriptorProto)
MergeFrom(*source);
}
}
void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::EnumValueOptions::MergeFrom(from.options());
}
if (cached_has_bits & 0x00000004u) {
number_ = from.number_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void EnumValueDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumValueDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void EnumValueDescriptorProto::CopyFrom(const EnumValueDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumValueDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EnumValueDescriptorProto::IsInitialized() const {
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void EnumValueDescriptorProto::Swap(EnumValueDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) {
name_.Swap(&other->name_);
std::swap(options_, other->options_);
std::swap(number_, other->number_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EnumValueDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// EnumValueDescriptorProto
// optional string name = 1;
bool EnumValueDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void EnumValueDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void EnumValueDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void EnumValueDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& EnumValueDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name)
return name_.GetNoArena();
}
void EnumValueDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
}
#if LANG_CXX11
void EnumValueDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValueDescriptorProto.name)
}
#endif
void EnumValueDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name)
}
void EnumValueDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name)
}
::std::string* EnumValueDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* EnumValueDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void EnumValueDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
}
// optional int32 number = 2;
bool EnumValueDescriptorProto::has_number() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void EnumValueDescriptorProto::set_has_number() {
_has_bits_[0] |= 0x00000004u;
}
void EnumValueDescriptorProto::clear_has_number() {
_has_bits_[0] &= ~0x00000004u;
}
void EnumValueDescriptorProto::clear_number() {
number_ = 0;
clear_has_number();
}
::google::protobuf::int32 EnumValueDescriptorProto::number() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number)
return number_;
}
void EnumValueDescriptorProto::set_number(::google::protobuf::int32 value) {
set_has_number();
number_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number)
}
// optional .google.protobuf.EnumValueOptions options = 3;
bool EnumValueDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void EnumValueDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000002u;
}
void EnumValueDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
void EnumValueDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear();
clear_has_options();
}
const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::EnumValueOptions::internal_default_instance();
}
::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::EnumValueOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options)
return options_;
}
::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
clear_has_options();
::google::protobuf::EnumValueOptions* temp = options_;
options_ = NULL;
return temp;
}
void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ServiceDescriptorProto::kNameFieldNumber;
const int ServiceDescriptorProto::kMethodFieldNumber;
const int ServiceDescriptorProto::kOptionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ServiceDescriptorProto::ServiceDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ServiceDescriptorProto)
}
ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
method_(from.method_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::ServiceOptions(*from.options_);
} else {
options_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto)
}
void ServiceDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
options_ = NULL;
}
ServiceDescriptorProto::~ServiceDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.ServiceDescriptorProto)
SharedDtor();
}
void ServiceDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void ServiceDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
ServiceDescriptorProto* ServiceDescriptorProto::New(::google::protobuf::Arena* arena) const {
ServiceDescriptorProto* n = new ServiceDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ServiceDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto)
method_.Clear();
if (_has_bits_[0 / 32] & 3u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::ServiceOptions::Clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool ServiceDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ServiceDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.ServiceDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_method()));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.ServiceOptions options = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.ServiceDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.ServiceDescriptorProto)
return false;
#undef DO_
}
void ServiceDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.ServiceDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.ServiceDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
for (unsigned int i = 0, n = this->method_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->method(i), output);
}
// optional .google.protobuf.ServiceOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.ServiceDescriptorProto)
}
::google::protobuf::uint8* ServiceDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.ServiceDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
for (unsigned int i = 0, n = this->method_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->method(i), deterministic, target);
}
// optional .google.protobuf.ServiceOptions options = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceDescriptorProto)
return target;
}
size_t ServiceDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
{
unsigned int count = this->method_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->method(i));
}
}
if (_has_bits_[0 / 32] & 3u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .google.protobuf.ServiceOptions options = 3;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ServiceDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.ServiceDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const ServiceDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const ServiceDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.ServiceDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.ServiceDescriptorProto)
MergeFrom(*source);
}
}
void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
method_.MergeFrom(from.method_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->::google::protobuf::ServiceOptions::MergeFrom(from.options());
}
}
}
void ServiceDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.ServiceDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ServiceDescriptorProto::CopyFrom(const ServiceDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.ServiceDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ServiceDescriptorProto::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->method())) return false;
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void ServiceDescriptorProto::Swap(ServiceDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) {
method_.InternalSwap(&other->method_);
name_.Swap(&other->name_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ServiceDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ServiceDescriptorProto
// optional string name = 1;
bool ServiceDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void ServiceDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void ServiceDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void ServiceDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& ServiceDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name)
return name_.GetNoArena();
}
void ServiceDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
}
#if LANG_CXX11
void ServiceDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.ServiceDescriptorProto.name)
}
#endif
void ServiceDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name)
}
void ServiceDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name)
}
::std::string* ServiceDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* ServiceDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void ServiceDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
int ServiceDescriptorProto::method_size() const {
return method_.size();
}
void ServiceDescriptorProto::clear_method() {
method_.Clear();
}
const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method)
return method_.Get(index);
}
::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method)
return method_.Mutable(index);
}
::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() {
// @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method)
return method_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >*
ServiceDescriptorProto::mutable_method() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method)
return &method_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >&
ServiceDescriptorProto::method() const {
// @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method)
return method_;
}
// optional .google.protobuf.ServiceOptions options = 3;
bool ServiceDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void ServiceDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000002u;
}
void ServiceDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000002u;
}
void ServiceDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear();
clear_has_options();
}
const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::ServiceOptions::internal_default_instance();
}
::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::ServiceOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options)
return options_;
}
::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
clear_has_options();
::google::protobuf::ServiceOptions* temp = options_;
options_ = NULL;
return temp;
}
void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MethodDescriptorProto::kNameFieldNumber;
const int MethodDescriptorProto::kInputTypeFieldNumber;
const int MethodDescriptorProto::kOutputTypeFieldNumber;
const int MethodDescriptorProto::kOptionsFieldNumber;
const int MethodDescriptorProto::kClientStreamingFieldNumber;
const int MethodDescriptorProto::kServerStreamingFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MethodDescriptorProto::MethodDescriptorProto()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MethodDescriptorProto)
}
MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name()) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_input_type()) {
input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_);
}
output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_output_type()) {
output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_);
}
if (from.has_options()) {
options_ = new ::google::protobuf::MethodOptions(*from.options_);
} else {
options_ = NULL;
}
::memcpy(&client_streaming_, &from.client_streaming_,
reinterpret_cast<char*>(&server_streaming_) -
reinterpret_cast<char*>(&client_streaming_) + sizeof(server_streaming_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto)
}
void MethodDescriptorProto::SharedCtor() {
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&options_, 0, reinterpret_cast<char*>(&server_streaming_) -
reinterpret_cast<char*>(&options_) + sizeof(server_streaming_));
}
MethodDescriptorProto::~MethodDescriptorProto() {
// @@protoc_insertion_point(destructor:google.protobuf.MethodDescriptorProto)
SharedDtor();
}
void MethodDescriptorProto::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
input_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
output_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) {
delete options_;
}
}
void MethodDescriptorProto::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MethodDescriptorProto& MethodDescriptorProto::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
MethodDescriptorProto* MethodDescriptorProto::New(::google::protobuf::Arena* arena) const {
MethodDescriptorProto* n = new MethodDescriptorProto;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void MethodDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto)
if (_has_bits_[0 / 32] & 15u) {
if (has_name()) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_.UnsafeRawStringPointer())->clear();
}
if (has_input_type()) {
GOOGLE_DCHECK(!input_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*input_type_.UnsafeRawStringPointer())->clear();
}
if (has_output_type()) {
GOOGLE_DCHECK(!output_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*output_type_.UnsafeRawStringPointer())->clear();
}
if (has_options()) {
GOOGLE_DCHECK(options_ != NULL);
options_->::google::protobuf::MethodOptions::Clear();
}
}
if (_has_bits_[0 / 32] & 48u) {
::memset(&client_streaming_, 0, reinterpret_cast<char*>(&server_streaming_) -
reinterpret_cast<char*>(&client_streaming_) + sizeof(server_streaming_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool MethodDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MethodDescriptorProto)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.name");
} else {
goto handle_unusual;
}
break;
}
// optional string input_type = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_input_type()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->input_type().data(), this->input_type().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.input_type");
} else {
goto handle_unusual;
}
break;
}
// optional string output_type = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_output_type()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->output_type().data(), this->output_type().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.output_type");
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.MethodOptions options = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_options()));
} else {
goto handle_unusual;
}
break;
}
// optional bool client_streaming = 5 [default = false];
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(40u)) {
set_has_client_streaming();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &client_streaming_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool server_streaming = 6 [default = false];
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(48u)) {
set_has_server_streaming();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &server_streaming_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.MethodDescriptorProto)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.MethodDescriptorProto)
return false;
#undef DO_
}
void MethodDescriptorProto::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.MethodDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional string input_type = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->input_type().data(), this->input_type().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.input_type");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->input_type(), output);
}
// optional string output_type = 3;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->output_type().data(), this->output_type().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.output_type");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->output_type(), output);
}
// optional .google.protobuf.MethodOptions options = 4;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *this->options_, output);
}
// optional bool client_streaming = 5 [default = false];
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->client_streaming(), output);
}
// optional bool server_streaming = 6 [default = false];
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteBool(6, this->server_streaming(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.MethodDescriptorProto)
}
::google::protobuf::uint8* MethodDescriptorProto::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional string input_type = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->input_type().data(), this->input_type().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.input_type");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->input_type(), target);
}
// optional string output_type = 3;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->output_type().data(), this->output_type().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.output_type");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->output_type(), target);
}
// optional .google.protobuf.MethodOptions options = 4;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *this->options_, deterministic, target);
}
// optional bool client_streaming = 5 [default = false];
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->client_streaming(), target);
}
// optional bool server_streaming = 6 [default = false];
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(6, this->server_streaming(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodDescriptorProto)
return target;
}
size_t MethodDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (_has_bits_[0 / 32] & 63u) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional string input_type = 2;
if (has_input_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->input_type());
}
// optional string output_type = 3;
if (has_output_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->output_type());
}
// optional .google.protobuf.MethodOptions options = 4;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->options_);
}
// optional bool client_streaming = 5 [default = false];
if (has_client_streaming()) {
total_size += 1 + 1;
}
// optional bool server_streaming = 6 [default = false];
if (has_server_streaming()) {
total_size += 1 + 1;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MethodDescriptorProto::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.MethodDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
const MethodDescriptorProto* source =
::google::protobuf::internal::DynamicCastToGenerated<const MethodDescriptorProto>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.MethodDescriptorProto)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.MethodDescriptorProto)
MergeFrom(*source);
}
}
void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
set_has_name();
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (cached_has_bits & 0x00000002u) {
set_has_input_type();
input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_);
}
if (cached_has_bits & 0x00000004u) {
set_has_output_type();
output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_);
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->::google::protobuf::MethodOptions::MergeFrom(from.options());
}
if (cached_has_bits & 0x00000010u) {
client_streaming_ = from.client_streaming_;
}
if (cached_has_bits & 0x00000020u) {
server_streaming_ = from.server_streaming_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void MethodDescriptorProto::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.MethodDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MethodDescriptorProto::CopyFrom(const MethodDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.MethodDescriptorProto)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MethodDescriptorProto::IsInitialized() const {
if (has_options()) {
if (!this->options_->IsInitialized()) return false;
}
return true;
}
void MethodDescriptorProto::Swap(MethodDescriptorProto* other) {
if (other == this) return;
InternalSwap(other);
}
void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) {
name_.Swap(&other->name_);
input_type_.Swap(&other->input_type_);
output_type_.Swap(&other->output_type_);
std::swap(options_, other->options_);
std::swap(client_streaming_, other->client_streaming_);
std::swap(server_streaming_, other->server_streaming_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MethodDescriptorProto::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MethodDescriptorProto
// optional string name = 1;
bool MethodDescriptorProto::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void MethodDescriptorProto::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
void MethodDescriptorProto::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
void MethodDescriptorProto::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name();
}
const ::std::string& MethodDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name)
return name_.GetNoArena();
}
void MethodDescriptorProto::set_name(const ::std::string& value) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
}
#if LANG_CXX11
void MethodDescriptorProto::set_name(::std::string&& value) {
set_has_name();
name_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.name)
}
#endif
void MethodDescriptorProto::set_name(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name)
}
void MethodDescriptorProto::set_name(const char* value, size_t size) {
set_has_name();
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name)
}
::std::string* MethodDescriptorProto::mutable_name() {
set_has_name();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* MethodDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name)
clear_has_name();
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MethodDescriptorProto::set_allocated_name(::std::string* name) {
if (name != NULL) {
set_has_name();
} else {
clear_has_name();
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
}
// optional string input_type = 2;
bool MethodDescriptorProto::has_input_type() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void MethodDescriptorProto::set_has_input_type() {
_has_bits_[0] |= 0x00000002u;
}
void MethodDescriptorProto::clear_has_input_type() {
_has_bits_[0] &= ~0x00000002u;
}
void MethodDescriptorProto::clear_input_type() {
input_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_input_type();
}
const ::std::string& MethodDescriptorProto::input_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type)
return input_type_.GetNoArena();
}
void MethodDescriptorProto::set_input_type(const ::std::string& value) {
set_has_input_type();
input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
}
#if LANG_CXX11
void MethodDescriptorProto::set_input_type(::std::string&& value) {
set_has_input_type();
input_type_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.input_type)
}
#endif
void MethodDescriptorProto::set_input_type(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_input_type();
input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type)
}
void MethodDescriptorProto::set_input_type(const char* value, size_t size) {
set_has_input_type();
input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type)
}
::std::string* MethodDescriptorProto::mutable_input_type() {
set_has_input_type();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type)
return input_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* MethodDescriptorProto::release_input_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type)
clear_has_input_type();
return input_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) {
if (input_type != NULL) {
set_has_input_type();
} else {
clear_has_input_type();
}
input_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
}
// optional string output_type = 3;
bool MethodDescriptorProto::has_output_type() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void MethodDescriptorProto::set_has_output_type() {
_has_bits_[0] |= 0x00000004u;
}
void MethodDescriptorProto::clear_has_output_type() {
_has_bits_[0] &= ~0x00000004u;
}
void MethodDescriptorProto::clear_output_type() {
output_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_output_type();
}
const ::std::string& MethodDescriptorProto::output_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type)
return output_type_.GetNoArena();
}
void MethodDescriptorProto::set_output_type(const ::std::string& value) {
set_has_output_type();
output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
}
#if LANG_CXX11
void MethodDescriptorProto::set_output_type(::std::string&& value) {
set_has_output_type();
output_type_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.output_type)
}
#endif
void MethodDescriptorProto::set_output_type(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_output_type();
output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type)
}
void MethodDescriptorProto::set_output_type(const char* value, size_t size) {
set_has_output_type();
output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type)
}
::std::string* MethodDescriptorProto::mutable_output_type() {
set_has_output_type();
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type)
return output_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* MethodDescriptorProto::release_output_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type)
clear_has_output_type();
return output_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) {
if (output_type != NULL) {
set_has_output_type();
} else {
clear_has_output_type();
}
output_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
}
// optional .google.protobuf.MethodOptions options = 4;
bool MethodDescriptorProto::has_options() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void MethodDescriptorProto::set_has_options() {
_has_bits_[0] |= 0x00000008u;
}
void MethodDescriptorProto::clear_has_options() {
_has_bits_[0] &= ~0x00000008u;
}
void MethodDescriptorProto::clear_options() {
if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear();
clear_has_options();
}
const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options)
return options_ != NULL ? *options_
: *::google::protobuf::MethodOptions::internal_default_instance();
}
::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
options_ = new ::google::protobuf::MethodOptions;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options)
return options_;
}
::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
clear_has_options();
::google::protobuf::MethodOptions* temp = options_;
options_ = NULL;
return temp;
}
void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* options) {
delete options_;
options_ = options;
if (options) {
set_has_options();
} else {
clear_has_options();
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options)
}
// optional bool client_streaming = 5 [default = false];
bool MethodDescriptorProto::has_client_streaming() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void MethodDescriptorProto::set_has_client_streaming() {
_has_bits_[0] |= 0x00000010u;
}
void MethodDescriptorProto::clear_has_client_streaming() {
_has_bits_[0] &= ~0x00000010u;
}
void MethodDescriptorProto::clear_client_streaming() {
client_streaming_ = false;
clear_has_client_streaming();
}
bool MethodDescriptorProto::client_streaming() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.client_streaming)
return client_streaming_;
}
void MethodDescriptorProto::set_client_streaming(bool value) {
set_has_client_streaming();
client_streaming_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.client_streaming)
}
// optional bool server_streaming = 6 [default = false];
bool MethodDescriptorProto::has_server_streaming() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void MethodDescriptorProto::set_has_server_streaming() {
_has_bits_[0] |= 0x00000020u;
}
void MethodDescriptorProto::clear_has_server_streaming() {
_has_bits_[0] &= ~0x00000020u;
}
void MethodDescriptorProto::clear_server_streaming() {
server_streaming_ = false;
clear_has_server_streaming();
}
bool MethodDescriptorProto::server_streaming() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.server_streaming)
return server_streaming_;
}
void MethodDescriptorProto::set_server_streaming(bool value) {
set_has_server_streaming();
server_streaming_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.server_streaming)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FileOptions::kJavaPackageFieldNumber;
const int FileOptions::kJavaOuterClassnameFieldNumber;
const int FileOptions::kJavaMultipleFilesFieldNumber;
const int FileOptions::kJavaGenerateEqualsAndHashFieldNumber;
const int FileOptions::kJavaStringCheckUtf8FieldNumber;
const int FileOptions::kOptimizeForFieldNumber;
const int FileOptions::kGoPackageFieldNumber;
const int FileOptions::kCcGenericServicesFieldNumber;
const int FileOptions::kJavaGenericServicesFieldNumber;
const int FileOptions::kPyGenericServicesFieldNumber;
const int FileOptions::kDeprecatedFieldNumber;
const int FileOptions::kCcEnableArenasFieldNumber;
const int FileOptions::kObjcClassPrefixFieldNumber;
const int FileOptions::kCsharpNamespaceFieldNumber;
const int FileOptions::kSwiftPrefixFieldNumber;
const int FileOptions::kPhpClassPrefixFieldNumber;
const int FileOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FileOptions::FileOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FileOptions)
}
FileOptions::FileOptions(const FileOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
java_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_java_package()) {
java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_);
}
java_outer_classname_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_java_outer_classname()) {
java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_);
}
go_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_go_package()) {
go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_);
}
objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_objc_class_prefix()) {
objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_);
}
csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_csharp_namespace()) {
csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_);
}
swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_swift_prefix()) {
swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_);
}
php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_php_class_prefix()) {
php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
}
::memcpy(&java_multiple_files_, &from.java_multiple_files_,
reinterpret_cast<char*>(&optimize_for_) -
reinterpret_cast<char*>(&java_multiple_files_) + sizeof(optimize_for_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions)
}
void FileOptions::SharedCtor() {
_cached_size_ = 0;
java_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
go_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&java_multiple_files_, 0, reinterpret_cast<char*>(&cc_enable_arenas_) -
reinterpret_cast<char*>(&java_multiple_files_) + sizeof(cc_enable_arenas_));
optimize_for_ = 1;
}
FileOptions::~FileOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.FileOptions)
SharedDtor();
}
void FileOptions::SharedDtor() {
java_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
go_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
objc_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
csharp_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
swift_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
php_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FileOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FileOptions& FileOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
FileOptions* FileOptions::New(::google::protobuf::Arena* arena) const {
FileOptions* n = new FileOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void FileOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
if (_has_bits_[0 / 32] & 127u) {
if (has_java_package()) {
GOOGLE_DCHECK(!java_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*java_package_.UnsafeRawStringPointer())->clear();
}
if (has_java_outer_classname()) {
GOOGLE_DCHECK(!java_outer_classname_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*java_outer_classname_.UnsafeRawStringPointer())->clear();
}
if (has_go_package()) {
GOOGLE_DCHECK(!go_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*go_package_.UnsafeRawStringPointer())->clear();
}
if (has_objc_class_prefix()) {
GOOGLE_DCHECK(!objc_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*objc_class_prefix_.UnsafeRawStringPointer())->clear();
}
if (has_csharp_namespace()) {
GOOGLE_DCHECK(!csharp_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*csharp_namespace_.UnsafeRawStringPointer())->clear();
}
if (has_swift_prefix()) {
GOOGLE_DCHECK(!swift_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*swift_prefix_.UnsafeRawStringPointer())->clear();
}
if (has_php_class_prefix()) {
GOOGLE_DCHECK(!php_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*php_class_prefix_.UnsafeRawStringPointer())->clear();
}
}
java_multiple_files_ = false;
if (_has_bits_[8 / 32] & 65280u) {
::memset(&java_generate_equals_and_hash_, 0, reinterpret_cast<char*>(&cc_enable_arenas_) -
reinterpret_cast<char*>(&java_generate_equals_and_hash_) + sizeof(cc_enable_arenas_));
optimize_for_ = 1;
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool FileOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FileOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string java_package = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_java_package()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_package().data(), this->java_package().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.java_package");
} else {
goto handle_unusual;
}
break;
}
// optional string java_outer_classname = 8;
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_java_outer_classname()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_outer_classname().data(), this->java_outer_classname().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.java_outer_classname");
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(72u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::FileOptions_OptimizeMode_IsValid(value)) {
set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value));
} else {
mutable_unknown_fields()->AddVarint(9, value);
}
} else {
goto handle_unusual;
}
break;
}
// optional bool java_multiple_files = 10 [default = false];
case 10: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(80u)) {
set_has_java_multiple_files();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &java_multiple_files_)));
} else {
goto handle_unusual;
}
break;
}
// optional string go_package = 11;
case 11: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(90u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_go_package()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->go_package().data(), this->go_package().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.go_package");
} else {
goto handle_unusual;
}
break;
}
// optional bool cc_generic_services = 16 [default = false];
case 16: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(128u)) {
set_has_cc_generic_services();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &cc_generic_services_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool java_generic_services = 17 [default = false];
case 17: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(136u)) {
set_has_java_generic_services();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &java_generic_services_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool py_generic_services = 18 [default = false];
case 18: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(144u)) {
set_has_py_generic_services();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &py_generic_services_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
case 20: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(160u)) {
set_has_java_generate_equals_and_hash();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &java_generate_equals_and_hash_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool deprecated = 23 [default = false];
case 23: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(184u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool java_string_check_utf8 = 27 [default = false];
case 27: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(216u)) {
set_has_java_string_check_utf8();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &java_string_check_utf8_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool cc_enable_arenas = 31 [default = false];
case 31: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(248u)) {
set_has_cc_enable_arenas();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &cc_enable_arenas_)));
} else {
goto handle_unusual;
}
break;
}
// optional string objc_class_prefix = 36;
case 36: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(290u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_objc_class_prefix()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->objc_class_prefix().data(), this->objc_class_prefix().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.objc_class_prefix");
} else {
goto handle_unusual;
}
break;
}
// optional string csharp_namespace = 37;
case 37: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(298u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_csharp_namespace()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->csharp_namespace().data(), this->csharp_namespace().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.csharp_namespace");
} else {
goto handle_unusual;
}
break;
}
// optional string swift_prefix = 39;
case 39: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(314u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_swift_prefix()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->swift_prefix().data(), this->swift_prefix().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.swift_prefix");
} else {
goto handle_unusual;
}
break;
}
// optional string php_class_prefix = 40;
case 40: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(322u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_php_class_prefix()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->php_class_prefix().data(), this->php_class_prefix().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.php_class_prefix");
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.FileOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.FileOptions)
return false;
#undef DO_
}
void FileOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.FileOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string java_package = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_package().data(), this->java_package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_package");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->java_package(), output);
}
// optional string java_outer_classname = 8;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_outer_classname().data(), this->java_outer_classname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_outer_classname");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->java_outer_classname(), output);
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
if (cached_has_bits & 0x00008000u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
9, this->optimize_for(), output);
}
// optional bool java_multiple_files = 10 [default = false];
if (cached_has_bits & 0x00000080u) {
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output);
}
// optional string go_package = 11;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->go_package().data(), this->go_package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.go_package");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
11, this->go_package(), output);
}
// optional bool cc_generic_services = 16 [default = false];
if (cached_has_bits & 0x00000400u) {
::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output);
}
// optional bool java_generic_services = 17 [default = false];
if (cached_has_bits & 0x00000800u) {
::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output);
}
// optional bool py_generic_services = 18 [default = false];
if (cached_has_bits & 0x00001000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output);
}
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
if (cached_has_bits & 0x00000100u) {
::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output);
}
// optional bool deprecated = 23 [default = false];
if (cached_has_bits & 0x00002000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(23, this->deprecated(), output);
}
// optional bool java_string_check_utf8 = 27 [default = false];
if (cached_has_bits & 0x00000200u) {
::google::protobuf::internal::WireFormatLite::WriteBool(27, this->java_string_check_utf8(), output);
}
// optional bool cc_enable_arenas = 31 [default = false];
if (cached_has_bits & 0x00004000u) {
::google::protobuf::internal::WireFormatLite::WriteBool(31, this->cc_enable_arenas(), output);
}
// optional string objc_class_prefix = 36;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->objc_class_prefix().data(), this->objc_class_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.objc_class_prefix");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
36, this->objc_class_prefix(), output);
}
// optional string csharp_namespace = 37;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->csharp_namespace().data(), this->csharp_namespace().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.csharp_namespace");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
37, this->csharp_namespace(), output);
}
// optional string swift_prefix = 39;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->swift_prefix().data(), this->swift_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.swift_prefix");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
39, this->swift_prefix(), output);
}
// optional string php_class_prefix = 40;
if (cached_has_bits & 0x00000040u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->php_class_prefix().data(), this->php_class_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.php_class_prefix");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
40, this->php_class_prefix(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.FileOptions)
}
::google::protobuf::uint8* FileOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string java_package = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_package().data(), this->java_package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_package");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->java_package(), target);
}
// optional string java_outer_classname = 8;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->java_outer_classname().data(), this->java_outer_classname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_outer_classname");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->java_outer_classname(), target);
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
if (cached_has_bits & 0x00008000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
9, this->optimize_for(), target);
}
// optional bool java_multiple_files = 10 [default = false];
if (cached_has_bits & 0x00000080u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target);
}
// optional string go_package = 11;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->go_package().data(), this->go_package().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.go_package");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
11, this->go_package(), target);
}
// optional bool cc_generic_services = 16 [default = false];
if (cached_has_bits & 0x00000400u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target);
}
// optional bool java_generic_services = 17 [default = false];
if (cached_has_bits & 0x00000800u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target);
}
// optional bool py_generic_services = 18 [default = false];
if (cached_has_bits & 0x00001000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target);
}
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
if (cached_has_bits & 0x00000100u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target);
}
// optional bool deprecated = 23 [default = false];
if (cached_has_bits & 0x00002000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target);
}
// optional bool java_string_check_utf8 = 27 [default = false];
if (cached_has_bits & 0x00000200u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(27, this->java_string_check_utf8(), target);
}
// optional bool cc_enable_arenas = 31 [default = false];
if (cached_has_bits & 0x00004000u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target);
}
// optional string objc_class_prefix = 36;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->objc_class_prefix().data(), this->objc_class_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.objc_class_prefix");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
36, this->objc_class_prefix(), target);
}
// optional string csharp_namespace = 37;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->csharp_namespace().data(), this->csharp_namespace().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.csharp_namespace");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
37, this->csharp_namespace(), target);
}
// optional string swift_prefix = 39;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->swift_prefix().data(), this->swift_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.swift_prefix");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
39, this->swift_prefix(), target);
}
// optional string php_class_prefix = 40;
if (cached_has_bits & 0x00000040u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->php_class_prefix().data(), this->php_class_prefix().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.php_class_prefix");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
40, this->php_class_prefix(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileOptions)
return target;
}
size_t FileOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
if (_has_bits_[0 / 32] & 255u) {
// optional string java_package = 1;
if (has_java_package()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->java_package());
}
// optional string java_outer_classname = 8;
if (has_java_outer_classname()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->java_outer_classname());
}
// optional string go_package = 11;
if (has_go_package()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->go_package());
}
// optional string objc_class_prefix = 36;
if (has_objc_class_prefix()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->objc_class_prefix());
}
// optional string csharp_namespace = 37;
if (has_csharp_namespace()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->csharp_namespace());
}
// optional string swift_prefix = 39;
if (has_swift_prefix()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->swift_prefix());
}
// optional string php_class_prefix = 40;
if (has_php_class_prefix()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->php_class_prefix());
}
// optional bool java_multiple_files = 10 [default = false];
if (has_java_multiple_files()) {
total_size += 1 + 1;
}
}
if (_has_bits_[8 / 32] & 65280u) {
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
if (has_java_generate_equals_and_hash()) {
total_size += 2 + 1;
}
// optional bool java_string_check_utf8 = 27 [default = false];
if (has_java_string_check_utf8()) {
total_size += 2 + 1;
}
// optional bool cc_generic_services = 16 [default = false];
if (has_cc_generic_services()) {
total_size += 2 + 1;
}
// optional bool java_generic_services = 17 [default = false];
if (has_java_generic_services()) {
total_size += 2 + 1;
}
// optional bool py_generic_services = 18 [default = false];
if (has_py_generic_services()) {
total_size += 2 + 1;
}
// optional bool deprecated = 23 [default = false];
if (has_deprecated()) {
total_size += 2 + 1;
}
// optional bool cc_enable_arenas = 31 [default = false];
if (has_cc_enable_arenas()) {
total_size += 2 + 1;
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
if (has_optimize_for()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FileOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FileOptions)
GOOGLE_DCHECK_NE(&from, this);
const FileOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const FileOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FileOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FileOptions)
MergeFrom(*source);
}
}
void FileOptions::MergeFrom(const FileOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
set_has_java_package();
java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_);
}
if (cached_has_bits & 0x00000002u) {
set_has_java_outer_classname();
java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_);
}
if (cached_has_bits & 0x00000004u) {
set_has_go_package();
go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_);
}
if (cached_has_bits & 0x00000008u) {
set_has_objc_class_prefix();
objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_);
}
if (cached_has_bits & 0x00000010u) {
set_has_csharp_namespace();
csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_);
}
if (cached_has_bits & 0x00000020u) {
set_has_swift_prefix();
swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_);
}
if (cached_has_bits & 0x00000040u) {
set_has_php_class_prefix();
php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
}
if (cached_has_bits & 0x00000080u) {
java_multiple_files_ = from.java_multiple_files_;
}
_has_bits_[0] |= cached_has_bits;
}
if (cached_has_bits & 65280u) {
if (cached_has_bits & 0x00000100u) {
java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_;
}
if (cached_has_bits & 0x00000200u) {
java_string_check_utf8_ = from.java_string_check_utf8_;
}
if (cached_has_bits & 0x00000400u) {
cc_generic_services_ = from.cc_generic_services_;
}
if (cached_has_bits & 0x00000800u) {
java_generic_services_ = from.java_generic_services_;
}
if (cached_has_bits & 0x00001000u) {
py_generic_services_ = from.py_generic_services_;
}
if (cached_has_bits & 0x00002000u) {
deprecated_ = from.deprecated_;
}
if (cached_has_bits & 0x00004000u) {
cc_enable_arenas_ = from.cc_enable_arenas_;
}
if (cached_has_bits & 0x00008000u) {
optimize_for_ = from.optimize_for_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void FileOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FileOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FileOptions::CopyFrom(const FileOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FileOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FileOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void FileOptions::Swap(FileOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void FileOptions::InternalSwap(FileOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
java_package_.Swap(&other->java_package_);
java_outer_classname_.Swap(&other->java_outer_classname_);
go_package_.Swap(&other->go_package_);
objc_class_prefix_.Swap(&other->objc_class_prefix_);
csharp_namespace_.Swap(&other->csharp_namespace_);
swift_prefix_.Swap(&other->swift_prefix_);
php_class_prefix_.Swap(&other->php_class_prefix_);
std::swap(java_multiple_files_, other->java_multiple_files_);
std::swap(java_generate_equals_and_hash_, other->java_generate_equals_and_hash_);
std::swap(java_string_check_utf8_, other->java_string_check_utf8_);
std::swap(cc_generic_services_, other->cc_generic_services_);
std::swap(java_generic_services_, other->java_generic_services_);
std::swap(py_generic_services_, other->py_generic_services_);
std::swap(deprecated_, other->deprecated_);
std::swap(cc_enable_arenas_, other->cc_enable_arenas_);
std::swap(optimize_for_, other->optimize_for_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata FileOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// FileOptions
// optional string java_package = 1;
bool FileOptions::has_java_package() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void FileOptions::set_has_java_package() {
_has_bits_[0] |= 0x00000001u;
}
void FileOptions::clear_has_java_package() {
_has_bits_[0] &= ~0x00000001u;
}
void FileOptions::clear_java_package() {
java_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_java_package();
}
const ::std::string& FileOptions::java_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package)
return java_package_.GetNoArena();
}
void FileOptions::set_java_package(const ::std::string& value) {
set_has_java_package();
java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
}
#if LANG_CXX11
void FileOptions::set_java_package(::std::string&& value) {
set_has_java_package();
java_package_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_package)
}
#endif
void FileOptions::set_java_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_java_package();
java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package)
}
void FileOptions::set_java_package(const char* value, size_t size) {
set_has_java_package();
java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package)
}
::std::string* FileOptions::mutable_java_package() {
set_has_java_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package)
return java_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_java_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package)
clear_has_java_package();
return java_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_java_package(::std::string* java_package) {
if (java_package != NULL) {
set_has_java_package();
} else {
clear_has_java_package();
}
java_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
}
// optional string java_outer_classname = 8;
bool FileOptions::has_java_outer_classname() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void FileOptions::set_has_java_outer_classname() {
_has_bits_[0] |= 0x00000002u;
}
void FileOptions::clear_has_java_outer_classname() {
_has_bits_[0] &= ~0x00000002u;
}
void FileOptions::clear_java_outer_classname() {
java_outer_classname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_java_outer_classname();
}
const ::std::string& FileOptions::java_outer_classname() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname)
return java_outer_classname_.GetNoArena();
}
void FileOptions::set_java_outer_classname(const ::std::string& value) {
set_has_java_outer_classname();
java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
}
#if LANG_CXX11
void FileOptions::set_java_outer_classname(::std::string&& value) {
set_has_java_outer_classname();
java_outer_classname_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_outer_classname)
}
#endif
void FileOptions::set_java_outer_classname(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_java_outer_classname();
java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname)
}
void FileOptions::set_java_outer_classname(const char* value, size_t size) {
set_has_java_outer_classname();
java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname)
}
::std::string* FileOptions::mutable_java_outer_classname() {
set_has_java_outer_classname();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname)
return java_outer_classname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_java_outer_classname() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname)
clear_has_java_outer_classname();
return java_outer_classname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) {
if (java_outer_classname != NULL) {
set_has_java_outer_classname();
} else {
clear_has_java_outer_classname();
}
java_outer_classname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
}
// optional bool java_multiple_files = 10 [default = false];
bool FileOptions::has_java_multiple_files() const {
return (_has_bits_[0] & 0x00000080u) != 0;
}
void FileOptions::set_has_java_multiple_files() {
_has_bits_[0] |= 0x00000080u;
}
void FileOptions::clear_has_java_multiple_files() {
_has_bits_[0] &= ~0x00000080u;
}
void FileOptions::clear_java_multiple_files() {
java_multiple_files_ = false;
clear_has_java_multiple_files();
}
bool FileOptions::java_multiple_files() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_multiple_files)
return java_multiple_files_;
}
void FileOptions::set_java_multiple_files(bool value) {
set_has_java_multiple_files();
java_multiple_files_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_multiple_files)
}
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
bool FileOptions::has_java_generate_equals_and_hash() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
void FileOptions::set_has_java_generate_equals_and_hash() {
_has_bits_[0] |= 0x00000100u;
}
void FileOptions::clear_has_java_generate_equals_and_hash() {
_has_bits_[0] &= ~0x00000100u;
}
void FileOptions::clear_java_generate_equals_and_hash() {
java_generate_equals_and_hash_ = false;
clear_has_java_generate_equals_and_hash();
}
bool FileOptions::java_generate_equals_and_hash() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generate_equals_and_hash)
return java_generate_equals_and_hash_;
}
void FileOptions::set_java_generate_equals_and_hash(bool value) {
set_has_java_generate_equals_and_hash();
java_generate_equals_and_hash_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generate_equals_and_hash)
}
// optional bool java_string_check_utf8 = 27 [default = false];
bool FileOptions::has_java_string_check_utf8() const {
return (_has_bits_[0] & 0x00000200u) != 0;
}
void FileOptions::set_has_java_string_check_utf8() {
_has_bits_[0] |= 0x00000200u;
}
void FileOptions::clear_has_java_string_check_utf8() {
_has_bits_[0] &= ~0x00000200u;
}
void FileOptions::clear_java_string_check_utf8() {
java_string_check_utf8_ = false;
clear_has_java_string_check_utf8();
}
bool FileOptions::java_string_check_utf8() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_string_check_utf8)
return java_string_check_utf8_;
}
void FileOptions::set_java_string_check_utf8(bool value) {
set_has_java_string_check_utf8();
java_string_check_utf8_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_string_check_utf8)
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
bool FileOptions::has_optimize_for() const {
return (_has_bits_[0] & 0x00008000u) != 0;
}
void FileOptions::set_has_optimize_for() {
_has_bits_[0] |= 0x00008000u;
}
void FileOptions::clear_has_optimize_for() {
_has_bits_[0] &= ~0x00008000u;
}
void FileOptions::clear_optimize_for() {
optimize_for_ = 1;
clear_has_optimize_for();
}
::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for)
return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_);
}
void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) {
assert(::google::protobuf::FileOptions_OptimizeMode_IsValid(value));
set_has_optimize_for();
optimize_for_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for)
}
// optional string go_package = 11;
bool FileOptions::has_go_package() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void FileOptions::set_has_go_package() {
_has_bits_[0] |= 0x00000004u;
}
void FileOptions::clear_has_go_package() {
_has_bits_[0] &= ~0x00000004u;
}
void FileOptions::clear_go_package() {
go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_go_package();
}
const ::std::string& FileOptions::go_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package)
return go_package_.GetNoArena();
}
void FileOptions::set_go_package(const ::std::string& value) {
set_has_go_package();
go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
}
#if LANG_CXX11
void FileOptions::set_go_package(::std::string&& value) {
set_has_go_package();
go_package_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.go_package)
}
#endif
void FileOptions::set_go_package(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_go_package();
go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package)
}
void FileOptions::set_go_package(const char* value, size_t size) {
set_has_go_package();
go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package)
}
::std::string* FileOptions::mutable_go_package() {
set_has_go_package();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package)
return go_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_go_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package)
clear_has_go_package();
return go_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_go_package(::std::string* go_package) {
if (go_package != NULL) {
set_has_go_package();
} else {
clear_has_go_package();
}
go_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
}
// optional bool cc_generic_services = 16 [default = false];
bool FileOptions::has_cc_generic_services() const {
return (_has_bits_[0] & 0x00000400u) != 0;
}
void FileOptions::set_has_cc_generic_services() {
_has_bits_[0] |= 0x00000400u;
}
void FileOptions::clear_has_cc_generic_services() {
_has_bits_[0] &= ~0x00000400u;
}
void FileOptions::clear_cc_generic_services() {
cc_generic_services_ = false;
clear_has_cc_generic_services();
}
bool FileOptions::cc_generic_services() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_generic_services)
return cc_generic_services_;
}
void FileOptions::set_cc_generic_services(bool value) {
set_has_cc_generic_services();
cc_generic_services_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_generic_services)
}
// optional bool java_generic_services = 17 [default = false];
bool FileOptions::has_java_generic_services() const {
return (_has_bits_[0] & 0x00000800u) != 0;
}
void FileOptions::set_has_java_generic_services() {
_has_bits_[0] |= 0x00000800u;
}
void FileOptions::clear_has_java_generic_services() {
_has_bits_[0] &= ~0x00000800u;
}
void FileOptions::clear_java_generic_services() {
java_generic_services_ = false;
clear_has_java_generic_services();
}
bool FileOptions::java_generic_services() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generic_services)
return java_generic_services_;
}
void FileOptions::set_java_generic_services(bool value) {
set_has_java_generic_services();
java_generic_services_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generic_services)
}
// optional bool py_generic_services = 18 [default = false];
bool FileOptions::has_py_generic_services() const {
return (_has_bits_[0] & 0x00001000u) != 0;
}
void FileOptions::set_has_py_generic_services() {
_has_bits_[0] |= 0x00001000u;
}
void FileOptions::clear_has_py_generic_services() {
_has_bits_[0] &= ~0x00001000u;
}
void FileOptions::clear_py_generic_services() {
py_generic_services_ = false;
clear_has_py_generic_services();
}
bool FileOptions::py_generic_services() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.py_generic_services)
return py_generic_services_;
}
void FileOptions::set_py_generic_services(bool value) {
set_has_py_generic_services();
py_generic_services_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services)
}
// optional bool deprecated = 23 [default = false];
bool FileOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00002000u) != 0;
}
void FileOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00002000u;
}
void FileOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00002000u;
}
void FileOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool FileOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.deprecated)
return deprecated_;
}
void FileOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.deprecated)
}
// optional bool cc_enable_arenas = 31 [default = false];
bool FileOptions::has_cc_enable_arenas() const {
return (_has_bits_[0] & 0x00004000u) != 0;
}
void FileOptions::set_has_cc_enable_arenas() {
_has_bits_[0] |= 0x00004000u;
}
void FileOptions::clear_has_cc_enable_arenas() {
_has_bits_[0] &= ~0x00004000u;
}
void FileOptions::clear_cc_enable_arenas() {
cc_enable_arenas_ = false;
clear_has_cc_enable_arenas();
}
bool FileOptions::cc_enable_arenas() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_enable_arenas)
return cc_enable_arenas_;
}
void FileOptions::set_cc_enable_arenas(bool value) {
set_has_cc_enable_arenas();
cc_enable_arenas_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_enable_arenas)
}
// optional string objc_class_prefix = 36;
bool FileOptions::has_objc_class_prefix() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void FileOptions::set_has_objc_class_prefix() {
_has_bits_[0] |= 0x00000008u;
}
void FileOptions::clear_has_objc_class_prefix() {
_has_bits_[0] &= ~0x00000008u;
}
void FileOptions::clear_objc_class_prefix() {
objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_objc_class_prefix();
}
const ::std::string& FileOptions::objc_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix)
return objc_class_prefix_.GetNoArena();
}
void FileOptions::set_objc_class_prefix(const ::std::string& value) {
set_has_objc_class_prefix();
objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
}
#if LANG_CXX11
void FileOptions::set_objc_class_prefix(::std::string&& value) {
set_has_objc_class_prefix();
objc_class_prefix_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.objc_class_prefix)
}
#endif
void FileOptions::set_objc_class_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_objc_class_prefix();
objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.objc_class_prefix)
}
void FileOptions::set_objc_class_prefix(const char* value, size_t size) {
set_has_objc_class_prefix();
objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix)
}
::std::string* FileOptions::mutable_objc_class_prefix() {
set_has_objc_class_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix)
return objc_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_objc_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix)
clear_has_objc_class_prefix();
return objc_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_class_prefix) {
if (objc_class_prefix != NULL) {
set_has_objc_class_prefix();
} else {
clear_has_objc_class_prefix();
}
objc_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
}
// optional string csharp_namespace = 37;
bool FileOptions::has_csharp_namespace() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void FileOptions::set_has_csharp_namespace() {
_has_bits_[0] |= 0x00000010u;
}
void FileOptions::clear_has_csharp_namespace() {
_has_bits_[0] &= ~0x00000010u;
}
void FileOptions::clear_csharp_namespace() {
csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_csharp_namespace();
}
const ::std::string& FileOptions::csharp_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace)
return csharp_namespace_.GetNoArena();
}
void FileOptions::set_csharp_namespace(const ::std::string& value) {
set_has_csharp_namespace();
csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
}
#if LANG_CXX11
void FileOptions::set_csharp_namespace(::std::string&& value) {
set_has_csharp_namespace();
csharp_namespace_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.csharp_namespace)
}
#endif
void FileOptions::set_csharp_namespace(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_csharp_namespace();
csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace)
}
void FileOptions::set_csharp_namespace(const char* value, size_t size) {
set_has_csharp_namespace();
csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace)
}
::std::string* FileOptions::mutable_csharp_namespace() {
set_has_csharp_namespace();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace)
return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_csharp_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace)
clear_has_csharp_namespace();
return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) {
if (csharp_namespace != NULL) {
set_has_csharp_namespace();
} else {
clear_has_csharp_namespace();
}
csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
}
// optional string swift_prefix = 39;
bool FileOptions::has_swift_prefix() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void FileOptions::set_has_swift_prefix() {
_has_bits_[0] |= 0x00000020u;
}
void FileOptions::clear_has_swift_prefix() {
_has_bits_[0] &= ~0x00000020u;
}
void FileOptions::clear_swift_prefix() {
swift_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_swift_prefix();
}
const ::std::string& FileOptions::swift_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix)
return swift_prefix_.GetNoArena();
}
void FileOptions::set_swift_prefix(const ::std::string& value) {
set_has_swift_prefix();
swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
}
#if LANG_CXX11
void FileOptions::set_swift_prefix(::std::string&& value) {
set_has_swift_prefix();
swift_prefix_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.swift_prefix)
}
#endif
void FileOptions::set_swift_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_swift_prefix();
swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.swift_prefix)
}
void FileOptions::set_swift_prefix(const char* value, size_t size) {
set_has_swift_prefix();
swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix)
}
::std::string* FileOptions::mutable_swift_prefix() {
set_has_swift_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix)
return swift_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_swift_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix)
clear_has_swift_prefix();
return swift_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) {
if (swift_prefix != NULL) {
set_has_swift_prefix();
} else {
clear_has_swift_prefix();
}
swift_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
}
// optional string php_class_prefix = 40;
bool FileOptions::has_php_class_prefix() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
void FileOptions::set_has_php_class_prefix() {
_has_bits_[0] |= 0x00000040u;
}
void FileOptions::clear_has_php_class_prefix() {
_has_bits_[0] &= ~0x00000040u;
}
void FileOptions::clear_php_class_prefix() {
php_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_php_class_prefix();
}
const ::std::string& FileOptions::php_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix)
return php_class_prefix_.GetNoArena();
}
void FileOptions::set_php_class_prefix(const ::std::string& value) {
set_has_php_class_prefix();
php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
}
#if LANG_CXX11
void FileOptions::set_php_class_prefix(::std::string&& value) {
set_has_php_class_prefix();
php_class_prefix_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_class_prefix)
}
#endif
void FileOptions::set_php_class_prefix(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_php_class_prefix();
php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_class_prefix)
}
void FileOptions::set_php_class_prefix(const char* value, size_t size) {
set_has_php_class_prefix();
php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix)
}
::std::string* FileOptions::mutable_php_class_prefix() {
set_has_php_class_prefix();
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix)
return php_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* FileOptions::release_php_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix)
clear_has_php_class_prefix();
return php_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix) {
if (php_class_prefix != NULL) {
set_has_php_class_prefix();
} else {
clear_has_php_class_prefix();
}
php_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int FileOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void FileOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
FileOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
FileOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MessageOptions::kMessageSetWireFormatFieldNumber;
const int MessageOptions::kNoStandardDescriptorAccessorFieldNumber;
const int MessageOptions::kDeprecatedFieldNumber;
const int MessageOptions::kMapEntryFieldNumber;
const int MessageOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MessageOptions::MessageOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MessageOptions)
}
MessageOptions::MessageOptions(const MessageOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
::memcpy(&message_set_wire_format_, &from.message_set_wire_format_,
reinterpret_cast<char*>(&map_entry_) -
reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions)
}
void MessageOptions::SharedCtor() {
_cached_size_ = 0;
::memset(&message_set_wire_format_, 0, reinterpret_cast<char*>(&map_entry_) -
reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_));
}
MessageOptions::~MessageOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.MessageOptions)
SharedDtor();
}
void MessageOptions::SharedDtor() {
}
void MessageOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MessageOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MessageOptions& MessageOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
MessageOptions* MessageOptions::New(::google::protobuf::Arena* arena) const {
MessageOptions* n = new MessageOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void MessageOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
if (_has_bits_[0 / 32] & 15u) {
::memset(&message_set_wire_format_, 0, reinterpret_cast<char*>(&map_entry_) -
reinterpret_cast<char*>(&message_set_wire_format_) + sizeof(map_entry_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool MessageOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MessageOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool message_set_wire_format = 1 [default = false];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
set_has_message_set_wire_format();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &message_set_wire_format_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_no_standard_descriptor_accessor();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &no_standard_descriptor_accessor_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool deprecated = 3 [default = false];
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool map_entry = 7;
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(56u)) {
set_has_map_entry();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &map_entry_)));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.MessageOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.MessageOptions)
return false;
#undef DO_
}
void MessageOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.MessageOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool message_set_wire_format = 1 [default = false];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->message_set_wire_format(), output);
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->no_standard_descriptor_accessor(), output);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteBool(3, this->deprecated(), output);
}
// optional bool map_entry = 7;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteBool(7, this->map_entry(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.MessageOptions)
}
::google::protobuf::uint8* MessageOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool message_set_wire_format = 1 [default = false];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->message_set_wire_format(), target);
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->no_standard_descriptor_accessor(), target);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target);
}
// optional bool map_entry = 7;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(7, this->map_entry(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MessageOptions)
return target;
}
size_t MessageOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.MessageOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
if (_has_bits_[0 / 32] & 15u) {
// optional bool message_set_wire_format = 1 [default = false];
if (has_message_set_wire_format()) {
total_size += 1 + 1;
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
if (has_no_standard_descriptor_accessor()) {
total_size += 1 + 1;
}
// optional bool deprecated = 3 [default = false];
if (has_deprecated()) {
total_size += 1 + 1;
}
// optional bool map_entry = 7;
if (has_map_entry()) {
total_size += 1 + 1;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MessageOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.MessageOptions)
GOOGLE_DCHECK_NE(&from, this);
const MessageOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const MessageOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.MessageOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.MessageOptions)
MergeFrom(*source);
}
}
void MessageOptions::MergeFrom(const MessageOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MessageOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 15u) {
if (cached_has_bits & 0x00000001u) {
message_set_wire_format_ = from.message_set_wire_format_;
}
if (cached_has_bits & 0x00000002u) {
no_standard_descriptor_accessor_ = from.no_standard_descriptor_accessor_;
}
if (cached_has_bits & 0x00000004u) {
deprecated_ = from.deprecated_;
}
if (cached_has_bits & 0x00000008u) {
map_entry_ = from.map_entry_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void MessageOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.MessageOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MessageOptions::CopyFrom(const MessageOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.MessageOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MessageOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void MessageOptions::Swap(MessageOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void MessageOptions::InternalSwap(MessageOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(message_set_wire_format_, other->message_set_wire_format_);
std::swap(no_standard_descriptor_accessor_, other->no_standard_descriptor_accessor_);
std::swap(deprecated_, other->deprecated_);
std::swap(map_entry_, other->map_entry_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata MessageOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MessageOptions
// optional bool message_set_wire_format = 1 [default = false];
bool MessageOptions::has_message_set_wire_format() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void MessageOptions::set_has_message_set_wire_format() {
_has_bits_[0] |= 0x00000001u;
}
void MessageOptions::clear_has_message_set_wire_format() {
_has_bits_[0] &= ~0x00000001u;
}
void MessageOptions::clear_message_set_wire_format() {
message_set_wire_format_ = false;
clear_has_message_set_wire_format();
}
bool MessageOptions::message_set_wire_format() const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.message_set_wire_format)
return message_set_wire_format_;
}
void MessageOptions::set_message_set_wire_format(bool value) {
set_has_message_set_wire_format();
message_set_wire_format_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.message_set_wire_format)
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
bool MessageOptions::has_no_standard_descriptor_accessor() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void MessageOptions::set_has_no_standard_descriptor_accessor() {
_has_bits_[0] |= 0x00000002u;
}
void MessageOptions::clear_has_no_standard_descriptor_accessor() {
_has_bits_[0] &= ~0x00000002u;
}
void MessageOptions::clear_no_standard_descriptor_accessor() {
no_standard_descriptor_accessor_ = false;
clear_has_no_standard_descriptor_accessor();
}
bool MessageOptions::no_standard_descriptor_accessor() const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.no_standard_descriptor_accessor)
return no_standard_descriptor_accessor_;
}
void MessageOptions::set_no_standard_descriptor_accessor(bool value) {
set_has_no_standard_descriptor_accessor();
no_standard_descriptor_accessor_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.no_standard_descriptor_accessor)
}
// optional bool deprecated = 3 [default = false];
bool MessageOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void MessageOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000004u;
}
void MessageOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000004u;
}
void MessageOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool MessageOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated)
return deprecated_;
}
void MessageOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated)
}
// optional bool map_entry = 7;
bool MessageOptions::has_map_entry() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void MessageOptions::set_has_map_entry() {
_has_bits_[0] |= 0x00000008u;
}
void MessageOptions::clear_has_map_entry() {
_has_bits_[0] &= ~0x00000008u;
}
void MessageOptions::clear_map_entry() {
map_entry_ = false;
clear_has_map_entry();
}
bool MessageOptions::map_entry() const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.map_entry)
return map_entry_;
}
void MessageOptions::set_map_entry(bool value) {
set_has_map_entry();
map_entry_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int MessageOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void MessageOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
MessageOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
MessageOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FieldOptions::kCtypeFieldNumber;
const int FieldOptions::kPackedFieldNumber;
const int FieldOptions::kJstypeFieldNumber;
const int FieldOptions::kLazyFieldNumber;
const int FieldOptions::kDeprecatedFieldNumber;
const int FieldOptions::kWeakFieldNumber;
const int FieldOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
FieldOptions::FieldOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.FieldOptions)
}
FieldOptions::FieldOptions(const FieldOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
::memcpy(&ctype_, &from.ctype_,
reinterpret_cast<char*>(&jstype_) -
reinterpret_cast<char*>(&ctype_) + sizeof(jstype_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions)
}
void FieldOptions::SharedCtor() {
_cached_size_ = 0;
::memset(&ctype_, 0, reinterpret_cast<char*>(&jstype_) -
reinterpret_cast<char*>(&ctype_) + sizeof(jstype_));
}
FieldOptions::~FieldOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.FieldOptions)
SharedDtor();
}
void FieldOptions::SharedDtor() {
}
void FieldOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FieldOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const FieldOptions& FieldOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
FieldOptions* FieldOptions::New(::google::protobuf::Arena* arena) const {
FieldOptions* n = new FieldOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void FieldOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
if (_has_bits_[0 / 32] & 63u) {
::memset(&ctype_, 0, reinterpret_cast<char*>(&jstype_) -
reinterpret_cast<char*>(&ctype_) + sizeof(jstype_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool FieldOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.FieldOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::FieldOptions_CType_IsValid(value)) {
set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value));
} else {
mutable_unknown_fields()->AddVarint(1, value);
}
} else {
goto handle_unusual;
}
break;
}
// optional bool packed = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_packed();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &packed_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool deprecated = 3 [default = false];
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool lazy = 5 [default = false];
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(40u)) {
set_has_lazy();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &lazy_)));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(48u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::FieldOptions_JSType_IsValid(value)) {
set_jstype(static_cast< ::google::protobuf::FieldOptions_JSType >(value));
} else {
mutable_unknown_fields()->AddVarint(6, value);
}
} else {
goto handle_unusual;
}
break;
}
// optional bool weak = 10 [default = false];
case 10: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(80u)) {
set_has_weak();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &weak_)));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.FieldOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.FieldOptions)
return false;
#undef DO_
}
void FieldOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.FieldOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->ctype(), output);
}
// optional bool packed = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->packed(), output);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteBool(3, this->deprecated(), output);
}
// optional bool lazy = 5 [default = false];
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->lazy(), output);
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
6, this->jstype(), output);
}
// optional bool weak = 10 [default = false];
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->weak(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.FieldOptions)
}
::google::protobuf::uint8* FieldOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
1, this->ctype(), target);
}
// optional bool packed = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->packed(), target);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target);
}
// optional bool lazy = 5 [default = false];
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->lazy(), target);
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
6, this->jstype(), target);
}
// optional bool weak = 10 [default = false];
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->weak(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions)
return target;
}
size_t FieldOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
if (_has_bits_[0 / 32] & 63u) {
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
if (has_ctype()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->ctype());
}
// optional bool packed = 2;
if (has_packed()) {
total_size += 1 + 1;
}
// optional bool lazy = 5 [default = false];
if (has_lazy()) {
total_size += 1 + 1;
}
// optional bool deprecated = 3 [default = false];
if (has_deprecated()) {
total_size += 1 + 1;
}
// optional bool weak = 10 [default = false];
if (has_weak()) {
total_size += 1 + 1;
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
if (has_jstype()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->jstype());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FieldOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FieldOptions)
GOOGLE_DCHECK_NE(&from, this);
const FieldOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const FieldOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FieldOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FieldOptions)
MergeFrom(*source);
}
}
void FieldOptions::MergeFrom(const FieldOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
ctype_ = from.ctype_;
}
if (cached_has_bits & 0x00000002u) {
packed_ = from.packed_;
}
if (cached_has_bits & 0x00000004u) {
lazy_ = from.lazy_;
}
if (cached_has_bits & 0x00000008u) {
deprecated_ = from.deprecated_;
}
if (cached_has_bits & 0x00000010u) {
weak_ = from.weak_;
}
if (cached_has_bits & 0x00000020u) {
jstype_ = from.jstype_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void FieldOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FieldOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FieldOptions::CopyFrom(const FieldOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FieldOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FieldOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void FieldOptions::Swap(FieldOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void FieldOptions::InternalSwap(FieldOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(ctype_, other->ctype_);
std::swap(packed_, other->packed_);
std::swap(lazy_, other->lazy_);
std::swap(deprecated_, other->deprecated_);
std::swap(weak_, other->weak_);
std::swap(jstype_, other->jstype_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata FieldOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// FieldOptions
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
bool FieldOptions::has_ctype() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void FieldOptions::set_has_ctype() {
_has_bits_[0] |= 0x00000001u;
}
void FieldOptions::clear_has_ctype() {
_has_bits_[0] &= ~0x00000001u;
}
void FieldOptions::clear_ctype() {
ctype_ = 0;
clear_has_ctype();
}
::google::protobuf::FieldOptions_CType FieldOptions::ctype() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype)
return static_cast< ::google::protobuf::FieldOptions_CType >(ctype_);
}
void FieldOptions::set_ctype(::google::protobuf::FieldOptions_CType value) {
assert(::google::protobuf::FieldOptions_CType_IsValid(value));
set_has_ctype();
ctype_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype)
}
// optional bool packed = 2;
bool FieldOptions::has_packed() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void FieldOptions::set_has_packed() {
_has_bits_[0] |= 0x00000002u;
}
void FieldOptions::clear_has_packed() {
_has_bits_[0] &= ~0x00000002u;
}
void FieldOptions::clear_packed() {
packed_ = false;
clear_has_packed();
}
bool FieldOptions::packed() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.packed)
return packed_;
}
void FieldOptions::set_packed(bool value) {
set_has_packed();
packed_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.packed)
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
bool FieldOptions::has_jstype() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void FieldOptions::set_has_jstype() {
_has_bits_[0] |= 0x00000020u;
}
void FieldOptions::clear_has_jstype() {
_has_bits_[0] &= ~0x00000020u;
}
void FieldOptions::clear_jstype() {
jstype_ = 0;
clear_has_jstype();
}
::google::protobuf::FieldOptions_JSType FieldOptions::jstype() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.jstype)
return static_cast< ::google::protobuf::FieldOptions_JSType >(jstype_);
}
void FieldOptions::set_jstype(::google::protobuf::FieldOptions_JSType value) {
assert(::google::protobuf::FieldOptions_JSType_IsValid(value));
set_has_jstype();
jstype_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.jstype)
}
// optional bool lazy = 5 [default = false];
bool FieldOptions::has_lazy() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void FieldOptions::set_has_lazy() {
_has_bits_[0] |= 0x00000004u;
}
void FieldOptions::clear_has_lazy() {
_has_bits_[0] &= ~0x00000004u;
}
void FieldOptions::clear_lazy() {
lazy_ = false;
clear_has_lazy();
}
bool FieldOptions::lazy() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.lazy)
return lazy_;
}
void FieldOptions::set_lazy(bool value) {
set_has_lazy();
lazy_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.lazy)
}
// optional bool deprecated = 3 [default = false];
bool FieldOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void FieldOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000008u;
}
void FieldOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000008u;
}
void FieldOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool FieldOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.deprecated)
return deprecated_;
}
void FieldOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.deprecated)
}
// optional bool weak = 10 [default = false];
bool FieldOptions::has_weak() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void FieldOptions::set_has_weak() {
_has_bits_[0] |= 0x00000010u;
}
void FieldOptions::clear_has_weak() {
_has_bits_[0] &= ~0x00000010u;
}
void FieldOptions::clear_weak() {
weak_ = false;
clear_has_weak();
}
bool FieldOptions::weak() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.weak)
return weak_;
}
void FieldOptions::set_weak(bool value) {
set_has_weak();
weak_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.weak)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int FieldOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void FieldOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
FieldOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
FieldOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int OneofOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
OneofOptions::OneofOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.OneofOptions)
}
OneofOptions::OneofOptions(const OneofOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions)
}
void OneofOptions::SharedCtor() {
_cached_size_ = 0;
}
OneofOptions::~OneofOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.OneofOptions)
SharedDtor();
}
void OneofOptions::SharedDtor() {
}
void OneofOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OneofOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const OneofOptions& OneofOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
OneofOptions* OneofOptions::New(::google::protobuf::Arena* arena) const {
OneofOptions* n = new OneofOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void OneofOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool OneofOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.OneofOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.OneofOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.OneofOptions)
return false;
#undef DO_
}
void OneofOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.OneofOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.OneofOptions)
}
::google::protobuf::uint8* OneofOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofOptions)
return target;
}
size_t OneofOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void OneofOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.OneofOptions)
GOOGLE_DCHECK_NE(&from, this);
const OneofOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const OneofOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.OneofOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.OneofOptions)
MergeFrom(*source);
}
}
void OneofOptions::MergeFrom(const OneofOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
}
void OneofOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.OneofOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void OneofOptions::CopyFrom(const OneofOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.OneofOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool OneofOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void OneofOptions::Swap(OneofOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void OneofOptions::InternalSwap(OneofOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata OneofOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// OneofOptions
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int OneofOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void OneofOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
OneofOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
OneofOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.OneofOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumOptions::kAllowAliasFieldNumber;
const int EnumOptions::kDeprecatedFieldNumber;
const int EnumOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EnumOptions::EnumOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumOptions)
}
EnumOptions::EnumOptions(const EnumOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
::memcpy(&allow_alias_, &from.allow_alias_,
reinterpret_cast<char*>(&deprecated_) -
reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions)
}
void EnumOptions::SharedCtor() {
_cached_size_ = 0;
::memset(&allow_alias_, 0, reinterpret_cast<char*>(&deprecated_) -
reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_));
}
EnumOptions::~EnumOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.EnumOptions)
SharedDtor();
}
void EnumOptions::SharedDtor() {
}
void EnumOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumOptions& EnumOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
EnumOptions* EnumOptions::New(::google::protobuf::Arena* arena) const {
EnumOptions* n = new EnumOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void EnumOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
if (_has_bits_[0 / 32] & 3u) {
::memset(&allow_alias_, 0, reinterpret_cast<char*>(&deprecated_) -
reinterpret_cast<char*>(&allow_alias_) + sizeof(deprecated_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool EnumOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool allow_alias = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_allow_alias();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &allow_alias_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool deprecated = 3 [default = false];
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.EnumOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.EnumOptions)
return false;
#undef DO_
}
void EnumOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.EnumOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool allow_alias = 2;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->allow_alias(), output);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBool(3, this->deprecated(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.EnumOptions)
}
::google::protobuf::uint8* EnumOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool allow_alias = 2;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->allow_alias(), target);
}
// optional bool deprecated = 3 [default = false];
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->deprecated(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumOptions)
return target;
}
size_t EnumOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
if (_has_bits_[0 / 32] & 3u) {
// optional bool allow_alias = 2;
if (has_allow_alias()) {
total_size += 1 + 1;
}
// optional bool deprecated = 3 [default = false];
if (has_deprecated()) {
total_size += 1 + 1;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void EnumOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumOptions)
GOOGLE_DCHECK_NE(&from, this);
const EnumOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const EnumOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumOptions)
MergeFrom(*source);
}
}
void EnumOptions::MergeFrom(const EnumOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
allow_alias_ = from.allow_alias_;
}
if (cached_has_bits & 0x00000002u) {
deprecated_ = from.deprecated_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void EnumOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void EnumOptions::CopyFrom(const EnumOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EnumOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void EnumOptions::Swap(EnumOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void EnumOptions::InternalSwap(EnumOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(allow_alias_, other->allow_alias_);
std::swap(deprecated_, other->deprecated_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata EnumOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// EnumOptions
// optional bool allow_alias = 2;
bool EnumOptions::has_allow_alias() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void EnumOptions::set_has_allow_alias() {
_has_bits_[0] |= 0x00000001u;
}
void EnumOptions::clear_has_allow_alias() {
_has_bits_[0] &= ~0x00000001u;
}
void EnumOptions::clear_allow_alias() {
allow_alias_ = false;
clear_has_allow_alias();
}
bool EnumOptions::allow_alias() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.allow_alias)
return allow_alias_;
}
void EnumOptions::set_allow_alias(bool value) {
set_has_allow_alias();
allow_alias_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.allow_alias)
}
// optional bool deprecated = 3 [default = false];
bool EnumOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void EnumOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000002u;
}
void EnumOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000002u;
}
void EnumOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool EnumOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated)
return deprecated_;
}
void EnumOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int EnumOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void EnumOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
EnumOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
EnumOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EnumValueOptions::kDeprecatedFieldNumber;
const int EnumValueOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EnumValueOptions::EnumValueOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.EnumValueOptions)
}
EnumValueOptions::EnumValueOptions(const EnumValueOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
deprecated_ = from.deprecated_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions)
}
void EnumValueOptions::SharedCtor() {
_cached_size_ = 0;
deprecated_ = false;
}
EnumValueOptions::~EnumValueOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.EnumValueOptions)
SharedDtor();
}
void EnumValueOptions::SharedDtor() {
}
void EnumValueOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const EnumValueOptions& EnumValueOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
EnumValueOptions* EnumValueOptions::New(::google::protobuf::Arena* arena) const {
EnumValueOptions* n = new EnumValueOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void EnumValueOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
deprecated_ = false;
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool EnumValueOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.EnumValueOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool deprecated = 1 [default = false];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.EnumValueOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.EnumValueOptions)
return false;
#undef DO_
}
void EnumValueOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.EnumValueOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 1 [default = false];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->deprecated(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.EnumValueOptions)
}
::google::protobuf::uint8* EnumValueOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 1 [default = false];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->deprecated(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueOptions)
return target;
}
size_t EnumValueOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
// optional bool deprecated = 1 [default = false];
if (has_deprecated()) {
total_size += 1 + 1;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void EnumValueOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumValueOptions)
GOOGLE_DCHECK_NE(&from, this);
const EnumValueOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const EnumValueOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumValueOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumValueOptions)
MergeFrom(*source);
}
}
void EnumValueOptions::MergeFrom(const EnumValueOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
if (from.has_deprecated()) {
set_deprecated(from.deprecated());
}
}
void EnumValueOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumValueOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void EnumValueOptions::CopyFrom(const EnumValueOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumValueOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EnumValueOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void EnumValueOptions::Swap(EnumValueOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void EnumValueOptions::InternalSwap(EnumValueOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(deprecated_, other->deprecated_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata EnumValueOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// EnumValueOptions
// optional bool deprecated = 1 [default = false];
bool EnumValueOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void EnumValueOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000001u;
}
void EnumValueOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000001u;
}
void EnumValueOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool EnumValueOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.deprecated)
return deprecated_;
}
void EnumValueOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueOptions.deprecated)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int EnumValueOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void EnumValueOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
EnumValueOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
EnumValueOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ServiceOptions::kDeprecatedFieldNumber;
const int ServiceOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ServiceOptions::ServiceOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.ServiceOptions)
}
ServiceOptions::ServiceOptions(const ServiceOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
deprecated_ = from.deprecated_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions)
}
void ServiceOptions::SharedCtor() {
_cached_size_ = 0;
deprecated_ = false;
}
ServiceOptions::~ServiceOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.ServiceOptions)
SharedDtor();
}
void ServiceOptions::SharedDtor() {
}
void ServiceOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ServiceOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ServiceOptions& ServiceOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
ServiceOptions* ServiceOptions::New(::google::protobuf::Arena* arena) const {
ServiceOptions* n = new ServiceOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ServiceOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
deprecated_ = false;
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool ServiceOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.ServiceOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool deprecated = 33 [default = false];
case 33: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(264u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.ServiceOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.ServiceOptions)
return false;
#undef DO_
}
void ServiceOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.ServiceOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 33 [default = false];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteBool(33, this->deprecated(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.ServiceOptions)
}
::google::protobuf::uint8* ServiceOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 33 [default = false];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(33, this->deprecated(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceOptions)
return target;
}
size_t ServiceOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
// optional bool deprecated = 33 [default = false];
if (has_deprecated()) {
total_size += 2 + 1;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ServiceOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.ServiceOptions)
GOOGLE_DCHECK_NE(&from, this);
const ServiceOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const ServiceOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.ServiceOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.ServiceOptions)
MergeFrom(*source);
}
}
void ServiceOptions::MergeFrom(const ServiceOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
if (from.has_deprecated()) {
set_deprecated(from.deprecated());
}
}
void ServiceOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.ServiceOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ServiceOptions::CopyFrom(const ServiceOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.ServiceOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ServiceOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void ServiceOptions::Swap(ServiceOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void ServiceOptions::InternalSwap(ServiceOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(deprecated_, other->deprecated_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata ServiceOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ServiceOptions
// optional bool deprecated = 33 [default = false];
bool ServiceOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void ServiceOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000001u;
}
void ServiceOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000001u;
}
void ServiceOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool ServiceOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.deprecated)
return deprecated_;
}
void ServiceOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.ServiceOptions.deprecated)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int ServiceOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void ServiceOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
ServiceOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
ServiceOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MethodOptions::kDeprecatedFieldNumber;
const int MethodOptions::kIdempotencyLevelFieldNumber;
const int MethodOptions::kUninterpretedOptionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MethodOptions::MethodOptions()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.MethodOptions)
}
MethodOptions::MethodOptions(const MethodOptions& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
uninterpreted_option_(from.uninterpreted_option_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
::memcpy(&deprecated_, &from.deprecated_,
reinterpret_cast<char*>(&idempotency_level_) -
reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions)
}
void MethodOptions::SharedCtor() {
_cached_size_ = 0;
::memset(&deprecated_, 0, reinterpret_cast<char*>(&idempotency_level_) -
reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_));
}
MethodOptions::~MethodOptions() {
// @@protoc_insertion_point(destructor:google.protobuf.MethodOptions)
SharedDtor();
}
void MethodOptions::SharedDtor() {
}
void MethodOptions::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MethodOptions::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MethodOptions& MethodOptions::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
MethodOptions* MethodOptions::New(::google::protobuf::Arena* arena) const {
MethodOptions* n = new MethodOptions;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void MethodOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions)
_extensions_.Clear();
uninterpreted_option_.Clear();
if (_has_bits_[0 / 32] & 3u) {
::memset(&deprecated_, 0, reinterpret_cast<char*>(&idempotency_level_) -
reinterpret_cast<char*>(&deprecated_) + sizeof(idempotency_level_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool MethodOptions::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.MethodOptions)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(16383u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool deprecated = 33 [default = false];
case 33: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(264u)) {
set_has_deprecated();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &deprecated_)));
} else {
goto handle_unusual;
}
break;
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
case 34: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(272u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value)) {
set_idempotency_level(static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(value));
} else {
mutable_unknown_fields()->AddVarint(34, value);
}
} else {
goto handle_unusual;
}
break;
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(7994u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
if ((8000u <= tag)) {
DO_(_extensions_.ParseField(tag, input, internal_default_instance(),
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.MethodOptions)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.MethodOptions)
return false;
#undef DO_
}
void MethodOptions::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.MethodOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 33 [default = false];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteBool(33, this->deprecated(), output);
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
34, this->idempotency_level(), output);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
999, this->uninterpreted_option(i), output);
}
// Extension range [1000, 536870912)
_extensions_.SerializeWithCachedSizes(
1000, 536870912, output);
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.MethodOptions)
}
::google::protobuf::uint8* MethodOptions::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional bool deprecated = 33 [default = false];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(33, this->deprecated(), target);
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
34, this->idempotency_level(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
999, this->uninterpreted_option(i), deterministic, target);
}
// Extension range [1000, 536870912)
target = _extensions_.InternalSerializeWithCachedSizesToArray(
1000, 536870912, deterministic, target);
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodOptions)
return target;
}
size_t MethodOptions::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodOptions)
size_t total_size = 0;
total_size += _extensions_.ByteSize();
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
{
unsigned int count = this->uninterpreted_option_size();
total_size += 2UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->uninterpreted_option(i));
}
}
if (_has_bits_[0 / 32] & 3u) {
// optional bool deprecated = 33 [default = false];
if (has_deprecated()) {
total_size += 2 + 1;
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
if (has_idempotency_level()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->idempotency_level());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MethodOptions::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.MethodOptions)
GOOGLE_DCHECK_NE(&from, this);
const MethodOptions* source =
::google::protobuf::internal::DynamicCastToGenerated<const MethodOptions>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.MethodOptions)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.MethodOptions)
MergeFrom(*source);
}
}
void MethodOptions::MergeFrom(const MethodOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodOptions)
GOOGLE_DCHECK_NE(&from, this);
_extensions_.MergeFrom(from._extensions_);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
deprecated_ = from.deprecated_;
}
if (cached_has_bits & 0x00000002u) {
idempotency_level_ = from.idempotency_level_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void MethodOptions::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.MethodOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MethodOptions::CopyFrom(const MethodOptions& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.MethodOptions)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MethodOptions::IsInitialized() const {
if (!_extensions_.IsInitialized()) {
return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->uninterpreted_option())) return false;
return true;
}
void MethodOptions::Swap(MethodOptions* other) {
if (other == this) return;
InternalSwap(other);
}
void MethodOptions::InternalSwap(MethodOptions* other) {
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
std::swap(deprecated_, other->deprecated_);
std::swap(idempotency_level_, other->idempotency_level_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
::google::protobuf::Metadata MethodOptions::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MethodOptions
// optional bool deprecated = 33 [default = false];
bool MethodOptions::has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void MethodOptions::set_has_deprecated() {
_has_bits_[0] |= 0x00000001u;
}
void MethodOptions::clear_has_deprecated() {
_has_bits_[0] &= ~0x00000001u;
}
void MethodOptions::clear_deprecated() {
deprecated_ = false;
clear_has_deprecated();
}
bool MethodOptions::deprecated() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.deprecated)
return deprecated_;
}
void MethodOptions::set_deprecated(bool value) {
set_has_deprecated();
deprecated_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.deprecated)
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
bool MethodOptions::has_idempotency_level() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void MethodOptions::set_has_idempotency_level() {
_has_bits_[0] |= 0x00000002u;
}
void MethodOptions::clear_has_idempotency_level() {
_has_bits_[0] &= ~0x00000002u;
}
void MethodOptions::clear_idempotency_level() {
idempotency_level_ = 0;
clear_has_idempotency_level();
}
::google::protobuf::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.idempotency_level)
return static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(idempotency_level_);
}
void MethodOptions::set_idempotency_level(::google::protobuf::MethodOptions_IdempotencyLevel value) {
assert(::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value));
set_has_idempotency_level();
idempotency_level_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.idempotency_level)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int MethodOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
}
void MethodOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option)
return uninterpreted_option_.Get(index);
}
::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() {
// @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option)
return uninterpreted_option_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
MethodOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option)
return &uninterpreted_option_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
MethodOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option)
return uninterpreted_option_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UninterpretedOption_NamePart::kNamePartFieldNumber;
const int UninterpretedOption_NamePart::kIsExtensionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UninterpretedOption_NamePart::UninterpretedOption_NamePart()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption.NamePart)
}
UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_part_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_name_part()) {
name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_);
}
is_extension_ = from.is_extension_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart)
}
void UninterpretedOption_NamePart::SharedCtor() {
_cached_size_ = 0;
name_part_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
is_extension_ = false;
}
UninterpretedOption_NamePart::~UninterpretedOption_NamePart() {
// @@protoc_insertion_point(destructor:google.protobuf.UninterpretedOption.NamePart)
SharedDtor();
}
void UninterpretedOption_NamePart::SharedDtor() {
name_part_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption_NamePart::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
UninterpretedOption_NamePart* UninterpretedOption_NamePart::New(::google::protobuf::Arena* arena) const {
UninterpretedOption_NamePart* n = new UninterpretedOption_NamePart;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void UninterpretedOption_NamePart::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart)
if (has_name_part()) {
GOOGLE_DCHECK(!name_part_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*name_part_.UnsafeRawStringPointer())->clear();
}
is_extension_ = false;
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool UninterpretedOption_NamePart::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption.NamePart)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required string name_part = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name_part()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name_part().data(), this->name_part().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.NamePart.name_part");
} else {
goto handle_unusual;
}
break;
}
// required bool is_extension = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
set_has_is_extension();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &is_extension_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.UninterpretedOption.NamePart)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.UninterpretedOption.NamePart)
return false;
#undef DO_
}
void UninterpretedOption_NamePart::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.UninterpretedOption.NamePart)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// required string name_part = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name_part().data(), this->name_part().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.NamePart.name_part");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name_part(), output);
}
// required bool is_extension = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->is_extension(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.UninterpretedOption.NamePart)
}
::google::protobuf::uint8* UninterpretedOption_NamePart::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// required string name_part = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name_part().data(), this->name_part().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.NamePart.name_part");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name_part(), target);
}
// required bool is_extension = 2;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->is_extension(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption.NamePart)
return target;
}
size_t UninterpretedOption_NamePart::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:google.protobuf.UninterpretedOption.NamePart)
size_t total_size = 0;
if (has_name_part()) {
// required string name_part = 1;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name_part());
}
if (has_is_extension()) {
// required bool is_extension = 2;
total_size += 1 + 1;
}
return total_size;
}
size_t UninterpretedOption_NamePart::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption.NamePart)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present.
// required string name_part = 1;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name_part());
// required bool is_extension = 2;
total_size += 1 + 1;
} else {
total_size += RequiredFieldsByteSizeFallback();
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void UninterpretedOption_NamePart::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.UninterpretedOption.NamePart)
GOOGLE_DCHECK_NE(&from, this);
const UninterpretedOption_NamePart* source =
::google::protobuf::internal::DynamicCastToGenerated<const UninterpretedOption_NamePart>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.UninterpretedOption.NamePart)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.UninterpretedOption.NamePart)
MergeFrom(*source);
}
}
void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption.NamePart)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_name_part();
name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_);
}
if (cached_has_bits & 0x00000002u) {
is_extension_ = from.is_extension_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void UninterpretedOption_NamePart::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.UninterpretedOption.NamePart)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void UninterpretedOption_NamePart::CopyFrom(const UninterpretedOption_NamePart& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.UninterpretedOption.NamePart)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool UninterpretedOption_NamePart::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void UninterpretedOption_NamePart::Swap(UninterpretedOption_NamePart* other) {
if (other == this) return;
InternalSwap(other);
}
void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* other) {
name_part_.Swap(&other->name_part_);
std::swap(is_extension_, other->is_extension_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UninterpretedOption_NamePart::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// UninterpretedOption_NamePart
// required string name_part = 1;
bool UninterpretedOption_NamePart::has_name_part() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void UninterpretedOption_NamePart::set_has_name_part() {
_has_bits_[0] |= 0x00000001u;
}
void UninterpretedOption_NamePart::clear_has_name_part() {
_has_bits_[0] &= ~0x00000001u;
}
void UninterpretedOption_NamePart::clear_name_part() {
name_part_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_name_part();
}
const ::std::string& UninterpretedOption_NamePart::name_part() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part)
return name_part_.GetNoArena();
}
void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) {
set_has_name_part();
name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
}
#if LANG_CXX11
void UninterpretedOption_NamePart::set_name_part(::std::string&& value) {
set_has_name_part();
name_part_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.NamePart.name_part)
}
#endif
void UninterpretedOption_NamePart::set_name_part(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_name_part();
name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part)
}
void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) {
set_has_name_part();
name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part)
}
::std::string* UninterpretedOption_NamePart::mutable_name_part() {
set_has_name_part();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part)
return name_part_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* UninterpretedOption_NamePart::release_name_part() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part)
clear_has_name_part();
return name_part_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) {
if (name_part != NULL) {
set_has_name_part();
} else {
clear_has_name_part();
}
name_part_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
}
// required bool is_extension = 2;
bool UninterpretedOption_NamePart::has_is_extension() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void UninterpretedOption_NamePart::set_has_is_extension() {
_has_bits_[0] |= 0x00000002u;
}
void UninterpretedOption_NamePart::clear_has_is_extension() {
_has_bits_[0] &= ~0x00000002u;
}
void UninterpretedOption_NamePart::clear_is_extension() {
is_extension_ = false;
clear_has_is_extension();
}
bool UninterpretedOption_NamePart::is_extension() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.is_extension)
return is_extension_;
}
void UninterpretedOption_NamePart::set_is_extension(bool value) {
set_has_is_extension();
is_extension_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.is_extension)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UninterpretedOption::kNameFieldNumber;
const int UninterpretedOption::kIdentifierValueFieldNumber;
const int UninterpretedOption::kPositiveIntValueFieldNumber;
const int UninterpretedOption::kNegativeIntValueFieldNumber;
const int UninterpretedOption::kDoubleValueFieldNumber;
const int UninterpretedOption::kStringValueFieldNumber;
const int UninterpretedOption::kAggregateValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UninterpretedOption::UninterpretedOption()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption)
}
UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
name_(from.name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_identifier_value()) {
identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_);
}
string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_string_value()) {
string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_);
}
aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_aggregate_value()) {
aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_);
}
::memcpy(&positive_int_value_, &from.positive_int_value_,
reinterpret_cast<char*>(&double_value_) -
reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption)
}
void UninterpretedOption::SharedCtor() {
_cached_size_ = 0;
identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&positive_int_value_, 0, reinterpret_cast<char*>(&double_value_) -
reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_));
}
UninterpretedOption::~UninterpretedOption() {
// @@protoc_insertion_point(destructor:google.protobuf.UninterpretedOption)
SharedDtor();
}
void UninterpretedOption::SharedDtor() {
identifier_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
aggregate_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const UninterpretedOption& UninterpretedOption::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
UninterpretedOption* UninterpretedOption::New(::google::protobuf::Arena* arena) const {
UninterpretedOption* n = new UninterpretedOption;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void UninterpretedOption::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption)
name_.Clear();
if (_has_bits_[0 / 32] & 7u) {
if (has_identifier_value()) {
GOOGLE_DCHECK(!identifier_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*identifier_value_.UnsafeRawStringPointer())->clear();
}
if (has_string_value()) {
GOOGLE_DCHECK(!string_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*string_value_.UnsafeRawStringPointer())->clear();
}
if (has_aggregate_value()) {
GOOGLE_DCHECK(!aggregate_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*aggregate_value_.UnsafeRawStringPointer())->clear();
}
}
if (_has_bits_[0 / 32] & 56u) {
::memset(&positive_int_value_, 0, reinterpret_cast<char*>(&double_value_) -
reinterpret_cast<char*>(&positive_int_value_) + sizeof(double_value_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool UninterpretedOption::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.UninterpretedOption)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_name()));
} else {
goto handle_unusual;
}
break;
}
// optional string identifier_value = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_identifier_value()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->identifier_value().data(), this->identifier_value().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.identifier_value");
} else {
goto handle_unusual;
}
break;
}
// optional uint64 positive_int_value = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(32u)) {
set_has_positive_int_value();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &positive_int_value_)));
} else {
goto handle_unusual;
}
break;
}
// optional int64 negative_int_value = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(40u)) {
set_has_negative_int_value();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, &negative_int_value_)));
} else {
goto handle_unusual;
}
break;
}
// optional double double_value = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(49u)) {
set_has_double_value();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &double_value_)));
} else {
goto handle_unusual;
}
break;
}
// optional bytes string_value = 7;
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
input, this->mutable_string_value()));
} else {
goto handle_unusual;
}
break;
}
// optional string aggregate_value = 8;
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_aggregate_value()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->aggregate_value().data(), this->aggregate_value().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.aggregate_value");
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.UninterpretedOption)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.UninterpretedOption)
return false;
#undef DO_
}
void UninterpretedOption::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.UninterpretedOption)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
for (unsigned int i = 0, n = this->name_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->name(i), output);
}
cached_has_bits = _has_bits_[0];
// optional string identifier_value = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->identifier_value().data(), this->identifier_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.identifier_value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->identifier_value(), output);
}
// optional uint64 positive_int_value = 4;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->positive_int_value(), output);
}
// optional int64 negative_int_value = 5;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteInt64(5, this->negative_int_value(), output);
}
// optional double double_value = 6;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteDouble(6, this->double_value(), output);
}
// optional bytes string_value = 7;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
7, this->string_value(), output);
}
// optional string aggregate_value = 8;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->aggregate_value().data(), this->aggregate_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.aggregate_value");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->aggregate_value(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.UninterpretedOption)
}
::google::protobuf::uint8* UninterpretedOption::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
for (unsigned int i = 0, n = this->name_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->name(i), deterministic, target);
}
cached_has_bits = _has_bits_[0];
// optional string identifier_value = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->identifier_value().data(), this->identifier_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.identifier_value");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->identifier_value(), target);
}
// optional uint64 positive_int_value = 4;
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->positive_int_value(), target);
}
// optional int64 negative_int_value = 5;
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(5, this->negative_int_value(), target);
}
// optional double double_value = 6;
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(6, this->double_value(), target);
}
// optional bytes string_value = 7;
if (cached_has_bits & 0x00000002u) {
target =
::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
7, this->string_value(), target);
}
// optional string aggregate_value = 8;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->aggregate_value().data(), this->aggregate_value().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.aggregate_value");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->aggregate_value(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption)
return target;
}
size_t UninterpretedOption::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
{
unsigned int count = this->name_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->name(i));
}
}
if (_has_bits_[0 / 32] & 63u) {
// optional string identifier_value = 3;
if (has_identifier_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->identifier_value());
}
// optional bytes string_value = 7;
if (has_string_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::BytesSize(
this->string_value());
}
// optional string aggregate_value = 8;
if (has_aggregate_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->aggregate_value());
}
// optional uint64 positive_int_value = 4;
if (has_positive_int_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->positive_int_value());
}
// optional int64 negative_int_value = 5;
if (has_negative_int_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->negative_int_value());
}
// optional double double_value = 6;
if (has_double_value()) {
total_size += 1 + 8;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void UninterpretedOption::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.UninterpretedOption)
GOOGLE_DCHECK_NE(&from, this);
const UninterpretedOption* source =
::google::protobuf::internal::DynamicCastToGenerated<const UninterpretedOption>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.UninterpretedOption)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.UninterpretedOption)
MergeFrom(*source);
}
}
void UninterpretedOption::MergeFrom(const UninterpretedOption& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
name_.MergeFrom(from.name_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 63u) {
if (cached_has_bits & 0x00000001u) {
set_has_identifier_value();
identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_);
}
if (cached_has_bits & 0x00000002u) {
set_has_string_value();
string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_);
}
if (cached_has_bits & 0x00000004u) {
set_has_aggregate_value();
aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_);
}
if (cached_has_bits & 0x00000008u) {
positive_int_value_ = from.positive_int_value_;
}
if (cached_has_bits & 0x00000010u) {
negative_int_value_ = from.negative_int_value_;
}
if (cached_has_bits & 0x00000020u) {
double_value_ = from.double_value_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void UninterpretedOption::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.UninterpretedOption)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void UninterpretedOption::CopyFrom(const UninterpretedOption& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.UninterpretedOption)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool UninterpretedOption::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->name())) return false;
return true;
}
void UninterpretedOption::Swap(UninterpretedOption* other) {
if (other == this) return;
InternalSwap(other);
}
void UninterpretedOption::InternalSwap(UninterpretedOption* other) {
name_.InternalSwap(&other->name_);
identifier_value_.Swap(&other->identifier_value_);
string_value_.Swap(&other->string_value_);
aggregate_value_.Swap(&other->aggregate_value_);
std::swap(positive_int_value_, other->positive_int_value_);
std::swap(negative_int_value_, other->negative_int_value_);
std::swap(double_value_, other->double_value_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UninterpretedOption::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// UninterpretedOption
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
int UninterpretedOption::name_size() const {
return name_.size();
}
void UninterpretedOption::clear_name() {
name_.Clear();
}
const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name)
return name_.Get(index);
}
::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name)
return name_.Mutable(index);
}
::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() {
// @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name)
return name_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >*
UninterpretedOption::mutable_name() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name)
return &name_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >&
UninterpretedOption::name() const {
// @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name)
return name_;
}
// optional string identifier_value = 3;
bool UninterpretedOption::has_identifier_value() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void UninterpretedOption::set_has_identifier_value() {
_has_bits_[0] |= 0x00000001u;
}
void UninterpretedOption::clear_has_identifier_value() {
_has_bits_[0] &= ~0x00000001u;
}
void UninterpretedOption::clear_identifier_value() {
identifier_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_identifier_value();
}
const ::std::string& UninterpretedOption::identifier_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value)
return identifier_value_.GetNoArena();
}
void UninterpretedOption::set_identifier_value(const ::std::string& value) {
set_has_identifier_value();
identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
}
#if LANG_CXX11
void UninterpretedOption::set_identifier_value(::std::string&& value) {
set_has_identifier_value();
identifier_value_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.identifier_value)
}
#endif
void UninterpretedOption::set_identifier_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_identifier_value();
identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value)
}
void UninterpretedOption::set_identifier_value(const char* value, size_t size) {
set_has_identifier_value();
identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value)
}
::std::string* UninterpretedOption::mutable_identifier_value() {
set_has_identifier_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value)
return identifier_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* UninterpretedOption::release_identifier_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value)
clear_has_identifier_value();
return identifier_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) {
if (identifier_value != NULL) {
set_has_identifier_value();
} else {
clear_has_identifier_value();
}
identifier_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
}
// optional uint64 positive_int_value = 4;
bool UninterpretedOption::has_positive_int_value() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void UninterpretedOption::set_has_positive_int_value() {
_has_bits_[0] |= 0x00000008u;
}
void UninterpretedOption::clear_has_positive_int_value() {
_has_bits_[0] &= ~0x00000008u;
}
void UninterpretedOption::clear_positive_int_value() {
positive_int_value_ = GOOGLE_ULONGLONG(0);
clear_has_positive_int_value();
}
::google::protobuf::uint64 UninterpretedOption::positive_int_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value)
return positive_int_value_;
}
void UninterpretedOption::set_positive_int_value(::google::protobuf::uint64 value) {
set_has_positive_int_value();
positive_int_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value)
}
// optional int64 negative_int_value = 5;
bool UninterpretedOption::has_negative_int_value() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void UninterpretedOption::set_has_negative_int_value() {
_has_bits_[0] |= 0x00000010u;
}
void UninterpretedOption::clear_has_negative_int_value() {
_has_bits_[0] &= ~0x00000010u;
}
void UninterpretedOption::clear_negative_int_value() {
negative_int_value_ = GOOGLE_LONGLONG(0);
clear_has_negative_int_value();
}
::google::protobuf::int64 UninterpretedOption::negative_int_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value)
return negative_int_value_;
}
void UninterpretedOption::set_negative_int_value(::google::protobuf::int64 value) {
set_has_negative_int_value();
negative_int_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value)
}
// optional double double_value = 6;
bool UninterpretedOption::has_double_value() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void UninterpretedOption::set_has_double_value() {
_has_bits_[0] |= 0x00000020u;
}
void UninterpretedOption::clear_has_double_value() {
_has_bits_[0] &= ~0x00000020u;
}
void UninterpretedOption::clear_double_value() {
double_value_ = 0;
clear_has_double_value();
}
double UninterpretedOption::double_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.double_value)
return double_value_;
}
void UninterpretedOption::set_double_value(double value) {
set_has_double_value();
double_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.double_value)
}
// optional bytes string_value = 7;
bool UninterpretedOption::has_string_value() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void UninterpretedOption::set_has_string_value() {
_has_bits_[0] |= 0x00000002u;
}
void UninterpretedOption::clear_has_string_value() {
_has_bits_[0] &= ~0x00000002u;
}
void UninterpretedOption::clear_string_value() {
string_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_string_value();
}
const ::std::string& UninterpretedOption::string_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value)
return string_value_.GetNoArena();
}
void UninterpretedOption::set_string_value(const ::std::string& value) {
set_has_string_value();
string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
}
#if LANG_CXX11
void UninterpretedOption::set_string_value(::std::string&& value) {
set_has_string_value();
string_value_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.string_value)
}
#endif
void UninterpretedOption::set_string_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_string_value();
string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value)
}
void UninterpretedOption::set_string_value(const void* value, size_t size) {
set_has_string_value();
string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value)
}
::std::string* UninterpretedOption::mutable_string_value() {
set_has_string_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value)
return string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* UninterpretedOption::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value)
clear_has_string_value();
return string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption::set_allocated_string_value(::std::string* string_value) {
if (string_value != NULL) {
set_has_string_value();
} else {
clear_has_string_value();
}
string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
}
// optional string aggregate_value = 8;
bool UninterpretedOption::has_aggregate_value() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void UninterpretedOption::set_has_aggregate_value() {
_has_bits_[0] |= 0x00000004u;
}
void UninterpretedOption::clear_has_aggregate_value() {
_has_bits_[0] &= ~0x00000004u;
}
void UninterpretedOption::clear_aggregate_value() {
aggregate_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_aggregate_value();
}
const ::std::string& UninterpretedOption::aggregate_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value)
return aggregate_value_.GetNoArena();
}
void UninterpretedOption::set_aggregate_value(const ::std::string& value) {
set_has_aggregate_value();
aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
}
#if LANG_CXX11
void UninterpretedOption::set_aggregate_value(::std::string&& value) {
set_has_aggregate_value();
aggregate_value_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.aggregate_value)
}
#endif
void UninterpretedOption::set_aggregate_value(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_aggregate_value();
aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value)
}
void UninterpretedOption::set_aggregate_value(const char* value, size_t size) {
set_has_aggregate_value();
aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value)
}
::std::string* UninterpretedOption::mutable_aggregate_value() {
set_has_aggregate_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value)
return aggregate_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* UninterpretedOption::release_aggregate_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value)
clear_has_aggregate_value();
return aggregate_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) {
if (aggregate_value != NULL) {
set_has_aggregate_value();
} else {
clear_has_aggregate_value();
}
aggregate_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceCodeInfo_Location::kPathFieldNumber;
const int SourceCodeInfo_Location::kSpanFieldNumber;
const int SourceCodeInfo_Location::kLeadingCommentsFieldNumber;
const int SourceCodeInfo_Location::kTrailingCommentsFieldNumber;
const int SourceCodeInfo_Location::kLeadingDetachedCommentsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceCodeInfo_Location::SourceCodeInfo_Location()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo.Location)
}
SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
path_(from.path_),
span_(from.span_),
leading_detached_comments_(from.leading_detached_comments_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
leading_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_leading_comments()) {
leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_);
}
trailing_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_trailing_comments()) {
trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
}
void SourceCodeInfo_Location::SharedCtor() {
_cached_size_ = 0;
leading_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
trailing_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
SourceCodeInfo_Location::~SourceCodeInfo_Location() {
// @@protoc_insertion_point(destructor:google.protobuf.SourceCodeInfo.Location)
SharedDtor();
}
void SourceCodeInfo_Location::SharedDtor() {
leading_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
trailing_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SourceCodeInfo_Location::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
SourceCodeInfo_Location* SourceCodeInfo_Location::New(::google::protobuf::Arena* arena) const {
SourceCodeInfo_Location* n = new SourceCodeInfo_Location;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SourceCodeInfo_Location::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location)
path_.Clear();
span_.Clear();
leading_detached_comments_.Clear();
if (_has_bits_[0 / 32] & 3u) {
if (has_leading_comments()) {
GOOGLE_DCHECK(!leading_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*leading_comments_.UnsafeRawStringPointer())->clear();
}
if (has_trailing_comments()) {
GOOGLE_DCHECK(!trailing_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*trailing_comments_.UnsafeRawStringPointer())->clear();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool SourceCodeInfo_Location::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo.Location)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated int32 path = 1 [packed = true];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_path())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 10u, input, this->mutable_path())));
} else {
goto handle_unusual;
}
break;
}
// repeated int32 span = 2 [packed = true];
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_span())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 18u, input, this->mutable_span())));
} else {
goto handle_unusual;
}
break;
}
// optional string leading_comments = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_leading_comments()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_comments().data(), this->leading_comments().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.leading_comments");
} else {
goto handle_unusual;
}
break;
}
// optional string trailing_comments = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_trailing_comments()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->trailing_comments().data(), this->trailing_comments().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.trailing_comments");
} else {
goto handle_unusual;
}
break;
}
// repeated string leading_detached_comments = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_leading_detached_comments()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_detached_comments(this->leading_detached_comments_size() - 1).data(),
this->leading_detached_comments(this->leading_detached_comments_size() - 1).length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.SourceCodeInfo.Location)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.SourceCodeInfo.Location)
return false;
#undef DO_
}
void SourceCodeInfo_Location::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.SourceCodeInfo.Location)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 path = 1 [packed = true];
if (this->path_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_path_cached_byte_size_);
}
for (int i = 0, n = this->path_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
this->path(i), output);
}
// repeated int32 span = 2 [packed = true];
if (this->span_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_span_cached_byte_size_);
}
for (int i = 0, n = this->span_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
this->span(i), output);
}
cached_has_bits = _has_bits_[0];
// optional string leading_comments = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_comments().data(), this->leading_comments().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.leading_comments");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->leading_comments(), output);
}
// optional string trailing_comments = 4;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->trailing_comments().data(), this->trailing_comments().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.trailing_comments");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
4, this->trailing_comments(), output);
}
// repeated string leading_detached_comments = 6;
for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
::google::protobuf::internal::WireFormatLite::WriteString(
6, this->leading_detached_comments(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.SourceCodeInfo.Location)
}
::google::protobuf::uint8* SourceCodeInfo_Location::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 path = 1 [packed = true];
if (this->path_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_path_cached_byte_size_, target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->path_, target);
}
// repeated int32 span = 2 [packed = true];
if (this->span_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
2,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_span_cached_byte_size_, target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->span_, target);
}
cached_has_bits = _has_bits_[0];
// optional string leading_comments = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_comments().data(), this->leading_comments().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.leading_comments");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->leading_comments(), target);
}
// optional string trailing_comments = 4;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->trailing_comments().data(), this->trailing_comments().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.trailing_comments");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->trailing_comments(), target);
}
// repeated string leading_detached_comments = 6;
for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(6, this->leading_detached_comments(i), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo.Location)
return target;
}
size_t SourceCodeInfo_Location::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated int32 path = 1 [packed = true];
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->path_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_path_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated int32 span = 2 [packed = true];
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->span_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_span_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated string leading_detached_comments = 6;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->leading_detached_comments_size());
for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->leading_detached_comments(i));
}
if (_has_bits_[0 / 32] & 3u) {
// optional string leading_comments = 3;
if (has_leading_comments()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->leading_comments());
}
// optional string trailing_comments = 4;
if (has_trailing_comments()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->trailing_comments());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SourceCodeInfo_Location::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.SourceCodeInfo.Location)
GOOGLE_DCHECK_NE(&from, this);
const SourceCodeInfo_Location* source =
::google::protobuf::internal::DynamicCastToGenerated<const SourceCodeInfo_Location>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.SourceCodeInfo.Location)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.SourceCodeInfo.Location)
MergeFrom(*source);
}
}
void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo.Location)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
path_.MergeFrom(from.path_);
span_.MergeFrom(from.span_);
leading_detached_comments_.MergeFrom(from.leading_detached_comments_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
set_has_leading_comments();
leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_);
}
if (cached_has_bits & 0x00000002u) {
set_has_trailing_comments();
trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_);
}
}
}
void SourceCodeInfo_Location::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.SourceCodeInfo.Location)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SourceCodeInfo_Location::CopyFrom(const SourceCodeInfo_Location& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.SourceCodeInfo.Location)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SourceCodeInfo_Location::IsInitialized() const {
return true;
}
void SourceCodeInfo_Location::Swap(SourceCodeInfo_Location* other) {
if (other == this) return;
InternalSwap(other);
}
void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) {
path_.InternalSwap(&other->path_);
span_.InternalSwap(&other->span_);
leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
leading_comments_.Swap(&other->leading_comments_);
trailing_comments_.Swap(&other->trailing_comments_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SourceCodeInfo_Location::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SourceCodeInfo_Location
// repeated int32 path = 1 [packed = true];
int SourceCodeInfo_Location::path_size() const {
return path_.size();
}
void SourceCodeInfo_Location::clear_path() {
path_.Clear();
}
::google::protobuf::int32 SourceCodeInfo_Location::path(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path)
return path_.Get(index);
}
void SourceCodeInfo_Location::set_path(int index, ::google::protobuf::int32 value) {
path_.Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path)
}
void SourceCodeInfo_Location::add_path(::google::protobuf::int32 value) {
path_.Add(value);
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
SourceCodeInfo_Location::path() const {
// @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path)
return path_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
SourceCodeInfo_Location::mutable_path() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path)
return &path_;
}
// repeated int32 span = 2 [packed = true];
int SourceCodeInfo_Location::span_size() const {
return span_.size();
}
void SourceCodeInfo_Location::clear_span() {
span_.Clear();
}
::google::protobuf::int32 SourceCodeInfo_Location::span(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span)
return span_.Get(index);
}
void SourceCodeInfo_Location::set_span(int index, ::google::protobuf::int32 value) {
span_.Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span)
}
void SourceCodeInfo_Location::add_span(::google::protobuf::int32 value) {
span_.Add(value);
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
SourceCodeInfo_Location::span() const {
// @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span)
return span_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
SourceCodeInfo_Location::mutable_span() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span)
return &span_;
}
// optional string leading_comments = 3;
bool SourceCodeInfo_Location::has_leading_comments() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void SourceCodeInfo_Location::set_has_leading_comments() {
_has_bits_[0] |= 0x00000001u;
}
void SourceCodeInfo_Location::clear_has_leading_comments() {
_has_bits_[0] &= ~0x00000001u;
}
void SourceCodeInfo_Location::clear_leading_comments() {
leading_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_leading_comments();
}
const ::std::string& SourceCodeInfo_Location::leading_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments)
return leading_comments_.GetNoArena();
}
void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) {
set_has_leading_comments();
leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
#if LANG_CXX11
void SourceCodeInfo_Location::set_leading_comments(::std::string&& value) {
set_has_leading_comments();
leading_comments_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
#endif
void SourceCodeInfo_Location::set_leading_comments(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_leading_comments();
leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) {
set_has_leading_comments();
leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
::std::string* SourceCodeInfo_Location::mutable_leading_comments() {
set_has_leading_comments();
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments)
return leading_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* SourceCodeInfo_Location::release_leading_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
clear_has_leading_comments();
return leading_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) {
if (leading_comments != NULL) {
set_has_leading_comments();
} else {
clear_has_leading_comments();
}
leading_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
// optional string trailing_comments = 4;
bool SourceCodeInfo_Location::has_trailing_comments() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void SourceCodeInfo_Location::set_has_trailing_comments() {
_has_bits_[0] |= 0x00000002u;
}
void SourceCodeInfo_Location::clear_has_trailing_comments() {
_has_bits_[0] &= ~0x00000002u;
}
void SourceCodeInfo_Location::clear_trailing_comments() {
trailing_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_trailing_comments();
}
const ::std::string& SourceCodeInfo_Location::trailing_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments)
return trailing_comments_.GetNoArena();
}
void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) {
set_has_trailing_comments();
trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
#if LANG_CXX11
void SourceCodeInfo_Location::set_trailing_comments(::std::string&& value) {
set_has_trailing_comments();
trailing_comments_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
#endif
void SourceCodeInfo_Location::set_trailing_comments(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_trailing_comments();
trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) {
set_has_trailing_comments();
trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
::std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
set_has_trailing_comments();
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments)
return trailing_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* SourceCodeInfo_Location::release_trailing_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
clear_has_trailing_comments();
return trailing_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) {
if (trailing_comments != NULL) {
set_has_trailing_comments();
} else {
clear_has_trailing_comments();
}
trailing_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
// repeated string leading_detached_comments = 6;
int SourceCodeInfo_Location::leading_detached_comments_size() const {
return leading_detached_comments_.size();
}
void SourceCodeInfo_Location::clear_leading_detached_comments() {
leading_detached_comments_.Clear();
}
const ::std::string& SourceCodeInfo_Location::leading_detached_comments(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return leading_detached_comments_.Get(index);
}
::std::string* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return leading_detached_comments_.Mutable(index);
}
void SourceCodeInfo_Location::set_leading_detached_comments(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
leading_detached_comments_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void SourceCodeInfo_Location::set_leading_detached_comments(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
leading_detached_comments_.Mutable(index)->assign(std::move(value));
}
#endif
void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value) {
GOOGLE_DCHECK(value != NULL);
leading_detached_comments_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value, size_t size) {
leading_detached_comments_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
::std::string* SourceCodeInfo_Location::add_leading_detached_comments() {
// @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return leading_detached_comments_.Add();
}
void SourceCodeInfo_Location::add_leading_detached_comments(const ::std::string& value) {
leading_detached_comments_.Add()->assign(value);
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
#if LANG_CXX11
void SourceCodeInfo_Location::add_leading_detached_comments(::std::string&& value) {
leading_detached_comments_.Add(std::move(value));
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
#endif
void SourceCodeInfo_Location::add_leading_detached_comments(const char* value) {
GOOGLE_DCHECK(value != NULL);
leading_detached_comments_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
void SourceCodeInfo_Location::add_leading_detached_comments(const char* value, size_t size) {
leading_detached_comments_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
SourceCodeInfo_Location::leading_detached_comments() const {
// @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return leading_detached_comments_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
SourceCodeInfo_Location::mutable_leading_detached_comments() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return &leading_detached_comments_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceCodeInfo::kLocationFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceCodeInfo::SourceCodeInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo)
}
SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
location_(from.location_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo)
}
void SourceCodeInfo::SharedCtor() {
_cached_size_ = 0;
}
SourceCodeInfo::~SourceCodeInfo() {
// @@protoc_insertion_point(destructor:google.protobuf.SourceCodeInfo)
SharedDtor();
}
void SourceCodeInfo::SharedDtor() {
}
void SourceCodeInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SourceCodeInfo& SourceCodeInfo::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
SourceCodeInfo* SourceCodeInfo::New(::google::protobuf::Arena* arena) const {
SourceCodeInfo* n = new SourceCodeInfo;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SourceCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo)
location_.Clear();
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool SourceCodeInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.SourceCodeInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_location()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.SourceCodeInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.SourceCodeInfo)
return false;
#undef DO_
}
void SourceCodeInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.SourceCodeInfo)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
for (unsigned int i = 0, n = this->location_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->location(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.SourceCodeInfo)
}
::google::protobuf::uint8* SourceCodeInfo::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
for (unsigned int i = 0, n = this->location_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, this->location(i), deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo)
return target;
}
size_t SourceCodeInfo::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
{
unsigned int count = this->location_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->location(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SourceCodeInfo::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.SourceCodeInfo)
GOOGLE_DCHECK_NE(&from, this);
const SourceCodeInfo* source =
::google::protobuf::internal::DynamicCastToGenerated<const SourceCodeInfo>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.SourceCodeInfo)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.SourceCodeInfo)
MergeFrom(*source);
}
}
void SourceCodeInfo::MergeFrom(const SourceCodeInfo& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
location_.MergeFrom(from.location_);
}
void SourceCodeInfo::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.SourceCodeInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SourceCodeInfo::CopyFrom(const SourceCodeInfo& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.SourceCodeInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SourceCodeInfo::IsInitialized() const {
return true;
}
void SourceCodeInfo::Swap(SourceCodeInfo* other) {
if (other == this) return;
InternalSwap(other);
}
void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) {
location_.InternalSwap(&other->location_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SourceCodeInfo::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SourceCodeInfo
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
int SourceCodeInfo::location_size() const {
return location_.size();
}
void SourceCodeInfo::clear_location() {
location_.Clear();
}
const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location)
return location_.Get(index);
}
::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location)
return location_.Mutable(index);
}
::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() {
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location)
return location_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >*
SourceCodeInfo::mutable_location() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location)
return &location_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >&
SourceCodeInfo::location() const {
// @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location)
return location_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GeneratedCodeInfo_Annotation::kPathFieldNumber;
const int GeneratedCodeInfo_Annotation::kSourceFileFieldNumber;
const int GeneratedCodeInfo_Annotation::kBeginFieldNumber;
const int GeneratedCodeInfo_Annotation::kEndFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo.Annotation)
}
GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
path_(from.path_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.has_source_file()) {
source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_);
}
::memcpy(&begin_, &from.begin_,
reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&begin_) + sizeof(end_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation)
}
void GeneratedCodeInfo_Annotation::SharedCtor() {
_cached_size_ = 0;
source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&begin_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&begin_) + sizeof(end_));
}
GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() {
// @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo.Annotation)
SharedDtor();
}
void GeneratedCodeInfo_Annotation::SharedDtor() {
source_file_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const {
GeneratedCodeInfo_Annotation* n = new GeneratedCodeInfo_Annotation;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GeneratedCodeInfo_Annotation::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation)
path_.Clear();
if (has_source_file()) {
GOOGLE_DCHECK(!source_file_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
(*source_file_.UnsafeRawStringPointer())->clear();
}
if (_has_bits_[0 / 32] & 6u) {
::memset(&begin_, 0, reinterpret_cast<char*>(&end_) -
reinterpret_cast<char*>(&begin_) + sizeof(end_));
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo.Annotation)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated int32 path = 1 [packed = true];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_path())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 10u, input, this->mutable_path())));
} else {
goto handle_unusual;
}
break;
}
// optional string source_file = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_source_file()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->source_file().data(), this->source_file().length(),
::google::protobuf::internal::WireFormat::PARSE,
"google.protobuf.GeneratedCodeInfo.Annotation.source_file");
} else {
goto handle_unusual;
}
break;
}
// optional int32 begin = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u)) {
set_has_begin();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &begin_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 end = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(32u)) {
set_has_end();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &end_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo.Annotation)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo.Annotation)
return false;
#undef DO_
}
void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo.Annotation)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 path = 1 [packed = true];
if (this->path_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_path_cached_byte_size_);
}
for (int i = 0, n = this->path_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
this->path(i), output);
}
cached_has_bits = _has_bits_[0];
// optional string source_file = 2;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->source_file().data(), this->source_file().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.GeneratedCodeInfo.Annotation.source_file");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->source_file(), output);
}
// optional int32 begin = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->begin(), output);
}
// optional int32 end = 4;
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->end(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo.Annotation)
}
::google::protobuf::uint8* GeneratedCodeInfo_Annotation::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 path = 1 [packed = true];
if (this->path_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_path_cached_byte_size_, target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->path_, target);
}
cached_has_bits = _has_bits_[0];
// optional string source_file = 2;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->source_file().data(), this->source_file().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"google.protobuf.GeneratedCodeInfo.Annotation.source_file");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->source_file(), target);
}
// optional int32 begin = 3;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->begin(), target);
}
// optional int32 end = 4;
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->end(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo.Annotation)
return target;
}
size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo.Annotation)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated int32 path = 1 [packed = true];
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->path_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_path_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
if (_has_bits_[0 / 32] & 7u) {
// optional string source_file = 2;
if (has_source_file()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->source_file());
}
// optional int32 begin = 3;
if (has_begin()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->begin());
}
// optional int32 end = 4;
if (has_end()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->end());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GeneratedCodeInfo_Annotation::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.GeneratedCodeInfo.Annotation)
GOOGLE_DCHECK_NE(&from, this);
const GeneratedCodeInfo_Annotation* source =
::google::protobuf::internal::DynamicCastToGenerated<const GeneratedCodeInfo_Annotation>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.GeneratedCodeInfo.Annotation)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.GeneratedCodeInfo.Annotation)
MergeFrom(*source);
}
}
void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo.Annotation)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
path_.MergeFrom(from.path_);
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
set_has_source_file();
source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_);
}
if (cached_has_bits & 0x00000002u) {
begin_ = from.begin_;
}
if (cached_has_bits & 0x00000004u) {
end_ = from.end_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void GeneratedCodeInfo_Annotation::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.GeneratedCodeInfo.Annotation)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GeneratedCodeInfo_Annotation::CopyFrom(const GeneratedCodeInfo_Annotation& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.GeneratedCodeInfo.Annotation)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GeneratedCodeInfo_Annotation::IsInitialized() const {
return true;
}
void GeneratedCodeInfo_Annotation::Swap(GeneratedCodeInfo_Annotation* other) {
if (other == this) return;
InternalSwap(other);
}
void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) {
path_.InternalSwap(&other->path_);
source_file_.Swap(&other->source_file_);
std::swap(begin_, other->begin_);
std::swap(end_, other->end_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GeneratedCodeInfo_Annotation
// repeated int32 path = 1 [packed = true];
int GeneratedCodeInfo_Annotation::path_size() const {
return path_.size();
}
void GeneratedCodeInfo_Annotation::clear_path() {
path_.Clear();
}
::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path)
return path_.Get(index);
}
void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) {
path_.Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path)
}
void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) {
path_.Add(value);
// @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >&
GeneratedCodeInfo_Annotation::path() const {
// @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
return path_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int32 >*
GeneratedCodeInfo_Annotation::mutable_path() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
return &path_;
}
// optional string source_file = 2;
bool GeneratedCodeInfo_Annotation::has_source_file() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void GeneratedCodeInfo_Annotation::set_has_source_file() {
_has_bits_[0] |= 0x00000001u;
}
void GeneratedCodeInfo_Annotation::clear_has_source_file() {
_has_bits_[0] &= ~0x00000001u;
}
void GeneratedCodeInfo_Annotation::clear_source_file() {
source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_source_file();
}
const ::std::string& GeneratedCodeInfo_Annotation::source_file() const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
return source_file_.GetNoArena();
}
void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) {
set_has_source_file();
source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
#if LANG_CXX11
void GeneratedCodeInfo_Annotation::set_source_file(::std::string&& value) {
set_has_source_file();
source_file_.SetNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
#endif
void GeneratedCodeInfo_Annotation::set_source_file(const char* value) {
GOOGLE_DCHECK(value != NULL);
set_has_source_file();
source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) {
set_has_source_file();
source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
set_has_source_file();
// @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* GeneratedCodeInfo_Annotation::release_source_file() {
// @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
clear_has_source_file();
return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) {
if (source_file != NULL) {
set_has_source_file();
} else {
clear_has_source_file();
}
source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file);
// @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
// optional int32 begin = 3;
bool GeneratedCodeInfo_Annotation::has_begin() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void GeneratedCodeInfo_Annotation::set_has_begin() {
_has_bits_[0] |= 0x00000002u;
}
void GeneratedCodeInfo_Annotation::clear_has_begin() {
_has_bits_[0] &= ~0x00000002u;
}
void GeneratedCodeInfo_Annotation::clear_begin() {
begin_ = 0;
clear_has_begin();
}
::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin)
return begin_;
}
void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) {
set_has_begin();
begin_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin)
}
// optional int32 end = 4;
bool GeneratedCodeInfo_Annotation::has_end() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void GeneratedCodeInfo_Annotation::set_has_end() {
_has_bits_[0] |= 0x00000004u;
}
void GeneratedCodeInfo_Annotation::clear_has_end() {
_has_bits_[0] &= ~0x00000004u;
}
void GeneratedCodeInfo_Annotation::clear_end() {
end_ = 0;
clear_has_end();
}
::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end)
return end_;
}
void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) {
set_has_end();
end_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GeneratedCodeInfo::kAnnotationFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GeneratedCodeInfo::GeneratedCodeInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo)
}
GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0),
annotation_(from.annotation_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo)
}
void GeneratedCodeInfo::SharedCtor() {
_cached_size_ = 0;
}
GeneratedCodeInfo::~GeneratedCodeInfo() {
// @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo)
SharedDtor();
}
void GeneratedCodeInfo::SharedDtor() {
}
void GeneratedCodeInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GeneratedCodeInfo::descriptor() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults();
return *internal_default_instance();
}
GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const {
GeneratedCodeInfo* n = new GeneratedCodeInfo;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GeneratedCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo)
annotation_.Clear();
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool GeneratedCodeInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_annotation()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo)
return false;
#undef DO_
}
void GeneratedCodeInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->annotation(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo)
}
::google::protobuf::uint8* GeneratedCodeInfo::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, this->annotation(i), deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo)
return target;
}
size_t GeneratedCodeInfo::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
{
unsigned int count = this->annotation_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GeneratedCodeInfo::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.GeneratedCodeInfo)
GOOGLE_DCHECK_NE(&from, this);
const GeneratedCodeInfo* source =
::google::protobuf::internal::DynamicCastToGenerated<const GeneratedCodeInfo>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.GeneratedCodeInfo)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.GeneratedCodeInfo)
MergeFrom(*source);
}
}
void GeneratedCodeInfo::MergeFrom(const GeneratedCodeInfo& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
annotation_.MergeFrom(from.annotation_);
}
void GeneratedCodeInfo::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.GeneratedCodeInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GeneratedCodeInfo::CopyFrom(const GeneratedCodeInfo& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.GeneratedCodeInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GeneratedCodeInfo::IsInitialized() const {
return true;
}
void GeneratedCodeInfo::Swap(GeneratedCodeInfo* other) {
if (other == this) return;
InternalSwap(other);
}
void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
annotation_.InternalSwap(&other->annotation_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const {
protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GeneratedCodeInfo
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
int GeneratedCodeInfo::annotation_size() const {
return annotation_.size();
}
void GeneratedCodeInfo::clear_annotation() {
annotation_.Clear();
}
const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation)
return annotation_.Get(index);
}
::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation)
return annotation_.Mutable(index);
}
::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() {
// @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation)
return annotation_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >*
GeneratedCodeInfo::mutable_annotation() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation)
return &annotation_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >&
GeneratedCodeInfo::annotation() const {
// @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation)
return annotation_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
| npuichigo/ttsflow | third_party/protobuf/src/google/protobuf/descriptor.pb.cc | C++ | apache-2.0 | 644,516 |
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/internal_errqueue.h"
#include <grpc/impl/codegen/log.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_POSIX_SOCKET_TCP
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
namespace grpc_core {
static bool errqueue_supported = false;
bool kernel_supports_errqueue() { return errqueue_supported; }
void grpc_errqueue_init() {
/* Both-compile time and run-time linux kernel versions should be at least 4.0.0
*/
#ifdef GRPC_LINUX_ERRQUEUE
struct utsname buffer;
if (uname(&buffer) != 0) {
gpr_log(GPR_ERROR, "uname: %s", strerror(errno));
return;
}
char* release = buffer.release;
if (release == nullptr) {
return;
}
if (strtol(release, nullptr, 10) >= 4) {
errqueue_supported = true;
} else {
gpr_log(GPR_DEBUG, "ERRQUEUE support not enabled");
}
#endif /* GRPC_LINUX_ERRQUEUE */
}
} /* namespace grpc_core */
#else
namespace grpc_core {
void grpc_errqueue_init() {}
} /* namespace grpc_core */
#endif /* GRPC_POSIX_SOCKET_TCP */
| ctiller/grpc | src/core/lib/iomgr/internal_errqueue.cc | C++ | apache-2.0 | 1,686 |
package org.apache.hawq.pxf.plugins.hbase;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.hawq.pxf.api.FilterParser;
import org.apache.hawq.pxf.api.io.DataType;
import org.apache.hawq.pxf.plugins.hbase.utilities.HBaseColumnDescriptor;
import org.apache.hawq.pxf.plugins.hbase.utilities.HBaseDoubleComparator;
import org.apache.hawq.pxf.plugins.hbase.utilities.HBaseFloatComparator;
import org.apache.hawq.pxf.plugins.hbase.utilities.HBaseIntegerComparator;
import org.apache.hawq.pxf.plugins.hbase.utilities.HBaseTupleDescription;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.filter.*;
import org.apache.hadoop.hbase.util.Bytes;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.apache.hawq.pxf.api.io.DataType.TEXT;
/**
* This is the implementation of {@code FilterParser.FilterBuilder} for HBase.
* <p>
* The class uses the filter parser code to build a filter object,
* either simple (single {@link Filter} class) or a compound ({@link FilterList})
* for {@link HBaseAccessor} to use for its scan.
* <p>
* This is done before the scan starts. It is not a scan time operation.
* <p>
* HBase row key column is a special case.
* If the user defined row key column as TEXT and used {@code <,>,<=,>=,=} operators
* the startkey ({@code >/>=}) and the endkey ({@code </<=}) are stored in addition to
* the created filter.
* This is an addition on top of regular filters and does not replace
* any logic in HBase filter objects.
*/
public class HBaseFilterBuilder implements FilterParser.FilterBuilder {
private Map<FilterParser.Operation, CompareFilter.CompareOp> operatorsMap;
private Map<FilterParser.LogicalOperation, FilterList.Operator> logicalOperatorsMap;
private byte[] startKey;
private byte[] endKey;
private HBaseTupleDescription tupleDescription;
private static final String NOT_OP = "l2";
public HBaseFilterBuilder(HBaseTupleDescription tupleDescription) {
initOperatorsMap();
initLogicalOperatorsMap();
startKey = HConstants.EMPTY_START_ROW;
endKey = HConstants.EMPTY_END_ROW;
this.tupleDescription = tupleDescription;
}
private boolean filterNotOpPresent(String filterString) {
if (filterString.contains(NOT_OP)) {
String regex = ".*[o\\d|l\\d]l2.*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(filterString);
return m.matches();
} else {
return false;
}
}
/**
* Translates a filterString into a HBase {@link Filter} object.
*
* @param filterString filter string
* @return filter object
* @throws Exception if parsing failed
*/
public Filter getFilterObject(String filterString) throws Exception {
if (filterString == null)
return null;
// First check for NOT, HBase does not support this
if (filterNotOpPresent(filterString))
return null;
FilterParser parser = new FilterParser(this);
Object result = parser.parse(filterString.getBytes(FilterParser.DEFAULT_CHARSET));
if (!(result instanceof Filter)) {
throw new Exception("String " + filterString + " couldn't be resolved to any supported filter");
}
return (Filter) result;
}
/**
* Returns the startKey for scanning the HBase table.
* If the user specified a {@code > / >=} operation
* on a textual row key column, this value will be returned.
* Otherwise, the start of table.
*
* @return start key for scanning HBase table
*/
public byte[] startKey() {
return startKey;
}
/**
* Returns the endKey for scanning the HBase table.
* If the user specified a {@code < / <=} operation
* on a textual row key column, this value will be returned.
* Otherwise, the end of table.
*
* @return end key for scanning HBase table
*/
public byte[] endKey() {
return endKey;
}
/**
* Builds a filter from the input operands and operation.
* Two kinds of operations are handled:
* <ol>
* <li>Simple operation between {@code FilterParser.Constant} and {@code FilterParser.ColumnIndex}.
* Supported operations are {@code <, >, <=, <=, >=, =, !=}. </li>
* <li>Compound operations between {@link Filter} objects.
* The only supported operation is {@code AND}. </li>
* </ol>
* <p>
* This function is called by {@link FilterParser},
* each time the parser comes across an operator.
*/
@Override
public Object build(FilterParser.Operation opId,
Object leftOperand,
Object rightOperand) throws Exception {
// Assume column is on the left
return handleSimpleOperations(opId,
(FilterParser.ColumnIndex) leftOperand,
(FilterParser.Constant) rightOperand);
}
@Override
public Object build(FilterParser.Operation operation, Object operand) throws Exception {
return handleSimpleOperations(operation, (FilterParser.ColumnIndex) operand);
}
@Override
public Object build(FilterParser.LogicalOperation opId, Object leftOperand, Object rightOperand) {
return handleCompoundOperations(opId, (Filter) leftOperand, (Filter) rightOperand);
}
@Override
public Object build(FilterParser.LogicalOperation opId, Object leftOperand) {
return null;
}
/**
* Initializes the {@link #operatorsMap} with appropriate values.
*/
private void initOperatorsMap() {
operatorsMap = new EnumMap<FilterParser.Operation, CompareFilter.CompareOp>(FilterParser.Operation.class);
operatorsMap.put(FilterParser.Operation.HDOP_LT, CompareFilter.CompareOp.LESS); // "<"
operatorsMap.put(FilterParser.Operation.HDOP_GT, CompareFilter.CompareOp.GREATER); // ">"
operatorsMap.put(FilterParser.Operation.HDOP_LE, CompareFilter.CompareOp.LESS_OR_EQUAL); // "<="
operatorsMap.put(FilterParser.Operation.HDOP_GE, CompareFilter.CompareOp.GREATER_OR_EQUAL); // ">="
operatorsMap.put(FilterParser.Operation.HDOP_EQ, CompareFilter.CompareOp.EQUAL); // "="
operatorsMap.put(FilterParser.Operation.HDOP_NE, CompareFilter.CompareOp.NOT_EQUAL); // "!="
}
private void initLogicalOperatorsMap() {
logicalOperatorsMap = new EnumMap<>(FilterParser.LogicalOperation.class);
logicalOperatorsMap.put(FilterParser.LogicalOperation.HDOP_AND, FilterList.Operator.MUST_PASS_ALL);
logicalOperatorsMap.put(FilterParser.LogicalOperation.HDOP_OR, FilterList.Operator.MUST_PASS_ONE);
}
private Object handleSimpleOperations(FilterParser.Operation opId,
FilterParser.ColumnIndex column) throws Exception {
HBaseColumnDescriptor hbaseColumn = tupleDescription.getColumn(column.index());
CompareFilter.CompareOp compareOperation;
ByteArrayComparable comparator;
switch (opId) {
case HDOP_IS_NULL:
compareOperation = CompareFilter.CompareOp.EQUAL;
comparator = new NullComparator();
break;
case HDOP_IS_NOT_NULL:
compareOperation = CompareFilter.CompareOp.NOT_EQUAL;
comparator = new NullComparator();
break;
default:
throw new Exception("unsupported unary operation for filtering " + opId);
}
return new SingleColumnValueFilter(hbaseColumn.columnFamilyBytes(),
hbaseColumn.qualifierBytes(),
compareOperation,
comparator);
}
/**
* Handles simple column-operator-constant expressions.
* Creates a special filter in the case the column is the row key column.
*/
private Filter handleSimpleOperations(FilterParser.Operation opId,
FilterParser.ColumnIndex column,
FilterParser.Constant constant) throws Exception {
HBaseColumnDescriptor hbaseColumn = tupleDescription.getColumn(column.index());
ByteArrayComparable comparator = getComparator(hbaseColumn.columnTypeCode(),
constant.constant());
if(operatorsMap.get(opId) == null){
//HBase does not support HDOP_LIKE, use 'NOT NULL' comparator
return new SingleColumnValueFilter(hbaseColumn.columnFamilyBytes(),
hbaseColumn.qualifierBytes(),
CompareFilter.CompareOp.NOT_EQUAL,
new NullComparator());
}
/**
* If row key is of type TEXT, allow filter in start/stop row key API in
* HBaseAccessor/Scan object.
*/
if (textualRowKey(hbaseColumn)) {
storeStartEndKeys(opId, constant.constant());
}
if (hbaseColumn.isKeyColumn()) {
return new RowFilter(operatorsMap.get(opId), comparator);
}
return new SingleColumnValueFilter(hbaseColumn.columnFamilyBytes(),
hbaseColumn.qualifierBytes(),
operatorsMap.get(opId),
comparator);
}
/**
* Resolves the column's type to a comparator class to be used.
* Currently, supported types are TEXT and INTEGER types.
*/
private ByteArrayComparable getComparator(int type, Object data) throws Exception {
ByteArrayComparable result;
switch (DataType.get(type)) {
case TEXT:
result = new BinaryComparator(Bytes.toBytes((String) data));
break;
case SMALLINT:
case INTEGER:
result = new HBaseIntegerComparator(((Integer) data).longValue());
break;
case BIGINT:
if (data instanceof Long) {
result = new HBaseIntegerComparator((Long) data);
} else if (data instanceof Integer) {
result = new HBaseIntegerComparator(((Integer) data).longValue());
} else {
result = null;
}
break;
case FLOAT8:
result = new HBaseDoubleComparator((double) data);
break;
case REAL:
if (data instanceof Double) {
result = new HBaseDoubleComparator((double) data);
} else if (data instanceof Float) {
result = new HBaseFloatComparator((float) data);
} else {
result = null;
}
break;
default:
throw new Exception("unsupported column type for filtering " + type);
}
return result;
}
/**
* Handles operation between already calculated expressions.
* Currently only {@code AND}, in the future {@code OR} can be added.
* <p>
* Four cases here:
* <ol>
* <li>Both are simple filters.</li>
* <li>Left is a FilterList and right is a filter.</li>
* <li>Left is a filter and right is a FilterList.</li>
* <li>Both are FilterLists.</li>
* </ol>
* <p>
* Currently, 1, 2 can occur, since no parenthesis are used.
*/
private Filter handleCompoundOperations(FilterParser.LogicalOperation opId, Filter left, Filter right) {
return new FilterList(logicalOperatorsMap.get(opId), new Filter[] {left, right});
}
/**
* Returns true if column is of type TEXT and is a row key column.
*/
private boolean textualRowKey(HBaseColumnDescriptor column) {
return column.isKeyColumn() &&
column.columnTypeCode() == TEXT.getOID();
}
/**
* Sets startKey/endKey and their inclusiveness
* according to the operation op.
* <p>
* TODO allow only one assignment to start/end key.
* Currently, multiple calls to this function might change
* previous assignments.
*/
private void storeStartEndKeys(FilterParser.Operation op, Object data) {
String key = (String) data;
// Adding a zero byte to endkey, makes it inclusive
// Adding a zero byte to startkey, makes it exclusive
byte[] zeroByte = new byte[1];
zeroByte[0] = 0;
switch (op) {
case HDOP_LT:
endKey = Bytes.toBytes(key);
break;
case HDOP_GT:
startKey = Bytes.add(Bytes.toBytes(key), zeroByte);
break;
case HDOP_LE:
endKey = Bytes.add(Bytes.toBytes(key), zeroByte);
break;
case HDOP_GE:
startKey = Bytes.toBytes(key);
break;
case HDOP_EQ:
startKey = Bytes.toBytes(key);
endKey = Bytes.add(Bytes.toBytes(key), zeroByte);
break;
}
}
}
| lavjain/incubator-hawq | pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java | Java | apache-2.0 | 13,894 |
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.actuate.health;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Factory to create a {@link CompositeReactiveHealthIndicator}.
*
* @author Stephane Nicoll
* @since 2.0.0
*/
public class CompositeReactiveHealthIndicatorFactory {
private final Function<String, String> healthIndicatorNameFactory;
public CompositeReactiveHealthIndicatorFactory(
Function<String, String> healthIndicatorNameFactory) {
this.healthIndicatorNameFactory = healthIndicatorNameFactory;
}
public CompositeReactiveHealthIndicatorFactory() {
this(new HealthIndicatorNameFactory());
}
/**
* Create a {@link CompositeReactiveHealthIndicator} based on the specified health
* indicators. Each {@link HealthIndicator} are wrapped to a
* {@link HealthIndicatorReactiveAdapter}. If two instances share the same name, the
* reactive variant takes precedence.
* @param healthAggregator the {@link HealthAggregator}
* @param reactiveHealthIndicators the {@link ReactiveHealthIndicator} instances
* mapped by name
* @param healthIndicators the {@link HealthIndicator} instances mapped by name if
* any.
* @return a {@link ReactiveHealthIndicator} that delegates to the specified
* {@code reactiveHealthIndicators}.
*/
public CompositeReactiveHealthIndicator createReactiveHealthIndicator(
HealthAggregator healthAggregator,
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(healthAggregator, "HealthAggregator must not be null");
Assert.notNull(reactiveHealthIndicators,
"ReactiveHealthIndicators must not be null");
CompositeReactiveHealthIndicator healthIndicator = new CompositeReactiveHealthIndicator(
healthAggregator);
merge(reactiveHealthIndicators, healthIndicators)
.forEach((beanName, indicator) -> {
String name = this.healthIndicatorNameFactory.apply(beanName);
healthIndicator.addHealthIndicator(name, indicator);
});
return healthIndicator;
}
private Map<String, ReactiveHealthIndicator> merge(
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
if (ObjectUtils.isEmpty(healthIndicators)) {
return reactiveHealthIndicators;
}
Map<String, ReactiveHealthIndicator> allIndicators = new LinkedHashMap<>(
reactiveHealthIndicators);
healthIndicators.forEach((beanName, indicator) -> {
String name = this.healthIndicatorNameFactory.apply(beanName);
allIndicators.computeIfAbsent(name,
(n) -> new HealthIndicatorReactiveAdapter(indicator));
});
return allIndicators;
}
}
| vakninr/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicatorFactory.java | Java | apache-2.0 | 3,398 |
/******************************************
* *
* dcm4che: A OpenSource DICOM Toolkit *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
******************************************/
package org.dcm4chex.archive.hl7;
/**
* @author gunter.zeilinger@tiani.com
* @version $Revision: 1357 $ $Date: 2004-12-30 08:55:56 +0800 (周四, 30 12月 2004) $
* @since 27.10.2004
*
*/
public abstract class HL7Exception extends Exception {
public HL7Exception(String message) {
super(message);
}
public HL7Exception(String message, Throwable cause) {
super(message, cause);
}
public abstract String getAcknowledgementCode();
public static class AE extends HL7Exception {
public AE(String message) {
super(message);
}
public AE(String message, Throwable cause) {
super(message, cause);
}
public String getAcknowledgementCode() {
return "AE";
}
}
public static class AR extends HL7Exception {
public AR(String message) {
super(message);
}
public AR(String message, Throwable cause) {
super(message, cause);
}
public String getAcknowledgementCode() {
return "AR";
}
}
}
| medicayun/medicayundicom | dcm4jboss-all/tags/DCM4JBOSS_2_4_2/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/HL7Exception.java | Java | apache-2.0 | 1,468 |
/*
* Copyright 2012, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.jf.dexlib2.dexbacked.instruction;
import javax.annotation.Nonnull;
import org.jf.dexlib2.Opcode;
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
import org.jf.dexlib2.dexbacked.reference.DexBackedReference;
import org.jf.dexlib2.iface.instruction.formats.Instruction22c;
import org.jf.dexlib2.iface.reference.Reference;
import org.jf.util.NibbleUtils;
public class DexBackedInstruction22c extends DexBackedInstruction implements Instruction22c {
public DexBackedInstruction22c(@Nonnull DexBackedDexFile dexFile,
@Nonnull Opcode opcode,
int instructionStart) {
super(dexFile, opcode, instructionStart);
}
@Override
public int getRegisterA() {
return NibbleUtils.extractLowUnsignedNibble(dexFile.readByte(instructionStart + 1));
}
@Override
public int getRegisterB() {
return NibbleUtils.extractHighUnsignedNibble(dexFile.readByte(instructionStart + 1));
}
@Nonnull
@Override
public Reference getReference() {
return DexBackedReference.makeReference(dexFile, opcode.referenceType, dexFile.readUshort(instructionStart + 2));
}
@Override
public int getReferenceType() {
return opcode.referenceType;
}
}
| aliosmanyuksel/show-java | app/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction22c.java | Java | apache-2.0 | 2,854 |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Apache.Arrow.Types
{
public sealed class Int8Type : NumberType
{
public static readonly Int8Type Default = new Int8Type();
public override ArrowTypeId TypeId => ArrowTypeId.Int8;
public override string Name => "int8";
public override int BitWidth => 8;
public override bool IsSigned => true;
public override void Accept(IArrowTypeVisitor visitor) => Accept(this, visitor);
}
}
| tebeka/arrow | csharp/src/Apache.Arrow/Types/Int8Type.cs | C# | apache-2.0 | 1,248 |
//// [crashIntypeCheckInvocationExpression.ts]
var nake;
function doCompile<P0, P1, P2>(fileset: P0, moduleType: P1) {
return undefined;
}
export var compileServer = task<number, number, any>(<P0, P1, P2>() => {
var folder = path.join(),
fileset = nake.fileSetSync<number, number, any>(folder)
return doCompile<number, number, any>(fileset, moduleType);
});
//// [crashIntypeCheckInvocationExpression.js]
define(["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
exports.compileServer = void 0;
var nake;
function doCompile(fileset, moduleType) {
return undefined;
}
exports.compileServer = task(function () {
var folder = path.join(), fileset = nake.fileSetSync(folder);
return doCompile(fileset, moduleType);
});
});
| Microsoft/TypeScript | tests/baselines/reference/crashIntypeCheckInvocationExpression.js | JavaScript | apache-2.0 | 858 |
require 'spec_helper'
describe 'GET /api/v1/cookbooks/:cookbook/contingent' do
context 'when the cookbook exists' do
let(:apt) { create(:cookbook, name: 'apt') }
let(:nginx) { create(:cookbook, name: 'nginx') }
let(:apache) { create(:cookbook, name: 'apache') }
before do
create(:cookbook_dependency, cookbook: apt, cookbook_version: nginx.latest_cookbook_version)
create(:cookbook_dependency, cookbook: apt, cookbook_version: apache.latest_cookbook_version)
get '/api/v1/cookbooks/apt/contingent'
end
it 'returns a 200' do
expect(response.status.to_i).to eql(200)
end
it 'returns the cookbooks' do
contingents = json_body['contingents']
expect(contingents.size).to eql(2)
expect(contingents.first['name']).to eql('apache')
expect(contingents.last['name']).to eql('nginx')
end
end
context 'when the cookbook does not exist' do
it 'returns a 404' do
get '/api/v1/cookbooks/mamimi'
expect(response.status.to_i).to eql(404)
end
it 'returns a 404 message' do
get '/api/v1/cookbooks/mamimi'
expect(json_body).to eql(error_404)
end
end
end
| tas50/supermarket | src/supermarket/spec/api/cookbook_contingent_spec.rb | Ruby | apache-2.0 | 1,174 |
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.xmladapters;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
/**
* A listener which expects a URL as a tag of the view it is associated with. It then opens the URL
* in the browser application.
*/
public class UrlIntentListener implements OnItemClickListener {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final String url = view.getTag().toString();
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final Context context = parent.getContext();
context.startActivity(intent);
}
}
| efortuna/AndroidSDKClone | sdk/samples/android-20/legacy/XmlAdapters/src/com/example/android/xmladapters/UrlIntentListener.java | Java | apache-2.0 | 1,446 |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.search.aggregations.pipeline.cumulativesum;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.PipelineAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.AbstractPipelineAggregationBuilder;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.pipeline.bucketmetrics.BucketMetricsParser;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.Parser.BUCKETS_PATH;
import static org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.Parser.FORMAT;
public class CumulativeSumPipelineAggregationBuilder extends AbstractPipelineAggregationBuilder<CumulativeSumPipelineAggregationBuilder> {
public static final String NAME = "cumulative_sum";
private String format;
public CumulativeSumPipelineAggregationBuilder(String name, String bucketsPath) {
super(name, NAME, new String[] { bucketsPath });
}
/**
* Read from a stream.
*/
public CumulativeSumPipelineAggregationBuilder(StreamInput in) throws IOException {
super(in, NAME);
format = in.readOptionalString();
}
@Override
protected final void doWriteTo(StreamOutput out) throws IOException {
out.writeOptionalString(format);
}
/**
* Sets the format to use on the output of this aggregation.
*/
public CumulativeSumPipelineAggregationBuilder format(String format) {
if (format == null) {
throw new IllegalArgumentException("[format] must not be null: [" + name + "]");
}
this.format = format;
return this;
}
/**
* Gets the format to use on the output of this aggregation.
*/
public String format() {
return format;
}
protected DocValueFormat formatter() {
if (format != null) {
return new DocValueFormat.Decimal(format);
} else {
return DocValueFormat.RAW;
}
}
@Override
protected PipelineAggregator createInternal(Map<String, Object> metaData) throws IOException {
return new CumulativeSumPipelineAggregator(name, bucketsPaths, formatter(), metaData);
}
@Override
public void doValidate(AggregatorFactory<?> parent, AggregatorFactory<?>[] aggFactories,
List<PipelineAggregationBuilder> pipelineAggregatorFactories) {
if (bucketsPaths.length != 1) {
throw new IllegalStateException(BUCKETS_PATH.getPreferredName()
+ " must contain a single entry for aggregation [" + name + "]");
}
if (parent instanceof HistogramAggregatorFactory) {
HistogramAggregatorFactory histoParent = (HistogramAggregatorFactory) parent;
if (histoParent.minDocCount() != 0) {
throw new IllegalStateException("parent histogram of cumulative sum aggregation [" + name
+ "] must have min_doc_count of 0");
}
} else if (parent instanceof DateHistogramAggregatorFactory) {
DateHistogramAggregatorFactory histoParent = (DateHistogramAggregatorFactory) parent;
if (histoParent.minDocCount() != 0) {
throw new IllegalStateException("parent histogram of cumulative sum aggregation [" + name
+ "] must have min_doc_count of 0");
}
} else {
throw new IllegalStateException("cumulative sum aggregation [" + name
+ "] must have a histogram or date_histogram as parent");
}
}
@Override
protected final XContentBuilder internalXContent(XContentBuilder builder, Params params) throws IOException {
if (format != null) {
builder.field(BucketMetricsParser.FORMAT.getPreferredName(), format);
}
return builder;
}
public static CumulativeSumPipelineAggregationBuilder parse(String pipelineAggregatorName, XContentParser parser)
throws IOException {
XContentParser.Token token;
String currentFieldName = null;
String[] bucketsPaths = null;
String format = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.VALUE_STRING) {
if (FORMAT.match(currentFieldName)) {
format = parser.text();
} else if (BUCKETS_PATH.match(currentFieldName)) {
bucketsPaths = new String[] { parser.text() };
} else {
throw new ParsingException(parser.getTokenLocation(),
"Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "].");
}
} else if (token == XContentParser.Token.START_ARRAY) {
if (BUCKETS_PATH.match(currentFieldName)) {
List<String> paths = new ArrayList<>();
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
String path = parser.text();
paths.add(path);
}
bucketsPaths = paths.toArray(new String[paths.size()]);
} else {
throw new ParsingException(parser.getTokenLocation(),
"Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "].");
}
} else {
throw new ParsingException(parser.getTokenLocation(),
"Unexpected token " + token + " in [" + pipelineAggregatorName + "].");
}
}
if (bucketsPaths == null) {
throw new ParsingException(parser.getTokenLocation(), "Missing required field [" + BUCKETS_PATH.getPreferredName()
+ "] for derivative aggregation [" + pipelineAggregatorName + "]");
}
CumulativeSumPipelineAggregationBuilder factory =
new CumulativeSumPipelineAggregationBuilder(pipelineAggregatorName, bucketsPaths[0]);
if (format != null) {
factory.format(format);
}
return factory;
}
@Override
protected int doHashCode() {
return Objects.hash(format);
}
@Override
protected boolean doEquals(Object obj) {
CumulativeSumPipelineAggregationBuilder other = (CumulativeSumPipelineAggregationBuilder) obj;
return Objects.equals(format, other.format);
}
@Override
public String getWriteableName() {
return NAME;
}
} | jimczi/elasticsearch | core/src/main/java/org/elasticsearch/search/aggregations/pipeline/cumulativesum/CumulativeSumPipelineAggregationBuilder.java | Java | apache-2.0 | 8,250 |
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "PoolAllocator.h"
namespace paddle {
PoolAllocator::PoolAllocator(Allocator* allocator,
size_t sizeLimit,
const std::string& name)
: allocator_(allocator),
sizeLimit_(sizeLimit),
poolMemorySize_(0),
name_(name) {}
PoolAllocator::~PoolAllocator() { freeAll(); }
void* PoolAllocator::alloc(size_t size) {
if (sizeLimit_ > 0) {
std::lock_guard<std::mutex> guard(mutex_);
auto it = pool_.find(size);
if (it == pool_.end() || it->second.size() == 0) {
if (poolMemorySize_ >= sizeLimit_) {
freeAll();
}
return allocator_->alloc(size);
} else {
auto buf = it->second.back();
it->second.pop_back();
poolMemorySize_ -= size;
return buf;
}
} else {
return allocator_->alloc(size);
}
}
void PoolAllocator::free(void* ptr, size_t size) {
if (sizeLimit_ > 0) {
std::lock_guard<std::mutex> guard(mutex_);
auto& it = pool_[size];
it.push_back(ptr);
poolMemorySize_ += size;
} else {
allocator_->free(ptr);
}
}
void PoolAllocator::freeAll() {
for (auto it : pool_) {
for (auto ptr : it.second) {
allocator_->free(ptr);
}
}
poolMemorySize_ = 0;
pool_.clear();
}
void PoolAllocator::printAll() {
size_t memory = 0;
LOG(INFO) << name_ << ":";
for (auto it : pool_) {
LOG(INFO) << " size:" << it.first;
for (auto ptr : it.second) {
LOG(INFO) << " ptr:" << ptr;
memory += it.first;
}
}
LOG(INFO) << "memory size: " << memory;
}
} // namespace paddle
| putcn/Paddle | paddle/math/PoolAllocator.cpp | C++ | apache-2.0 | 2,187 |
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.autoscaling.storage;
import org.elasticsearch.cluster.ClusterInfo;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.DiskUsage;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.DataStreamMetadata;
import org.elasticsearch.cluster.metadata.IndexAbstraction;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodeFilters;
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.RoutingNode;
import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.allocation.DataTier;
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider;
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.snapshots.SnapshotShardSizeInfo;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xpack.autoscaling.capacity.AutoscalingCapacity;
import org.elasticsearch.xpack.autoscaling.capacity.AutoscalingDeciderContext;
import org.elasticsearch.xpack.autoscaling.capacity.AutoscalingDeciderResult;
import org.elasticsearch.xpack.autoscaling.capacity.AutoscalingDeciderService;
import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider;
import java.io.IOException;
import java.math.BigInteger;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class ReactiveStorageDeciderService implements AutoscalingDeciderService {
public static final String NAME = "reactive_storage";
private final DiskThresholdSettings diskThresholdSettings;
private final DataTierAllocationDecider dataTierAllocationDecider;
private final AllocationDeciders allocationDeciders;
public ReactiveStorageDeciderService(Settings settings, ClusterSettings clusterSettings, AllocationDeciders allocationDeciders) {
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
this.dataTierAllocationDecider = new DataTierAllocationDecider();
this.allocationDeciders = allocationDeciders;
}
@Override
public String name() {
return NAME;
}
@Override
public List<Setting<?>> deciderSettings() {
return List.of();
}
@Override
public List<DiscoveryNodeRole> roles() {
return List.of(
DiscoveryNodeRole.DATA_ROLE,
DiscoveryNodeRole.DATA_CONTENT_NODE_ROLE,
DiscoveryNodeRole.DATA_HOT_NODE_ROLE,
DiscoveryNodeRole.DATA_WARM_NODE_ROLE,
DiscoveryNodeRole.DATA_COLD_NODE_ROLE
);
}
@Override
public AutoscalingDeciderResult scale(Settings configuration, AutoscalingDeciderContext context) {
AutoscalingCapacity autoscalingCapacity = context.currentCapacity();
if (autoscalingCapacity == null || autoscalingCapacity.total().storage() == null) {
return new AutoscalingDeciderResult(null, new ReactiveReason("current capacity not available", -1, -1));
}
AllocationState allocationState = new AllocationState(
context,
diskThresholdSettings,
allocationDeciders,
dataTierAllocationDecider
);
long unassignedBytes = allocationState.storagePreventsAllocation();
long assignedBytes = allocationState.storagePreventsRemainOrMove();
long maxShardSize = allocationState.maxShardSize();
assert assignedBytes >= 0;
assert unassignedBytes >= 0;
assert maxShardSize >= 0;
String message = message(unassignedBytes, assignedBytes);
AutoscalingCapacity requiredCapacity = AutoscalingCapacity.builder()
.total(autoscalingCapacity.total().storage().getBytes() + unassignedBytes + assignedBytes, null)
.node(maxShardSize, null)
.build();
return new AutoscalingDeciderResult(requiredCapacity, new ReactiveReason(message, unassignedBytes, assignedBytes));
}
static String message(long unassignedBytes, long assignedBytes) {
return unassignedBytes > 0 || assignedBytes > 0
? "not enough storage available, needs " + new ByteSizeValue(unassignedBytes + assignedBytes)
: "storage ok";
}
static boolean isDiskOnlyNoDecision(Decision decision) {
return singleNoDecision(decision, single -> true).map(DiskThresholdDecider.NAME::equals).orElse(false);
}
static boolean isFilterTierOnlyDecision(Decision decision, IndexMetadata indexMetadata) {
// only primary shards are handled here, allowing us to disregard same shard allocation decider.
return singleNoDecision(decision, single -> SameShardAllocationDecider.NAME.equals(single.label()) == false).filter(
FilterAllocationDecider.NAME::equals
).map(d -> filterLooksLikeTier(indexMetadata)).orElse(false);
}
static boolean filterLooksLikeTier(IndexMetadata indexMetadata) {
return isOnlyAttributeValueFilter(indexMetadata.requireFilters())
&& isOnlyAttributeValueFilter(indexMetadata.includeFilters())
&& isOnlyAttributeValueFilter(indexMetadata.excludeFilters());
}
private static boolean isOnlyAttributeValueFilter(DiscoveryNodeFilters filters) {
if (filters == null) {
return true;
} else {
return DiscoveryNodeFilters.trimTier(filters).isOnlyAttributeValueFilter();
}
}
static Optional<String> singleNoDecision(Decision decision, Predicate<Decision> predicate) {
List<Decision> nos = decision.getDecisions()
.stream()
.filter(single -> single.type() == Decision.Type.NO)
.filter(predicate)
.collect(Collectors.toList());
if (nos.size() == 1) {
return Optional.ofNullable(nos.get(0).label());
} else {
return Optional.empty();
}
}
// todo: move this to top level class.
public static class AllocationState {
private final ClusterState state;
private final AllocationDeciders allocationDeciders;
private final DataTierAllocationDecider dataTierAllocationDecider;
private final DiskThresholdSettings diskThresholdSettings;
private final ClusterInfo info;
private final SnapshotShardSizeInfo shardSizeInfo;
private final Predicate<DiscoveryNode> nodeTierPredicate;
private final Set<DiscoveryNode> nodes;
private final Set<String> nodeIds;
private final Set<DiscoveryNodeRole> roles;
AllocationState(
AutoscalingDeciderContext context,
DiskThresholdSettings diskThresholdSettings,
AllocationDeciders allocationDeciders,
DataTierAllocationDecider dataTierAllocationDecider
) {
this(
context.state(),
allocationDeciders,
dataTierAllocationDecider,
diskThresholdSettings,
context.info(),
context.snapshotShardSizeInfo(),
context.nodes(),
context.roles()
);
}
AllocationState(
ClusterState state,
AllocationDeciders allocationDeciders,
DataTierAllocationDecider dataTierAllocationDecider,
DiskThresholdSettings diskThresholdSettings,
ClusterInfo info,
SnapshotShardSizeInfo shardSizeInfo,
Set<DiscoveryNode> nodes,
Set<DiscoveryNodeRole> roles
) {
this.state = state;
this.allocationDeciders = allocationDeciders;
this.dataTierAllocationDecider = dataTierAllocationDecider;
this.diskThresholdSettings = diskThresholdSettings;
this.info = info;
this.shardSizeInfo = shardSizeInfo;
this.nodes = nodes;
this.nodeIds = nodes.stream().map(DiscoveryNode::getId).collect(Collectors.toSet());
this.nodeTierPredicate = nodes::contains;
this.roles = roles;
}
public long storagePreventsAllocation() {
RoutingAllocation allocation = new RoutingAllocation(
allocationDeciders,
state.getRoutingNodes(),
state,
info,
shardSizeInfo,
System.nanoTime()
);
return StreamSupport.stream(state.getRoutingNodes().unassigned().spliterator(), false)
.filter(shard -> canAllocate(shard, allocation) == false)
.filter(shard -> cannotAllocateDueToStorage(shard, allocation))
.mapToLong(this::sizeOf)
.sum();
}
public long storagePreventsRemainOrMove() {
RoutingAllocation allocation = new RoutingAllocation(
allocationDeciders,
state.getRoutingNodes(),
state,
info,
shardSizeInfo,
System.nanoTime()
);
List<ShardRouting> candidates = new LinkedList<>();
for (RoutingNode routingNode : state.getRoutingNodes()) {
for (ShardRouting shard : routingNode) {
if (shard.started()
&& canRemainOnlyHighestTierPreference(shard, allocation) == false
&& canAllocate(shard, allocation) == false) {
candidates.add(shard);
}
}
}
// track these to ensure we do not double account if they both cannot remain and allocated due to storage.
Set<ShardRouting> unmovableShards = candidates.stream()
.filter(s -> allocatedToTier(s, allocation))
.filter(s -> cannotRemainDueToStorage(s, allocation))
.collect(Collectors.toSet());
long unmovableBytes = unmovableShards.stream()
.collect(Collectors.groupingBy(ShardRouting::currentNodeId))
.entrySet()
.stream()
.mapToLong(e -> unmovableSize(e.getKey(), e.getValue()))
.sum();
long unallocatableBytes = candidates.stream()
.filter(Predicate.not(unmovableShards::contains))
.filter(s1 -> cannotAllocateDueToStorage(s1, allocation))
.mapToLong(this::sizeOf)
.sum();
return unallocatableBytes + unmovableBytes;
}
/**
* Check if shard can remain where it is, with the additional check that the DataTierAllocationDecider did not allow it to stay
* on a node in a lower preference tier.
*/
public boolean canRemainOnlyHighestTierPreference(ShardRouting shard, RoutingAllocation allocation) {
boolean result = allocationDeciders.canRemain(
shard,
allocation.routingNodes().node(shard.currentNodeId()),
allocation
) != Decision.NO;
if (result
&& nodes.isEmpty()
&& Strings.hasText(DataTier.TIER_PREFERENCE_SETTING.get(indexMetadata(shard, allocation).getSettings()))) {
// The data tier decider allows a shard to remain on a lower preference tier when no nodes exists on higher preference
// tiers.
// Here we ensure that if our policy governs the highest preference tier, we assume the shard needs to move to that tier
// once a node is started for it.
// In the case of overlapping policies, this is consistent with double accounting of unassigned.
return isAssignedToTier(shard, allocation) == false;
}
return result;
}
private boolean allocatedToTier(ShardRouting s, RoutingAllocation allocation) {
return nodeTierPredicate.test(allocation.routingNodes().node(s.currentNodeId()).node());
}
/**
* Check that disk decider is only decider for a node preventing allocation of the shard.
* @return true if and only if a node exists in the tier where only disk decider prevents allocation
*/
private boolean cannotAllocateDueToStorage(ShardRouting shard, RoutingAllocation allocation) {
if (nodeIds.isEmpty() && needsThisTier(shard, allocation)) {
return true;
}
assert allocation.debugDecision() == false;
// enable debug decisions to see all decisions and preserve the allocation decision label
allocation.debugDecision(true);
try {
return nodesInTier(allocation.routingNodes()).map(node -> allocationDeciders.canAllocate(shard, node, allocation))
.anyMatch(ReactiveStorageDeciderService::isDiskOnlyNoDecision);
} finally {
allocation.debugDecision(false);
}
}
/**
* Check that the disk decider is only decider that says NO to let shard remain on current node.
* @return true if and only if disk decider is only decider that says NO to canRemain.
*/
private boolean cannotRemainDueToStorage(ShardRouting shard, RoutingAllocation allocation) {
assert allocation.debugDecision() == false;
// enable debug decisions to see all decisions and preserve the allocation decision label
allocation.debugDecision(true);
try {
return isDiskOnlyNoDecision(
allocationDeciders.canRemain(shard, allocation.routingNodes().node(shard.currentNodeId()), allocation)
);
} finally {
allocation.debugDecision(false);
}
}
private boolean canAllocate(ShardRouting shard, RoutingAllocation allocation) {
return nodesInTier(allocation.routingNodes()).anyMatch(
node -> allocationDeciders.canAllocate(shard, node, allocation) != Decision.NO
);
}
boolean needsThisTier(ShardRouting shard, RoutingAllocation allocation) {
if (isAssignedToTier(shard, allocation) == false) {
return false;
}
IndexMetadata indexMetadata = indexMetadata(shard, allocation);
Set<Decision.Type> decisionTypes = StreamSupport.stream(allocation.routingNodes().spliterator(), false)
.map(
node -> dataTierAllocationDecider.shouldFilter(
indexMetadata,
node.node().getRoles(),
this::highestPreferenceTier,
allocation
)
)
.map(Decision::type)
.collect(Collectors.toSet());
if (decisionTypes.contains(Decision.Type.NO)) {
// we know we have some filter and can respond. Only need this tier if ALL responses where NO.
return decisionTypes.size() == 1;
}
// check for using allocation filters for data tiers. For simplicity, only scale up new tier based on primary shard
if (shard.primary() == false) {
return false;
}
assert allocation.debugDecision() == false;
// enable debug decisions to see all decisions and preserve the allocation decision label
allocation.debugDecision(true);
try {
// check that it does not belong on any existing node, i.e., there must be only a tier like reason it cannot be allocated
return StreamSupport.stream(allocation.routingNodes().spliterator(), false)
.anyMatch(node -> isFilterTierOnlyDecision(allocationDeciders.canAllocate(shard, node, allocation), indexMetadata));
} finally {
allocation.debugDecision(false);
}
}
private boolean isAssignedToTier(ShardRouting shard, RoutingAllocation allocation) {
IndexMetadata indexMetadata = indexMetadata(shard, allocation);
return dataTierAllocationDecider.shouldFilter(indexMetadata, roles, this::highestPreferenceTier, allocation) != Decision.NO;
}
private IndexMetadata indexMetadata(ShardRouting shard, RoutingAllocation allocation) {
return allocation.metadata().getIndexSafe(shard.index());
}
private Optional<String> highestPreferenceTier(List<String> preferredTiers, DiscoveryNodes unused) {
assert preferredTiers.isEmpty() == false;
return Optional.of(preferredTiers.get(0));
}
public long maxShardSize() {
return nodesInTier(state.getRoutingNodes()).flatMap(rn -> StreamSupport.stream(rn.spliterator(), false))
.mapToLong(this::sizeOf)
.max()
.orElse(0L);
}
long sizeOf(ShardRouting shard) {
long expectedShardSize = getExpectedShardSize(shard);
if (expectedShardSize == 0L && shard.primary() == false) {
ShardRouting primary = state.getRoutingNodes().activePrimary(shard.shardId());
if (primary != null) {
expectedShardSize = getExpectedShardSize(primary);
}
}
assert expectedShardSize >= 0;
// todo: we should ideally not have the level of uncertainty we have here.
return expectedShardSize == 0L ? ByteSizeUnit.KB.toBytes(1) : expectedShardSize;
}
private long getExpectedShardSize(ShardRouting shard) {
return DiskThresholdDecider.getExpectedShardSize(shard, 0L, info, shardSizeInfo, state.metadata(), state.routingTable());
}
long unmovableSize(String nodeId, Collection<ShardRouting> shards) {
ClusterInfo clusterInfo = this.info;
DiskUsage diskUsage = clusterInfo.getNodeMostAvailableDiskUsages().get(nodeId);
if (diskUsage == null) {
// do not want to scale up then, since this should only happen when node has just joined (clearly edge case).
return 0;
}
long threshold = Math.max(
diskThresholdSettings.getFreeBytesThresholdHigh().getBytes(),
thresholdFromPercentage(diskThresholdSettings.getFreeDiskThresholdHigh(), diskUsage)
);
long missing = threshold - diskUsage.getFreeBytes();
return Math.max(missing, shards.stream().mapToLong(this::sizeOf).min().orElseThrow());
}
private long thresholdFromPercentage(Double percentage, DiskUsage diskUsage) {
if (percentage == null) {
return 0L;
}
return (long) Math.ceil(diskUsage.getTotalBytes() * percentage / 100);
}
Stream<RoutingNode> nodesInTier(RoutingNodes routingNodes) {
return nodeIds.stream().map(n -> routingNodes.node(n));
}
private static class SingleForecast {
private final Map<IndexMetadata, Long> additionalIndices;
private final DataStream updatedDataStream;
private SingleForecast(Map<IndexMetadata, Long> additionalIndices, DataStream updatedDataStream) {
this.additionalIndices = additionalIndices;
this.updatedDataStream = updatedDataStream;
}
public void applyRouting(RoutingTable.Builder routing) {
additionalIndices.keySet().forEach(routing::addAsNew);
}
public void applyMetadata(Metadata.Builder metadataBuilder) {
additionalIndices.keySet().forEach(imd -> metadataBuilder.put(imd, false));
metadataBuilder.put(updatedDataStream);
}
public void applySize(ImmutableOpenMap.Builder<String, Long> builder, RoutingTable updatedRoutingTable) {
for (Map.Entry<IndexMetadata, Long> entry : additionalIndices.entrySet()) {
List<ShardRouting> shardRoutings = updatedRoutingTable.allShards(entry.getKey().getIndex().getName());
long size = entry.getValue() / shardRoutings.size();
shardRoutings.forEach(s -> builder.put(ClusterInfo.shardIdentifierFromRouting(s), size));
}
}
}
public AllocationState forecast(long forecastWindow, long now) {
if (forecastWindow == 0) {
return this;
}
// for now we only look at data-streams. We might want to also detect alias based time-based indices.
DataStreamMetadata dataStreamMetadata = state.metadata().custom(DataStreamMetadata.TYPE);
if (dataStreamMetadata == null) {
return this;
}
List<SingleForecast> singleForecasts = dataStreamMetadata.dataStreams()
.keySet()
.stream()
.map(state.metadata().getIndicesLookup()::get)
.map(IndexAbstraction.DataStream.class::cast)
.map(ds -> forecast(state.metadata(), ds, forecastWindow, now))
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (singleForecasts.isEmpty()) {
return this;
}
Metadata.Builder metadataBuilder = Metadata.builder(state.metadata());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(state.routingTable());
ImmutableOpenMap.Builder<String, Long> sizeBuilder = ImmutableOpenMap.builder();
singleForecasts.forEach(p -> p.applyMetadata(metadataBuilder));
singleForecasts.forEach(p -> p.applyRouting(routingTableBuilder));
RoutingTable routingTable = routingTableBuilder.build();
singleForecasts.forEach(p -> p.applySize(sizeBuilder, routingTable));
ClusterState forecastClusterState = ClusterState.builder(state).metadata(metadataBuilder).routingTable(routingTable).build();
ClusterInfo forecastInfo = new ExtendedClusterInfo(sizeBuilder.build(), AllocationState.this.info);
return new AllocationState(
forecastClusterState,
allocationDeciders,
dataTierAllocationDecider,
diskThresholdSettings,
forecastInfo,
shardSizeInfo,
nodes,
roles
);
}
private SingleForecast forecast(Metadata metadata, IndexAbstraction.DataStream stream, long forecastWindow, long now) {
List<Index> indices = stream.getIndices();
if (dataStreamAllocatedToNodes(metadata, indices) == false) return null;
long minCreationDate = Long.MAX_VALUE;
long totalSize = 0;
int count = 0;
while (count < indices.size()) {
++count;
IndexMetadata indexMetadata = metadata.index(indices.get(indices.size() - count));
long creationDate = indexMetadata.getCreationDate();
if (creationDate < 0) {
return null;
}
minCreationDate = Math.min(minCreationDate, creationDate);
totalSize += state.getRoutingTable().allShards(indexMetadata.getIndex().getName()).stream().mapToLong(this::sizeOf).sum();
// we terminate loop after collecting data to ensure we consider at least the forecast window (and likely some more).
if (creationDate <= now - forecastWindow) {
break;
}
}
if (totalSize == 0) {
return null;
}
// round up
long avgSizeCeil = (totalSize - 1) / count + 1;
long actualWindow = now - minCreationDate;
if (actualWindow == 0) {
return null;
}
// rather than simulate rollover, we copy the index meta data and do minimal adjustments.
long scaledTotalSize;
int numberNewIndices;
if (actualWindow > forecastWindow) {
scaledTotalSize = BigInteger.valueOf(totalSize)
.multiply(BigInteger.valueOf(forecastWindow))
.divide(BigInteger.valueOf(actualWindow))
.longValueExact();
// round up
numberNewIndices = (int) Math.min((scaledTotalSize - 1) / avgSizeCeil + 1, indices.size());
if (scaledTotalSize == 0) {
return null;
}
} else {
numberNewIndices = count;
scaledTotalSize = totalSize;
}
IndexMetadata writeIndex = metadata.index(stream.getWriteIndex());
Map<IndexMetadata, Long> newIndices = new HashMap<>();
DataStream dataStream = stream.getDataStream();
for (int i = 0; i < numberNewIndices; ++i) {
final String uuid = UUIDs.randomBase64UUID();
final Tuple<String, Long> dummyRolledDatastream = dataStream.nextWriteIndexAndGeneration(state.metadata());
dataStream = dataStream.rollover(new Index(dummyRolledDatastream.v1(), uuid), dummyRolledDatastream.v2());
// this unintentionally copies the in-sync allocation ids too. This has the fortunate effect of these indices
// not being regarded new by the disk threshold decider, thereby respecting the low watermark threshold even for primaries.
// This is highly desirable so fixing this to clear the in-sync allocation ids will require a more elaborate solution,
// ensuring at least that when replicas are involved, we still respect the low watermark. This is therefore left as is
// for now with the intention to fix in a follow-up.
IndexMetadata newIndex = IndexMetadata.builder(writeIndex)
.index(dataStream.getWriteIndex().getName())
.settings(Settings.builder().put(writeIndex.getSettings()).put(IndexMetadata.SETTING_INDEX_UUID, uuid))
.build();
long size = Math.min(avgSizeCeil, scaledTotalSize - (avgSizeCeil * i));
assert size > 0;
newIndices.put(newIndex, size);
}
return new SingleForecast(newIndices, dataStream);
}
/**
* Check that at least one shard is on the set of nodes. If they are all unallocated, we do not want to make any prediction to not
* hit the wrong policy.
* @param indices the indices of the data stream, in original order from data stream meta.
* @return true if the first allocated index is allocated only to the set of nodes.
*/
private boolean dataStreamAllocatedToNodes(Metadata metadata, List<Index> indices) {
for (int i = 0; i < indices.size(); ++i) {
IndexMetadata indexMetadata = metadata.index(indices.get(indices.size() - i - 1));
Set<Boolean> inNodes = state.getRoutingTable()
.allShards(indexMetadata.getIndex().getName())
.stream()
.map(ShardRouting::currentNodeId)
.filter(Objects::nonNull)
.map(nodeIds::contains)
.collect(Collectors.toSet());
if (inNodes.contains(false)) {
return false;
}
if (inNodes.contains(true)) {
return true;
}
}
return false;
}
// for tests
ClusterState state() {
return state;
}
ClusterInfo info() {
return info;
}
private static class ExtendedClusterInfo extends ClusterInfo {
private final ClusterInfo delegate;
private ExtendedClusterInfo(ImmutableOpenMap<String, Long> extraShardSizes, ClusterInfo info) {
super(
info.getNodeLeastAvailableDiskUsages(),
info.getNodeMostAvailableDiskUsages(),
extraShardSizes,
ImmutableOpenMap.of(),
null,
null
);
this.delegate = info;
}
@Override
public Long getShardSize(ShardRouting shardRouting) {
Long shardSize = super.getShardSize(shardRouting);
if (shardSize != null) {
return shardSize;
} else {
return delegate.getShardSize(shardRouting);
}
}
@Override
public long getShardSize(ShardRouting shardRouting, long defaultValue) {
Long shardSize = super.getShardSize(shardRouting);
if (shardSize != null) {
return shardSize;
} else {
return delegate.getShardSize(shardRouting, defaultValue);
}
}
@Override
public Optional<Long> getShardDataSetSize(ShardId shardId) {
return delegate.getShardDataSetSize(shardId);
}
@Override
public String getDataPath(ShardRouting shardRouting) {
return delegate.getDataPath(shardRouting);
}
@Override
public ReservedSpace getReservedSpace(String nodeId, String dataPath) {
return delegate.getReservedSpace(nodeId, dataPath);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
throw new UnsupportedOperationException();
}
}
}
public static class ReactiveReason implements AutoscalingDeciderResult.Reason {
private final String reason;
private final long unassigned;
private final long assigned;
public ReactiveReason(String reason, long unassigned, long assigned) {
this.reason = reason;
this.unassigned = unassigned;
this.assigned = assigned;
}
public ReactiveReason(StreamInput in) throws IOException {
this.reason = in.readString();
this.unassigned = in.readLong();
this.assigned = in.readLong();
}
@Override
public String summary() {
return reason;
}
public long unassigned() {
return unassigned;
}
public long assigned() {
return assigned;
}
@Override
public String getWriteableName() {
return ReactiveStorageDeciderService.NAME;
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(reason);
out.writeLong(unassigned);
out.writeLong(assigned);
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("reason", reason);
builder.field("unassigned", unassigned);
builder.field("assigned", assigned);
builder.endObject();
return builder;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReactiveReason that = (ReactiveReason) o;
return unassigned == that.unassigned && assigned == that.assigned && reason.equals(that.reason);
}
@Override
public int hashCode() {
return Objects.hash(reason, unassigned, assigned);
}
}
}
| GlenRSmith/elasticsearch | x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageDeciderService.java | Java | apache-2.0 | 34,193 |
/**
* Copyright 2010-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.jpetstore.domain;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author Eduardo Macarron
*
*/
public class CartItem implements Serializable {
private static final long serialVersionUID = 6620528781626504362L;
private Item item;
private int quantity;
private boolean inStock;
private BigDecimal total;
public boolean isInStock() {
return inStock;
}
public void setInStock(boolean inStock) {
this.inStock = inStock;
}
public BigDecimal getTotal() {
return total;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
calculateTotal();
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
calculateTotal();
}
public void incrementQuantity() {
quantity++;
calculateTotal();
}
private void calculateTotal() {
if (item != null && item.getListPrice() != null) {
total = item.getListPrice().multiply(new BigDecimal(quantity));
} else {
total = null;
}
}
}
| Derzhevitskiy/spring-petclinic-master | src/main/java/org/mybatis/jpetstore/domain/CartItem.java | Java | apache-2.0 | 1,767 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import angular from 'angular';
import igniteDialog from './dialog.directive';
import igniteDialogTitle from './dialog-title.directive';
import igniteDialogContent from './dialog-content.directive';
import IgniteDialog from './dialog.factory';
angular
.module('ignite-console.dialog', [
])
.factory('IgniteDialog', IgniteDialog)
.directive('igniteDialog', igniteDialog)
.directive('igniteDialogTitle', igniteDialogTitle)
.directive('igniteDialogContent', igniteDialogContent);
| ilantukh/ignite | modules/web-console/frontend/app/modules/dialog/dialog.module.js | JavaScript | apache-2.0 | 1,283 |
/*
* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.identity.application.authenticator.facebook;
public class FacebookAuthenticatorConstants {
public static final String AUTHENTICATOR_NAME = "FacebookAuthenticator";
// TODO : Change login type
public static final String FACEBOOK_LOGIN_TYPE = "facebook";
public static final String LOGIN_TYPE = "loginType";
public static final String OAUTH2_GRANT_TYPE_CODE = "code";
public static final String OAUTH2_PARAM_STATE = "state";
public static final String USERNAME = "id";
public static final String FB_AUTHZ_URL = "http://www.facebook.com/dialog/oauth";
public static final String FB_TOKEN_URL = "https://graph.facebook.com/oauth/access_token";
public static final String FB_USER_INFO_URL = "https://graph.facebook.com/me";
public static final String SCOPE = "email";
public static final String CLIENT_ID = "ClientId";
public static final String CLIENT_SECRET = "ClientSecret";
private FacebookAuthenticatorConstants() {
}
} | malakasilva/carbon-identity | components/identity/org.wso2.carbon.identity.application.authenticator.facebook/src/main/java/org/wso2/carbon/identity/application/authenticator/facebook/FacebookAuthenticatorConstants.java | Java | apache-2.0 | 1,678 |
/* global CodeMirror */
/* global define */
(function(mod) {
'use strict';
if (typeof exports === 'object' && typeof module === 'object') // CommonJS
mod(require('../../lib/codemirror'));
else if (typeof define === 'function' && define.amd) // AMD
define(['../../lib/codemirror'], mod);
else
mod(CodeMirror);
})(function(CodeMirror) {
'use strict';
var SearchOnly;
CodeMirror.defineOption('searchonly', false, function(cm) {
if (!SearchOnly){
SearchOnly = new SearchOnlyBox(cm);
}
});
function SearchOnlyBox(cm) {
var self = this;
var el = self.element = document;
init();
function initElements(el) {
self.searchBox = el.querySelector('.div-search');
self.searchInput = el.querySelector('.log-search');
}
function init() {
initElements(el);
bindKeys();
self.$onChange = delayedCall(function() {
self.find(false, false);
});
el.addEventListener('click', function(e) {
var t = e.target || e.srcElement;
var action = t.getAttribute('action');
if (action && self[action])
self[action]();
e.stopPropagation();
});
self.searchInput.addEventListener('input', function() {
self.$onChange.schedule(20);
});
self.searchInput.addEventListener('focus', function() {
self.activeInput = self.searchInput;
});
self.$onChange = delayedCall(function() {
self.find(false, false);
});
}
function bindKeys() {
var sb = self,
obj = {
'Enter': function() {
sb.findNext();
}
};
self.element.addEventListener('keydown', function(event) {
Object.keys(obj).some(function(name) {
var is = key(name, event);
if (is) {
event.stopPropagation();
event.preventDefault();
obj[name](event);
}
return is;
});
});
}
this.find = function(skipCurrent, backwards) {
var value = this.searchInput.value,
options = {
skipCurrent: skipCurrent,
backwards: backwards
};
find(value, options, function(searchCursor) {
var current = searchCursor.matches(false, searchCursor.from());
cm.setSelection(current.from, current.to);
});
};
this.findNext = function() {
this.find(true, false);
};
this.findPrev = function() {
this.find(true, true);
};
function find(value, options, callback) {
var done,
noMatch, searchCursor, next, prev, matches, cursor,
position,
val = value,
o = options,
is = true,
caseSensitive = o.caseSensitive,
regExp = o.regExp,
wholeWord = o.wholeWord;
if (regExp || wholeWord) {
if (options.wholeWord)
val = '\\b' + val + '\\b';
val = RegExp(val);
}
if (o.backwards)
position = o.skipCurrent ? 'from': 'to';
else
position = o.skipCurrent ? 'to' : 'from';
cursor = cm.getCursor(position);
searchCursor = cm.getSearchCursor(val, cursor, !caseSensitive);
next = searchCursor.findNext.bind(searchCursor),
prev = searchCursor.findPrevious.bind(searchCursor),
matches = searchCursor.matches.bind(searchCursor);
if (o.backwards && !prev()) {
is = next();
if (is) {
cm.setCursor(cm.doc.size - 1, 0);
find(value, options, callback);
done = true;
}
} else if (!o.backwards && !next()) {
is = prev();
if (is) {
cm.setCursor(0, 0);
find(value, options, callback);
done = true;
}
}
noMatch = !is && self.searchInput.value;
setCssClass(self.searchInput, 'no_result_found', noMatch);
if (!done && is)
callback(searchCursor);
}
function setCssClass(el, className, condition) {
var list = el.classList;
list[condition ? 'add' : 'remove'](className);
}
function delayedCall(fcn, defaultTimeout) {
var timer,
callback = function() {
timer = null;
fcn();
},
_self = function(timeout) {
if (!timer)
timer = setTimeout(callback, timeout || defaultTimeout);
};
_self.delay = function(timeout) {
timer && clearTimeout(timer);
timer = setTimeout(callback, timeout || defaultTimeout);
};
_self.schedule = _self;
_self.call = function() {
this.cancel();
fcn();
};
_self.cancel = function() {
timer && clearTimeout(timer);
timer = null;
};
_self.isPending = function() {
return timer;
};
return _self;
}
/* https://github.com/coderaiser/key */
function key(str, event) {
var right,
KEY = {
BACKSPACE : 8,
TAB : 9,
ENTER : 13,
ESC : 27,
SPACE : 32,
PAGE_UP : 33,
PAGE_DOWN : 34,
END : 35,
HOME : 36,
UP : 38,
DOWN : 40,
INSERT : 45,
DELETE : 46,
INSERT_MAC : 96,
ASTERISK : 106,
PLUS : 107,
MINUS : 109,
F1 : 112,
F2 : 113,
F3 : 114,
F4 : 115,
F5 : 116,
F6 : 117,
F7 : 118,
F8 : 119,
F9 : 120,
F10 : 121,
SLASH : 191,
TRA : 192, /* Typewritten Reverse Apostrophe (`) */
BACKSLASH : 220
};
keyCheck(str, event);
right = str.split('|').some(function(combination) {
var wrong;
wrong = combination.split('-').some(function(key) {
var right;
switch(key) {
case 'Ctrl':
right = event.ctrlKey;
break;
case 'Shift':
right = event.shiftKey;
break;
case 'Alt':
right = event.altKey;
break;
case 'Cmd':
right = event.metaKey;
break;
default:
if (key.length === 1)
right = event.keyCode === key.charCodeAt(0);
else
Object.keys(KEY).some(function(name) {
var up = key.toUpperCase();
if (up === name)
right = event.keyCode === KEY[name];
});
break;
}
return !right;
});
return !wrong;
});
return right;
}
function keyCheck(str, event) {
if (typeof str !== 'string')
throw(Error('str should be string!'));
if (typeof event !== 'object')
throw(Error('event should be object!'));
}
}
});
| hisamith/app-cloud | modules/jaggeryapps/appmgt/src/site/themes/default/js/CodeMirror-5.7.0/addon/search/searchonly.js | JavaScript | apache-2.0 | 9,107 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package gobblin.dataset;
import java.io.IOException;
import java.util.Iterator;
/**
* A {@link DatasetsFinder} that can return the {@link Dataset}s as an {@link Iterator}. This allows {@link Dataset}s
* to be created on demand instead of all at once, possibly reducing memory usage and improving performance.
*/
public interface IterableDatasetFinder<T extends Dataset> extends DatasetsFinder<T> {
/**
* @return An {@link Iterator} over the {@link Dataset}s found.
* @throws IOException
*/
public Iterator<T> getDatasetsIterator() throws IOException;
}
| ydai1124/gobblin-1 | gobblin-api/src/main/java/gobblin/dataset/IterableDatasetFinder.java | Java | apache-2.0 | 1,376 |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Threading;
using KafkaNet.Common;
using KafkaNet.Model;
using KafkaNet.Protocol;
using KafkaNet.Statistics;
namespace KafkaNet
{
/// <summary>
/// The TcpSocket provides an abstraction from the main driver from having to handle connection to and reconnections with a server.
/// The interface is intentionally limited to only read/write. All connection and reconnect details are handled internally.
/// </summary>
public class KafkaTcpSocket : IKafkaTcpSocket
{
public event Action OnServerDisconnected;
public event Action<int> OnReconnectionAttempt;
public event Action<int> OnReadFromSocketAttempt;
public event Action<int> OnBytesReceived;
public event Action<KafkaDataPayload> OnWriteToSocketAttempt;
private const int DefaultReconnectionTimeout = 100;
private const int DefaultReconnectionTimeoutMultiplier = 2;
private const int MaxReconnectionTimeoutMinutes = 5;
private readonly CancellationTokenSource _disposeToken = new CancellationTokenSource();
private readonly CancellationTokenRegistration _disposeRegistration;
private readonly IKafkaLog _log;
private readonly KafkaEndpoint _endpoint;
private readonly TimeSpan _maximumReconnectionTimeout;
private readonly AsyncCollection<SocketPayloadSendTask> _sendTaskQueue;
private readonly AsyncCollection<SocketPayloadReadTask> _readTaskQueue;
private readonly Task _socketTask;
private readonly AsyncLock _clientLock = new AsyncLock();
private TcpClient _client;
private int _disposeCount;
/// <summary>
/// Construct socket and open connection to a specified server.
/// </summary>
/// <param name="log">Logging facility for verbose messaging of actions.</param>
/// <param name="endpoint">The IP endpoint to connect to.</param>
/// <param name="maximumReconnectionTimeout">The maximum time to wait when backing off on reconnection attempts.</param>
public KafkaTcpSocket(IKafkaLog log, KafkaEndpoint endpoint, TimeSpan? maximumReconnectionTimeout = null)
{
_log = log;
_endpoint = endpoint;
_maximumReconnectionTimeout = maximumReconnectionTimeout ?? TimeSpan.FromMinutes(MaxReconnectionTimeoutMinutes);
_sendTaskQueue = new AsyncCollection<SocketPayloadSendTask>();
_readTaskQueue = new AsyncCollection<SocketPayloadReadTask>();
//dedicate a long running task to the read/write operations
_socketTask = Task.Factory.StartNew(DedicatedSocketTask, CancellationToken.None,
TaskCreationOptions.LongRunning, TaskScheduler.Default);
_disposeRegistration = _disposeToken.Token.Register(() =>
{
_sendTaskQueue.CompleteAdding();
_readTaskQueue.CompleteAdding();
});
}
#region Interface Implementation...
/// <summary>
/// The IP Endpoint to the server.
/// </summary>
public KafkaEndpoint Endpoint { get { return _endpoint; } }
/// <summary>
/// Read a certain byte array size return only when all bytes received.
/// </summary>
/// <param name="readSize">The size in bytes to receive from server.</param>
/// <returns>Returns a byte[] array with the size of readSize.</returns>
public Task<byte[]> ReadAsync(int readSize)
{
return EnqueueReadTask(readSize, CancellationToken.None);
}
/// <summary>
/// Read a certain byte array size return only when all bytes received.
/// </summary>
/// <param name="readSize">The size in bytes to receive from server.</param>
/// <param name="cancellationToken">A cancellation token which will cancel the request.</param>
/// <returns>Returns a byte[] array with the size of readSize.</returns>
public Task<byte[]> ReadAsync(int readSize, CancellationToken cancellationToken)
{
return EnqueueReadTask(readSize, cancellationToken);
}
/// <summary>
/// Convenience function to write full buffer data to the server.
/// </summary>
/// <param name="payload">The buffer data to send.</param>
/// <returns>Returns Task handle to the write operation with size of written bytes..</returns>
public Task<KafkaDataPayload> WriteAsync(KafkaDataPayload payload)
{
return WriteAsync(payload, CancellationToken.None);
}
/// <summary>
/// Write the buffer data to the server.
/// </summary>
/// <param name="payload">The buffer data to send.</param>
/// <param name="cancellationToken">A cancellation token which will cancel the request.</param>
/// <returns>Returns Task handle to the write operation with size of written bytes..</returns>
public Task<KafkaDataPayload> WriteAsync(KafkaDataPayload payload, CancellationToken cancellationToken)
{
return EnqueueWriteTask(payload, cancellationToken);
}
#endregion
private Task<KafkaDataPayload> EnqueueWriteTask(KafkaDataPayload payload, CancellationToken cancellationToken)
{
var sendTask = new SocketPayloadSendTask(payload, cancellationToken);
_sendTaskQueue.Add(sendTask);
StatisticsTracker.QueueNetworkWrite(_endpoint, payload);
return sendTask.Tcp.Task;
}
private Task<byte[]> EnqueueReadTask(int readSize, CancellationToken cancellationToken)
{
var readTask = new SocketPayloadReadTask(readSize, cancellationToken);
_readTaskQueue.Add(readTask);
return readTask.Tcp.Task;
}
private void DedicatedSocketTask()
{
while (_disposeToken.IsCancellationRequested == false)
{
try
{
//block here until we can get connections then start loop pushing data through network stream
var netStream = GetStreamAsync().Result;
ProcessNetworkstreamTasks(netStream);
}
catch (Exception ex)
{
if (_disposeToken.IsCancellationRequested)
{
_log.WarnFormat("KafkaTcpSocket thread shutting down because of a dispose call.");
var disposeException = new ObjectDisposedException("Object is disposing.");
_sendTaskQueue.DrainAndApply(t => t.Tcp.TrySetException(disposeException));
_readTaskQueue.DrainAndApply(t => t.Tcp.TrySetException(disposeException));
return;
}
if (ex is ServerDisconnectedException)
{
if (OnServerDisconnected != null) OnServerDisconnected();
_log.ErrorFormat(ex.Message);
continue;
}
_log.ErrorFormat("Exception occured in Socket handler task. Exception: {0}", ex);
}
}
}
private void ProcessNetworkstreamTasks(NetworkStream netStream)
{
Task writeTask = Task.FromResult(true);
Task readTask = Task.FromResult(true);
//reading/writing from network steam is not thread safe
//Read and write operations can be performed simultaneously on an instance of the NetworkStream class without the need for synchronization.
//As long as there is one unique thread for the write operations and one unique thread for the read operations, there will be no cross-interference
//between read and write threads and no synchronization is required.
//https://msdn.microsoft.com/en-us/library/z2xae4f4.aspx
while (_disposeToken.IsCancellationRequested == false && netStream != null)
{
Task sendDataReady = Task.WhenAll(writeTask, _sendTaskQueue.OnHasDataAvailable(_disposeToken.Token));
Task readDataReady = Task.WhenAll(readTask, _readTaskQueue.OnHasDataAvailable(_disposeToken.Token));
Task.WaitAny(sendDataReady, readDataReady);
var exception = new[] { writeTask, readTask }
.Where(x => x.IsFaulted && x.Exception != null)
.SelectMany(x => x.Exception.InnerExceptions)
.FirstOrDefault();
if (exception != null) throw exception;
if (sendDataReady.IsCompleted) writeTask = ProcessSentTasksAsync(netStream, _sendTaskQueue.Pop());
if (readDataReady.IsCompleted) readTask = ProcessReadTaskAsync(netStream, _readTaskQueue.Pop());
}
}
private async Task ProcessReadTaskAsync(NetworkStream netStream, SocketPayloadReadTask readTask)
{
using (readTask)
{
try
{
StatisticsTracker.IncrementGauge(StatisticGauge.ActiveReadOperation);
var readSize = readTask.ReadSize;
var result = new List<byte>(readSize);
var bytesReceived = 0;
while (bytesReceived < readSize)
{
readSize = readSize - bytesReceived;
var buffer = new byte[readSize];
if (OnReadFromSocketAttempt != null) OnReadFromSocketAttempt(readSize);
bytesReceived = await netStream.ReadAsync(buffer, 0, readSize, readTask.CancellationToken)
.WithCancellation(readTask.CancellationToken).ConfigureAwait(false);
if (OnBytesReceived != null) OnBytesReceived(bytesReceived);
if (bytesReceived <= 0)
{
using (_client)
{
_client = null;
throw new ServerDisconnectedException(string.Format("Lost connection to server: {0}", _endpoint));
}
}
result.AddRange(buffer.Take(bytesReceived));
}
readTask.Tcp.TrySetResult(result.ToArray());
}
catch (Exception ex)
{
if (_disposeToken.IsCancellationRequested)
{
var exception = new ObjectDisposedException("Object is disposing.");
readTask.Tcp.TrySetException(exception);
throw exception;
}
if (ex is ServerDisconnectedException)
{
readTask.Tcp.TrySetException(ex);
throw;
}
//if an exception made us lose a connection throw disconnected exception
if (_client == null || _client.Connected == false)
{
var exception = new ServerDisconnectedException(string.Format("Lost connection to server: {0}", _endpoint));
readTask.Tcp.TrySetException(exception);
throw exception;
}
readTask.Tcp.TrySetException(ex);
throw;
}
finally
{
StatisticsTracker.DecrementGauge(StatisticGauge.ActiveReadOperation);
}
}
}
private async Task ProcessSentTasksAsync(NetworkStream netStream, SocketPayloadSendTask sendTask)
{
if (sendTask == null) return;
using (sendTask)
{
var failed = false;
var sw = Stopwatch.StartNew();
try
{
sw.Restart();
StatisticsTracker.IncrementGauge(StatisticGauge.ActiveWriteOperation);
if (OnWriteToSocketAttempt != null) OnWriteToSocketAttempt(sendTask.Payload);
await netStream.WriteAsync(sendTask.Payload.Buffer, 0, sendTask.Payload.Buffer.Length).ConfigureAwait(false);
sendTask.Tcp.TrySetResult(sendTask.Payload);
}
catch (Exception ex)
{
failed = true;
if (_disposeToken.IsCancellationRequested)
{
var exception = new ObjectDisposedException("Object is disposing.");
sendTask.Tcp.TrySetException(exception);
throw exception;
}
sendTask.Tcp.TrySetException(ex);
throw;
}
finally
{
StatisticsTracker.DecrementGauge(StatisticGauge.ActiveWriteOperation);
StatisticsTracker.CompleteNetworkWrite(sendTask.Payload, sw.ElapsedMilliseconds, failed);
}
}
}
private async Task<NetworkStream> GetStreamAsync()
{
//using a semaphore here to allow async waiting rather than blocking locks
using (await _clientLock.LockAsync(_disposeToken.Token).ConfigureAwait(false))
{
if ((_client == null || _client.Connected == false) && !_disposeToken.IsCancellationRequested)
{
_client = await ReEstablishConnectionAsync().ConfigureAwait(false);
}
return _client == null ? null : _client.GetStream();
}
}
/// <summary>
/// (Re-)establish the Kafka server connection.
/// Assumes that the caller has already obtained the <c>_clientLock</c>
/// </summary>
private async Task<TcpClient> ReEstablishConnectionAsync()
{
var attempts = 1;
var reconnectionDelay = DefaultReconnectionTimeout;
_log.WarnFormat("No connection to:{0}. Attempting to connect...", _endpoint);
_client = null;
while (_disposeToken.IsCancellationRequested == false)
{
try
{
if (OnReconnectionAttempt != null) OnReconnectionAttempt(attempts++);
_client = new TcpClient();
await _client.ConnectAsync(_endpoint.Endpoint.Address, _endpoint.Endpoint.Port).ConfigureAwait(false);
_log.WarnFormat("Connection established to:{0}.", _endpoint);
return _client;
}
catch
{
reconnectionDelay = reconnectionDelay * DefaultReconnectionTimeoutMultiplier;
reconnectionDelay = Math.Min(reconnectionDelay, (int)_maximumReconnectionTimeout.TotalMilliseconds);
_log.WarnFormat("Failed connection to:{0}. Will retry in:{1}", _endpoint, reconnectionDelay);
}
await Task.Delay(TimeSpan.FromMilliseconds(reconnectionDelay), _disposeToken.Token).ConfigureAwait(false);
}
return _client;
}
public void Dispose()
{
if (Interlocked.Increment(ref _disposeCount) != 1) return;
if (_disposeToken != null) _disposeToken.Cancel();
using (_disposeToken)
using (_disposeRegistration)
using (_client)
using (_socketTask)
{
_socketTask.SafeWait(TimeSpan.FromSeconds(30));
}
}
}
class SocketPayloadReadTask : IDisposable
{
public CancellationToken CancellationToken { get; private set; }
public TaskCompletionSource<byte[]> Tcp { get; set; }
public int ReadSize { get; set; }
private readonly CancellationTokenRegistration _cancellationTokenRegistration;
public SocketPayloadReadTask(int readSize, CancellationToken cancellationToken)
{
CancellationToken = cancellationToken;
Tcp = new TaskCompletionSource<byte[]>();
ReadSize = readSize;
_cancellationTokenRegistration = cancellationToken.Register(() => Tcp.TrySetCanceled());
}
public void Dispose()
{
using (_cancellationTokenRegistration)
{
}
}
}
class SocketPayloadSendTask : IDisposable
{
public TaskCompletionSource<KafkaDataPayload> Tcp { get; set; }
public KafkaDataPayload Payload { get; set; }
private readonly CancellationTokenRegistration _cancellationTokenRegistration;
public SocketPayloadSendTask(KafkaDataPayload payload, CancellationToken cancellationToken)
{
Tcp = new TaskCompletionSource<KafkaDataPayload>();
Payload = payload;
_cancellationTokenRegistration = cancellationToken.Register(() => Tcp.TrySetCanceled());
}
public void Dispose()
{
using (_cancellationTokenRegistration)
{
}
}
}
public class KafkaDataPayload
{
public int CorrelationId { get; set; }
public ApiKeyRequestType ApiKey { get; set; }
public int MessageCount { get; set; }
public bool TrackPayload
{
get { return MessageCount > 0; }
}
public byte[] Buffer { get; set; }
}
}
| bridgewell/kafka-net | src/kafka-net/KafkaTcpSocket.cs | C# | apache-2.0 | 17,955 |
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.taglibs.i18n;
import java.io.IOException;
import java.util.ResourceBundle;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* This class implements body tag that allows you to use a resource bundle
* to internationalize content in a web page. If a value is found in the
* resource bundle for the required "key" attribute, then the enclosed JSP
* is evaluated, otherwise, it is skipped.
* <P>
* The ifdef and ifndef tags allow the JSP author to conditionally evaluate
* sections of a JSP based on whether or not a value is provided for the
* given key.
* <P>
* <H2>Examples</H2>
* <PRE>
* <i18n:bundle baseName="test"/>
* <i18n:ifndef key="test">
* misc html and jsp
* </i18n:ifndef>
* etc...
* </PRE>
* <P>
*
* @author <a href="mailto:tdawson@wamnet.com">Tim Dawson</a>
*
*/
public class IfndefTag extends ConditionalTagSupport
{
protected static final String _tagname = "i18n:ifndef";
/**
* locates the bundle and tests whether the key has a value
*/
public boolean shouldEvaluate() throws JspException
{
String value = this.getValue();
if ( value == null || value.length() == 0 ) {
return true;
} else {
return false;
}
}
}
| jboss-integration/kie-uberfire-extensions | i18n-taglib/src/main/java/org/apache/taglibs/i18n/IfndefTag.java | Java | apache-2.0 | 2,046 |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.common.ssl;
import org.elasticsearch.common.CharArrays;
import javax.crypto.Cipher;
import javax.crypto.EncryptedPrivateKeyInfo;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.interfaces.ECKey;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.DSAPrivateKeySpec;
import java.security.spec.ECGenParameterSpec;
import java.security.spec.ECParameterSpec;
import java.security.spec.ECPrivateKeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.RSAPrivateCrtKeySpec;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
final class PemUtils {
private static final String PKCS1_HEADER = "-----BEGIN RSA PRIVATE KEY-----";
private static final String PKCS1_FOOTER = "-----END RSA PRIVATE KEY-----";
private static final String OPENSSL_DSA_HEADER = "-----BEGIN DSA PRIVATE KEY-----";
private static final String OPENSSL_DSA_FOOTER = "-----END DSA PRIVATE KEY-----";
private static final String OPENSSL_DSA_PARAMS_HEADER ="-----BEGIN DSA PARAMETERS-----";
private static final String OPENSSL_DSA_PARAMS_FOOTER ="-----END DSA PARAMETERS-----";
private static final String PKCS8_HEADER = "-----BEGIN PRIVATE KEY-----";
private static final String PKCS8_FOOTER = "-----END PRIVATE KEY-----";
private static final String PKCS8_ENCRYPTED_HEADER = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
private static final String PKCS8_ENCRYPTED_FOOTER = "-----END ENCRYPTED PRIVATE KEY-----";
private static final String OPENSSL_EC_HEADER = "-----BEGIN EC PRIVATE KEY-----";
private static final String OPENSSL_EC_FOOTER = "-----END EC PRIVATE KEY-----";
private static final String OPENSSL_EC_PARAMS_HEADER = "-----BEGIN EC PARAMETERS-----";
private static final String OPENSSL_EC_PARAMS_FOOTER = "-----END EC PARAMETERS-----";
private static final String HEADER = "-----BEGIN";
private PemUtils() {
throw new IllegalStateException("Utility class should not be instantiated");
}
/**
* Creates a {@link PrivateKey} from the contents of a file. Supports PKCS#1, PKCS#8
* encoded formats of encrypted and plaintext RSA, DSA and EC(secp256r1) keys
*
* @param keyPath the path for the key file
* @param passwordSupplier A password supplier for the potentially encrypted (password protected) key
* @return a private key from the contents of the file
*/
public static PrivateKey readPrivateKey(Path keyPath, Supplier<char[]> passwordSupplier) throws IOException, GeneralSecurityException {
try (BufferedReader bReader = Files.newBufferedReader(keyPath, StandardCharsets.UTF_8)) {
String line = bReader.readLine();
while (null != line && line.startsWith(HEADER) == false) {
line = bReader.readLine();
}
if (null == line) {
throw new SslConfigException("Error parsing Private Key [" + keyPath.toAbsolutePath() + "], file is empty");
}
if (PKCS8_ENCRYPTED_HEADER.equals(line.trim())) {
char[] password = passwordSupplier.get();
if (password == null) {
throw new SslConfigException("cannot read encrypted key [" + keyPath.toAbsolutePath() + "] without a password");
}
return parsePKCS8Encrypted(bReader, password);
} else if (PKCS8_HEADER.equals(line.trim())) {
return parsePKCS8(bReader);
} else if (PKCS1_HEADER.equals(line.trim())) {
return parsePKCS1Rsa(bReader, passwordSupplier);
} else if (OPENSSL_DSA_HEADER.equals(line.trim())) {
return parseOpenSslDsa(bReader, passwordSupplier);
} else if (OPENSSL_DSA_PARAMS_HEADER.equals(line.trim())) {
return parseOpenSslDsa(removeDsaHeaders(bReader), passwordSupplier);
} else if (OPENSSL_EC_HEADER.equals(line.trim())) {
return parseOpenSslEC(bReader, passwordSupplier);
} else if (OPENSSL_EC_PARAMS_HEADER.equals(line.trim())) {
return parseOpenSslEC(removeECHeaders(bReader), passwordSupplier);
} else {
throw new SslConfigException("error parsing Private Key [" + keyPath.toAbsolutePath()
+ "], file does not contain a supported key format");
}
} catch (FileNotFoundException | NoSuchFileException e) {
throw new SslConfigException("private key file [" + keyPath.toAbsolutePath() + "] does not exist", e);
} catch (IOException | GeneralSecurityException e) {
throw new SslConfigException("private key file [" + keyPath.toAbsolutePath() + "] cannot be parsed", e);
}
}
/**
* Removes the EC Headers that OpenSSL adds to EC private keys as the information in them
* is redundant
*
* @throws IOException if the EC Parameter footer is missing
*/
private static BufferedReader removeECHeaders(BufferedReader bReader) throws IOException {
String line = bReader.readLine();
while (line != null) {
if (OPENSSL_EC_PARAMS_FOOTER.equals(line.trim())) {
break;
}
line = bReader.readLine();
}
if (null == line || OPENSSL_EC_PARAMS_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, EC Parameters footer is missing");
}
// Verify that the key starts with the correct header before passing it to parseOpenSslEC
if (OPENSSL_EC_HEADER.equals(bReader.readLine()) == false) {
throw new IOException("Malformed PEM file, EC Key header is missing");
}
return bReader;
}
/**
* Removes the DSA Params Headers that OpenSSL adds to DSA private keys as the information in them
* is redundant
*
* @throws IOException if the EC Parameter footer is missing
*/
private static BufferedReader removeDsaHeaders(BufferedReader bReader) throws IOException {
String line = bReader.readLine();
while (line != null) {
if (OPENSSL_DSA_PARAMS_FOOTER.equals(line.trim())) {
break;
}
line = bReader.readLine();
}
if (null == line || OPENSSL_DSA_PARAMS_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, DSA Parameters footer is missing");
}
// Verify that the key starts with the correct header before passing it to parseOpenSslDsa
if (OPENSSL_DSA_HEADER.equals(bReader.readLine()) == false) {
throw new IOException("Malformed PEM file, DSA Key header is missing");
}
return bReader;
}
/**
* Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an plaintext private key encoded in
* PKCS#8
*
* @param bReader the {@link BufferedReader} containing the key file contents
* @return {@link PrivateKey}
* @throws IOException if the file can't be read
* @throws GeneralSecurityException if the private key can't be generated from the {@link PKCS8EncodedKeySpec}
*/
private static PrivateKey parsePKCS8(BufferedReader bReader) throws IOException, GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
while (line != null) {
if (PKCS8_FOOTER.equals(line.trim())) {
break;
}
sb.append(line.trim());
line = bReader.readLine();
}
if (null == line || PKCS8_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, PEM footer is invalid or missing");
}
byte[] keyBytes = Base64.getDecoder().decode(sb.toString());
String keyAlgo = getKeyAlgorithmIdentifier(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(keyAlgo);
return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(keyBytes));
}
/**
* Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an EC private key encoded in
* OpenSSL traditional format.
*
* @param bReader the {@link BufferedReader} containing the key file contents
* @param passwordSupplier A password supplier for the potentially encrypted (password protected) key
* @return {@link PrivateKey}
* @throws IOException if the file can't be read
* @throws GeneralSecurityException if the private key can't be generated from the {@link ECPrivateKeySpec}
*/
private static PrivateKey parseOpenSslEC(BufferedReader bReader, Supplier<char[]> passwordSupplier) throws IOException,
GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
Map<String, String> pemHeaders = new HashMap<>();
while (line != null) {
if (OPENSSL_EC_FOOTER.equals(line.trim())) {
break;
}
// Parse PEM headers according to https://www.ietf.org/rfc/rfc1421.txt
if (line.contains(":")) {
String[] header = line.split(":");
pemHeaders.put(header[0].trim(), header[1].trim());
} else {
sb.append(line.trim());
}
line = bReader.readLine();
}
if (null == line || OPENSSL_EC_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, PEM footer is invalid or missing");
}
byte[] keyBytes = possiblyDecryptPKCS1Key(pemHeaders, sb.toString(), passwordSupplier);
KeyFactory keyFactory = KeyFactory.getInstance("EC");
ECPrivateKeySpec ecSpec = parseEcDer(keyBytes);
return keyFactory.generatePrivate(ecSpec);
}
/**
* Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an RSA private key encoded in
* OpenSSL traditional format.
*
* @param bReader the {@link BufferedReader} containing the key file contents
* @param passwordSupplier A password supplier for the potentially encrypted (password protected) key
* @return {@link PrivateKey}
* @throws IOException if the file can't be read
* @throws GeneralSecurityException if the private key can't be generated from the {@link RSAPrivateCrtKeySpec}
*/
private static PrivateKey parsePKCS1Rsa(BufferedReader bReader, Supplier<char[]> passwordSupplier) throws IOException,
GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
Map<String, String> pemHeaders = new HashMap<>();
while (line != null) {
if (PKCS1_FOOTER.equals(line.trim())) {
// Unencrypted
break;
}
// Parse PEM headers according to https://www.ietf.org/rfc/rfc1421.txt
if (line.contains(":")) {
String[] header = line.split(":");
pemHeaders.put(header[0].trim(), header[1].trim());
} else {
sb.append(line.trim());
}
line = bReader.readLine();
}
if (null == line || PKCS1_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, PEM footer is invalid or missing");
}
byte[] keyBytes = possiblyDecryptPKCS1Key(pemHeaders, sb.toString(), passwordSupplier);
RSAPrivateCrtKeySpec spec = parseRsaDer(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
return keyFactory.generatePrivate(spec);
}
/**
* Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an DSA private key encoded in
* OpenSSL traditional format.
*
* @param bReader the {@link BufferedReader} containing the key file contents
* @param passwordSupplier A password supplier for the potentially encrypted (password protected) key
* @return {@link PrivateKey}
* @throws IOException if the file can't be read
* @throws GeneralSecurityException if the private key can't be generated from the {@link DSAPrivateKeySpec}
*/
private static PrivateKey parseOpenSslDsa(BufferedReader bReader, Supplier<char[]> passwordSupplier) throws IOException,
GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
Map<String, String> pemHeaders = new HashMap<>();
while (line != null) {
if (OPENSSL_DSA_FOOTER.equals(line.trim())) {
// Unencrypted
break;
}
// Parse PEM headers according to https://www.ietf.org/rfc/rfc1421.txt
if (line.contains(":")) {
String[] header = line.split(":");
pemHeaders.put(header[0].trim(), header[1].trim());
} else {
sb.append(line.trim());
}
line = bReader.readLine();
}
if (null == line || OPENSSL_DSA_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, PEM footer is invalid or missing");
}
byte[] keyBytes = possiblyDecryptPKCS1Key(pemHeaders, sb.toString(), passwordSupplier);
DSAPrivateKeySpec spec = parseDsaDer(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
return keyFactory.generatePrivate(spec);
}
/**
* Creates a {@link PrivateKey} from the contents of {@code bReader} that contains an encrypted private key encoded in
* PKCS#8
*
* @param bReader the {@link BufferedReader} containing the key file contents
* @param keyPassword The password for the encrypted (password protected) key
* @return {@link PrivateKey}
* @throws IOException if the file can't be read
* @throws GeneralSecurityException if the private key can't be generated from the {@link PKCS8EncodedKeySpec}
*/
private static PrivateKey parsePKCS8Encrypted(BufferedReader bReader, char[] keyPassword) throws IOException,
GeneralSecurityException {
StringBuilder sb = new StringBuilder();
String line = bReader.readLine();
while (line != null) {
if (PKCS8_ENCRYPTED_FOOTER.equals(line.trim())) {
break;
}
sb.append(line.trim());
line = bReader.readLine();
}
if (null == line || PKCS8_ENCRYPTED_FOOTER.equals(line.trim()) == false) {
throw new IOException("Malformed PEM file, PEM footer is invalid or missing");
}
byte[] keyBytes = Base64.getDecoder().decode(sb.toString());
EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new EncryptedPrivateKeyInfo(keyBytes);
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(encryptedPrivateKeyInfo.getAlgName());
SecretKey secretKey = secretKeyFactory.generateSecret(new PBEKeySpec(keyPassword));
Arrays.fill(keyPassword, '\u0000');
Cipher cipher = Cipher.getInstance(encryptedPrivateKeyInfo.getAlgName());
cipher.init(Cipher.DECRYPT_MODE, secretKey, encryptedPrivateKeyInfo.getAlgParameters());
PKCS8EncodedKeySpec keySpec = encryptedPrivateKeyInfo.getKeySpec(cipher);
String keyAlgo = getKeyAlgorithmIdentifier(keySpec.getEncoded());
KeyFactory keyFactory = KeyFactory.getInstance(keyAlgo);
return keyFactory.generatePrivate(keySpec);
}
/**
* Decrypts the password protected contents using the algorithm and IV that is specified in the PEM Headers of the file
*
* @param pemHeaders The Proc-Type and DEK-Info PEM headers that have been extracted from the key file
* @param keyContents The key as a base64 encoded String
* @param passwordSupplier A password supplier for the encrypted (password protected) key
* @return the decrypted key bytes
* @throws GeneralSecurityException if the key can't be decrypted
* @throws IOException if the PEM headers are missing or malformed
*/
private static byte[] possiblyDecryptPKCS1Key(Map<String, String> pemHeaders, String keyContents, Supplier<char[]> passwordSupplier)
throws GeneralSecurityException, IOException {
byte[] keyBytes = Base64.getDecoder().decode(keyContents);
String procType = pemHeaders.get("Proc-Type");
if ("4,ENCRYPTED".equals(procType)) {
//We only handle PEM encryption
String encryptionParameters = pemHeaders.get("DEK-Info");
if (null == encryptionParameters) {
//malformed pem
throw new IOException("Malformed PEM File, DEK-Info header is missing");
}
char[] password = passwordSupplier.get();
if (password == null) {
throw new IOException("cannot read encrypted key without a password");
}
Cipher cipher = getCipherFromParameters(encryptionParameters, password);
byte[] decryptedKeyBytes = cipher.doFinal(keyBytes);
return decryptedKeyBytes;
}
return keyBytes;
}
/**
* Creates a {@link Cipher} from the contents of the DEK-Info header of a PEM file. RFC 1421 indicates that supported algorithms are
* defined in RFC 1423. RFC 1423 only defines DES-CBS and triple DES (EDE) in CBC mode. AES in CBC mode is also widely used though ( 3
* different variants of 128, 192, 256 bit keys )
*
* @param dekHeaderValue The value of the the DEK-Info PEM header
* @param password The password with which the key is encrypted
* @return a cipher of the appropriate algorithm and parameters to be used for decryption
* @throws GeneralSecurityException if the algorithm is not available in the used security provider, or if the key is inappropriate
* for the cipher
* @throws IOException if the DEK-Info PEM header is invalid
*/
private static Cipher getCipherFromParameters(String dekHeaderValue, char[] password) throws
GeneralSecurityException, IOException {
final String padding = "PKCS5Padding";
final SecretKey encryptionKey;
final String[] valueTokens = dekHeaderValue.split(",");
if (valueTokens.length != 2) {
throw new IOException("Malformed PEM file, DEK-Info PEM header is invalid");
}
final String algorithm = valueTokens[0];
final String ivString = valueTokens[1];
final byte[] iv;
try {
iv = hexStringToByteArray(ivString);
} catch (IllegalArgumentException e) {
throw new IOException("Malformed PEM file, DEK-Info IV is invalid", e);
}
if ("DES-CBC".equals(algorithm)) {
byte[] key = generateOpenSslKey(password, iv, 8);
encryptionKey = new SecretKeySpec(key, "DES");
} else if ("DES-EDE3-CBC".equals(algorithm)) {
byte[] key = generateOpenSslKey(password, iv, 24);
encryptionKey = new SecretKeySpec(key, "DESede");
} else if ("AES-128-CBC".equals(algorithm)) {
byte[] key = generateOpenSslKey(password, iv, 16);
encryptionKey = new SecretKeySpec(key, "AES");
} else if ("AES-192-CBC".equals(algorithm)) {
byte[] key = generateOpenSslKey(password, iv, 24);
encryptionKey = new SecretKeySpec(key, "AES");
} else if ("AES-256-CBC".equals(algorithm)) {
byte[] key = generateOpenSslKey(password, iv, 32);
encryptionKey = new SecretKeySpec(key, "AES");
} else {
throw new GeneralSecurityException("Private Key encrypted with unsupported algorithm [" + algorithm + "]");
}
String transformation = encryptionKey.getAlgorithm() + "/" + "CBC" + "/" + padding;
Cipher cipher = Cipher.getInstance(transformation);
cipher.init(Cipher.DECRYPT_MODE, encryptionKey, new IvParameterSpec(iv));
return cipher;
}
/**
* Performs key stretching in the same manner that OpenSSL does. This is basically a KDF
* that uses n rounds of salted MD5 (as many times as needed to get the necessary number of key bytes)
* <p>
* https://www.openssl.org/docs/man1.1.0/crypto/PEM_write_bio_PrivateKey_traditional.html
*/
private static byte[] generateOpenSslKey(char[] password, byte[] salt, int keyLength) {
byte[] passwordBytes = CharArrays.toUtf8Bytes(password);
MessageDigest md5 = messageDigest("md5");
byte[] key = new byte[keyLength];
int copied = 0;
int remaining;
while (copied < keyLength) {
remaining = keyLength - copied;
md5.update(passwordBytes, 0, passwordBytes.length);
md5.update(salt, 0, 8);// AES IV (salt) is longer but we only need 8 bytes
byte[] tempDigest = md5.digest();
int bytesToCopy = (remaining > 16) ? 16 : remaining; // MD5 digests are 16 bytes
System.arraycopy(tempDigest, 0, key, copied, bytesToCopy);
copied += bytesToCopy;
if (remaining == 0) {
break;
}
md5.update(tempDigest, 0, 16); // use previous round digest as IV
}
Arrays.fill(passwordBytes, (byte) 0);
return key;
}
/**
* Converts a hexadecimal string to a byte array
*/
private static byte[] hexStringToByteArray(String hexString) {
int len = hexString.length();
if (len % 2 == 0) {
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
final int k = Character.digit(hexString.charAt(i), 16);
final int l = Character.digit(hexString.charAt(i + 1), 16);
if (k == -1 || l == -1) {
throw new IllegalStateException("String [" + hexString + "] is not hexadecimal");
}
data[i / 2] = (byte) ((k << 4) + l);
}
return data;
} else {
throw new IllegalStateException("Hexadecimal string [" + hexString +
"] has odd length and cannot be converted to a byte array");
}
}
/**
* Parses a DER encoded EC key to an {@link ECPrivateKeySpec} using a minimal {@link DerParser}
*
* @param keyBytes the private key raw bytes
* @return {@link ECPrivateKeySpec}
* @throws IOException if the DER encoded key can't be parsed
*/
private static ECPrivateKeySpec parseEcDer(byte[] keyBytes) throws IOException,
GeneralSecurityException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // version
String keyHex = parser.readAsn1Object().getString();
BigInteger privateKeyInt = new BigInteger(keyHex, 16);
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC");
AlgorithmParameterSpec prime256v1ParamSpec = new ECGenParameterSpec("secp256r1");
keyPairGenerator.initialize(prime256v1ParamSpec);
ECParameterSpec parameterSpec = ((ECKey) keyPairGenerator.generateKeyPair().getPrivate()).getParams();
return new ECPrivateKeySpec(privateKeyInt, parameterSpec);
}
/**
* Parses a DER encoded RSA key to a {@link RSAPrivateCrtKeySpec} using a minimal {@link DerParser}
*
* @param keyBytes the private key raw bytes
* @return {@link RSAPrivateCrtKeySpec}
* @throws IOException if the DER encoded key can't be parsed
*/
private static RSAPrivateCrtKeySpec parseRsaDer(byte[] keyBytes) throws IOException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // (version) We don't need it but must read to get to modulus
BigInteger modulus = parser.readAsn1Object().getInteger();
BigInteger publicExponent = parser.readAsn1Object().getInteger();
BigInteger privateExponent = parser.readAsn1Object().getInteger();
BigInteger prime1 = parser.readAsn1Object().getInteger();
BigInteger prime2 = parser.readAsn1Object().getInteger();
BigInteger exponent1 = parser.readAsn1Object().getInteger();
BigInteger exponent2 = parser.readAsn1Object().getInteger();
BigInteger coefficient = parser.readAsn1Object().getInteger();
return new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, prime1, prime2, exponent1, exponent2, coefficient);
}
/**
* Parses a DER encoded DSA key to a {@link DSAPrivateKeySpec} using a minimal {@link DerParser}
*
* @param keyBytes the private key raw bytes
* @return {@link DSAPrivateKeySpec}
* @throws IOException if the DER encoded key can't be parsed
*/
private static DSAPrivateKeySpec parseDsaDer(byte[] keyBytes) throws IOException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // (version) We don't need it but must read to get to p
BigInteger p = parser.readAsn1Object().getInteger();
BigInteger q = parser.readAsn1Object().getInteger();
BigInteger g = parser.readAsn1Object().getInteger();
parser.readAsn1Object().getInteger(); // we don't need x
BigInteger x = parser.readAsn1Object().getInteger();
return new DSAPrivateKeySpec(x, p, q, g);
}
/**
* Parses a DER encoded private key and reads its algorithm identifier Object OID.
*
* @param keyBytes the private key raw bytes
* @return A string identifier for the key algorithm (RSA, DSA, or EC)
* @throws GeneralSecurityException if the algorithm oid that is parsed from ASN.1 is unknown
* @throws IOException if the DER encoded key can't be parsed
*/
private static String getKeyAlgorithmIdentifier(byte[] keyBytes) throws IOException, GeneralSecurityException {
DerParser parser = new DerParser(keyBytes);
DerParser.Asn1Object sequence = parser.readAsn1Object();
parser = sequence.getParser();
parser.readAsn1Object().getInteger(); // version
DerParser.Asn1Object algSequence = parser.readAsn1Object();
parser = algSequence.getParser();
String oidString = parser.readAsn1Object().getOid();
switch (oidString) {
case "1.2.840.10040.4.1":
return "DSA";
case "1.2.840.113549.1.1.1":
return "RSA";
case "1.2.840.10045.2.1":
return "EC";
}
throw new GeneralSecurityException("Error parsing key algorithm identifier. Algorithm with OID [" + oidString +
"] is not żsupported");
}
static List<Certificate> readCertificates(Collection<Path> certPaths) throws CertificateException, IOException {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
List<Certificate> certificates = new ArrayList<>(certPaths.size());
for (Path path : certPaths) {
try (InputStream input = Files.newInputStream(path)) {
final Collection<? extends Certificate> parsed = certFactory.generateCertificates(input);
if (parsed.isEmpty()) {
throw new SslConfigException("failed to parse any certificates from [" + path.toAbsolutePath() + "]");
}
certificates.addAll(parsed);
}
}
return certificates;
}
private static MessageDigest messageDigest(String digestAlgorithm) {
try {
return MessageDigest.getInstance(digestAlgorithm);
} catch (NoSuchAlgorithmException e) {
throw new SslConfigException("unexpected exception creating MessageDigest instance for [" + digestAlgorithm + "]", e);
}
}
}
| strapdata/elassandra | libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/PemUtils.java | Java | apache-2.0 | 30,153 |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_RecommendationsAI_GoogleCloudRecommendationengineV1alphaRejoinCatalogResponse extends Google_Model
{
public $rejoinedUserEventsCount;
public function setRejoinedUserEventsCount($rejoinedUserEventsCount)
{
$this->rejoinedUserEventsCount = $rejoinedUserEventsCount;
}
public function getRejoinedUserEventsCount()
{
return $this->rejoinedUserEventsCount;
}
}
| tsugiproject/tsugi | vendor/google/apiclient-services/src/Google/Service/RecommendationsAI/GoogleCloudRecommendationengineV1alphaRejoinCatalogResponse.php | PHP | apache-2.0 | 998 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.namenode;
import static org.apache.hadoop.fs.permission.AclEntryScope.*;
import static org.apache.hadoop.fs.permission.AclEntryType.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.fs.permission.AclEntry;
import org.apache.hadoop.fs.permission.AclEntryScope;
import org.apache.hadoop.fs.permission.AclEntryType;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.permission.ScopedAclEntries;
import org.apache.hadoop.hdfs.protocol.AclException;
import org.apache.hadoop.util.Lists;
import org.apache.hadoop.thirdparty.com.google.common.collect.ComparisonChain;
import org.apache.hadoop.thirdparty.com.google.common.collect.Maps;
import org.apache.hadoop.thirdparty.com.google.common.collect.Ordering;
/**
* AclTransformation defines the operations that can modify an ACL. All ACL
* modifications take as input an existing ACL and apply logic to add new
* entries, modify existing entries or remove old entries. Some operations also
* accept an ACL spec: a list of entries that further describes the requested
* change. Different operations interpret the ACL spec differently. In the
* case of adding an ACL to an inode that previously did not have one, the
* existing ACL can be a "minimal ACL" containing exactly 3 entries for owner,
* group and other, all derived from the {@link FsPermission} bits.
*
* The algorithms implemented here require sorted lists of ACL entries. For any
* existing ACL, it is assumed that the entries are sorted. This is because all
* ACL creation and modification is intended to go through these methods, and
* they all guarantee correct sort order in their outputs. However, an ACL spec
* is considered untrusted user input, so all operations pre-sort the ACL spec as
* the first step.
*/
@InterfaceAudience.Private
final class AclTransformation {
private static final int MAX_ENTRIES = 32;
/**
* Filters (discards) any existing ACL entries that have the same scope, type
* and name of any entry in the ACL spec. If necessary, recalculates the mask
* entries. If necessary, default entries may be inferred by copying the
* permissions of the corresponding access entries. It is invalid to request
* removal of the mask entry from an ACL that would otherwise require a mask
* entry, due to existing named entries or an unnamed group entry.
*
* @param existingAcl List<AclEntry> existing ACL
* @param inAclSpec List<AclEntry> ACL spec describing entries to filter
* @return List<AclEntry> new ACL
* @throws AclException if validation fails
*/
public static List<AclEntry> filterAclEntriesByAclSpec(
List<AclEntry> existingAcl, List<AclEntry> inAclSpec) throws AclException {
ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec);
ArrayList<AclEntry> aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES);
EnumMap<AclEntryScope, AclEntry> providedMask =
Maps.newEnumMap(AclEntryScope.class);
EnumSet<AclEntryScope> maskDirty = EnumSet.noneOf(AclEntryScope.class);
EnumSet<AclEntryScope> scopeDirty = EnumSet.noneOf(AclEntryScope.class);
for (AclEntry existingEntry: existingAcl) {
if (aclSpec.containsKey(existingEntry)) {
scopeDirty.add(existingEntry.getScope());
if (existingEntry.getType() == MASK) {
maskDirty.add(existingEntry.getScope());
}
} else {
if (existingEntry.getType() == MASK) {
providedMask.put(existingEntry.getScope(), existingEntry);
} else {
aclBuilder.add(existingEntry);
}
}
}
copyDefaultsIfNeeded(aclBuilder);
calculateMasks(aclBuilder, providedMask, maskDirty, scopeDirty);
return buildAndValidateAcl(aclBuilder);
}
/**
* Filters (discards) any existing default ACL entries. The new ACL retains
* only the access ACL entries.
*
* @param existingAcl List<AclEntry> existing ACL
* @return List<AclEntry> new ACL
* @throws AclException if validation fails
*/
public static List<AclEntry> filterDefaultAclEntries(
List<AclEntry> existingAcl) throws AclException {
ArrayList<AclEntry> aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES);
for (AclEntry existingEntry: existingAcl) {
if (existingEntry.getScope() == DEFAULT) {
// Default entries sort after access entries, so we can exit early.
break;
}
aclBuilder.add(existingEntry);
}
return buildAndValidateAcl(aclBuilder);
}
/**
* Merges the entries of the ACL spec into the existing ACL. If necessary,
* recalculates the mask entries. If necessary, default entries may be
* inferred by copying the permissions of the corresponding access entries.
*
* @param existingAcl List<AclEntry> existing ACL
* @param inAclSpec List<AclEntry> ACL spec containing entries to merge
* @return List<AclEntry> new ACL
* @throws AclException if validation fails
*/
public static List<AclEntry> mergeAclEntries(List<AclEntry> existingAcl,
List<AclEntry> inAclSpec) throws AclException {
ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec);
ArrayList<AclEntry> aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES);
List<AclEntry> foundAclSpecEntries =
Lists.newArrayListWithCapacity(MAX_ENTRIES);
EnumMap<AclEntryScope, AclEntry> providedMask =
Maps.newEnumMap(AclEntryScope.class);
EnumSet<AclEntryScope> maskDirty = EnumSet.noneOf(AclEntryScope.class);
EnumSet<AclEntryScope> scopeDirty = EnumSet.noneOf(AclEntryScope.class);
for (AclEntry existingEntry: existingAcl) {
AclEntry aclSpecEntry = aclSpec.findByKey(existingEntry);
if (aclSpecEntry != null) {
foundAclSpecEntries.add(aclSpecEntry);
scopeDirty.add(aclSpecEntry.getScope());
if (aclSpecEntry.getType() == MASK) {
providedMask.put(aclSpecEntry.getScope(), aclSpecEntry);
maskDirty.add(aclSpecEntry.getScope());
} else {
aclBuilder.add(aclSpecEntry);
}
} else {
if (existingEntry.getType() == MASK) {
providedMask.put(existingEntry.getScope(), existingEntry);
} else {
aclBuilder.add(existingEntry);
}
}
}
// ACL spec entries that were not replacements are new additions.
for (AclEntry newEntry: aclSpec) {
if (Collections.binarySearch(foundAclSpecEntries, newEntry,
ACL_ENTRY_COMPARATOR) < 0) {
scopeDirty.add(newEntry.getScope());
if (newEntry.getType() == MASK) {
providedMask.put(newEntry.getScope(), newEntry);
maskDirty.add(newEntry.getScope());
} else {
aclBuilder.add(newEntry);
}
}
}
copyDefaultsIfNeeded(aclBuilder);
calculateMasks(aclBuilder, providedMask, maskDirty, scopeDirty);
return buildAndValidateAcl(aclBuilder);
}
/**
* Completely replaces the ACL with the entries of the ACL spec. If
* necessary, recalculates the mask entries. If necessary, default entries
* are inferred by copying the permissions of the corresponding access
* entries. Replacement occurs separately for each of the access ACL and the
* default ACL. If the ACL spec contains only access entries, then the
* existing default entries are retained. If the ACL spec contains only
* default entries, then the existing access entries are retained. If the ACL
* spec contains both access and default entries, then both are replaced.
*
* @param existingAcl List<AclEntry> existing ACL
* @param inAclSpec List<AclEntry> ACL spec containing replacement entries
* @return List<AclEntry> new ACL
* @throws AclException if validation fails
*/
public static List<AclEntry> replaceAclEntries(List<AclEntry> existingAcl,
List<AclEntry> inAclSpec) throws AclException {
ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec);
ArrayList<AclEntry> aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES);
// Replacement is done separately for each scope: access and default.
EnumMap<AclEntryScope, AclEntry> providedMask =
Maps.newEnumMap(AclEntryScope.class);
EnumSet<AclEntryScope> maskDirty = EnumSet.noneOf(AclEntryScope.class);
EnumSet<AclEntryScope> scopeDirty = EnumSet.noneOf(AclEntryScope.class);
for (AclEntry aclSpecEntry: aclSpec) {
scopeDirty.add(aclSpecEntry.getScope());
if (aclSpecEntry.getType() == MASK) {
providedMask.put(aclSpecEntry.getScope(), aclSpecEntry);
maskDirty.add(aclSpecEntry.getScope());
} else {
aclBuilder.add(aclSpecEntry);
}
}
// Copy existing entries if the scope was not replaced.
for (AclEntry existingEntry: existingAcl) {
if (!scopeDirty.contains(existingEntry.getScope())) {
if (existingEntry.getType() == MASK) {
providedMask.put(existingEntry.getScope(), existingEntry);
} else {
aclBuilder.add(existingEntry);
}
}
}
copyDefaultsIfNeeded(aclBuilder);
calculateMasks(aclBuilder, providedMask, maskDirty, scopeDirty);
return buildAndValidateAcl(aclBuilder);
}
/**
* There is no reason to instantiate this class.
*/
private AclTransformation() {
}
/**
* Comparator that enforces required ordering for entries within an ACL:
* -owner entry (unnamed user)
* -all named user entries (internal ordering undefined)
* -owning group entry (unnamed group)
* -all named group entries (internal ordering undefined)
* -mask entry
* -other entry
* All access ACL entries sort ahead of all default ACL entries.
*/
static final Comparator<AclEntry> ACL_ENTRY_COMPARATOR =
new Comparator<AclEntry>() {
@Override
public int compare(AclEntry entry1, AclEntry entry2) {
return ComparisonChain.start()
.compare(entry1.getScope(), entry2.getScope(),
Ordering.explicit(ACCESS, DEFAULT))
.compare(entry1.getType(), entry2.getType(),
Ordering.explicit(USER, GROUP, MASK, OTHER))
.compare(entry1.getName(), entry2.getName(),
Ordering.natural().nullsFirst())
.result();
}
};
/**
* Builds the final list of ACL entries to return by trimming, sorting and
* validating the ACL entries that have been added.
*
* @param aclBuilder ArrayList<AclEntry> containing entries to build
* @return List<AclEntry> unmodifiable, sorted list of ACL entries
* @throws AclException if validation fails
*/
private static List<AclEntry> buildAndValidateAcl(
ArrayList<AclEntry> aclBuilder) throws AclException {
aclBuilder.trimToSize();
Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR);
// Full iteration to check for duplicates and invalid named entries.
AclEntry prevEntry = null;
for (AclEntry entry: aclBuilder) {
if (prevEntry != null &&
ACL_ENTRY_COMPARATOR.compare(prevEntry, entry) == 0) {
throw new AclException(
"Invalid ACL: multiple entries with same scope, type and name.");
}
if (entry.getName() != null && (entry.getType() == MASK ||
entry.getType() == OTHER)) {
throw new AclException(
"Invalid ACL: this entry type must not have a name: " + entry + ".");
}
prevEntry = entry;
}
ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder);
checkMaxEntries(scopedEntries);
// Search for the required base access entries. If there is a default ACL,
// then do the same check on the default entries.
for (AclEntryType type: EnumSet.of(USER, GROUP, OTHER)) {
AclEntry accessEntryKey = new AclEntry.Builder().setScope(ACCESS)
.setType(type).build();
if (Collections.binarySearch(scopedEntries.getAccessEntries(),
accessEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
throw new AclException(
"Invalid ACL: the user, group and other entries are required.");
}
if (!scopedEntries.getDefaultEntries().isEmpty()) {
AclEntry defaultEntryKey = new AclEntry.Builder().setScope(DEFAULT)
.setType(type).build();
if (Collections.binarySearch(scopedEntries.getDefaultEntries(),
defaultEntryKey, ACL_ENTRY_COMPARATOR) < 0) {
throw new AclException(
"Invalid default ACL: the user, group and other entries are required.");
}
}
}
return Collections.unmodifiableList(aclBuilder);
}
// Check the max entries separately on access and default entries
// HDFS-7582
private static void checkMaxEntries(ScopedAclEntries scopedEntries)
throws AclException {
List<AclEntry> accessEntries = scopedEntries.getAccessEntries();
List<AclEntry> defaultEntries = scopedEntries.getDefaultEntries();
if (accessEntries.size() > MAX_ENTRIES) {
throw new AclException("Invalid ACL: ACL has " + accessEntries.size()
+ " access entries, which exceeds maximum of " + MAX_ENTRIES + ".");
}
if (defaultEntries.size() > MAX_ENTRIES) {
throw new AclException("Invalid ACL: ACL has " + defaultEntries.size()
+ " default entries, which exceeds maximum of " + MAX_ENTRIES + ".");
}
}
/**
* Calculates mask entries required for the ACL. Mask calculation is performed
* separately for each scope: access and default. This method is responsible
* for handling the following cases of mask calculation:
* 1. Throws an exception if the caller attempts to remove the mask entry of an
* existing ACL that requires it. If the ACL has any named entries, then a
* mask entry is required.
* 2. If the caller supplied a mask in the ACL spec, use it.
* 3. If the caller did not supply a mask, but there are ACL entry changes in
* this scope, then automatically calculate a new mask. The permissions of
* the new mask are the union of the permissions on the group entry and all
* named entries.
*
* @param aclBuilder ArrayList<AclEntry> containing entries to build
* @param providedMask EnumMap<AclEntryScope, AclEntry> mapping each scope to
* the mask entry that was provided for that scope (if provided)
* @param maskDirty EnumSet<AclEntryScope> which contains a scope if the mask
* entry is dirty (added or deleted) in that scope
* @param scopeDirty EnumSet<AclEntryScope> which contains a scope if any entry
* is dirty (added or deleted) in that scope
* @throws AclException if validation fails
*/
private static void calculateMasks(List<AclEntry> aclBuilder,
EnumMap<AclEntryScope, AclEntry> providedMask,
EnumSet<AclEntryScope> maskDirty, EnumSet<AclEntryScope> scopeDirty)
throws AclException {
EnumSet<AclEntryScope> scopeFound = EnumSet.noneOf(AclEntryScope.class);
EnumMap<AclEntryScope, FsAction> unionPerms =
Maps.newEnumMap(AclEntryScope.class);
EnumSet<AclEntryScope> maskNeeded = EnumSet.noneOf(AclEntryScope.class);
// Determine which scopes are present, which scopes need a mask, and the
// union of group class permissions in each scope.
for (AclEntry entry: aclBuilder) {
scopeFound.add(entry.getScope());
if (entry.getType() == GROUP || entry.getName() != null) {
FsAction scopeUnionPerms = unionPerms.get(entry.getScope());
if (scopeUnionPerms == null) {
scopeUnionPerms = FsAction.NONE;
}
unionPerms.put(entry.getScope(),
scopeUnionPerms.or(entry.getPermission()));
}
if (entry.getName() != null) {
maskNeeded.add(entry.getScope());
}
}
// Add mask entry if needed in each scope.
for (AclEntryScope scope: scopeFound) {
if (!providedMask.containsKey(scope) && maskNeeded.contains(scope) &&
maskDirty.contains(scope)) {
// Caller explicitly removed mask entry, but it's required.
throw new AclException(
"Invalid ACL: mask is required and cannot be deleted.");
} else if (providedMask.containsKey(scope) &&
(!scopeDirty.contains(scope) || maskDirty.contains(scope))) {
// Caller explicitly provided new mask, or we are preserving the existing
// mask in an unchanged scope.
aclBuilder.add(providedMask.get(scope));
} else if (maskNeeded.contains(scope) || providedMask.containsKey(scope)) {
// Otherwise, if there are maskable entries present, or the ACL
// previously had a mask, then recalculate a mask automatically.
aclBuilder.add(new AclEntry.Builder()
.setScope(scope)
.setType(MASK)
.setPermission(unionPerms.get(scope))
.build());
}
}
}
/**
* Adds unspecified default entries by copying permissions from the
* corresponding access entries.
*
* @param aclBuilder ArrayList<AclEntry> containing entries to build
*/
private static void copyDefaultsIfNeeded(List<AclEntry> aclBuilder) {
Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR);
ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder);
if (!scopedEntries.getDefaultEntries().isEmpty()) {
List<AclEntry> accessEntries = scopedEntries.getAccessEntries();
List<AclEntry> defaultEntries = scopedEntries.getDefaultEntries();
List<AclEntry> copiedEntries = Lists.newArrayListWithCapacity(3);
for (AclEntryType type: EnumSet.of(USER, GROUP, OTHER)) {
AclEntry defaultEntryKey = new AclEntry.Builder().setScope(DEFAULT)
.setType(type).build();
int defaultEntryIndex = Collections.binarySearch(defaultEntries,
defaultEntryKey, ACL_ENTRY_COMPARATOR);
if (defaultEntryIndex < 0) {
AclEntry accessEntryKey = new AclEntry.Builder().setScope(ACCESS)
.setType(type).build();
int accessEntryIndex = Collections.binarySearch(accessEntries,
accessEntryKey, ACL_ENTRY_COMPARATOR);
if (accessEntryIndex >= 0) {
copiedEntries.add(new AclEntry.Builder()
.setScope(DEFAULT)
.setType(type)
.setPermission(accessEntries.get(accessEntryIndex).getPermission())
.build());
}
}
}
// Add all copied entries when done to prevent potential issues with binary
// search on a modified aclBulider during the main loop.
aclBuilder.addAll(copiedEntries);
}
}
/**
* An ACL spec that has been pre-validated and sorted.
*/
private static final class ValidatedAclSpec implements Iterable<AclEntry> {
private final List<AclEntry> aclSpec;
/**
* Creates a ValidatedAclSpec by pre-validating and sorting the given ACL
* entries. Pre-validation checks that it does not exceed the maximum
* entries. This check is performed before modifying the ACL, and it's
* actually insufficient for enforcing the maximum number of entries.
* Transformation logic can create additional entries automatically,such as
* the mask and some of the default entries, so we also need additional
* checks during transformation. The up-front check is still valuable here
* so that we don't run a lot of expensive transformation logic while
* holding the namesystem lock for an attacker who intentionally sent a huge
* ACL spec.
*
* @param aclSpec List<AclEntry> containing unvalidated input ACL spec
* @throws AclException if validation fails
*/
public ValidatedAclSpec(List<AclEntry> aclSpec) throws AclException {
Collections.sort(aclSpec, ACL_ENTRY_COMPARATOR);
checkMaxEntries(new ScopedAclEntries(aclSpec));
this.aclSpec = aclSpec;
}
/**
* Returns true if this contains an entry matching the given key. An ACL
* entry's key consists of scope, type and name (but not permission).
*
* @param key AclEntry search key
* @return boolean true if found
*/
public boolean containsKey(AclEntry key) {
return Collections.binarySearch(aclSpec, key, ACL_ENTRY_COMPARATOR) >= 0;
}
/**
* Returns the entry matching the given key or null if not found. An ACL
* entry's key consists of scope, type and name (but not permission).
*
* @param key AclEntry search key
* @return AclEntry entry matching the given key or null if not found
*/
public AclEntry findByKey(AclEntry key) {
int index = Collections.binarySearch(aclSpec, key, ACL_ENTRY_COMPARATOR);
if (index >= 0) {
return aclSpec.get(index);
}
return null;
}
@Override
public Iterator<AclEntry> iterator() {
return aclSpec.iterator();
}
}
}
| apurtell/hadoop | hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/AclTransformation.java | Java | apache-2.0 | 21,791 |
package com.jorgecastilloprz.pagedheadlistview.pagetransformers;
import android.support.v4.view.ViewPager;
import android.view.View;
/**
* Created by jorge on 10/08/14.
*/
public class DepthPageTransformer implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.75f;
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0);
} else if (position <= 0) { // [-1,0]
// Use the default slide transition when moving to the left page
view.setAlpha(1);
view.setTranslationX(0);
view.setScaleX(1);
view.setScaleY(1);
} else if (position <= 1) { // (0,1]
// Fade the page out.
view.setAlpha(1 - position);
// Counteract the default slide transition
view.setTranslationX(pageWidth * -position);
// Scale the page down (between MIN_SCALE and 1)
float scaleFactor = MIN_SCALE
+ (1 - MIN_SCALE) * (1 - Math.abs(position));
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
} else { // (1,+Infinity]
// This page is way off-screen to the right.
view.setAlpha(0);
}
}
} | 0359xiaodong/PagedHeadListView | library/src/main/java/com/jorgecastilloprz/pagedheadlistview/pagetransformers/DepthPageTransformer.java | Java | apache-2.0 | 1,412 |
/*
* Copyright 2012-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.json;
import com.facebook.buck.util.ExceptionWithHumanReadableMessage;
import java.io.IOException;
import java.nio.file.Path;
/**
* Thrown if we encounter an unexpected, fatal condition while interacting with the
* build file parser.
*/
@SuppressWarnings("serial")
public class BuildFileParseException extends Exception
implements ExceptionWithHumanReadableMessage {
private BuildFileParseException(String message) {
super(message);
}
static BuildFileParseException createForUnknownParseError(String message) {
return new BuildFileParseException(message);
}
private static String formatMessageWithCause(String message, IOException cause) {
if (cause != null && cause.getMessage() != null) {
return message + ":\n" + cause.getMessage();
} else {
return message;
}
}
static BuildFileParseException createForBuildFileParseError(Path buildFile,
IOException cause) {
String message = String.format("Parse error for build file %s",
buildFile);
return new BuildFileParseException(formatMessageWithCause(message, cause));
}
@Override
public String getHumanReadableErrorMessage() {
return getMessage();
}
}
| daedric/buck | src/com/facebook/buck/json/BuildFileParseException.java | Java | apache-2.0 | 1,826 |
package packp
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
)
const ackLineLen = 44
// ServerResponse object acknowledgement from upload-pack service
type ServerResponse struct {
ACKs []plumbing.Hash
}
// Decode decodes the response into the struct, isMultiACK should be true, if
// the request was done with multi_ack or multi_ack_detailed capabilities.
func (r *ServerResponse) Decode(reader *bufio.Reader, isMultiACK bool) error {
// TODO: implement support for multi_ack or multi_ack_detailed responses
if isMultiACK {
return errors.New("multi_ack and multi_ack_detailed are not supported")
}
s := pktline.NewScanner(reader)
for s.Scan() {
line := s.Bytes()
if err := r.decodeLine(line); err != nil {
return err
}
// we need to detect when the end of a response header and the begining
// of a packfile header happend, some requests to the git daemon
// produces a duplicate ACK header even when multi_ack is not supported.
stop, err := r.stopReading(reader)
if err != nil {
return err
}
if stop {
break
}
}
return s.Err()
}
// stopReading detects when a valid command such as ACK or NAK is found to be
// read in the buffer without moving the read pointer.
func (r *ServerResponse) stopReading(reader *bufio.Reader) (bool, error) {
ahead, err := reader.Peek(7)
if err == io.EOF {
return true, nil
}
if err != nil {
return false, err
}
if len(ahead) > 4 && r.isValidCommand(ahead[0:3]) {
return false, nil
}
if len(ahead) == 7 && r.isValidCommand(ahead[4:]) {
return false, nil
}
return true, nil
}
func (r *ServerResponse) isValidCommand(b []byte) bool {
commands := [][]byte{ack, nak}
for _, c := range commands {
if bytes.Compare(b, c) == 0 {
return true
}
}
return false
}
func (r *ServerResponse) decodeLine(line []byte) error {
if len(line) == 0 {
return fmt.Errorf("unexpected flush")
}
if bytes.Compare(line[0:3], ack) == 0 {
return r.decodeACKLine(line)
}
if bytes.Compare(line[0:3], nak) == 0 {
return nil
}
return fmt.Errorf("unexpected content %q", string(line))
}
func (r *ServerResponse) decodeACKLine(line []byte) error {
if len(line) < ackLineLen {
return fmt.Errorf("malformed ACK %q", line)
}
sp := bytes.Index(line, []byte(" "))
h := plumbing.NewHash(string(line[sp+1 : sp+41]))
r.ACKs = append(r.ACKs, h)
return nil
}
// Encode encodes the ServerResponse into a writer.
func (r *ServerResponse) Encode(w io.Writer) error {
if len(r.ACKs) > 1 {
return errors.New("multi_ack and multi_ack_detailed are not supported")
}
e := pktline.NewEncoder(w)
if len(r.ACKs) == 0 {
return e.Encodef("%s\n", nak)
}
return e.Encodef("%s %s\n", ack, r.ACKs[0].String())
}
| terrorform/pool-resource | vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/srvresp.go | GO | apache-2.0 | 2,799 |
// Copyright © 2012, Université catholique de Louvain
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "generator.hh"
#include <sstream>
using namespace clang;
struct InterfaceDef {
InterfaceDef() {
name = "";
implems = 0;
autoWait = true;
autoReflectiveCalls = true;
}
void makeOutput(const SpecDecl* ND, llvm::raw_fd_ostream& to);
std::string name;
const TemplateSpecializationType* implems;
bool autoWait;
bool autoReflectiveCalls;
};
void handleInterface(const std::string& outputDir, const SpecDecl* ND) {
const std::string name = getTypeParamAsString(ND);
InterfaceDef definition;
definition.name = name;
// For every marker, i.e. base class
for (auto iter = ND->bases_begin(), e = ND->bases_end(); iter != e; ++iter) {
CXXRecordDecl* marker = iter->getType()->getAsCXXRecordDecl();
std::string markerLabel = marker->getNameAsString();
if (markerLabel == "ImplementedBy") {
definition.implems =
dyn_cast<TemplateSpecializationType>(iter->getType().getTypePtr());
} else if (markerLabel == "NoAutoWait") {
definition.autoWait = false;
} else if (markerLabel == "NoAutoReflectiveCalls") {
definition.autoReflectiveCalls = false;
} else {}
}
// Write output
withFileOutputStream(outputDir + name + "-interf.hh",
[&] (ostream& to) { definition.makeOutput(ND, to); });
}
void InterfaceDef::makeOutput(const SpecDecl* ND, llvm::raw_fd_ostream& to) {
to << "class "<< name << " {\n";
to << "public:\n";
to << " " << name << "(RichNode self) : _self(self) {}\n";
to << " " << name << "(UnstableNode& self) : _self(self) {}\n";
to << " " << name << "(StableNode& self) : _self(self) {}\n";
for (auto iter = ND->decls_begin(), e = ND->decls_end(); iter != e; ++iter) {
const Decl* decl = *iter;
if (decl->isImplicit())
continue;
if (!decl->isFunctionOrFunctionTemplate())
continue;
if (decl->getAccess() != AS_public)
continue;
const FunctionDecl* function;
if ((function = dyn_cast<FunctionDecl>(decl))) {
// Do nothing
} else if (const FunctionTemplateDecl* funTemplate =
dyn_cast<FunctionTemplateDecl>(decl)) {
function = funTemplate->getTemplatedDecl();
TemplateParameterList* params = funTemplate->getTemplateParameters();
to << "\n ";
printTemplateParameters(to, params);
}
if (!function->isCXXInstanceMember())
continue;
std::string funName, resultType, formals, actuals, reflectActuals;
parseFunction(function, funName, resultType, formals, actuals,
reflectActuals, true);
// Declaration of the procedure
to << "\n " << resultType << " " << funName
<< "(" << formals << ") {\n ";
// For every implementation that implements this interface (ImplementedBy)
for (int i = 0; i < (int) implems->getNumArgs(); ++i) {
std::string imp =
implems->getArg(i).getAsType()->getAsCXXRecordDecl()->getNameAsString();
to << "if (_self.is<" << imp << ">()) {\n";
to << " return _self.as<" << imp << ">()."
<< funName << "(" << actuals << ");\n";
to << " } else ";
}
// Auto-wait handling
if (autoWait) {
to << "if (_self.isTransient()) {\n";
to << " waitFor(vm, _self);\n";
to << " throw std::exception(); // not reachable\n";
to << " } else ";
}
to << "{\n";
// Auto-reflective calls handling
if (autoReflectiveCalls) {
to << " if (_self.is< ::mozart::ReflectiveEntity>()) {\n";
if (resultType != "void")
to << " " << resultType << " _result;\n";
to << " if (_self.as< ::mozart::ReflectiveEntity>()."
<< "reflectiveCall(vm, \"$intf$::" << name << "::" << funName
<< "\", \"" << funName << "\"";
if (!reflectActuals.empty())
to << ", " << reflectActuals;
if (resultType != "void")
to << ", ::mozart::ozcalls::out(_result)";
to << "))\n";
if (resultType != "void")
to << " return _result;\n";
else
to << " return;\n";
to << " }\n";
}
// Default behavior
to << " return Interface<" << name << ">()." << funName << "(_self";
if (!actuals.empty())
to << ", " << actuals;
to << ");\n";
to << " }\n";
to << " }\n";
}
to << "protected:\n";
to << " RichNode _self;\n";
to << "};\n\n";
}
| yjaradin/mozart2 | vm/generator/main/interfaces.cc | C++ | bsd-2-clause | 5,779 |
cask :v1 => 'ssx' do
version '06082006-2216'
sha256 '34d904e909191e60e0b84ea43f177871ac4310c91af53e5c4cbff28c5dd29fcb'
url "http://chris.schleifer.net/ssX/builds/ssX-#{version}.dmg"
homepage 'http://chris.schleifer.net/ssX/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
app 'ssX.app'
end
| gustavoavellar/homebrew-cask | Casks/ssx.rb | Ruby | bsd-2-clause | 371 |
cask 'icq' do
version '3.0.18725'
sha256 '437ce23444ae3449e53195e10b0c8a7515d8ea5357435335e4d2793c12e1f8b7'
# mra.mail.ru/icq_mac3_update was verified as official when first introduced to the cask
url 'https://mra.mail.ru/icq_mac3_update/icq.dmg'
appcast 'https://mra.mail.ru/icq_mac3_update/icq_update.xml'
name 'ICQ for macOS'
homepage 'https://icq.com/mac/en'
app 'ICQ.app'
zap trash: [
'~/Library/Application Support/ICQ',
'~/Library/Caches/com.icq.macicq',
'~/Library/Preferences/com.icq.macicq.plist',
'~/Library/Saved Application State/com.icq.macicq.savedState',
]
end
| reelsense/homebrew-cask | Casks/icq.rb | Ruby | bsd-2-clause | 671 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Gatherer for administrative template files.
'''
import re
import types
from grit.gather import regexp
from grit import exception
from grit import tclib
from grit import util
class MalformedAdminTemplateException(exception.Base):
'''This file doesn't look like a .adm file to me.'''
def __init__(self, msg=''):
exception.Base.__init__(self, msg)
class AdmGatherer(regexp.RegexpGatherer):
'''Gatherer for the translateable portions of an admin template.
This gatherer currently makes the following assumptions:
- there is only one [strings] section and it is always the last section
of the file
- translateable strings do not need to be escaped.
'''
# Finds the strings section as the group named 'strings'
_STRINGS_SECTION = re.compile('(?P<first_part>.+^\[strings\])(?P<strings>.+)\Z',
re.MULTILINE | re.DOTALL)
# Finds the translateable sections from within the [strings] section.
_TRANSLATEABLES = re.compile('^\s*[A-Za-z0-9_]+\s*=\s*"(?P<text>.+)"\s*$',
re.MULTILINE)
def __init__(self, text):
regexp.RegexpGatherer.__init__(self, text)
def Escape(self, text):
return text.replace('\n', '\\n')
def UnEscape(self, text):
return text.replace('\\n', '\n')
def Parse(self):
if self.have_parsed_:
return
m = self._STRINGS_SECTION.match(self.text_)
if not m:
raise MalformedAdminTemplateException()
# Add the first part, which is all nontranslateable, to the skeleton
self._AddNontranslateableChunk(m.group('first_part'))
# Then parse the rest using the _TRANSLATEABLES regexp.
self._RegExpParse(self._TRANSLATEABLES, m.group('strings'))
# static method
def FromFile(adm_file, ext_key=None, encoding='cp1252'):
'''Loads the contents of 'adm_file' in encoding 'encoding' and creates
an AdmGatherer instance that gathers from those contents.
The 'ext_key' parameter is ignored.
Args:
adm_file: file('bingo.rc') | 'filename.rc'
encoding: 'utf-8'
Return:
AdmGatherer(contents_of_file)
'''
if isinstance(adm_file, types.StringTypes):
adm_file = util.WrapInputStream(file(adm_file, 'r'), encoding)
return AdmGatherer(adm_file.read())
FromFile = staticmethod(FromFile)
| meego-tablet-ux/meego-app-browser | tools/grit/grit/gather/admin_template.py | Python | bsd-3-clause | 2,488 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Export guts for testing.
package runtime
import (
"runtime/internal/atomic"
"runtime/internal/sys"
"unsafe"
)
var Fadd64 = fadd64
var Fsub64 = fsub64
var Fmul64 = fmul64
var Fdiv64 = fdiv64
var F64to32 = f64to32
var F32to64 = f32to64
var Fcmp64 = fcmp64
var Fintto64 = fintto64
var F64toint = f64toint
var Sqrt = sqrt
var Entersyscall = entersyscall
var Exitsyscall = exitsyscall
var LockedOSThread = lockedOSThread
var Xadduintptr = atomic.Xadduintptr
var FuncPC = funcPC
var Fastlog2 = fastlog2
type LFNode struct {
Next uint64
Pushcnt uintptr
}
func LFStackPush(head *uint64, node *LFNode) {
lfstackpush(head, (*lfnode)(unsafe.Pointer(node)))
}
func LFStackPop(head *uint64) *LFNode {
return (*LFNode)(unsafe.Pointer(lfstackpop(head)))
}
type ParFor struct {
body func(*ParFor, uint32)
done uint32
Nthr uint32
thrseq uint32
Cnt uint32
wait bool
}
func NewParFor(nthrmax uint32) *ParFor {
var desc *ParFor
systemstack(func() {
desc = (*ParFor)(unsafe.Pointer(parforalloc(nthrmax)))
})
return desc
}
func ParForSetup(desc *ParFor, nthr, n uint32, wait bool, body func(*ParFor, uint32)) {
systemstack(func() {
parforsetup((*parfor)(unsafe.Pointer(desc)), nthr, n, wait,
*(*func(*parfor, uint32))(unsafe.Pointer(&body)))
})
}
func ParForDo(desc *ParFor) {
systemstack(func() {
parfordo((*parfor)(unsafe.Pointer(desc)))
})
}
func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) {
desc1 := (*parfor)(unsafe.Pointer(desc))
pos := desc1.thr[tid].pos
return uint32(pos), uint32(pos >> 32)
}
func GCMask(x interface{}) (ret []byte) {
systemstack(func() {
ret = getgcmask(x)
})
return
}
func RunSchedLocalQueueTest() {
testSchedLocalQueue()
}
func RunSchedLocalQueueStealTest() {
testSchedLocalQueueSteal()
}
var StringHash = stringHash
var BytesHash = bytesHash
var Int32Hash = int32Hash
var Int64Hash = int64Hash
var EfaceHash = efaceHash
var IfaceHash = ifaceHash
var MemclrBytes = memclrBytes
var HashLoad = &hashLoad
// entry point for testing
func GostringW(w []uint16) (s string) {
systemstack(func() {
s = gostringw(&w[0])
})
return
}
var Gostringnocopy = gostringnocopy
var Maxstring = &maxstring
type Uintreg sys.Uintreg
var Open = open
var Close = closefd
var Read = read
var Write = write
func Envs() []string { return envs }
func SetEnvs(e []string) { envs = e }
var BigEndian = sys.BigEndian
// For benchmarking.
func BenchSetType(n int, x interface{}) {
e := *efaceOf(&x)
t := e._type
var size uintptr
var p unsafe.Pointer
switch t.kind & kindMask {
case kindPtr:
t = (*ptrtype)(unsafe.Pointer(t)).elem
size = t.size
p = e.data
case kindSlice:
slice := *(*struct {
ptr unsafe.Pointer
len, cap uintptr
})(e.data)
t = (*slicetype)(unsafe.Pointer(t)).elem
size = t.size * slice.len
p = slice.ptr
}
allocSize := roundupsize(size)
systemstack(func() {
for i := 0; i < n; i++ {
heapBitsSetType(uintptr(p), allocSize, size, t)
}
})
}
const PtrSize = sys.PtrSize
var TestingAssertE2I2GC = &testingAssertE2I2GC
var TestingAssertE2T2GC = &testingAssertE2T2GC
var ForceGCPeriod = &forcegcperiod
| deft-code/go | src/runtime/export_test.go | GO | bsd-3-clause | 3,299 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkSynchronizedTemplatesCutter3D(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkSynchronizedTemplatesCutter3D(), 'Processing.',
('vtkImageData',), ('vtkPolyData',),
replaceDoc=True,
inputFunctions=None, outputFunctions=None)
| nagyistoce/devide | modules/vtk_basic/vtkSynchronizedTemplatesCutter3D.py | Python | bsd-3-clause | 520 |
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_RESPONSE_PROMISE_HPP
#define CAF_RESPONSE_PROMISE_HPP
#include "caf/actor.hpp"
#include "caf/message.hpp"
#include "caf/actor_addr.hpp"
#include "caf/message_id.hpp"
namespace caf {
/// A response promise can be used to deliver a uniquely identifiable
/// response message from the server (i.e. receiver of the request)
/// to the client (i.e. the sender of the request).
class response_promise {
public:
response_promise() = default;
response_promise(response_promise&&) = default;
response_promise(const response_promise&) = default;
response_promise& operator=(response_promise&&) = default;
response_promise& operator=(const response_promise&) = default;
response_promise(const actor_addr& from, const actor_addr& to,
const message_id& response_id);
/// Queries whether this promise is still valid, i.e., no response
/// was yet delivered to the client.
inline explicit operator bool() const {
// handle is valid if it has a receiver
return static_cast<bool>(to_);
}
/// Sends `response_message` and invalidates this handle afterwards.
template <class... Ts>
void deliver(Ts&&... xs) const {
deliver_impl(make_message(std::forward<Ts>(xs)...));
}
private:
void deliver_impl(message response_message) const;
actor_addr from_;
actor_addr to_;
message_id id_;
};
} // namespace caf
#endif // CAF_RESPONSE_PROMISE_HPP
| szdavid92/actor-framework | libcaf_core/caf/response_promise.hpp | C++ | bsd-3-clause | 2,848 |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/gtk/importer/import_lock_dialog_gtk.h"
#include <gtk/gtk.h>
#include "base/bind.h"
#include "base/message_loop.h"
#include "chrome/browser/importer/importer_lock_dialog.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "content/public/browser/user_metrics.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
using content::UserMetricsAction;
namespace importer {
void ShowImportLockDialog(gfx::NativeWindow parent,
const base::Callback<void(bool)>& callback) {
ImportLockDialogGtk::Show(parent, callback);
content::RecordAction(UserMetricsAction("ImportLockDialogGtk_Shown"));
}
} // namespace importer
// static
void ImportLockDialogGtk::Show(GtkWindow* parent,
const base::Callback<void(bool)>& callback) {
new ImportLockDialogGtk(parent, callback);
}
ImportLockDialogGtk::ImportLockDialogGtk(
GtkWindow* parent,
const base::Callback<void(bool)>& callback) : callback_(callback) {
// Build the dialog.
dialog_ = gtk_dialog_new_with_buttons(
l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_TITLE).c_str(),
parent,
(GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
NULL);
gtk_util::AddButtonToDialog(dialog_,
l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_CANCEL).c_str(),
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
gtk_util::AddButtonToDialog(dialog_,
l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_OK).c_str(),
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_));
gtk_box_set_spacing(GTK_BOX(content_area), ui::kContentAreaSpacing);
GtkWidget* label = gtk_label_new(
l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_TEXT).c_str());
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0);
g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
gtk_widget_show_all(dialog_);
}
ImportLockDialogGtk::~ImportLockDialogGtk() {}
void ImportLockDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(callback_, response_id == GTK_RESPONSE_ACCEPT));
gtk_widget_destroy(dialog_);
delete this;
}
| espadrine/opera | chromium/src/chrome/browser/ui/gtk/importer/import_lock_dialog_gtk.cc | C++ | bsd-3-clause | 2,625 |
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace WebsitePanel.Providers.FTP.IIs70.Config
{
using System;
[Flags]
public enum PermissionsFlags
{
Read = 1,
Write = 2
}
}
| simonegli8/Websitepanel | WebsitePanel/Sources/WebsitePanel.Providers.FTP.IIs70/Configuration/PermissionsFlags.cs | C# | bsd-3-clause | 1,852 |
/*
Copyright (C) 2008-2016 The Communi Project
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ircconnection.h"
#include "ircconnection_p.h"
#include "ircnetwork_p.h"
#include "irccommand_p.h"
#include "ircprotocol.h"
#include "ircnetwork.h"
#include "irccommand.h"
#include "ircmessage.h"
#include "ircdebug_p.h"
#include "ircfilter.h"
#include "irc.h"
#include <QLocale>
#include <QRegExp>
#include <QDateTime>
#include <QTcpSocket>
#include <QTextCodec>
#include <QMetaObject>
#include <QMetaMethod>
#include <QMetaEnum>
#ifndef QT_NO_SSL
#include <QSslSocket>
#include <QSslError>
#endif // QT_NO_SSL
#include <QDataStream>
#include <QVariantMap>
IRC_BEGIN_NAMESPACE
/*!
\file ircconnection.h
\brief \#include <IrcConnection>
*/
/*!
\class IrcConnection ircconnection.h IrcConnection
\ingroup core
\brief Provides means to establish a connection to an IRC server.
\section connection-management Connection management
Before \ref open() "opening" a connection, it must be first initialized
with \ref host, \ref userName, \ref nickName and \ref realName.
The connection status may be queried at any time via status(). Also
\ref active "isActive()" and \ref connected "isConnected()" are provided
for convenience. In addition to the \ref status "statusChanged()" signal,
the most important statuses are informed via the following convenience
signals:
\li connecting() -
The connection is being established.
\li \ref connected "connected()" -
The IRC connection has been established, and the server is ready to receive commands.
\li disconnected() -
The connection has been lost.
\section receiving-messages Receiving messages
Whenever a message is received from the server, the messageReceived()
signal is emitted. Also message type specific signals are provided
for convenience. See messageReceived() and IrcMessage and its
subclasses for more details.
\section sending-commands Sending commands
Sending commands to a server is most conveniently done by creating
them via the various static \ref IrcCommand "IrcCommand::createXxx()"
methods and passing them to sendCommand(). Also sendData() is provided
for more low-level access. See IrcCommand for more details.
\section example Example
\code
IrcConnection* connection = new IrcConnection(this);
connect(connection, SIGNAL(messageReceived(IrcMessage*)), this, SLOT(onMessageReceived(IrcMessage*)));
connection->setHost("irc.server.com");
connection->setUserName("me");
connection->setNickName("myself");
connection->setRealName("And I");
connection->sendCommand(IrcCommand::createJoin("#mine"));
connection->open();
\endcode
\sa IrcNetwork, IrcMessage, IrcCommand
*/
/*!
\enum IrcConnection::Status
This enum describes the connection status.
*/
/*!
\var IrcConnection::Inactive
\brief The connection is inactive.
*/
/*!
\var IrcConnection::Waiting
\brief The connection is waiting for a reconnect.
*/
/*!
\var IrcConnection::Connecting
\brief The connection is being established.
*/
/*!
\var IrcConnection::Connected
\brief The connection has been established.
*/
/*!
\var IrcConnection::Closing
\brief The connection is being closed.
*/
/*!
\var IrcConnection::Closed
\brief The connection has been closed.
*/
/*!
\var IrcConnection::Error
\brief The connection has encountered an error.
*/
/*!
\fn void IrcConnection::connecting()
This signal is emitted when the connection is being established.
The underlying \ref socket has connected, but the IRC handshake is
not yet finished and the server is not yet ready to receive commands.
*/
/*!
\fn void IrcConnection::nickNameRequired(const QString& reserved, QString* alternate)
This signal is emitted when the requested nick name is \a reserved
and an \a alternate nick name should be provided.
An alternate nick name may be set via the provided argument, by changing
the \ref nickName property, or by sending a nick command directly.
\sa nickNames, IrcCommand::createNick(), Irc::ERR_NICKNAMEINUSE, Irc::ERR_NICKCOLLISION
*/
/*!
\fn void IrcConnection::channelKeyRequired(const QString& channel, QString* key)
This signal is emitted when joining a \a channel requires a \a key.
The key may be set via the provided argument, or by sending a new
join command directly.
\sa IrcCommand::createJoin(), Irc::ERR_BADCHANNELKEY
*/
/*!
\fn void IrcConnection::disconnected()
This signal is emitted when the connection has been lost.
*/
/*!
\fn void IrcConnection::socketError(QAbstractSocket::SocketError error)
This signal is emitted when a \ref socket \a error occurs.
\sa QAbstractSocket::error()
*/
/*!
\fn void IrcConnection::socketStateChanged(QAbstractSocket::SocketState state)
This signal is emitted when the \a state of the underlying \ref socket changes.
\sa QAbstractSocket::stateChanged()
*/
/*!
\since 3.2
\fn void IrcConnection::secureError()
This signal is emitted when SSL socket error occurs.
Either QSslSocket::sslErrors() was emitted, or the handshake failed
meaning that the server is not SSL-enabled.
*/
/*!
\fn void IrcConnection::messageReceived(IrcMessage* message)
This signal is emitted when a \a message is received.
In addition, message type specific signals are provided for convenience:
\li void <b>accountMessageReceived</b>(\ref IrcAccountMessage* message) (\b since 3.3)
\li void <b>awayMessageReceived</b>(\ref IrcAwayMessage* message) (\b since 3.3)
\li void <b>batchMessageReceived</b>(\ref IrcBatchMessage* message) (\b since 3.5)
\li void <b>capabilityMessageReceived</b>(\ref IrcCapabilityMessage* message)
\li void <b>errorMessageReceived</b>(\ref IrcErrorMessage* message)
\li void <b>hostChangeMessageReceived</b>(\ref IrcHostChangeMessage* message) (\b since 3.4)
\li void <b>inviteMessageReceived</b>(\ref IrcInviteMessage* message)
\li void <b>joinMessageReceived</b>(\ref IrcJoinMessage* message)
\li void <b>kickMessageReceived</b>(\ref IrcKickMessage* message)
\li void <b>modeMessageReceived</b>(\ref IrcModeMessage* message)
\li void <b>motdMessageReceived</b>(\ref IrcMotdMessage* message)
\li void <b>namesMessageReceived</b>(\ref IrcNamesMessage* message)
\li void <b>nickMessageReceived</b>(\ref IrcNickMessage* message)
\li void <b>noticeMessageReceived</b>(\ref IrcNoticeMessage* message)
\li void <b>numericMessageReceived</b>(\ref IrcNumericMessage* message)
\li void <b>partMessageReceived</b>(\ref IrcPartMessage* message)
\li void <b>pingMessageReceived</b>(\ref IrcPingMessage* message)
\li void <b>pongMessageReceived</b>(\ref IrcPongMessage* message)
\li void <b>privateMessageReceived</b>(\ref IrcPrivateMessage* message)
\li void <b>quitMessageReceived</b>(\ref IrcQuitMessage* message)
\li void <b>topicMessageReceived</b>(\ref IrcTopicMessage* message)
\li void <b>whoisMessageReceived</b>(\ref IrcWhoisMessage* message) (\b since 3.3)
\li void <b>whowasMessageReceived</b>(\ref IrcWhowasMessage* message) (\b since 3.3)
\li void <b>whoReplyMessageReceived</b>(\ref IrcWhoReplyMessage* message) (\b since 3.1)
*/
#ifndef IRC_DOXYGEN
IrcConnectionPrivate::IrcConnectionPrivate() :
q_ptr(0),
encoding("ISO-8859-15"),
network(0),
protocol(0),
socket(0),
host(),
port(6667),
currentServer(-1),
userName(),
nickName(),
realName(),
enabled(true),
status(IrcConnection::Inactive),
pendingOpen(false),
closed(false)
{
}
void IrcConnectionPrivate::init(IrcConnection* connection)
{
q_ptr = connection;
network = IrcNetworkPrivate::create(connection);
connection->setSocket(new QTcpSocket(connection));
connection->setProtocol(new IrcProtocol(connection));
QObject::connect(&reconnecter, SIGNAL(timeout()), connection, SLOT(_irc_reconnect()));
}
void IrcConnectionPrivate::_irc_connected()
{
Q_Q(IrcConnection);
closed = false;
pendingOpen = false;
emit q->connecting();
if (q->isSecure())
QMetaObject::invokeMethod(socket, "startClientEncryption");
protocol->open();
}
void IrcConnectionPrivate::_irc_disconnected()
{
Q_Q(IrcConnection);
protocol->close();
emit q->disconnected();
reconnect();
}
void IrcConnectionPrivate::_irc_error(QAbstractSocket::SocketError error)
{
Q_Q(IrcConnection);
if (error == QAbstractSocket::SslHandshakeFailedError) {
ircDebug(q, IrcDebug::Error) << error;
setStatus(IrcConnection::Error);
emit q->secureError();
} else if (!closed || (error != QAbstractSocket::RemoteHostClosedError && error != QAbstractSocket::UnknownSocketError)) {
ircDebug(q, IrcDebug::Error) << error;
emit q->socketError(error);
setStatus(IrcConnection::Error);
reconnect();
}
}
void IrcConnectionPrivate::_irc_sslErrors()
{
Q_Q(IrcConnection);
QStringList errors;
#ifndef QT_NO_SSL
QSslSocket* ssl = qobject_cast<QSslSocket*>(socket);
if (ssl) {
foreach (const QSslError& error, ssl->sslErrors())
errors += error.errorString();
}
#endif
ircDebug(q, IrcDebug::Error) << errors;
emit q->secureError();
}
void IrcConnectionPrivate::_irc_state(QAbstractSocket::SocketState state)
{
Q_Q(IrcConnection);
switch (state) {
case QAbstractSocket::UnconnectedState:
if (closed)
setStatus(IrcConnection::Closed);
break;
case QAbstractSocket::ClosingState:
if (status != IrcConnection::Error && status != IrcConnection::Waiting)
setStatus(IrcConnection::Closing);
break;
case QAbstractSocket::HostLookupState:
case QAbstractSocket::ConnectingState:
case QAbstractSocket::ConnectedState:
default:
setStatus(IrcConnection::Connecting);
break;
}
emit q->socketStateChanged(state);
}
void IrcConnectionPrivate::_irc_reconnect()
{
Q_Q(IrcConnection);
if (!q->isActive()) {
reconnecter.stop();
q->open();
}
}
void IrcConnectionPrivate::_irc_readData()
{
protocol->read();
}
void IrcConnectionPrivate::_irc_filterDestroyed(QObject* filter)
{
messageFilters.removeAll(filter);
commandFilters.removeAll(filter);
}
static bool parseServer(const QString& server, QString* host, int* port, bool* ssl)
{
QStringList p = server.split(QRegExp("[: ]"), QString::SkipEmptyParts);
*host = p.value(0);
*ssl = p.value(1).startsWith(QLatin1Char('+'));
bool ok = false;
*port = p.value(1).toInt(&ok);
if (*port == 0)
*port = 6667;
return !host->isEmpty() && (p.value(1).isEmpty() || ok) && (p.count() == 1 || p.count() == 2);
}
void IrcConnectionPrivate::open()
{
Q_Q(IrcConnection);
if (q->isActive()) {
pendingOpen = true;
} else {
closed = false;
if (!servers.isEmpty()) {
QString h; int p; bool s;
QString server = servers.value((++currentServer) % servers.count());
if (!parseServer(server, &h, &p, &s))
qWarning() << "IrcConnection::servers: malformed line" << server;
q->setHost(h);
q->setPort(p);
q->setSecure(s);
}
socket->connectToHost(host, port);
}
}
void IrcConnectionPrivate::reconnect()
{
if (enabled && (status != IrcConnection::Closed || !closed || pendingOpen) && !reconnecter.isActive() && reconnecter.interval() > 0) {
pendingOpen = false;
reconnecter.start();
setStatus(IrcConnection::Waiting);
}
}
void IrcConnectionPrivate::setNick(const QString& nick)
{
Q_Q(IrcConnection);
if (nickName != nick) {
nickName = nick;
emit q->nickNameChanged(nick);
}
}
void IrcConnectionPrivate::setStatus(IrcConnection::Status value)
{
Q_Q(IrcConnection);
if (status != value) {
const bool wasConnected = q->isConnected();
status = value;
emit q->statusChanged(value);
if (!wasConnected && q->isConnected()) {
emit q->connected();
foreach (const QByteArray& data, pendingData)
q->sendRaw(data);
pendingData.clear();
}
ircDebug(q, IrcDebug::Status) << status << qPrintable(host) << port;
}
}
void IrcConnectionPrivate::setInfo(const QHash<QString, QString>& info)
{
Q_Q(IrcConnection);
const QString oldName = q->displayName();
IrcNetworkPrivate* priv = IrcNetworkPrivate::get(network);
priv->setInfo(info);
const QString newName = q->displayName();
if (oldName != newName)
emit q->displayNameChanged(newName);
}
bool IrcConnectionPrivate::receiveMessage(IrcMessage* msg)
{
Q_Q(IrcConnection);
if (msg->type() == IrcMessage::Join && msg->isOwn()) {
replies.clear();
} else if (msg->type() == IrcMessage::Numeric) {
int code = static_cast<IrcNumericMessage*>(msg)->code();
if (code == Irc::RPL_NAMREPLY || code == Irc::RPL_ENDOFNAMES) {
if (!replies.contains(Irc::RPL_ENDOFNAMES))
msg->setFlag(IrcMessage::Implicit);
} else if (code == Irc::RPL_TOPIC || code == Irc::RPL_NOTOPIC || code == Irc::RPL_TOPICWHOTIME || code == Irc::RPL_CHANNEL_URL || code == Irc::RPL_CREATIONTIME) {
if (!replies.contains(code))
msg->setFlag(IrcMessage::Implicit);
}
replies.insert(code);
}
bool filtered = false;
for (int i = messageFilters.count() - 1; !filtered && i >= 0; --i) {
IrcMessageFilter* filter = qobject_cast<IrcMessageFilter*>(messageFilters.at(i));
if (filter)
filtered |= filter->messageFilter(msg);
}
if (!filtered) {
emit q->messageReceived(msg);
switch (msg->type()) {
case IrcMessage::Account:
emit q->accountMessageReceived(static_cast<IrcAccountMessage*>(msg));
break;
case IrcMessage::Away:
emit q->awayMessageReceived(static_cast<IrcAwayMessage*>(msg));
break;
case IrcMessage::Batch:
emit q->batchMessageReceived(static_cast<IrcBatchMessage*>(msg));
break;
case IrcMessage::Capability:
emit q->capabilityMessageReceived(static_cast<IrcCapabilityMessage*>(msg));
break;
case IrcMessage::Error:
emit q->errorMessageReceived(static_cast<IrcErrorMessage*>(msg));
break;
case IrcMessage::HostChange:
emit q->hostChangeMessageReceived(static_cast<IrcHostChangeMessage*>(msg));
break;
case IrcMessage::Invite:
emit q->inviteMessageReceived(static_cast<IrcInviteMessage*>(msg));
break;
case IrcMessage::Join:
emit q->joinMessageReceived(static_cast<IrcJoinMessage*>(msg));
break;
case IrcMessage::Kick:
emit q->kickMessageReceived(static_cast<IrcKickMessage*>(msg));
break;
case IrcMessage::Mode:
emit q->modeMessageReceived(static_cast<IrcModeMessage*>(msg));
break;
case IrcMessage::Motd:
emit q->motdMessageReceived(static_cast<IrcMotdMessage*>(msg));
break;
case IrcMessage::Names:
emit q->namesMessageReceived(static_cast<IrcNamesMessage*>(msg));
break;
case IrcMessage::Nick:
emit q->nickMessageReceived(static_cast<IrcNickMessage*>(msg));
break;
case IrcMessage::Notice:
emit q->noticeMessageReceived(static_cast<IrcNoticeMessage*>(msg));
break;
case IrcMessage::Numeric:
emit q->numericMessageReceived(static_cast<IrcNumericMessage*>(msg));
break;
case IrcMessage::Part:
emit q->partMessageReceived(static_cast<IrcPartMessage*>(msg));
break;
case IrcMessage::Ping:
emit q->pingMessageReceived(static_cast<IrcPingMessage*>(msg));
break;
case IrcMessage::Pong:
emit q->pongMessageReceived(static_cast<IrcPongMessage*>(msg));
break;
case IrcMessage::Private:
emit q->privateMessageReceived(static_cast<IrcPrivateMessage*>(msg));
break;
case IrcMessage::Quit:
emit q->quitMessageReceived(static_cast<IrcQuitMessage*>(msg));
break;
case IrcMessage::Topic:
emit q->topicMessageReceived(static_cast<IrcTopicMessage*>(msg));
break;
case IrcMessage::Whois:
emit q->whoisMessageReceived(static_cast<IrcWhoisMessage*>(msg));
break;
case IrcMessage::Whowas:
emit q->whowasMessageReceived(static_cast<IrcWhowasMessage*>(msg));
break;
case IrcMessage::WhoReply:
emit q->whoReplyMessageReceived(static_cast<IrcWhoReplyMessage*>(msg));
break;
case IrcMessage::Unknown:
default:
break;
}
}
if (!msg->parent() || msg->parent() == q)
msg->deleteLater();
return !filtered;
}
IrcCommand* IrcConnectionPrivate::createCtcpReply(IrcPrivateMessage* request)
{
Q_Q(IrcConnection);
IrcCommand* reply = 0;
const QMetaObject* metaObject = q->metaObject();
int idx = metaObject->indexOfMethod("createCtcpReply(QVariant)");
if (idx != -1) {
// QML: QVariant createCtcpReply(QVariant)
QVariant ret;
QMetaMethod method = metaObject->method(idx);
method.invoke(q, Q_RETURN_ARG(QVariant, ret), Q_ARG(QVariant, QVariant::fromValue(request)));
reply = ret.value<IrcCommand*>();
} else {
// C++: IrcCommand* createCtcpReply(IrcPrivateMessage*)
idx = metaObject->indexOfMethod("createCtcpReply(IrcPrivateMessage*)");
QMetaMethod method = metaObject->method(idx);
method.invoke(q, Q_RETURN_ARG(IrcCommand*, reply), Q_ARG(IrcPrivateMessage*, request));
}
return reply;
}
#endif // IRC_DOXYGEN
/*!
Constructs a new IRC connection with \a parent.
*/
IrcConnection::IrcConnection(QObject* parent) : QObject(parent), d_ptr(new IrcConnectionPrivate)
{
Q_D(IrcConnection);
d->init(this);
}
/*!
Constructs a new IRC connection with \a host and \a parent.
*/
IrcConnection::IrcConnection(const QString& host, QObject* parent) : QObject(parent), d_ptr(new IrcConnectionPrivate)
{
Q_D(IrcConnection);
d->init(this);
setHost(host);
}
/*!
Destructs the IRC connection.
*/
IrcConnection::~IrcConnection()
{
close();
emit destroyed(this);
}
/*!
\since 3.4
Clones the IRC connection.
*/
IrcConnection* IrcConnection::clone(QObject *parent) const
{
IrcConnection* connection = new IrcConnection(parent);
connection->setHost(host());
connection->setPort(port());
connection->setServers(servers());
connection->setUserName(userName());
connection->setNickName(nickName());
connection->setRealName(realName());
connection->setPassword(password());
connection->setNickNames(nickNames());
connection->setDisplayName(displayName());
connection->setUserData(userData());
connection->setEncoding(encoding());
connection->setEnabled(isEnabled());
connection->setReconnectDelay(reconnectDelay());
connection->setSecure(isSecure());
connection->setSaslMechanism(saslMechanism());
return connection;
}
/*!
This property holds the FALLBACK encoding for received messages.
The fallback encoding is used when the message is detected not
to be valid \c UTF-8 and the consequent auto-detection of message
encoding fails. See QTextCodec::availableCodecs() for the list of
supported encodings.
The default value is \c ISO-8859-15.
\par Access functions:
\li QByteArray <b>encoding</b>() const
\li void <b>setEncoding</b>(const QByteArray& encoding)
\sa QTextCodec::availableCodecs(), QTextCodec::codecForLocale()
*/
QByteArray IrcConnection::encoding() const
{
Q_D(const IrcConnection);
return d->encoding;
}
void IrcConnection::setEncoding(const QByteArray& encoding)
{
Q_D(IrcConnection);
extern bool irc_is_supported_encoding(const QByteArray& encoding); // ircmessagedecoder.cpp
if (!irc_is_supported_encoding(encoding)) {
qWarning() << "IrcConnection::setEncoding(): unsupported encoding" << encoding;
return;
}
d->encoding = encoding;
}
/*!
This property holds the server host.
\par Access functions:
\li QString <b>host</b>() const
\li void <b>setHost</b>(const QString& host)
\par Notifier signal:
\li void <b>hostChanged</b>(const QString& host)
*/
QString IrcConnection::host() const
{
Q_D(const IrcConnection);
return d->host;
}
void IrcConnection::setHost(const QString& host)
{
Q_D(IrcConnection);
if (d->host != host) {
if (isActive())
qWarning("IrcConnection::setHost() has no effect until re-connect");
const QString oldName = displayName();
d->host = host;
emit hostChanged(host);
const QString newName = displayName();
if (oldName != newName)
emit displayNameChanged(newName);
}
}
/*!
This property holds the server port.
The default value is \c 6667.
\par Access functions:
\li int <b>port</b>() const
\li void <b>setPort</b>(int port)
\par Notifier signal:
\li void <b>portChanged</b>(int port)
*/
int IrcConnection::port() const
{
Q_D(const IrcConnection);
return d->port;
}
void IrcConnection::setPort(int port)
{
Q_D(IrcConnection);
if (d->port != port) {
if (isActive())
qWarning("IrcConnection::setPort() has no effect until re-connect");
d->port = port;
emit portChanged(port);
}
}
/*!
\since 3.3
This property holds the list of servers.
The list of servers is automatically cycled through when reconnecting.
\par Access functions:
\li QStringList <b>servers</b>() const
\li void <b>setServers</b>(const QStringList& servers)
\par Notifier signal:
\li void <b>serversChanged</b>(const QStringList& servers)
\sa isValidServer()
*/
QStringList IrcConnection::servers() const
{
Q_D(const IrcConnection);
return d->servers;
}
void IrcConnection::setServers(const QStringList& servers)
{
Q_D(IrcConnection);
if (d->servers != servers) {
d->servers = servers;
emit serversChanged(servers);
}
}
/*!
\since 3.3
Returns \c true if the server line syntax is valid.
The syntax is:
\code
host <[+]port>
\endcode
where port is optional (defaults to \c 6667) and \c + prefix denotes SSL.
\sa servers
*/
bool IrcConnection::isValidServer(const QString& server)
{
QString h; int p; bool s;
return parseServer(server, &h, &p, &s);
}
/*!
This property holds the user name.
\note Changing the user name has no effect until the connection is re-established.
\par Access functions:
\li QString <b>userName</b>() const
\li void <b>setUserName</b>(const QString& name)
\par Notifier signal:
\li void <b>userNameChanged</b>(const QString& name)
*/
QString IrcConnection::userName() const
{
Q_D(const IrcConnection);
return d->userName;
}
void IrcConnection::setUserName(const QString& name)
{
Q_D(IrcConnection);
QString user = name.split(" ", QString::SkipEmptyParts).value(0).trimmed();
if (d->userName != user) {
if (isActive())
qWarning("IrcConnection::setUserName() has no effect until re-connect");
d->userName = user;
emit userNameChanged(user);
}
}
/*!
This property holds the current nick name.
\par Access functions:
\li QString <b>nickName</b>() const
\li void <b>setNickName</b>(const QString& name)
\par Notifier signal:
\li void <b>nickNameChanged</b>(const QString& name)
\sa nickNames
*/
QString IrcConnection::nickName() const
{
Q_D(const IrcConnection);
return d->nickName;
}
void IrcConnection::setNickName(const QString& name)
{
Q_D(IrcConnection);
QString nick = name.split(" ", QString::SkipEmptyParts).value(0).trimmed();
if (d->nickName != nick) {
if (isActive())
sendCommand(IrcCommand::createNick(nick));
else
d->setNick(nick);
}
}
/*!
This property holds the real name.
\note Changing the real name has no effect until the connection is re-established.
\par Access functions:
\li QString <b>realName</b>() const
\li void <b>setRealName</b>(const QString& name)
\par Notifier signal:
\li void <b>realNameChanged</b>(const QString& name)
*/
QString IrcConnection::realName() const
{
Q_D(const IrcConnection);
return d->realName;
}
void IrcConnection::setRealName(const QString& name)
{
Q_D(IrcConnection);
if (d->realName != name) {
if (isActive())
qWarning("IrcConnection::setRealName() has no effect until re-connect");
d->realName = name;
emit realNameChanged(name);
}
}
/*!
This property holds the password.
\par Access functions:
\li QString <b>password</b>() const
\li void <b>setPassword</b>(const QString& password)
\par Notifier signal:
\li void <b>passwordChanged</b>(const QString& password)
*/
QString IrcConnection::password() const
{
Q_D(const IrcConnection);
return d->password;
}
void IrcConnection::setPassword(const QString& password)
{
Q_D(IrcConnection);
if (d->password != password) {
if (isActive())
qWarning("IrcConnection::setPassword() has no effect until re-connect");
d->password = password;
emit passwordChanged(password);
}
}
/*!
\since 3.3
This property holds the nick names.
The list of nick names is automatically cycled through when the
current nick name is reserved. If all provided nick names are
reserved, the nickNameRequired() signal is emitted.
\par Access functions:
\li QStringList <b>nickNames</b>() const
\li void <b>setNickNames</b>(const QStringList& names)
\par Notifier signal:
\li void <b>nickNamesChanged</b>(const QStringList& names)
\sa nickName, nickNameRequired()
*/
QStringList IrcConnection::nickNames() const
{
Q_D(const IrcConnection);
return d->nickNames;
}
void IrcConnection::setNickNames(const QStringList& names)
{
Q_D(IrcConnection);
if (d->nickNames != names) {
d->nickNames = names;
emit nickNamesChanged(names);
}
}
/*!
This property holds the display name.
Unless explicitly set, display name resolves to IrcNetwork::name
or IrcConnection::host while the former is not known.
\par Access functions:
\li QString <b>displayName</b>() const
\li void <b>setDisplayName</b>(const QString& name)
\par Notifier signal:
\li void <b>displayNameChanged</b>(const QString& name)
*/
QString IrcConnection::displayName() const
{
Q_D(const IrcConnection);
QString name = d->displayName;
if (name.isEmpty())
name = d->network->name();
if (name.isEmpty())
name = d->host;
return name;
}
void IrcConnection::setDisplayName(const QString& name)
{
Q_D(IrcConnection);
if (d->displayName != name) {
d->displayName = name;
emit displayNameChanged(name);
}
}
/*!
\since 3.1
This property holds arbitrary user data.
\par Access functions:
\li QVariantMap <b>userData</b>() const
\li void <b>setUserData</b>(const QVariantMap& data)
\par Notifier signal:
\li void <b>userDataChanged</b>(const QVariantMap& data)
*/
QVariantMap IrcConnection::userData() const
{
Q_D(const IrcConnection);
return d->userData;
}
void IrcConnection::setUserData(const QVariantMap& data)
{
Q_D(IrcConnection);
if (d->userData != data) {
d->userData = data;
emit userDataChanged(data);
}
}
/*!
\property Status IrcConnection::status
This property holds the connection status.
\par Access function:
\li Status <b>status</b>() const
\par Notifier signal:
\li void <b>statusChanged</b>(Status status)
*/
IrcConnection::Status IrcConnection::status() const
{
Q_D(const IrcConnection);
return d->status;
}
/*!
\property bool IrcConnection::active
This property holds whether the connection is active.
The connection is considered active when its either connecting, connected or closing.
\par Access function:
\li bool <b>isActive</b>() const
*/
bool IrcConnection::isActive() const
{
Q_D(const IrcConnection);
return d->status == Connecting || d->status == Connected || d->status == Closing;
}
/*!
\property bool IrcConnection::connected
This property holds whether the connection has been established.
The connection has been established when the welcome message
has been received and the server is ready to receive commands.
\sa Irc::RPL_WELCOME
\par Access function:
\li bool <b>isConnected</b>() const
\par Notifier signal:
\li void <b>connected</b>()
*/
bool IrcConnection::isConnected() const
{
Q_D(const IrcConnection);
return d->status == Connected;
}
/*!
\property bool IrcConnection::enabled
This property holds whether the connection is enabled.
The default value is \c true.
When set to \c false, a disabled connection does nothing when open() is called.
\par Access functions:
\li bool <b>isEnabled</b>() const
\li void <b>setEnabled</b>(bool enabled) [slot]
\li void <b>setDisabled</b>(bool disabled) [slot]
\par Notifier signal:
\li void <b>enabledChanged</b>(bool enabled)
*/
bool IrcConnection::isEnabled() const
{
Q_D(const IrcConnection);
return d->enabled;
}
void IrcConnection::setEnabled(bool enabled)
{
Q_D(IrcConnection);
if (d->enabled != enabled) {
d->enabled = enabled;
emit enabledChanged(enabled);
}
}
void IrcConnection::setDisabled(bool disabled)
{
setEnabled(!disabled);
}
/*!
\property int IrcConnection::reconnectDelay
This property holds the reconnect delay in seconds.
A positive (greater than zero) value enables automatic reconnect.
When the connection is lost due to a socket error, IrcConnection
will automatically attempt to reconnect after the specified delay.
The default value is \c 0 (automatic reconnect disabled).
\par Access functions:
\li int <b>reconnectDelay</b>() const
\li void <b>setReconnectDelay</b>(int seconds)
\par Notifier signal:
\li void <b>reconnectDelayChanged</b>(int seconds)
*/
int IrcConnection::reconnectDelay() const
{
Q_D(const IrcConnection);
return d->reconnecter.interval() / 1000;
}
void IrcConnection::setReconnectDelay(int seconds)
{
Q_D(IrcConnection);
const int interval = qMax(0, seconds) * 1000;
if (d->reconnecter.interval() != interval) {
d->reconnecter.setInterval(interval);
emit reconnectDelayChanged(interval);
}
}
/*!
This property holds the socket. The default value is an instance of QTcpSocket.
The previously set socket is deleted if its parent is \c this.
\note IrcConnection supports QSslSocket in the way that it automatically
calls QSslSocket::startClientEncryption() while connecting.
\par Access functions:
\li \ref QAbstractSocket* <b>socket</b>() const
\li void <b>setSocket</b>(\ref QAbstractSocket* socket)
\sa IrcConnection::secure
*/
QAbstractSocket* IrcConnection::socket() const
{
Q_D(const IrcConnection);
return d->socket;
}
void IrcConnection::setSocket(QAbstractSocket* socket)
{
Q_D(IrcConnection);
if (d->socket != socket) {
if (d->socket) {
d->socket->disconnect(this);
if (d->socket->parent() == this)
d->socket->deleteLater();
}
d->socket = socket;
if (socket) {
connect(socket, SIGNAL(connected()), this, SLOT(_irc_connected()));
connect(socket, SIGNAL(disconnected()), this, SLOT(_irc_disconnected()));
connect(socket, SIGNAL(readyRead()), this, SLOT(_irc_readData()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_irc_error(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(_irc_state(QAbstractSocket::SocketState)));
if (isSecure())
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_irc_sslErrors()));
}
}
}
/*!
\property bool IrcConnection::secure
This property holds whether the socket is an SSL socket.
This property is provided for convenience. Calling
\code
connection->setSecure(true);
\endcode
is equivalent to:
\code
QSslSocket* socket = new QSslSocket(socket);
socket->setPeerVerifyMode(QSslSocket::QueryPeer);
connection->setSocket(socket);
\endcode
\note IrcConnection does not handle SSL errors, see
QSslSocket::sslErrors() for more details on the subject.
\par Access functions:
\li bool <b>isSecure</b>() const
\li void <b>setSecure</b>(bool secure)
\par Notifier signal:
\li void <b>secureChanged</b>(bool secure)
\sa secureSupported, IrcConnection::socket
*/
bool IrcConnection::isSecure() const
{
#ifdef QT_NO_SSL
return false;
#else
return qobject_cast<QSslSocket*>(socket());
#endif // QT_NO_SSL
}
void IrcConnection::setSecure(bool secure)
{
#ifdef QT_NO_SSL
if (secure) {
qWarning("IrcConnection::setSecure(): the Qt build does not support SSL");
return;
}
#else
if (secure && !QSslSocket::supportsSsl()) {
qWarning("IrcConnection::setSecure(): the platform does not support SSL - try installing OpenSSL");
return;
}
QSslSocket* sslSocket = qobject_cast<QSslSocket*>(socket());
if (secure && !sslSocket) {
sslSocket = new QSslSocket(this);
sslSocket->setPeerVerifyMode(QSslSocket::QueryPeer);
setSocket(sslSocket);
emit secureChanged(true);
} else if (!secure && sslSocket) {
setSocket(new QTcpSocket(this));
emit secureChanged(false);
}
#endif // !QT_NO_SSL
}
/*!
\deprecated Use Irc::isSecureSupported() instead.
*/
bool IrcConnection::isSecureSupported()
{
return Irc::isSecureSupported();
}
/*!
This property holds the used SASL (Simple Authentication and Security Layer) mechanism.
\par Access functions:
\li QString <b>saslMechanism</b>() const
\li void <b>setSaslMechanism</b>(const QString& mechanism)
\par Notifier signal:
\li void <b>saslMechanismChanged</b>(const QString& mechanism)
\sa supportedSaslMechanisms, \ref ircv3
*/
QString IrcConnection::saslMechanism() const
{
Q_D(const IrcConnection);
return d->saslMechanism;
}
void IrcConnection::setSaslMechanism(const QString& mechanism)
{
Q_D(IrcConnection);
if (!mechanism.isEmpty() && !supportedSaslMechanisms().contains(mechanism.toUpper())) {
qWarning("IrcConnection::setSaslMechanism(): unsupported mechanism: '%s'", qPrintable(mechanism));
return;
}
if (d->saslMechanism != mechanism) {
if (isActive())
qWarning("IrcConnection::setSaslMechanism() has no effect until re-connect");
d->saslMechanism = mechanism.toUpper();
emit saslMechanismChanged(mechanism);
}
}
/*!
\deprecated Use Irc::supportedSaslMechanisms() instead.
*/
QStringList IrcConnection::supportedSaslMechanisms()
{
return Irc::supportedSaslMechanisms();
}
/*!
\since 3.5
This property holds CTCP (client to client protocol) replies.
This is a convenient request-reply map for customized static
CTCP replies. For dynamic replies, override createCtcpReply()
instead.
\note Set an empty reply to omit the automatic reply.
\par Access functions:
\li QVariantMap <b>ctcpReplies</b>() const
\li void <b>setCtcpReplies</b>(const QVariantMap& replies)
\par Notifier signal:
\li void <b>ctcpRepliesChanged</b>(const QVariantMap& replies)
\sa createCtcpReply()
*/
QVariantMap IrcConnection::ctcpReplies() const
{
Q_D(const IrcConnection);
return d->ctcpReplies;
}
void IrcConnection::setCtcpReplies(const QVariantMap& replies)
{
Q_D(IrcConnection);
if (d->ctcpReplies != replies) {
d->ctcpReplies = replies;
emit ctcpRepliesChanged(replies);
}
}
/*!
This property holds the network information.
\par Access function:
\li IrcNetwork* <b>network</b>() const
*/
IrcNetwork* IrcConnection::network() const
{
Q_D(const IrcConnection);
return d->network;
}
/*!
Opens a connection to the server.
The function does nothing when the connection is already \ref active
or explicitly \ref enabled "disabled".
\note The function merely outputs a warnings and returns immediately if
either \ref host, \ref userName, \ref nickName or \ref realName is empty.
*/
void IrcConnection::open()
{
Q_D(IrcConnection);
if (d->host.isEmpty() && d->servers.isEmpty()) {
qWarning("IrcConnection::open(): host is empty!");
return;
}
if (d->userName.isEmpty()) {
qWarning("IrcConnection::open(): userName is empty!");
return;
}
if (d->nickName.isEmpty() && d->nickNames.isEmpty()) {
qWarning("IrcConnection::open(): nickNames is empty!");
return;
}
if (d->realName.isEmpty()) {
qWarning("IrcConnection::open(): realName is empty!");
return;
}
if (d->enabled && d->socket)
d->open();
}
/*!
Immediately closes the connection to the server.
Calling close() makes the connection close immediately and thus might lead to
"remote host closed the connection". In order to quit gracefully, call quit()
first. This function attempts to flush the underlying socket, but this does
not guarantee that the server ever receives the QUIT command if the connection
is closed immediately after sending the command. In order to ensure a graceful
quit, let the server handle closing the connection.
C++ example:
\code
connection->quit(reason);
QTimer::singleShot(timeout, connection, SLOT(deleteLater()));
\endcode
QML example:
\code
connection.quit(reason);
connection.destroy(timeout);
\endcode
\sa quit()
*/
void IrcConnection::close()
{
Q_D(IrcConnection);
if (d->socket) {
d->closed = true;
d->pendingOpen = false;
d->socket->flush();
d->socket->abort();
d->socket->disconnectFromHost();
if (d->socket->state() == QAbstractSocket::UnconnectedState)
d->setStatus(Closed);
d->reconnecter.stop();
}
}
/*!
Sends a quit command with an optionally specified \a reason.
This method is provided for convenience. It is equal to:
\code
if (connection->isActive())
connection->sendCommand(IrcCommand::createQuit(reason));
\endcode
\sa IrcCommand::createQuit()
*/
void IrcConnection::quit(const QString& reason)
{
if (isConnected())
sendCommand(IrcCommand::createQuit(reason));
else
close();
}
/*!
Sends a \a command to the server.
If the connection is not active, the \a command is queued and sent
later when the connection has been established.
\note If the command has a valid parent, it is an indication that
the caller of this method is be responsible for freeing the command.
If the command does not have a valid parent (like the commands
created via various IrcCommand::createXxx() methods) the connection
will take ownership of the command and delete it once it has been
sent. Thus, the command must have been allocated on the heap and
it is not safe to access the command after it has been sent.
\sa sendData()
*/
bool IrcConnection::sendCommand(IrcCommand* command)
{
Q_D(IrcConnection);
bool res = false;
if (command) {
bool filtered = false;
IrcCommandPrivate::get(command)->connection = this;
for (int i = d->commandFilters.count() - 1; !filtered && i >= 0; --i) {
QObject* filter = d->commandFilters.at(i);
IrcCommandFilter* commandFilter = qobject_cast<IrcCommandFilter*>(filter);
if (commandFilter && !d->activeCommandFilters.contains(filter)) {
d->activeCommandFilters.push(filter);
filtered |= commandFilter->commandFilter(command);
d->activeCommandFilters.pop();
}
}
if (filtered) {
res = false;
} else {
QTextCodec* codec = QTextCodec::codecForName(command->encoding());
Q_ASSERT(codec);
res = sendData(codec->fromUnicode(command->toString()));
}
if (!command->parent())
command->deleteLater();
}
return res;
}
/*!
Sends raw \a data to the server.
\sa sendCommand()
*/
bool IrcConnection::sendData(const QByteArray& data)
{
Q_D(IrcConnection);
if (d->socket) {
if (isActive()) {
const QByteArray cmd = data.left(5).toUpper();
if (cmd.startsWith("PASS "))
ircDebug(this, IrcDebug::Write) << data.left(5) + QByteArray(data.mid(5).length(), 'x');
else
ircDebug(this, IrcDebug::Write) << data;
if (!d->closed && data.length() >= 4) {
if (cmd.startsWith("QUIT") && (data.length() == 4 || QChar(data.at(4)).isSpace()))
d->closed = true;
}
return d->protocol->write(data);
} else {
d->pendingData += data;
}
}
return false;
}
/*!
Sends raw \a message to the server using UTF-8 encoding.
\sa sendData(), sendCommand()
*/
bool IrcConnection::sendRaw(const QString& message)
{
return sendData(message.toUtf8());
}
/*!
Installs a message \a filter on the connection. The \a filter must implement the IrcMessageFilter interface.
A message filter receives all messages that are sent to the connection. The filter
receives messages via the \ref IrcMessageFilter::messageFilter() "messageFilter()"
function. The function must return \c true if the message should be filtered,
(i.e. stopped); otherwise it must return \c false.
If multiple message filters are installed on the same connection, the filter
that was installed last is activated first.
\sa removeMessageFilter()
*/
void IrcConnection::installMessageFilter(QObject* filter)
{
Q_D(IrcConnection);
IrcMessageFilter* msgFilter = qobject_cast<IrcMessageFilter*>(filter);
if (msgFilter) {
d->messageFilters += filter;
connect(filter, SIGNAL(destroyed(QObject*)), this, SLOT(_irc_filterDestroyed(QObject*)), Qt::UniqueConnection);
}
}
/*!
Removes a message \a filter from the connection.
The request is ignored if such message filter has not been installed.
All message filters for a connection are automatically removed
when the connection is destroyed.
\sa installMessageFilter()
*/
void IrcConnection::removeMessageFilter(QObject* filter)
{
Q_D(IrcConnection);
IrcMessageFilter* msgFilter = qobject_cast<IrcMessageFilter*>(filter);
if (msgFilter) {
d->messageFilters.removeAll(filter);
disconnect(filter, SIGNAL(destroyed(QObject*)), this, SLOT(_irc_filterDestroyed(QObject*)));
}
}
/*!
Installs a command \a filter on the connection. The \a filter must implement the IrcCommandFilter interface.
A command filter receives all commands that are sent from the connection. The filter
receives commands via the \ref IrcCommandFilter::commandFilter() "commandFilter()"
function. The function must return \c true if the command should be filtered,
(i.e. stopped); otherwise it must return \c false.
If multiple command filters are installed on the same connection, the filter
that was installed last is activated first.
\sa removeCommandFilter()
*/
void IrcConnection::installCommandFilter(QObject* filter)
{
Q_D(IrcConnection);
IrcCommandFilter* cmdFilter = qobject_cast<IrcCommandFilter*>(filter);
if (cmdFilter) {
d->commandFilters += filter;
connect(filter, SIGNAL(destroyed(QObject*)), this, SLOT(_irc_filterDestroyed(QObject*)), Qt::UniqueConnection);
}
}
/*!
Removes a command \a filter from the connection.
The request is ignored if such command filter has not been installed.
All command filters for a connection are automatically removed when
the connection is destroyed.
\sa installCommandFilter()
*/
void IrcConnection::removeCommandFilter(QObject* filter)
{
Q_D(IrcConnection);
IrcCommandFilter* cmdFilter = qobject_cast<IrcCommandFilter*>(filter);
if (cmdFilter) {
d->commandFilters.removeAll(filter);
disconnect(filter, SIGNAL(destroyed(QObject*)), this, SLOT(_irc_filterDestroyed(QObject*)));
}
}
/*!
\since 3.1
Saves the state of the connection. The \a version number is stored as part of the state data.
To restore the saved state, pass the return value and \a version number to restoreState().
*/
QByteArray IrcConnection::saveState(int version) const
{
Q_D(const IrcConnection);
QVariantMap args;
args.insert("version", version);
args.insert("host", d->host);
args.insert("port", d->port);
args.insert("servers", d->servers);
args.insert("userName", d->userName);
args.insert("nickName", d->nickName);
args.insert("realName", d->realName);
args.insert("password", d->password);
args.insert("nickNames", d->nickNames);
args.insert("displayName", displayName());
args.insert("userData", d->userData);
args.insert("encoding", d->encoding);
args.insert("enabled", d->enabled);
args.insert("reconnectDelay", reconnectDelay());
args.insert("secure", isSecure());
args.insert("saslMechanism", d->saslMechanism);
QByteArray state;
QDataStream out(&state, QIODevice::WriteOnly);
out << args;
return state;
}
/*!
\since 3.1
Restores the \a state of the connection. The \a version number is compared with that stored in \a state.
If they do not match, the connection state is left unchanged, and this function returns \c false; otherwise,
the state is restored, and \c true is returned.
\sa saveState()
*/
bool IrcConnection::restoreState(const QByteArray& state, int version)
{
Q_D(IrcConnection);
if (isActive())
return false;
QVariantMap args;
QDataStream in(state);
in >> args;
if (in.status() != QDataStream::Ok || args.value("version", -1).toInt() != version)
return false;
setHost(args.value("host", d->host).toString());
setPort(args.value("port", d->port).toInt());
setServers(args.value("servers", d->servers).toStringList());
setUserName(args.value("userName", d->userName).toString());
setNickName(args.value("nickName", d->nickName).toString());
setRealName(args.value("realName", d->realName).toString());
setPassword(args.value("password", d->password).toString());
setNickNames(args.value("nickNames", d->nickNames).toStringList());
if (!d->nickNames.isEmpty() && d->nickNames.indexOf(d->nickName) != 0)
setNickName(d->nickNames.first());
setDisplayName(args.value("displayName").toString());
setUserData(args.value("userData", d->userData).toMap());
setEncoding(args.value("encoding", d->encoding).toByteArray());
setEnabled(args.value("enabled", d->enabled).toBool());
setReconnectDelay(args.value("reconnectDelay", reconnectDelay()).toInt());
setSecure(args.value("secure", isSecure()).toBool());
setSaslMechanism(args.value("saslMechanism", d->saslMechanism).toString());
return true;
}
/*!
Creates a reply command for the CTCP \a request.
The default implementation first checks whether the \ref ctcpReplies
property contains a user-supplied reply for the request. In case it
does, the reply is sent automatically. In case there is no user-supplied
reply, the default implementation handles the following CTCP requests:
CLIENTINFO, PING, SOURCE, TIME and VERSION.
Reimplement this function in order to alter or omit the default replies.
\sa ctcpReplies
*/
IrcCommand* IrcConnection::createCtcpReply(IrcPrivateMessage* request) const
{
Q_D(const IrcConnection);
QString reply;
QString type = request->content().split(" ", QString::SkipEmptyParts).value(0).toUpper();
if (d->ctcpReplies.contains(type))
reply = type + QLatin1String(" ") + d->ctcpReplies.value(type).toString();
else if (type == "PING")
reply = request->content();
else if (type == "TIME")
reply = QLatin1String("TIME ") + QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat);
else if (type == "VERSION")
reply = QLatin1String("VERSION Communi ") + Irc::version() + QLatin1String(" - https://communi.github.io");
else if (type == "SOURCE")
reply = QLatin1String("SOURCE https://communi.github.io");
else if (type == "CLIENTINFO")
reply = QLatin1String("CLIENTINFO PING SOURCE TIME VERSION");
if (!reply.isEmpty())
return IrcCommand::createCtcpReply(request->nick(), reply);
return 0;
}
/*!
\since 3.2
This property holds the protocol.
The previously set protocol is deleted if its parent is \c this.
\par Access functions:
\li \ref IrcProtocol* <b>protocol</b>() const
\li void <b>setProtocol</b>(\ref IrcProtocol* protocol)
*/
IrcProtocol* IrcConnection::protocol() const
{
Q_D(const IrcConnection);
return d->protocol;
}
void IrcConnection::setProtocol(IrcProtocol* proto)
{
Q_D(IrcConnection);
if (d->protocol != proto) {
if (d->protocol && d->protocol->parent() == this)
delete d->protocol;
d->protocol = proto;
}
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, IrcConnection::Status status)
{
const int index = IrcConnection::staticMetaObject.indexOfEnumerator("Status");
QMetaEnum enumerator = IrcConnection::staticMetaObject.enumerator(index);
const char* key = enumerator.valueToKey(status);
debug << (key ? key : "Unknown");
return debug;
}
QDebug operator<<(QDebug debug, const IrcConnection* connection)
{
if (!connection)
return debug << "IrcConnection(0x0) ";
debug.nospace() << connection->metaObject()->className() << '(' << (void*) connection;
if (!connection->displayName().isEmpty())
debug.nospace() << ", " << qPrintable(connection->displayName());
debug.nospace() << ')';
return debug.space();
}
#endif // QT_NO_DEBUG_STREAM
#include "moc_ircconnection.cpp"
IRC_END_NAMESPACE
| vitalyster/libcommuni-gbp | src/core/ircconnection.cpp | C++ | bsd-3-clause | 52,766 |
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
// template <class _Tp> using __is_inplace_type
#include <utility>
struct S {};
int main() {
using T = std::in_place_type_t<int>;
static_assert( std::__is_inplace_type<T>::value, "");
static_assert( std::__is_inplace_type<const T>::value, "");
static_assert( std::__is_inplace_type<const volatile T>::value, "");
static_assert( std::__is_inplace_type<T&>::value, "");
static_assert( std::__is_inplace_type<const T&>::value, "");
static_assert( std::__is_inplace_type<const volatile T&>::value, "");
static_assert( std::__is_inplace_type<T&&>::value, "");
static_assert( std::__is_inplace_type<const T&&>::value, "");
static_assert( std::__is_inplace_type<const volatile T&&>::value, "");
static_assert(!std::__is_inplace_type<std::in_place_index_t<0>>::value, "");
static_assert(!std::__is_inplace_type<std::in_place_t>::value, "");
static_assert(!std::__is_inplace_type<void>::value, "");
static_assert(!std::__is_inplace_type<int>::value, "");
static_assert(!std::__is_inplace_type<S>::value, "");
}
| youtube/cobalt | third_party/llvm-project/libcxx/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp | C++ | bsd-3-clause | 1,436 |
import { TSESTree } from '@typescript-eslint/types';
import { DefinitionType } from './DefinitionType';
import { DefinitionBase } from './DefinitionBase';
declare class VariableDefinition extends DefinitionBase<DefinitionType.Variable, TSESTree.VariableDeclarator, TSESTree.VariableDeclaration, TSESTree.Identifier> {
constructor(name: TSESTree.Identifier, node: VariableDefinition['node'], decl: TSESTree.VariableDeclaration);
readonly isTypeDefinition = false;
readonly isVariableDefinition = true;
}
export { VariableDefinition };
//# sourceMappingURL=VariableDefinition.d.ts.map | ChromeDevTools/devtools-frontend | node_modules/@typescript-eslint/scope-manager/dist/definition/VariableDefinition.d.ts | TypeScript | bsd-3-clause | 594 |
/*-----------------------------------------------------------------------------
Orderable plugin
-----------------------------------------------------------------------------*/
jQuery.fn.symphonyOrderable = function(custom_settings) {
var objects = this;
var settings = {
items: 'li',
handles: '*',
delay_initialize: false
};
jQuery.extend(settings, custom_settings);
/*-------------------------------------------------------------------------
Orderable
-------------------------------------------------------------------------*/
objects = objects.map(function() {
var object = this;
var state = null;
var start = function() {
state = {
item: jQuery(this).parents(settings.items),
min: null,
max: null,
delta: 0
};
jQuery(document).mousemove(change);
jQuery(document).mouseup(stop);
jQuery(document).mousemove();
return false;
};
var change = function(event) {
var item = state.item;
var target, next, top = event.pageY;
var a = item.height();
var b = item.offset().top;
var prev = item.prev();
state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity));
state.max = Math.max(a + b, b + (item.next().height() || Infinity));
if (!object.is('.ordering')) {
object.addClass('ordering');
item.addClass('ordering');
object.trigger('orderstart', [state.item]);
}
if (top < state.min) {
target = item.prev(settings.items);
while (true) {
state.delta--;
next = target.prev(settings.items);
if (next.length === 0 || top >= (state.min -= next.height())) {
item.insertBefore(target); break;
}
target = next;
}
}
else if (top > state.max) {
target = item.next(settings.items);
while (true) {
state.delta++;
next = target.next(settings.items);
if (next.length === 0 || top <= (state.max += next.height())) {
item.insertAfter(target); break;
}
target = next;
}
}
object.trigger('orderchange', [state.item]);
return false;
};
var stop = function() {
jQuery(document).unbind('mousemove', change);
jQuery(document).unbind('mouseup', stop);
if (state != null) {
object.removeClass('ordering');
state.item.removeClass('ordering');
object.trigger('orderstop', [state.item]);
state = null;
}
return false;
};
/*-------------------------------------------------------------------*/
if (object instanceof jQuery === false) {
object = jQuery(object);
}
object.orderable = {
cancel: function() {
jQuery(document).unbind('mousemove', change);
jQuery(document).unbind('mouseup', stop);
if (state != null) {
object.removeClass('ordering');
state.item.removeClass('ordering');
object.trigger('ordercancel', [state.item]);
state = null;
}
},
initialize: function() {
object.addClass('orderable');
object.find(settings.items).each(function() {
var item = jQuery(this);
var handle = item.find(settings.handles);
handle.unbind('mousedown', start);
handle.bind('mousedown', start);
});
}
};
if (settings.delay_initialize !== true) {
object.orderable.initialize();
}
return object;
});
return objects;
};
/*---------------------------------------------------------------------------*/
| bauhouse/sym-intranet | symphony/assets/symphony.orderable.js | JavaScript | mit | 3,588 |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Text;
namespace System.IO
{
// Provides methods for processing file system strings in a cross-platform manner.
// Most of the methods don't do a complete parsing (such as examining a UNC hostname),
// but they will handle most string operations.
public static partial class Path
{
// Public static readonly variant of the separators. The Path implementation itself is using
// internal const variant of the separators for better performance.
public static readonly char DirectorySeparatorChar = PathInternal.DirectorySeparatorChar;
public static readonly char AltDirectorySeparatorChar = PathInternal.AltDirectorySeparatorChar;
public static readonly char VolumeSeparatorChar = PathInternal.VolumeSeparatorChar;
public static readonly char PathSeparator = PathInternal.PathSeparator;
// For generating random file names
// 8 random bytes provides 12 chars in our encoding for the 8.3 name.
private const int KeyLength = 8;
[Obsolete("Please use GetInvalidPathChars or GetInvalidFileNameChars instead.")]
public static readonly char[] InvalidPathChars = GetInvalidPathChars();
// Changes the extension of a file path. The path parameter
// specifies a file path, and the extension parameter
// specifies a file extension (with a leading period, such as
// ".exe" or ".cs").
//
// The function returns a file path with the same root, directory, and base
// name parts as path, but with the file extension changed to
// the specified extension. If path is null, the function
// returns null. If path does not contain a file extension,
// the new file extension is appended to the path. If extension
// is null, any existing extension is removed from path.
public static string ChangeExtension(string path, string extension)
{
if (path != null)
{
PathInternal.CheckInvalidPathChars(path);
string s = path;
for (int i = path.Length - 1; i >= 0; i--)
{
char ch = path[i];
if (ch == '.')
{
s = path.Substring(0, i);
break;
}
if (PathInternal.IsDirectoryOrVolumeSeparator(ch)) break;
}
if (extension != null && path.Length != 0)
{
s = (extension.Length == 0 || extension[0] != '.') ?
s + "." + extension :
s + extension;
}
return s;
}
return null;
}
// Returns the directory path of a file path. This method effectively
// removes the last element of the given file path, i.e. it returns a
// string consisting of all characters up to but not including the last
// backslash ("\") in the file path. The returned value is null if the file
// path is null or if the file path denotes a root (such as "\", "C:", or
// "\\server\share").
public static string GetDirectoryName(string path)
{
if (path == null)
return null;
if (PathInternal.IsEffectivelyEmpty(path))
throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));
PathInternal.CheckInvalidPathChars(path);
path = PathInternal.NormalizeDirectorySeparators(path);
int root = PathInternal.GetRootLength(path);
int i = path.Length;
if (i > root)
{
while (i > root && !PathInternal.IsDirectorySeparator(path[--i])) ;
return path.Substring(0, i);
}
return null;
}
// Returns the extension of the given path. The returned value includes the
// period (".") character of the extension except when you have a terminal period when you get string.Empty, such as ".exe" or
// ".cpp". The returned value is null if the given path is
// null or if the given path does not include an extension.
public static string GetExtension(string path)
{
if (path == null)
return null;
PathInternal.CheckInvalidPathChars(path);
int length = path.Length;
for (int i = length - 1; i >= 0; i--)
{
char ch = path[i];
if (ch == '.')
{
if (i != length - 1)
return path.Substring(i, length - i);
else
return string.Empty;
}
if (PathInternal.IsDirectoryOrVolumeSeparator(ch))
break;
}
return string.Empty;
}
// Returns the name and extension parts of the given path. The resulting
// string contains the characters of path that follow the last
// separator in path. The resulting string is null if path is null.
public static string GetFileName(string path)
{
if (path == null)
return null;
int offset = PathInternal.FindFileNameIndex(path);
int count = path.Length - offset;
return path.Substring(offset, count);
}
public static string GetFileNameWithoutExtension(string path)
{
if (path == null)
return null;
int length = path.Length;
int offset = PathInternal.FindFileNameIndex(path);
int end = path.LastIndexOf('.', length - 1, length - offset);
return end == -1 ?
path.Substring(offset) : // No extension was found
path.Substring(offset, end - offset);
}
// Returns a cryptographically strong random 8.3 string that can be
// used as either a folder name or a file name.
public static unsafe string GetRandomFileName()
{
byte* pKey = stackalloc byte[KeyLength];
Interop.GetRandomBytes(pKey, KeyLength);
const int RandomFileNameLength = 12;
char* pRandomFileName = stackalloc char[RandomFileNameLength];
Populate83FileNameFromRandomBytes(pKey, KeyLength, pRandomFileName, RandomFileNameLength);
return new string(pRandomFileName, 0, RandomFileNameLength);
}
/// <summary>
/// Returns true if the path is fixed to a specific drive or UNC path. This method does no
/// validation of the path (URIs will be returned as relative as a result).
/// Returns false if the path specified is relative to the current drive or working directory.
/// </summary>
/// <remarks>
/// Handles paths that use the alternate directory separator. It is a frequent mistake to
/// assume that rooted paths <see cref="Path.IsPathRooted(string)"/> are not relative. This isn't the case.
/// "C:a" is drive relative- meaning that it will be resolved against the current directory
/// for C: (rooted, but relative). "C:\a" is rooted and not relative (the current directory
/// will not be used to modify the path).
/// </remarks>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="path"/> is null.
/// </exception>
public static bool IsPathFullyQualified(string path)
{
if (path == null)
{
throw new ArgumentNullException(nameof(path));
}
return !PathInternal.IsPartiallyQualified(path);
}
// Tests if a path includes a file extension. The result is
// true if the characters that follow the last directory
// separator ('\\' or '/') or volume separator (':') in the path include
// a period (".") other than a terminal period. The result is false otherwise.
public static bool HasExtension(string path)
{
if (path != null)
{
PathInternal.CheckInvalidPathChars(path);
for (int i = path.Length - 1; i >= 0; i--)
{
char ch = path[i];
if (ch == '.')
{
return i != path.Length - 1;
}
if (PathInternal.IsDirectoryOrVolumeSeparator(ch)) break;
}
}
return false;
}
public static string Combine(string path1, string path2)
{
if (path1 == null || path2 == null)
throw new ArgumentNullException((path1 == null) ? nameof(path1) : nameof(path2));
PathInternal.CheckInvalidPathChars(path1);
PathInternal.CheckInvalidPathChars(path2);
return CombineNoChecks(path1, path2);
}
public static string Combine(string path1, string path2, string path3)
{
if (path1 == null || path2 == null || path3 == null)
throw new ArgumentNullException((path1 == null) ? nameof(path1) : (path2 == null) ? nameof(path2) : nameof(path3));
PathInternal.CheckInvalidPathChars(path1);
PathInternal.CheckInvalidPathChars(path2);
PathInternal.CheckInvalidPathChars(path3);
return CombineNoChecks(path1, path2, path3);
}
public static string Combine(string path1, string path2, string path3, string path4)
{
if (path1 == null || path2 == null || path3 == null || path4 == null)
throw new ArgumentNullException((path1 == null) ? nameof(path1) : (path2 == null) ? nameof(path2) : (path3 == null) ? nameof(path3) : nameof(path4));
PathInternal.CheckInvalidPathChars(path1);
PathInternal.CheckInvalidPathChars(path2);
PathInternal.CheckInvalidPathChars(path3);
PathInternal.CheckInvalidPathChars(path4);
return CombineNoChecks(path1, path2, path3, path4);
}
public static string Combine(params string[] paths)
{
if (paths == null)
{
throw new ArgumentNullException(nameof(paths));
}
int finalSize = 0;
int firstComponent = 0;
// We have two passes, the first calculates how large a buffer to allocate and does some precondition
// checks on the paths passed in. The second actually does the combination.
for (int i = 0; i < paths.Length; i++)
{
if (paths[i] == null)
{
throw new ArgumentNullException(nameof(paths));
}
if (paths[i].Length == 0)
{
continue;
}
PathInternal.CheckInvalidPathChars(paths[i]);
if (IsPathRooted(paths[i]))
{
firstComponent = i;
finalSize = paths[i].Length;
}
else
{
finalSize += paths[i].Length;
}
char ch = paths[i][paths[i].Length - 1];
if (!PathInternal.IsDirectoryOrVolumeSeparator(ch))
finalSize++;
}
StringBuilder finalPath = StringBuilderCache.Acquire(finalSize);
for (int i = firstComponent; i < paths.Length; i++)
{
if (paths[i].Length == 0)
{
continue;
}
if (finalPath.Length == 0)
{
finalPath.Append(paths[i]);
}
else
{
char ch = finalPath[finalPath.Length - 1];
if (!PathInternal.IsDirectoryOrVolumeSeparator(ch))
{
finalPath.Append(PathInternal.DirectorySeparatorChar);
}
finalPath.Append(paths[i]);
}
}
return StringBuilderCache.GetStringAndRelease(finalPath);
}
private static string CombineNoChecks(string path1, string path2)
{
if (path2.Length == 0)
return path1;
if (path1.Length == 0)
return path2;
if (IsPathRooted(path2))
return path2;
char ch = path1[path1.Length - 1];
return PathInternal.IsDirectoryOrVolumeSeparator(ch) ?
path1 + path2 :
path1 + PathInternal.DirectorySeparatorCharAsString + path2;
}
private static string CombineNoChecks(string path1, string path2, string path3)
{
if (path1.Length == 0)
return CombineNoChecks(path2, path3);
if (path2.Length == 0)
return CombineNoChecks(path1, path3);
if (path3.Length == 0)
return CombineNoChecks(path1, path2);
if (IsPathRooted(path3))
return path3;
if (IsPathRooted(path2))
return CombineNoChecks(path2, path3);
bool hasSep1 = PathInternal.IsDirectoryOrVolumeSeparator(path1[path1.Length - 1]);
bool hasSep2 = PathInternal.IsDirectoryOrVolumeSeparator(path2[path2.Length - 1]);
if (hasSep1 && hasSep2)
{
return path1 + path2 + path3;
}
else if (hasSep1)
{
return path1 + path2 + PathInternal.DirectorySeparatorCharAsString + path3;
}
else if (hasSep2)
{
return path1 + PathInternal.DirectorySeparatorCharAsString + path2 + path3;
}
else
{
// string.Concat only has string-based overloads up to four arguments; after that requires allocating
// a params string[]. Instead, try to use a cached StringBuilder.
StringBuilder sb = StringBuilderCache.Acquire(path1.Length + path2.Length + path3.Length + 2);
sb.Append(path1)
.Append(PathInternal.DirectorySeparatorChar)
.Append(path2)
.Append(PathInternal.DirectorySeparatorChar)
.Append(path3);
return StringBuilderCache.GetStringAndRelease(sb);
}
}
private static string CombineNoChecks(string path1, string path2, string path3, string path4)
{
if (path1.Length == 0)
return CombineNoChecks(path2, path3, path4);
if (path2.Length == 0)
return CombineNoChecks(path1, path3, path4);
if (path3.Length == 0)
return CombineNoChecks(path1, path2, path4);
if (path4.Length == 0)
return CombineNoChecks(path1, path2, path3);
if (IsPathRooted(path4))
return path4;
if (IsPathRooted(path3))
return CombineNoChecks(path3, path4);
if (IsPathRooted(path2))
return CombineNoChecks(path2, path3, path4);
bool hasSep1 = PathInternal.IsDirectoryOrVolumeSeparator(path1[path1.Length - 1]);
bool hasSep2 = PathInternal.IsDirectoryOrVolumeSeparator(path2[path2.Length - 1]);
bool hasSep3 = PathInternal.IsDirectoryOrVolumeSeparator(path3[path3.Length - 1]);
if (hasSep1 && hasSep2 && hasSep3)
{
// Use string.Concat overload that takes four strings
return path1 + path2 + path3 + path4;
}
else
{
// string.Concat only has string-based overloads up to four arguments; after that requires allocating
// a params string[]. Instead, try to use a cached StringBuilder.
StringBuilder sb = StringBuilderCache.Acquire(path1.Length + path2.Length + path3.Length + path4.Length + 3);
sb.Append(path1);
if (!hasSep1)
{
sb.Append(PathInternal.DirectorySeparatorChar);
}
sb.Append(path2);
if (!hasSep2)
{
sb.Append(PathInternal.DirectorySeparatorChar);
}
sb.Append(path3);
if (!hasSep3)
{
sb.Append(PathInternal.DirectorySeparatorChar);
}
sb.Append(path4);
return StringBuilderCache.GetStringAndRelease(sb);
}
}
private static readonly char[] s_base32Char = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
'y', 'z', '0', '1', '2', '3', '4', '5'};
private static unsafe void Populate83FileNameFromRandomBytes(byte* bytes, int byteCount, char* chars, int charCount)
{
Debug.Assert(bytes != null);
Debug.Assert(chars != null);
// This method requires bytes of length 8 and chars of length 12.
Debug.Assert(byteCount == 8, $"Unexpected {nameof(byteCount)}");
Debug.Assert(charCount == 12, $"Unexpected {nameof(charCount)}");
byte b0 = bytes[0];
byte b1 = bytes[1];
byte b2 = bytes[2];
byte b3 = bytes[3];
byte b4 = bytes[4];
// Consume the 5 Least significant bits of the first 5 bytes
chars[0] = s_base32Char[b0 & 0x1F];
chars[1] = s_base32Char[b1 & 0x1F];
chars[2] = s_base32Char[b2 & 0x1F];
chars[3] = s_base32Char[b3 & 0x1F];
chars[4] = s_base32Char[b4 & 0x1F];
// Consume 3 MSB of b0, b1, MSB bits 6, 7 of b3, b4
chars[5] = s_base32Char[(
((b0 & 0xE0) >> 5) |
((b3 & 0x60) >> 2))];
chars[6] = s_base32Char[(
((b1 & 0xE0) >> 5) |
((b4 & 0x60) >> 2))];
// Consume 3 MSB bits of b2, 1 MSB bit of b3, b4
b2 >>= 5;
Debug.Assert(((b2 & 0xF8) == 0), "Unexpected set bits");
if ((b3 & 0x80) != 0)
b2 |= 0x08;
if ((b4 & 0x80) != 0)
b2 |= 0x10;
chars[7] = s_base32Char[b2];
// Set the file extension separator
chars[8] = '.';
// Consume the 5 Least significant bits of the remaining 3 bytes
chars[9] = s_base32Char[(bytes[5] & 0x1F)];
chars[10] = s_base32Char[(bytes[6] & 0x1F)];
chars[11] = s_base32Char[(bytes[7] & 0x1F)];
}
/// <summary>
/// Create a relative path from one path to another. Paths will be resolved before calculating the difference.
/// Default path comparison for the active platform will be used (OrdinalIgnoreCase for Windows or Mac, Ordinal for Unix).
/// </summary>
/// <param name="relativeTo">The source path the output should be relative to. This path is always considered to be a directory.</param>
/// <param name="path">The destination path.</param>
/// <returns>The relative path or <paramref name="path"/> if the paths don't share the same root.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="relativeTo"/> or <paramref name="path"/> is <c>null</c> or an empty string.</exception>
public static string GetRelativePath(string relativeTo, string path)
{
return GetRelativePath(relativeTo, path, StringComparison);
}
private static string GetRelativePath(string relativeTo, string path, StringComparison comparisonType)
{
if (string.IsNullOrEmpty(relativeTo)) throw new ArgumentNullException(nameof(relativeTo));
if (PathInternal.IsEffectivelyEmpty(path)) throw new ArgumentNullException(nameof(path));
Debug.Assert(comparisonType == StringComparison.Ordinal || comparisonType == StringComparison.OrdinalIgnoreCase);
relativeTo = GetFullPath(relativeTo);
path = GetFullPath(path);
// Need to check if the roots are different- if they are we need to return the "to" path.
if (!PathInternal.AreRootsEqual(relativeTo, path, comparisonType))
return path;
int commonLength = PathInternal.GetCommonPathLength(relativeTo, path, ignoreCase: comparisonType == StringComparison.OrdinalIgnoreCase);
// If there is nothing in common they can't share the same root, return the "to" path as is.
if (commonLength == 0)
return path;
// Trailing separators aren't significant for comparison
int relativeToLength = relativeTo.Length;
if (PathInternal.EndsInDirectorySeparator(relativeTo))
relativeToLength--;
bool pathEndsInSeparator = PathInternal.EndsInDirectorySeparator(path);
int pathLength = path.Length;
if (pathEndsInSeparator)
pathLength--;
// If we have effectively the same path, return "."
if (relativeToLength == pathLength && commonLength >= relativeToLength) return ".";
// We have the same root, we need to calculate the difference now using the
// common Length and Segment count past the length.
//
// Some examples:
//
// C:\Foo C:\Bar L3, S1 -> ..\Bar
// C:\Foo C:\Foo\Bar L6, S0 -> Bar
// C:\Foo\Bar C:\Bar\Bar L3, S2 -> ..\..\Bar\Bar
// C:\Foo\Foo C:\Foo\Bar L7, S1 -> ..\Bar
StringBuilder sb = StringBuilderCache.Acquire(Math.Max(relativeTo.Length, path.Length));
// Add parent segments for segments past the common on the "from" path
if (commonLength < relativeToLength)
{
sb.Append(PathInternal.ParentDirectoryPrefix);
for (int i = commonLength; i < relativeToLength; i++)
{
if (PathInternal.IsDirectorySeparator(relativeTo[i]))
{
sb.Append(PathInternal.ParentDirectoryPrefix);
}
}
}
else if (PathInternal.IsDirectorySeparator(path[commonLength]))
{
// No parent segments and we need to eat the initial separator
// (C:\Foo C:\Foo\Bar case)
commonLength++;
}
// Now add the rest of the "to" path, adding back the trailing separator
int count = pathLength - commonLength;
if (pathEndsInSeparator)
count++;
sb.Append(path, commonLength, count);
return StringBuilderCache.GetStringAndRelease(sb);
}
// StringComparison and IsCaseSensitive are also available in PathInternal.CaseSensitivity but we are
// too low in System.Runtime.Extensions to use it (no FileStream, etc.)
/// <summary>Returns a comparison that can be used to compare file and directory names for equality.</summary>
internal static StringComparison StringComparison
{
get
{
return IsCaseSensitive ?
StringComparison.Ordinal :
StringComparison.OrdinalIgnoreCase;
}
}
}
}
| parjong/coreclr | src/mscorlib/shared/System/IO/Path.cs | C# | mit | 24,186 |
// wrapped by build app
define("d3/src/scale/ordinal", ["dojo","dijit","dojox"], function(dojo,dijit,dojox){
import "../arrays/map";
import "../arrays/range";
import "scale";
d3.scale.ordinal = function() {
return d3_scale_ordinal([], {t: "range", a: [[]]});
};
function d3_scale_ordinal(domain, ranger) {
var index,
range,
rangeBand;
function scale(x) {
return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];
}
function steps(start, step) {
return d3.range(domain.length).map(function(i) { return start + step * i; });
}
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = [];
index = new d3_Map;
var i = -1, n = x.length, xi;
while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
return scale[ranger.t].apply(scale, ranger.a);
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
rangeBand = 0;
ranger = {t: "range", a: arguments};
return scale;
};
scale.rangePoints = function(x, padding) {
if (arguments.length < 2) padding = 0;
var start = x[0],
stop = x[1],
step = domain.length < 2 ? (start = (start + stop) / 2, 0) : (stop - start) / (domain.length - 1 + padding);
range = steps(start + step * padding / 2, step);
rangeBand = 0;
ranger = {t: "rangePoints", a: arguments};
return scale;
};
scale.rangeRoundPoints = function(x, padding) {
if (arguments.length < 2) padding = 0;
var start = x[0],
stop = x[1],
step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), 0) : (stop - start) / (domain.length - 1 + padding) | 0; // bitwise floor for symmetry
range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step);
rangeBand = 0;
ranger = {t: "rangeRoundPoints", a: arguments};
return scale;
};
scale.rangeBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0],
start = x[reverse - 0],
stop = x[1 - reverse],
step = (stop - start) / (domain.length - padding + 2 * outerPadding);
range = steps(start + step * outerPadding, step);
if (reverse) range.reverse();
rangeBand = step * (1 - padding);
ranger = {t: "rangeBands", a: arguments};
return scale;
};
scale.rangeRoundBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0],
start = x[reverse - 0],
stop = x[1 - reverse],
step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding));
range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);
if (reverse) range.reverse();
rangeBand = Math.round(step * (1 - padding));
ranger = {t: "rangeRoundBands", a: arguments};
return scale;
};
scale.rangeBand = function() {
return rangeBand;
};
scale.rangeExtent = function() {
return d3_scaleExtent(ranger.a[0]);
};
scale.copy = function() {
return d3_scale_ordinal(domain, ranger);
};
return scale.domain(domain);
}
});
| hyoo/p3_web | public/js/release/d3/src/scale/ordinal.js | JavaScript | mit | 3,374 |
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
it 'is_strings arrays' do
pp = <<-EOS
$a = ['aaa.com','bbb','ccc']
$b = false
$o = is_string($a)
if $o == $b {
notify { 'output correct': }
}
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Notice: output correct/)
end
end
it 'is_strings true' do
pp = <<-EOS
$a = true
$b = false
$o = is_string($a)
if $o == $b {
notify { 'output correct': }
}
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Notice: output correct/)
end
end
it 'is_strings strings' do
pp = <<-EOS
$a = "aoeu"
$o = is_string($a)
notice(inline_template('is_string is <%= @o.inspect %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/is_string is true/)
end
end
it 'is_strings number strings' do
pp = <<-EOS
$a = "3"
$o = is_string($a)
notice(inline_template('is_string is <%= @o.inspect %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/is_string is false/)
end
end
it 'is_strings floats' do
pp = <<-EOS
$a = 3.5
$b = false
$o = is_string($a)
if $o == $b {
notify { 'output correct': }
}
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Notice: output correct/)
end
end
it 'is_strings integers' do
pp = <<-EOS
$a = 3
$b = false
$o = is_string($a)
if $o == $b {
notify { 'output correct': }
}
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Notice: output correct/)
end
end
it 'is_strings hashes' do
pp = <<-EOS
$a = {'aaa'=>'www.com'}
$b = false
$o = is_string($a)
if $o == $b {
notify { 'output correct': }
}
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Notice: output correct/)
end
end
it 'is_strings undef' do
pp = <<-EOS
$a = undef
$o = is_string($a)
notice(inline_template('is_string is <%= @o.inspect %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/is_string is true/)
end
end
end
describe 'failure' do
it 'handles improper argument counts'
end
end
| wikimedia/mediawiki-vagrant | puppet/modules/stdlib/spec/acceptance/is_string_spec.rb | Ruby | mit | 2,778 |
<?php
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\AdminBundle\Mapper;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Builder\BuilderInterface;
/**
* This class is used to simulate the Form API.
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
abstract class BaseMapper
{
/**
* @var AdminInterface
*/
protected $admin;
/**
* @var BuilderInterface
*/
protected $builder;
/**
* @param BuilderInterface $builder
* @param AdminInterface $admin
*/
public function __construct(BuilderInterface $builder, AdminInterface $admin)
{
$this->builder = $builder;
$this->admin = $admin;
}
/**
* @return AdminInterface
*/
public function getAdmin()
{
return $this->admin;
}
/**
* @param string $key
*
* @return mixed
*/
abstract public function get($key);
/**
* @param string $key
*
* @return bool
*/
abstract public function has($key);
/**
* @param string $key
*
* @return $this
*/
abstract public function remove($key);
// To be uncommented on 4.0.
/**
* Returns configured keys.
*
* @return string[]
*/
//abstract public function keys();
/**
* @param array $keys field names
*
* @return $this
*/
abstract public function reorder(array $keys);
}
| smatthias/tausendkind | vendor/sonata-project/admin-bundle/Mapper/BaseMapper.php | PHP | mit | 1,668 |
var ITEM_TPL_CONTENT_ANCHOR =
'<a class="item-content" ng-href="{{$href()}}" target="{{$target()}}"></a>';
var ITEM_TPL_CONTENT =
'<div class="item-content"></div>';
/**
* @ngdoc directive
* @name ionItem
* @parent ionic.directive:ionList
* @module ionic
* @restrict E
* Creates a list-item that can easily be swiped,
* deleted, reordered, edited, and more.
*
* See {@link ionic.directive:ionList} for a complete example & explanation.
*
* Can be assigned any item class name. See the
* [list CSS documentation](/docs/components/#list).
*
* @usage
*
* ```html
* <ion-list>
* <ion-item>Hello!</ion-item>
* </ion-list>
* ```
*/
IonicModule
.directive('ionItem', [
'$animate',
'$compile',
function($animate, $compile) {
return {
restrict: 'E',
controller: ['$scope', '$element', function($scope, $element) {
this.$scope = $scope;
this.$element = $element;
}],
scope: true,
compile: function($element, $attrs) {
var isAnchor = angular.isDefined($attrs.href) ||
angular.isDefined($attrs.ngHref) ||
angular.isDefined($attrs.uiSref);
var isComplexItem = isAnchor ||
//Lame way of testing, but we have to know at compile what to do with the element
/ion-(delete|option|reorder)-button/i.test($element.html());
if (isComplexItem) {
var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT);
innerElement.append($element.contents());
$element.append(innerElement);
$element.addClass('item item-complex');
} else {
$element.addClass('item');
}
return function link($scope, $element, $attrs) {
$scope.$href = function() {
return $attrs.href || $attrs.ngHref;
};
$scope.$target = function() {
return $attrs.target || '_self';
};
};
}
};
}]);
| frangucc/gamify | www/sandbox/pals/app/bower_components/ionic/js/angular/directive/item.js | JavaScript | mit | 1,904 |
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Core\Api;
/**
* Filters applicable on a resource.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
interface FilterInterface
{
/**
* Gets the description of this filter for the given resource.
*
* Returns an array with the filter parameter names as keys and array with the following data as values:
* - property: the property where the filter is applied
* - type: the type of the filter
* - required: if this filter is required
* - strategy (optional): the used strategy
* - is_collection (optional): is this filter is collection
* - swagger (optional): additional parameters for the path operation,
* e.g. 'swagger' => [
* 'description' => 'My Description',
* 'name' => 'My Name',
* 'type' => 'integer',
* ]
* - openapi (optional): additional parameters for the path operation in the version 3 spec,
* e.g. 'openapi' => [
* 'description' => 'My Description',
* 'name' => 'My Name',
* 'schema' => [
* 'type' => 'integer',
* ]
* ]
* The description can contain additional data specific to a filter.
*
* @see \ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer::getFiltersParameters
*/
public function getDescription(string $resourceClass): array;
}
| api-platform/core | src/Core/Api/FilterInterface.php | PHP | mit | 1,670 |
require 'spec_helper'
describe 'ossec' do
context 'with defaults for all parameters' do
it { should contain_class('ossec') }
end
end
| ndnurun/nextdeploy | vagrant/modules/ossec/spec/classes/init_spec.rb | Ruby | mit | 142 |
/*
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
* Copyright (c) 2014 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include <string>
#include <mraa/aio.hpp>
#include <mraa/gpio.hpp>
#include <mraa/spi.hpp>
#define HIGH 1
#define LOW 0
namespace upm {
/**
* @brief MAX5487 Digital Potentiometer library
* @defgroup max5487 libupm-max5487
* @ingroup maxim spi digipot
*/
/**
* @library max5487
* @sensor max5487
* @comname Digital Potentiometer
* @type digipot
* @man maxim
* @con spi
* @web https://www.maximintegrated.com/en/products/analog/data-converters/digital-potentiometers/MAX5487.html
*
* @brief API for the MAX5487 SPI Digital Potentiometer
*
* Maxim Integrated*
* [MAX5487](http://datasheets.maximintegrated.com/en/ds/MAX5487-MAX5489.pdf)
* is a dual, 256-tap, nonvolatile, SPI, linear-taper digital
* potentiometer. This module was tested on the Maxim Integrated [MAX5487PMB1
* PMOD module](http://datasheets.maximintegrated.com/en/ds/MAX5487PMB1.pdf)
* from the analog PMOD kit.
*
* @snippet max5487.cxx Interesting
*/
class MAX5487 {
public:
static const uint8_t R_WR_WIPER_A = 0x01;
static const uint8_t R_WR_WIPER_B = 0x02;
/**
* Instantiates an MAX5487 object
*
* @param csn CSN to use, if any; by default, ICSP CS (-1) is used
*/
MAX5487 (int csn = -1);
/**
* MAX5487 object destructor, closes all IO connections
* no more needed as the connections will be closed when
* m_spi and m_csnPinCtx will go out of scope
* ~MAX5487 ();
**/
/**
* Sets a wiper for port A.
*/
void setWiperA (uint8_t wiper);
/**
* Sets a wiper for port B.
*/
void setWiperB (uint8_t wiper);
/**
* Returns the name of the component
*/
std::string name()
{
return m_name;
}
private:
std::string m_name;
mraa::Spi m_spi;
mraa::Gpio m_csnPinCtx;
/**
* Sets the chip select pin to LOW
*/
mraa::Result CSOn ();
/**
* Sets the chip select pin to HIGH
*/
mraa::Result CSOff ();
};
}
| whbruce/upm | src/max5487/max5487.hpp | C++ | mit | 3,393 |
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\ThemeBundle\Context;
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
/**
* @author Kamil Kokot <kamil@kokot.me>
*/
interface ThemeContextInterface
{
/**
* Should not throw any exception if failed to get theme.
*
* @return ThemeInterface|null
*/
public function getTheme(): ?ThemeInterface;
}
| rainlike/justshop | vendor/sylius/sylius/src/Sylius/Bundle/ThemeBundle/Context/ThemeContextInterface.php | PHP | mit | 598 |
import * as React from 'react';
import { IconBaseProps } from 'react-icon-base';
export default class GoLightBulb extends React.Component<IconBaseProps, any> { }
| smrq/DefinitelyTyped | types/react-icons/go/light-bulb.d.ts | TypeScript | mit | 162 |
import glCore from 'pixi-gl-core';
import createIndicesForQuads from '../../core/utils/createIndicesForQuads';
/**
* @author Mat Groves
*
* Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/
* for creating the original pixi version!
* Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that
* they now share 4 bytes on the vertex buffer
*
* Heavily inspired by LibGDX's ParticleBuffer:
* https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java
*/
/**
* The particle buffer manages the static and dynamic buffers for a particle container.
*
* @class
* @private
* @memberof PIXI
*/
export default class ParticleBuffer
{
/**
* @param {WebGLRenderingContext} gl - The rendering context.
* @param {object} properties - The properties to upload.
* @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.
* @param {number} size - The size of the batch.
*/
constructor(gl, properties, dynamicPropertyFlags, size)
{
/**
* The current WebGL drawing context.
*
* @member {WebGLRenderingContext}
*/
this.gl = gl;
/**
* Size of a single vertex.
*
* @member {number}
*/
this.vertSize = 2;
/**
* Size of a single vertex in bytes.
*
* @member {number}
*/
this.vertByteSize = this.vertSize * 4;
/**
* The number of particles the buffer can hold
*
* @member {number}
*/
this.size = size;
/**
* A list of the properties that are dynamic.
*
* @member {object[]}
*/
this.dynamicProperties = [];
/**
* A list of the properties that are static.
*
* @member {object[]}
*/
this.staticProperties = [];
for (let i = 0; i < properties.length; ++i)
{
let property = properties[i];
// Make copy of properties object so that when we edit the offset it doesn't
// change all other instances of the object literal
property = {
attribute: property.attribute,
size: property.size,
uploadFunction: property.uploadFunction,
offset: property.offset,
};
if (dynamicPropertyFlags[i])
{
this.dynamicProperties.push(property);
}
else
{
this.staticProperties.push(property);
}
}
this.staticStride = 0;
this.staticBuffer = null;
this.staticData = null;
this.dynamicStride = 0;
this.dynamicBuffer = null;
this.dynamicData = null;
this.initBuffers();
}
/**
* Sets up the renderer context and necessary buffers.
*
* @private
*/
initBuffers()
{
const gl = this.gl;
let dynamicOffset = 0;
/**
* Holds the indices of the geometry (quads) to draw
*
* @member {Uint16Array}
*/
this.indices = createIndicesForQuads(this.size);
this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);
this.dynamicStride = 0;
for (let i = 0; i < this.dynamicProperties.length; ++i)
{
const property = this.dynamicProperties[i];
property.offset = dynamicOffset;
dynamicOffset += property.size;
this.dynamicStride += property.size;
}
this.dynamicData = new Float32Array(this.size * this.dynamicStride * 4);
this.dynamicBuffer = glCore.GLBuffer.createVertexBuffer(gl, this.dynamicData, gl.STREAM_DRAW);
// static //
let staticOffset = 0;
this.staticStride = 0;
for (let i = 0; i < this.staticProperties.length; ++i)
{
const property = this.staticProperties[i];
property.offset = staticOffset;
staticOffset += property.size;
this.staticStride += property.size;
}
this.staticData = new Float32Array(this.size * this.staticStride * 4);
this.staticBuffer = glCore.GLBuffer.createVertexBuffer(gl, this.staticData, gl.STATIC_DRAW);
this.vao = new glCore.VertexArrayObject(gl)
.addIndex(this.indexBuffer);
for (let i = 0; i < this.dynamicProperties.length; ++i)
{
const property = this.dynamicProperties[i];
this.vao.addAttribute(
this.dynamicBuffer,
property.attribute,
gl.FLOAT,
false,
this.dynamicStride * 4,
property.offset * 4
);
}
for (let i = 0; i < this.staticProperties.length; ++i)
{
const property = this.staticProperties[i];
this.vao.addAttribute(
this.staticBuffer,
property.attribute,
gl.FLOAT,
false,
this.staticStride * 4,
property.offset * 4
);
}
}
/**
* Uploads the dynamic properties.
*
* @param {PIXI.DisplayObject[]} children - The children to upload.
* @param {number} startIndex - The index to start at.
* @param {number} amount - The number to upload.
*/
uploadDynamic(children, startIndex, amount)
{
for (let i = 0; i < this.dynamicProperties.length; i++)
{
const property = this.dynamicProperties[i];
property.uploadFunction(children, startIndex, amount, this.dynamicData, this.dynamicStride, property.offset);
}
this.dynamicBuffer.upload();
}
/**
* Uploads the static properties.
*
* @param {PIXI.DisplayObject[]} children - The children to upload.
* @param {number} startIndex - The index to start at.
* @param {number} amount - The number to upload.
*/
uploadStatic(children, startIndex, amount)
{
for (let i = 0; i < this.staticProperties.length; i++)
{
const property = this.staticProperties[i];
property.uploadFunction(children, startIndex, amount, this.staticData, this.staticStride, property.offset);
}
this.staticBuffer.upload();
}
/**
* Destroys the ParticleBuffer.
*
*/
destroy()
{
this.dynamicProperties = null;
this.dynamicData = null;
this.dynamicBuffer.destroy();
this.staticProperties = null;
this.staticData = null;
this.staticBuffer.destroy();
}
}
| jpweeks/pixi.js | src/particles/webgl/ParticleBuffer.js | JavaScript | mit | 6,828 |
//------------------------------------------------------------------------------
// <copyright file="ICodeCompiler.cs" company="Microsoft">
//
// <OWNER>petes</OWNER>
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.CodeDom.Compiler {
using System.Diagnostics;
using System.IO;
using System.Security.Permissions;
/// <devdoc>
/// <para>
/// Provides a
/// code compilation
/// interface.
/// </para>
/// </devdoc>
public interface ICodeCompiler {
/// <devdoc>
/// <para>
/// Creates an assembly based on options, with the information from the compile units
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromDom(CompilerParameters options, CodeCompileUnit compilationUnit);
/// <devdoc>
/// <para>
/// Creates an assembly based on options, with the contents of
/// fileName.
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromFile(CompilerParameters options, string fileName);
/// <devdoc>
/// <para>
/// Creates an assembly based on options, with the information from
/// source.
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromSource(CompilerParameters options, string source);
/// <devdoc>
/// <para>
/// Compiles an assembly based on the specified options and
/// information.
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromDomBatch(CompilerParameters options, CodeCompileUnit[] compilationUnits);
/// <devdoc>
/// <para>
/// Compiles
/// an
/// assembly based on the specified options and contents of the specified
/// filenames.
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromFileBatch(CompilerParameters options, string[] fileNames);
/// <devdoc>
/// <para>
/// Compiles an assembly based on the specified options and information from the specified
/// sources.
/// </para>
/// </devdoc>
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
CompilerResults CompileAssemblyFromSourceBatch(CompilerParameters options, string[] sources);
}
}
| esdrubal/referencesource | System/compmod/system/codedom/compiler/ICodeCompiler.cs | C# | mit | 3,460 |
using System.Web;
using System.Web.Optimization;
namespace AvaTaxConnector
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
}
} | JeremyCraigMartinez/developer-dot | public/code/blog/avatax-connector-app/AvaTaxConnector/App_Start/BundleConfig.cs | C# | mit | 2,136 |
//
// DiscVolume.cs
//
// Author:
// Timo Dörr <timo@latecrew.de>
//
// Copyright 2012 Timo Dörr
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using MonoMac.Foundation;
using Banshee.Hardware.Osx.LowLevel;
namespace Banshee.Hardware.Osx
{
public class DiscVolume : Volume, IDiscVolume
{
public DiscVolume (DeviceArguments arguments, IBlockDevice b) : base(arguments, b)
{
}
#region IDiscVolume implementation
public bool HasAudio {
get {
return true;
}
}
public bool HasData {
get {
return false;
}
}
public bool HasVideo {
get {
return false;
}
}
public bool IsRewritable {
get {
return false;
}
}
public bool IsBlank {
get {
return false;
}
}
public ulong MediaCapacity {
get {
return 128338384858;
}
}
#endregion
}
}
| GNOME/banshee | src/Backends/Banshee.Osx/Banshee.Hardware.Osx/DiscVolume.cs | C# | mit | 2,171 |
<TS language="hi_IN" version="2.1">
<context>
<name>AddressBookPage</name>
<message>
<source>Right-click to edit address or label</source>
<translation>पते या लेबल को संपादित करने के लिए राइट-क्लिक करें</translation>
</message>
<message>
<source>Create a new address</source>
<translation>नया पता लिखिए !</translation>
</message>
<message>
<source>&New</source>
<translation>&NEW</translation>
</message>
<message>
<source>Copy the currently selected address to the system clipboard</source>
<translation>चुनिन्दा पते को सिस्टम क्लिपबोर्ड पर कापी करे !</translation>
</message>
<message>
<source>Delete the currently selected address from the list</source>
<translation>सूची से वर्तमान में चयनित पता हटाएं</translation>
</message>
<message>
<source>&Delete</source>
<translation>&मिटाए !!</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<source>Enter passphrase</source>
<translation>पहचान शब्द/अक्षर डालिए !</translation>
</message>
<message>
<source>New passphrase</source>
<translation>नया पहचान शब्द/अक्षर डालिए !</translation>
</message>
<message>
<source>Repeat new passphrase</source>
<translation>दोबारा नया पहचान शब्द/अक्षर डालिए !</translation>
</message>
</context>
<context>
<name>BanTableModel</name>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<source>Synchronizing with network...</source>
<translation>नेटवर्क से समकालिक (मिल) रहा है ...</translation>
</message>
<message>
<source>&Overview</source>
<translation>&विवरण</translation>
</message>
<message>
<source>Show general overview of wallet</source>
<translation>वॉलेट का सामानया विवरण दिखाए !</translation>
</message>
<message>
<source>&Transactions</source>
<translation>& लेन-देन
</translation>
</message>
<message>
<source>Browse transaction history</source>
<translation>देखिए पुराने लेन-देन के विवरण !</translation>
</message>
<message>
<source>E&xit</source>
<translation>बाहर जायें</translation>
</message>
<message>
<source>Quit application</source>
<translation>अप्लिकेशन से बाहर निकलना !</translation>
</message>
<message>
<source>&Options...</source>
<translation>&विकल्प</translation>
</message>
<message>
<source>&Backup Wallet...</source>
<translation>&बैकप वॉलेट</translation>
</message>
<message>
<source>Change the passphrase used for wallet encryption</source>
<translation>पहचान शब्द/अक्षर जो वॉलेट एनक्रिपशन के लिए इस्तेमाल किया है उसे बदलिए!</translation>
</message>
<message>
<source>Bitcoin</source>
<translation>बीटकोइन</translation>
</message>
<message>
<source>Wallet</source>
<translation>वॉलेट</translation>
</message>
<message>
<source>&File</source>
<translation>&फाइल</translation>
</message>
<message>
<source>&Settings</source>
<translation>&सेट्टिंग्स</translation>
</message>
<message>
<source>&Help</source>
<translation>&मदद</translation>
</message>
<message>
<source>Tabs toolbar</source>
<translation>टैबस टूलबार</translation>
</message>
<message>
<source>%1 behind</source>
<translation>%1 पीछे</translation>
</message>
<message>
<source>Error</source>
<translation>भूल</translation>
</message>
<message>
<source>Warning</source>
<translation>चेतावनी</translation>
</message>
<message>
<source>Information</source>
<translation>जानकारी</translation>
</message>
<message>
<source>Up to date</source>
<translation>नवीनतम</translation>
</message>
<message>
<source>Sent transaction</source>
<translation>भेजी ट्रांजक्शन</translation>
</message>
<message>
<source>Incoming transaction</source>
<translation>प्राप्त हुई ट्रांजक्शन</translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>वॉलेट एन्क्रिप्टेड है तथा अभी लॉक्ड नहीं है</translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>वॉलेट एन्क्रिप्टेड है तथा अभी लॉक्ड है</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<source>Amount:</source>
<translation>राशि :</translation>
</message>
<message>
<source>Amount</source>
<translation>राशि</translation>
</message>
<message>
<source>Date</source>
<translation>taareek</translation>
</message>
<message>
<source>Confirmed</source>
<translation>पक्का</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<source>Edit Address</source>
<translation>पता एडिट करना</translation>
</message>
<message>
<source>&Label</source>
<translation>&लेबल</translation>
</message>
<message>
<source>&Address</source>
<translation>&पता</translation>
</message>
</context>
<context>
<name>FreespaceChecker</name>
</context>
<context>
<name>HelpMessageDialog</name>
<message>
<source>version</source>
<translation>संस्करण</translation>
</message>
<message>
<source>Usage:</source>
<translation>खपत :</translation>
</message>
</context>
<context>
<name>Intro</name>
<message>
<source>Error</source>
<translation>भूल</translation>
</message>
</context>
<context>
<name>ModalOverlay</name>
<message>
<source>Form</source>
<translation>फार्म</translation>
</message>
</context>
<context>
<name>OpenURIDialog</name>
</context>
<context>
<name>OptionsDialog</name>
<message>
<source>Options</source>
<translation>विकल्प</translation>
</message>
<message>
<source>W&allet</source>
<translation>वॉलेट</translation>
</message>
<message>
<source>&OK</source>
<translation>&ओके</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&कैन्सल</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<source>Form</source>
<translation>फार्म</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
</context>
<context>
<name>PeerTableModel</name>
</context>
<context>
<name>QObject</name>
<message>
<source>Amount</source>
<translation>राशि</translation>
</message>
<message>
<source>N/A</source>
<translation>लागू नही
</translation>
</message>
</context>
<context>
<name>QObject::QObject</name>
</context>
<context>
<name>QRImageWidget</name>
</context>
<context>
<name>RPCConsole</name>
<message>
<source>N/A</source>
<translation>लागू नही
</translation>
</message>
<message>
<source>&Information</source>
<translation>जानकारी</translation>
</message>
</context>
<context>
<name>ReceiveCoinsDialog</name>
<message>
<source>&Amount:</source>
<translation>राशि :</translation>
</message>
<message>
<source>&Label:</source>
<translation>लेबल:</translation>
</message>
</context>
<context>
<name>ReceiveRequestDialog</name>
<message>
<source>Copy &Address</source>
<translation>&पता कॉपी करे</translation>
</message>
</context>
<context>
<name>RecentRequestsTableModel</name>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<source>Send Coins</source>
<translation>सिक्के भेजें|</translation>
</message>
<message>
<source>Amount:</source>
<translation>राशि :</translation>
</message>
<message>
<source>Send to multiple recipients at once</source>
<translation>एक साथ कई प्राप्तकर्ताओं को भेजें</translation>
</message>
<message>
<source>Balance:</source>
<translation>बाकी रकम :</translation>
</message>
<message>
<source>Confirm the send action</source>
<translation>भेजने की पुष्टि करें</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<source>A&mount:</source>
<translation>अमाउंट:</translation>
</message>
<message>
<source>Pay &To:</source>
<translation>प्राप्तकर्ता:</translation>
</message>
<message>
<source>&Label:</source>
<translation>लेबल:</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt-A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Clipboard से एड्रेस paste करें</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt-P</translation>
</message>
<message>
<source>Pay To:</source>
<translation>प्राप्तकर्ता:</translation>
</message>
</context>
<context>
<name>SendConfirmationDialog</name>
</context>
<context>
<name>ShutdownWindow</name>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<source>Alt+A</source>
<translation>Alt-A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Clipboard से एड्रेस paste करें</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt-P</translation>
</message>
<message>
<source>Signature</source>
<translation>हस्ताक्षर</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<source>[testnet]</source>
<translation>[टेस्टनेट]</translation>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
</context>
<context>
<name>TransactionDesc</name>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<source>This pane shows a detailed description of the transaction</source>
<translation> ये खिड़की आपको लेन-देन का विस्तृत विवरण देगी !</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
</context>
<context>
<name>TransactionView</name>
</context>
<context>
<name>UnitDisplayStatusBarControl</name>
</context>
<context>
<name>WalletFrame</name>
</context>
<context>
<name>WalletModel</name>
</context>
<context>
<name>WalletView</name>
</context>
<context>
<name>bitcoin-core</name>
<message>
<source>Options:</source>
<translation>विकल्प:</translation>
</message>
<message>
<source>Specify data directory</source>
<translation>डेटा डायरेक्टरी बताएं </translation>
</message>
<message>
<source>Run in the background as a daemon and accept commands</source>
<translation>बैकग्राउंड में डेमॉन बन कर रन करे तथा कमांड्स स्वीकार करें </translation>
</message>
<message>
<source>Verifying blocks...</source>
<translation>ब्लॉक्स जाँचे जा रहा है...</translation>
</message>
<message>
<source>Verifying wallet...</source>
<translation>वॉलेट जाँचा जा रहा है...</translation>
</message>
<message>
<source>Information</source>
<translation>जानकारी</translation>
</message>
<message>
<source>Warning</source>
<translation>चेतावनी</translation>
</message>
<message>
<source>Loading addresses...</source>
<translation>पता पुस्तक आ रही है...</translation>
</message>
<message>
<source>Loading block index...</source>
<translation>ब्लॉक इंडेक्स आ रहा है...</translation>
</message>
<message>
<source>Loading wallet...</source>
<translation>वॉलेट आ रहा है...</translation>
</message>
<message>
<source>Rescanning...</source>
<translation>रि-स्केनी-इंग...</translation>
</message>
<message>
<source>Done loading</source>
<translation>लोड हो गया|</translation>
</message>
<message>
<source>Error</source>
<translation>भूल</translation>
</message>
</context>
</TS> | StarbuckBG/BTCGPU | src/qt/locale/bitcoin_hi_IN.ts | TypeScript | mit | 15,201 |
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
arr.map(x => x * x);
}; | lydell/babel | test/fixtures/transformation/api/blacklist/expected.js | JavaScript | mit | 264 |
CKEDITOR.plugins.setLang("imagebase","en-au",{captionPlaceholder:"Enter image caption"}); | cdnjs/cdnjs | ajax/libs/ckeditor/4.17.2/plugins/imagebase/lang/en-au.min.js | JavaScript | mit | 89 |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DataSource = (function () {
function DataSource() {
}
return DataSource;
}());
exports.DataSource = DataSource;
| cdnjs/cdnjs | ajax/libs/deeplearn/0.6.0-alpha6/contrib/data/datasource.js | JavaScript | mit | 205 |
<?php
namespace Drupal\Tests\language\Kernel;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests \Drupal\language\Config\LanguageConfigFactoryOverride.
*
* @group language
*/
class LanguageConfigFactoryOverrideTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['system', 'language'];
/**
* Tests language.config_factory_override service has the default language.
*/
public function testLanguageConfigFactoryOverride() {
$this->installConfig('system');
$this->installConfig('language');
/** @var \Drupal\language\Config\LanguageConfigFactoryOverride $config_factory_override */
$config_factory_override = \Drupal::service('language.config_factory_override');
$this->assertEquals('en', $config_factory_override->getLanguage()->getId());
ConfigurableLanguage::createFromLangcode('de')->save();
// Invalidate the container.
$this->config('system.site')->set('default_langcode', 'de')->save();
$this->container->get('kernel')->rebuildContainer();
$config_factory_override = \Drupal::service('language.config_factory_override');
$this->assertEquals('de', $config_factory_override->getLanguage()->getId());
}
}
| tobiasbuhrer/tobiasb | web/core/modules/language/tests/src/Kernel/LanguageConfigFactoryOverrideTest.php | PHP | gpl-2.0 | 1,290 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.agent import agent
from lib.core.common import arrayizeValue
from lib.core.common import Backend
from lib.core.common import filterPairValues
from lib.core.common import getLimitRange
from lib.core.common import isInferenceAvailable
from lib.core.common import isNoneValue
from lib.core.common import isNumPosStrValue
from lib.core.common import isTechniqueAvailable
from lib.core.common import readInput
from lib.core.common import safeSQLIdentificatorNaming
from lib.core.common import safeStringFormat
from lib.core.common import unArrayizeValue
from lib.core.common import unsafeSQLIdentificatorNaming
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.data import paths
from lib.core.data import queries
from lib.core.enums import CHARSET_TYPE
from lib.core.enums import DBMS
from lib.core.enums import EXPECTED
from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapMissingMandatoryOptionException
from lib.core.exception import SqlmapUserQuitException
from lib.core.settings import CURRENT_DB
from lib.core.settings import METADB_SUFFIX
from lib.request import inject
from lib.techniques.brute.use import columnExists
from lib.techniques.brute.use import tableExists
class Search:
"""
This class defines search functionalities for plugins.
"""
def __init__(self):
pass
def searchDb(self):
foundDbs = []
rootQuery = queries[Backend.getIdentifiedDbms()].search_db
dbList = conf.db.split(",")
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
dbCond = rootQuery.inband.condition2
else:
dbCond = rootQuery.inband.condition
dbConsider, dbCondParam = self.likeOrExact("database")
for db in dbList:
values = []
db = safeSQLIdentificatorNaming(db)
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
db = db.upper()
infoMsg = "searching database"
if dbConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(db)
logger.info(infoMsg)
if conf.excludeSysDbs:
exclDbsQuery = "".join(" AND '%s' != %s" % (unsafeSQLIdentificatorNaming(db), dbCond) for db in self.excludeDbsList)
infoMsg = "skipping system database%s '%s'" % ("s" if len(self.excludeDbsList) > 1 else "", ", ".join(db for db in self.excludeDbsList))
logger.info(infoMsg)
else:
exclDbsQuery = ""
dbQuery = "%s%s" % (dbCond, dbCondParam)
dbQuery = dbQuery % unsafeSQLIdentificatorNaming(db)
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
query = rootQuery.inband.query2
else:
query = rootQuery.inband.query
query = query % (dbQuery + exclDbsQuery)
values = inject.getValue(query, blind=False, time=False)
if not isNoneValue(values):
values = arrayizeValue(values)
for value in values:
value = safeSQLIdentificatorNaming(value)
foundDbs.append(value)
if not values and isInferenceAvailable() and not conf.direct:
infoMsg = "fetching number of database"
if dbConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(db)
logger.info(infoMsg)
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
query = rootQuery.blind.count2
else:
query = rootQuery.blind.count
query = query % (dbQuery + exclDbsQuery)
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
if not isNumPosStrValue(count):
warnMsg = "no database"
if dbConsider == "1":
warnMsg += "s like"
warnMsg += " '%s' found" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
continue
indexRange = getLimitRange(count)
for index in indexRange:
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
query = rootQuery.blind.query2
else:
query = rootQuery.blind.query
query = query % (dbQuery + exclDbsQuery)
query = agent.limitQuery(index, query, dbCond)
value = unArrayizeValue(inject.getValue(query, union=False, error=False))
value = safeSQLIdentificatorNaming(value)
foundDbs.append(value)
conf.dumper.lister("found databases", foundDbs)
def searchTable(self):
bruteForce = False
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
errMsg = "information_schema not available, "
errMsg += "back-end DBMS is MySQL < 5.0"
bruteForce = True
if bruteForce:
message = "do you want to use common table existence check? %s" % ("[Y/n/q]" if Backend.getIdentifiedDbms() in (DBMS.ACCESS,) else "[y/N/q]")
test = readInput(message, default="Y" if "Y" in message else "N")
if test[0] in ("n", "N"):
return
elif test[0] in ("q", "Q"):
raise SqlmapUserQuitException
else:
regex = "|".join(conf.tbl.split(","))
return tableExists(paths.COMMON_TABLES, regex)
foundTbls = {}
tblList = conf.tbl.split(",")
rootQuery = queries[Backend.getIdentifiedDbms()].search_table
tblCond = rootQuery.inband.condition
dbCond = rootQuery.inband.condition2
tblConsider, tblCondParam = self.likeOrExact("table")
for tbl in tblList:
values = []
tbl = safeSQLIdentificatorNaming(tbl, True)
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2, DBMS.FIREBIRD):
tbl = tbl.upper()
infoMsg = "searching table"
if tblConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(tbl)
if dbCond and conf.db and conf.db != CURRENT_DB:
_ = conf.db.split(",")
whereDbsQuery = " AND (" + " OR ".join("%s = '%s'" % (dbCond, unsafeSQLIdentificatorNaming(db)) for db in _) + ")"
infoMsg += " for database%s '%s'" % ("s" if len(_) > 1 else "", ", ".join(db for db in _))
elif conf.excludeSysDbs:
whereDbsQuery = "".join(" AND '%s' != %s" % (unsafeSQLIdentificatorNaming(db), dbCond) for db in self.excludeDbsList)
infoMsg2 = "skipping system database%s '%s'" % ("s" if len(self.excludeDbsList) > 1 else "", ", ".join(db for db in self.excludeDbsList))
logger.info(infoMsg2)
else:
whereDbsQuery = ""
logger.info(infoMsg)
tblQuery = "%s%s" % (tblCond, tblCondParam)
tblQuery = tblQuery % unsafeSQLIdentificatorNaming(tbl)
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
query = rootQuery.inband.query
query = query % (tblQuery + whereDbsQuery)
values = inject.getValue(query, blind=False, time=False)
if values and Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.FIREBIRD):
newValues = []
if isinstance(values, basestring):
values = [values]
for value in values:
dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird"
newValues.append(["%s%s" % (dbName, METADB_SUFFIX), value])
values = newValues
for foundDb, foundTbl in filterPairValues(values):
foundDb = safeSQLIdentificatorNaming(foundDb)
foundTbl = safeSQLIdentificatorNaming(foundTbl, True)
if foundDb is None or foundTbl is None:
continue
if foundDb in foundTbls:
foundTbls[foundDb].append(foundTbl)
else:
foundTbls[foundDb] = [foundTbl]
if not values and isInferenceAvailable() and not conf.direct:
if Backend.getIdentifiedDbms() not in (DBMS.SQLITE, DBMS.FIREBIRD):
if len(whereDbsQuery) == 0:
infoMsg = "fetching number of databases with table"
if tblConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(tbl)
logger.info(infoMsg)
query = rootQuery.blind.count
query = query % (tblQuery + whereDbsQuery)
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
if not isNumPosStrValue(count):
warnMsg = "no databases have table"
if tblConsider == "1":
warnMsg += "s like"
warnMsg += " '%s'" % unsafeSQLIdentificatorNaming(tbl)
logger.warn(warnMsg)
continue
indexRange = getLimitRange(count)
for index in indexRange:
query = rootQuery.blind.query
query = query % (tblQuery + whereDbsQuery)
query = agent.limitQuery(index, query)
foundDb = unArrayizeValue(inject.getValue(query, union=False, error=False))
foundDb = safeSQLIdentificatorNaming(foundDb)
if foundDb not in foundTbls:
foundTbls[foundDb] = []
if tblConsider == "2":
foundTbls[foundDb].append(tbl)
if tblConsider == "2":
continue
else:
for db in conf.db.split(","):
db = safeSQLIdentificatorNaming(db)
if db not in foundTbls:
foundTbls[db] = []
else:
dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird"
foundTbls["%s%s" % (dbName, METADB_SUFFIX)] = []
for db in foundTbls.keys():
db = safeSQLIdentificatorNaming(db)
infoMsg = "fetching number of table"
if tblConsider == "1":
infoMsg += "s like"
infoMsg += " '%s' in database '%s'" % (unsafeSQLIdentificatorNaming(tbl), unsafeSQLIdentificatorNaming(db))
logger.info(infoMsg)
query = rootQuery.blind.count2
if Backend.getIdentifiedDbms() not in (DBMS.SQLITE, DBMS.FIREBIRD):
query = query % unsafeSQLIdentificatorNaming(db)
query += " AND %s" % tblQuery
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
if not isNumPosStrValue(count):
warnMsg = "no table"
if tblConsider == "1":
warnMsg += "s like"
warnMsg += " '%s' " % unsafeSQLIdentificatorNaming(tbl)
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
continue
indexRange = getLimitRange(count)
for index in indexRange:
query = rootQuery.blind.query2
if query.endswith("'%s')"):
query = query[:-1] + " AND %s)" % tblQuery
else:
query += " AND %s" % tblQuery
if Backend.isDbms(DBMS.FIREBIRD):
query = safeStringFormat(query, index)
if Backend.getIdentifiedDbms() not in (DBMS.SQLITE, DBMS.FIREBIRD):
query = safeStringFormat(query, unsafeSQLIdentificatorNaming(db))
if not Backend.isDbms(DBMS.FIREBIRD):
query = agent.limitQuery(index, query)
foundTbl = unArrayizeValue(inject.getValue(query, union=False, error=False))
if not isNoneValue(foundTbl):
kb.hintValue = foundTbl
foundTbl = safeSQLIdentificatorNaming(foundTbl, True)
foundTbls[db].append(foundTbl)
for db in foundTbls.keys():
if isNoneValue(foundTbls[db]):
del foundTbls[db]
if not foundTbls:
warnMsg = "no databases contain any of the provided tables"
logger.warn(warnMsg)
return
conf.dumper.dbTables(foundTbls)
self.dumpFoundTables(foundTbls)
def searchColumn(self):
bruteForce = False
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
errMsg = "information_schema not available, "
errMsg += "back-end DBMS is MySQL < 5.0"
bruteForce = True
if bruteForce:
message = "do you want to use common column existence check? %s" % ("[Y/n/q]" if Backend.getIdentifiedDbms() in (DBMS.ACCESS,) else "[y/N/q]")
test = readInput(message, default="Y" if "Y" in message else "N")
if test[0] in ("n", "N"):
return
elif test[0] in ("q", "Q"):
raise SqlmapUserQuitException
else:
regex = "|".join(conf.col.split(","))
conf.dumper.dbTableColumns(columnExists(paths.COMMON_COLUMNS, regex))
message = "do you want to dump entries? [Y/n] "
output = readInput(message, default="Y")
if output and output[0] not in ("n", "N"):
self.dumpAll()
return
rootQuery = queries[Backend.getIdentifiedDbms()].search_column
foundCols = {}
dbs = {}
whereDbsQuery = ""
whereTblsQuery = ""
infoMsgTbl = ""
infoMsgDb = ""
colList = conf.col.split(",")
origTbl = conf.tbl
origDb = conf.db
colCond = rootQuery.inband.condition
dbCond = rootQuery.inband.condition2
tblCond = rootQuery.inband.condition3
colConsider, colCondParam = self.likeOrExact("column")
for column in colList:
values = []
column = safeSQLIdentificatorNaming(column)
conf.db = origDb
conf.tbl = origTbl
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
column = column.upper()
infoMsg = "searching column"
if colConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(column)
foundCols[column] = {}
if conf.tbl:
_ = conf.tbl.split(",")
whereTblsQuery = " AND (" + " OR ".join("%s = '%s'" % (tblCond, unsafeSQLIdentificatorNaming(tbl)) for tbl in _) + ")"
infoMsgTbl = " for table%s '%s'" % ("s" if len(_) > 1 else "", ", ".join(unsafeSQLIdentificatorNaming(tbl) for tbl in _))
if conf.db and conf.db != CURRENT_DB:
_ = conf.db.split(",")
whereDbsQuery = " AND (" + " OR ".join("%s = '%s'" % (dbCond, unsafeSQLIdentificatorNaming(db)) for db in _) + ")"
infoMsgDb = " in database%s '%s'" % ("s" if len(_) > 1 else "", ", ".join(unsafeSQLIdentificatorNaming(db) for db in _))
elif conf.excludeSysDbs:
whereDbsQuery = "".join(" AND %s != '%s'" % (dbCond, unsafeSQLIdentificatorNaming(db)) for db in self.excludeDbsList)
infoMsg2 = "skipping system database%s '%s'" % ("s" if len(self.excludeDbsList) > 1 else "", ", ".join(unsafeSQLIdentificatorNaming(db) for db in self.excludeDbsList))
logger.info(infoMsg2)
else:
infoMsgDb = " across all databases"
logger.info("%s%s%s" % (infoMsg, infoMsgTbl, infoMsgDb))
colQuery = "%s%s" % (colCond, colCondParam)
colQuery = colQuery % unsafeSQLIdentificatorNaming(column)
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
if not all((conf.db, conf.tbl)):
# Enumerate tables containing the column provided if
# either of database(s) or table(s) is not provided
query = rootQuery.inband.query
query = query % (colQuery + whereDbsQuery + whereTblsQuery)
values = inject.getValue(query, blind=False, time=False)
else:
# Assume provided databases' tables contain the
# column(s) provided
values = []
for db in conf.db.split(","):
for tbl in conf.tbl.split(","):
values.append([safeSQLIdentificatorNaming(db), safeSQLIdentificatorNaming(tbl, True)])
for db, tbl in filterPairValues(values):
db = safeSQLIdentificatorNaming(db)
tbls = tbl.split(",") if not isNoneValue(tbl) else []
for tbl in tbls:
tbl = safeSQLIdentificatorNaming(tbl, True)
if db is None or tbl is None:
continue
conf.db = db
conf.tbl = tbl
conf.col = column
self.getColumns(onlyColNames=True, colTuple=(colConsider, colCondParam), bruteForce=False)
if db in kb.data.cachedColumns and tbl in kb.data.cachedColumns[db]:
if db not in dbs:
dbs[db] = {}
if tbl not in dbs[db]:
dbs[db][tbl] = {}
dbs[db][tbl].update(kb.data.cachedColumns[db][tbl])
if db in foundCols[column]:
foundCols[column][db].append(tbl)
else:
foundCols[column][db] = [tbl]
kb.data.cachedColumns = {}
if not values and isInferenceAvailable() and not conf.direct:
if not conf.db:
infoMsg = "fetching number of databases with tables containing column"
if colConsider == "1":
infoMsg += "s like"
infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(column)
logger.info("%s%s%s" % (infoMsg, infoMsgTbl, infoMsgDb))
query = rootQuery.blind.count
query = query % (colQuery + whereDbsQuery + whereTblsQuery)
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
if not isNumPosStrValue(count):
warnMsg = "no databases have tables containing column"
if colConsider == "1":
warnMsg += "s like"
warnMsg += " '%s'" % unsafeSQLIdentificatorNaming(column)
logger.warn("%s%s" % (warnMsg, infoMsgTbl))
continue
indexRange = getLimitRange(count)
for index in indexRange:
query = rootQuery.blind.query
query = query % (colQuery + whereDbsQuery + whereTblsQuery)
query = agent.limitQuery(index, query)
db = unArrayizeValue(inject.getValue(query, union=False, error=False))
db = safeSQLIdentificatorNaming(db)
if db not in dbs:
dbs[db] = {}
if db not in foundCols[column]:
foundCols[column][db] = []
else:
for db in conf.db.split(","):
db = safeSQLIdentificatorNaming(db)
if db not in foundCols[column]:
foundCols[column][db] = []
origDb = conf.db
origTbl = conf.tbl
for column, dbData in foundCols.items():
colQuery = "%s%s" % (colCond, colCondParam)
colQuery = colQuery % unsafeSQLIdentificatorNaming(column)
for db in dbData:
conf.db = origDb
conf.tbl = origTbl
infoMsg = "fetching number of tables containing column"
if colConsider == "1":
infoMsg += "s like"
infoMsg += " '%s' in database '%s'" % (unsafeSQLIdentificatorNaming(column), unsafeSQLIdentificatorNaming(db))
logger.info(infoMsg)
query = rootQuery.blind.count2
query = query % unsafeSQLIdentificatorNaming(db)
query += " AND %s" % colQuery
query += whereTblsQuery
count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
if not isNumPosStrValue(count):
warnMsg = "no tables contain column"
if colConsider == "1":
warnMsg += "s like"
warnMsg += " '%s' " % unsafeSQLIdentificatorNaming(column)
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
continue
indexRange = getLimitRange(count)
for index in indexRange:
query = rootQuery.blind.query2
if query.endswith("'%s')"):
query = query[:-1] + " AND %s)" % (colQuery + whereTblsQuery)
else:
query += " AND %s" % (colQuery + whereTblsQuery)
query = safeStringFormat(query, unsafeSQLIdentificatorNaming(db))
query = agent.limitQuery(index, query)
tbl = unArrayizeValue(inject.getValue(query, union=False, error=False))
kb.hintValue = tbl
tbl = safeSQLIdentificatorNaming(tbl, True)
conf.db = db
conf.tbl = tbl
conf.col = column
self.getColumns(onlyColNames=True, colTuple=(colConsider, colCondParam), bruteForce=False)
if db in kb.data.cachedColumns and tbl in kb.data.cachedColumns[db]:
if db not in dbs:
dbs[db] = {}
if tbl not in dbs[db]:
dbs[db][tbl] = {}
dbs[db][tbl].update(kb.data.cachedColumns[db][tbl])
kb.data.cachedColumns = {}
if db in foundCols[column]:
foundCols[column][db].append(tbl)
else:
foundCols[column][db] = [tbl]
if dbs:
conf.dumper.dbColumns(foundCols, colConsider, dbs)
self.dumpFoundColumn(dbs, foundCols, colConsider)
else:
warnMsg = "no databases have tables containing any of the "
warnMsg += "provided columns"
logger.warn(warnMsg)
def search(self):
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
for item in ('db', 'tbl', 'col'):
if getattr(conf, item, None):
setattr(conf, item, getattr(conf, item).upper())
if conf.col:
self.searchColumn()
elif conf.tbl:
self.searchTable()
elif conf.db:
self.searchDb()
else:
errMsg = "missing parameter, provide -D, -T or -C along "
errMsg += "with --search"
raise SqlmapMissingMandatoryOptionException(errMsg)
| golismero/golismero | tools/sqlmap/plugins/generic/search.py | Python | gpl-2.0 | 26,113 |
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#include "stlport_prefix.h"
#include <cmath>
#include <ios>
#include <locale>
#if defined (__DECCXX)
# define NDIG 400
#else
# define NDIG 82
#endif
#if defined (_STLP_NO_LONG_DOUBLE)
# define MAXECVT 17
# define MAXFCVT 18
typedef double max_double_type;
#else
# define MAXECVT 35
# define MAXFCVT 36
typedef long double max_double_type;
#endif
#define MAXFSIG MAXECVT
#define MAXESIZ 5
#define todigit(x) ((x)+'0')
#if defined (_STLP_UNIX)
# if defined (__sun)
# include <floatingpoint.h>
# endif
# if defined (__sun) || defined (__digital__) || defined (__sgi) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
// DEC, SGI & Solaris need this
# include <values.h>
# include <nan.h>
# endif
# if defined (__QNXNTO__) || ( defined(__GNUC__) && defined(__APPLE__) ) || defined(_STLP_USE_UCLIBC) /* 0.9.26 */ || \
defined(__FreeBSD__)
# define USE_SPRINTF_INSTEAD
# endif
# if defined( _AIX ) // JFA 3-Aug-2000
# include <math.h>
# include <float.h>
# endif
#endif
#include <cstdio>
#include <cstdlib>
//#if defined(_CRAY)
//# include <stdlib.h>
//#endif
#if defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || \
defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
# include <float.h>
#endif
#if defined(__MRC__) || defined(__SC__) || defined(_CRAY) //*TY 02/24/2000 - added support for MPW
# include <fp.h>
#endif
#if defined (__CYGWIN__)
# include <ieeefp.h>
#endif
#if defined (__MSL__)
# include <cstdlib> // for atoi
# include <cstdio> // for snprintf
# include <algorithm>
# include <cassert>
#endif
#if defined (__ISCPP__)
# include <cfloat>
#endif
#include <algorithm>
#if defined (__DMC__)
# define snprintf _snprintf
#endif
#if defined (__SYMBIAN32__)
# include <e32math.h>
static char* _symbian_ecvt(double x, int n, int* pt, int* sign, char* buf)
{
// normalize sign and set sign bit
if (x < 0)
{
if (sign) *sign = 1;
x = -x;
}
else
if (sign) *sign = 0;
// initialize end-of-buffer
char* end = buf+n;
*end = 0;
// if buffer will be empty anyway, return now
if (n == 0)
return buf;
// normalize number and set point position
if (x != 0.0)
{
double fex;
if (Math::Log(fex, x) != KErrNone)
return buf;
int ex = (int)fex;
if (x < 1.0)
--ex;
if (ex != 0)
{
double temp;
if (Math::Pow10(temp, ex) != KErrNone)
return buf;
x /= temp;
}
if (pt) *pt = ex + 1;
}
else
if (pt) *pt = 1;
const double dbl_epsilon = 2.2204460492503131e-16;
// render digits (except for last digit)
char* ptr = buf;
for (; (ptr+1)!=end; ++ptr)
{
char digit = (char)x;
*ptr = '0' + digit;
x = (x - (double)digit) * 10.0 * (1.0 + dbl_epsilon);
}
// render last digit, rounded
double rx;
if (Math::Round(rx, x, 0) != KErrNone)
return buf;
*ptr = '0' + (char)rx;
// detect carry on last digit and propagate it back
for (; ptr!=buf && *ptr==':'; --ptr)
{
*ptr = '0';
++*(ptr-1);
}
// detect overflow on first digit and, in case, shift
// the sequence forward
if (*buf == ':')
{
*buf = '0';
memcpy(buf+1, buf, n-1);
*buf = '1';
if (pt) ++*pt;
}
return buf;
}
static char* _symbian_fcvt(double x, int n, int* pt, int* sign, char* buf)
{
*buf = 0;
if (x < 0.0)
{
*sign = 1;
x = -x;
}
else
*sign = 0;
double fx;
if (Math::Int(fx, x) != KErrNone)
return buf;
if (fx != 0.0 || x == 0.0 || n == 0)
{
int fn = 1;
if (fx != 0.0)
{
double temp;
if (Math::Log(temp, fx) != KErrNone)
return buf;
fn += (int)temp;
}
_symbian_ecvt(fx, fn, pt, 0, buf);
}
else
*pt = 0;
if (n != 0)
{
const double dx = x - fx;
_symbian_ecvt(dx, n, 0, 0, buf+*pt);
}
return buf;
}
#endif
#if defined(__hpux) && (!defined(_INCLUDE_HPUX_SOURCE) || defined(__GNUC__))
extern "C" double erf(double);
extern "C" double erfc(double);
extern "C" double gamma(double); /* obsolescent */
extern "C" double hypot(double, double);
extern "C" int isnan(double);
extern "C" double j0(double);
extern "C" double j1(double);
extern "C" double jn(int, double);
extern "C" double lgamma(double);
extern "C" double y0(double);
extern "C" double y1(double);
extern "C" double yn(int, double);
# define HUGE_VALF _SINFINITY
# define INFINITY _SINFINITY
# define NAN _SQNAN
# define isnan(x) _ISNAN(x)
# define isinf(x) _ISINF(x)
# define signbit(x) _SIGNBIT(x)
# define isfinite(x) _ISFINITE(x)
# define isnormal(x) _ISNORMAL(x)
# define fpclassify(x) _FPCLASSIFY(x)
# define isunordered(x,y) _ISUNORDERED(x,y)
# define isgreater(x,y) _ISGREATER(x,y)
# define isgreaterequal(x,y) _ISGREATEREQUAL(x,y)
# define isless(x,y) _ISLESS(x,y)
# define islessequal(x,y) _ISLESSEQUAL(x,y)
# define islessgreater(x,y) _ISLESSGREATER(x,y)
# define FP_NORMAL 0
# define FP_ZERO 1
# define FP_INFINITE 2
# define FP_SUBNORMAL 3
# define FP_NAN 4
# define DECIMAL_DIG 17
# define _IS64(x) (sizeof(x) == sizeof(double))
# define _IS32(x) (sizeof(x) == sizeof(float))
extern "C" {
extern double copysign(double, double);
extern const float _SINFINITY;
extern const float _SQNAN;
//# if defined (_PA_RISC)
# define _ISNAN(x) (_IS32(x)?_Isnanf(x):(isnan)(x))
# define _ISINF(x) (_IS32(x)?_Isinff(x):_Isinf(x))
# define _SIGNBIT(x) (_IS32(x)?_Signbitf(x):_Signbit(x))
# define _ISFINITE(x) (_IS32(x)?_Isfinitef(x):_Isfinite(x))
# define _ISNORMAL(x) (_IS32(x)?_Isnormalf(x):_Isnormal(x))
# define _FPCLASSIFY(x) (_IS32(x)?_Fpclassifyf(x)>>1:_Fpclassify(x)>>1)
# define _ISUNORDERED(x,y) (_IS32(x)&&_IS32(y)?_Isunorderedf(x,y):_Isunordered(x,y))
extern int _Signbit(double);
extern int _Signbitf(float);
extern int _Isnanf(float);
extern int _Isfinite(double);
extern int _Isfinitef(float);
extern int _Isinf(double);
extern int _Isinff(float);
extern int _Isnormal(double);
extern int _Isnormalf(float);
extern int _Isunordered(double, double);
extern int _Isunorderedf(float, float);
extern int _Fpclassify(double);
extern int _Fpclassifyf(float);
//# else
//# include "math_ia64_internal.h"
//# define _FPCLASSIFY(x) (_IS32(x)?_Fpclassf(x):_Fpclass(x))
// extern int _Fpclass(double);
// extern int _Fpclassf(float);
//# endif
}
# if !defined (_INCLUDE_XOPEN_SOURCE_EXTENDED)
extern "C" char *fcvt(double, int, int *, int *);
extern "C" char *ecvt(double, int, int *, int *);
# endif
# if !defined (_INCLUDE_HPUX_SOURCE)
# if !defined (_LONG_DOUBLE)
# define _LONG_DOUBLE
typedef struct {
uint32_t word1, word2, word3, word4;
} long_double;
# endif /* _LONG_DOUBLE */
extern "C" char *_ldecvt(long_double, int, int *, int *);
extern "C" char *_ldfcvt(long_double, int, int *, int *);
# endif
#endif /* __hpux */
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
#if defined (__MWERKS__) || defined(__BEOS__)
# define USE_SPRINTF_INSTEAD
#endif
#if defined (_AIX) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
// Some OS'es only provide non-reentrant primitives, so we have to use additional synchronization here
# if !defined(_REENTRANT) && !defined(_THREAD_SAFE) && !(defined(_POSIX_THREADS) && defined(__OpenBSD__))
# define LOCK_CVT
# define RETURN_CVT(ecvt, x, n, pt, sign, buf) return ecvt(x, n, pt, sign);
# else
static _STLP_STATIC_MUTEX __put_float_mutex _STLP_MUTEX_INITIALIZER;
# define LOCK_CVT _STLP_auto_lock lock(__put_float_mutex);
# define RETURN_CVT(ecvt, x, n, pt, sign, buf) strcpy(buf, ecvt(x, n, pt, sign)); return buf;
# endif // !_REENTRANT
#endif // _AIX || __FreeBSD__ || __NetBSD__ || __OpenBSD__
// Tests for infinity and NaN differ on different OSs. We encapsulate
// these differences here.
#if !defined (USE_SPRINTF_INSTEAD)
# if defined (__hpux) || defined (__DJGPP) || (defined (_STLP_USE_GLIBC) && ! defined (__MSL__)) || \
defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
static inline bool _Stl_is_nan_or_inf(double x)
# if defined (isfinite)
{ return !isfinite(x); }
# else
{ return !finite(x); }
# endif
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
static inline bool _Stl_is_inf(double x) { return isinf(x); }
// inline bool _Stl_is_neg_inf(double x) { return isinf(x) < 0; }
static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && x < 0; }
# elif (defined (__unix) || defined (__unix__)) && \
!defined (__APPLE__) && !defined (__DJGPP) && !defined(__osf__) && \
!defined (_CRAY)
static inline bool _Stl_is_nan_or_inf(double x) { return IsNANorINF(x); }
static inline bool _Stl_is_inf(double x) { return IsNANorINF(x) && IsINF(x); }
static inline bool _Stl_is_neg_inf(double x) { return (IsINF(x)) && (x < 0.0); }
static inline bool _Stl_is_neg_nan(double x) { return IsNegNAN(x); }
# elif defined (__BORLANDC__) && ( __BORLANDC__ < 0x540 )
static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! _isnan(x);}
static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && x < 0 ; }
# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
static inline bool _Stl_is_inf(double x) {
int fclass = _fpclass(x);
return fclass == _FPCLASS_NINF || fclass == _FPCLASS_PINF;
}
static inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; }
static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; }
# elif defined (__MRC__) || defined (__SC__) //*TY 02/24/2000 - added support for MPW
static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); }
static bool _Stl_is_inf(double x) { return !isfinite(x); }
static bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); }
static bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
# elif /* defined(__FreeBSD__) || defined(__OpenBSD__) || */ (defined(__GNUC__) && defined(__APPLE__))
static inline bool _Stl_is_nan_or_inf(double x) { return !finite(x); }
static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! isnan(x); }
static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && copysign(1., x) < 0 ; }
# elif defined( _AIX ) // JFA 11-Aug-2000
static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !finite(x); }
static bool _Stl_is_inf(double x) { return !finite(x); }
// bool _Stl_is_neg_inf(double x) { return _class(x) == FP_MINUS_INF; }
static bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && ( copysign(1., x) < 0 ); }
static bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
# elif defined (__ISCPP__)
static inline bool _Stl_is_nan_or_inf (double x) { return _fp_isINF(x) || _fp_isNAN(x); }
static inline bool _Stl_is_inf (double x) { return _fp_isINF(x); }
static inline bool _Stl_is_neg_inf (double x) { return _fp_isINF(x) && x < 0; }
static inline bool _Stl_is_neg_nan (double x) { return _fp_isNAN(x) && x < 0; }
# elif defined (_CRAY)
# if defined (_CRAYIEEE)
static inline bool _Stl_is_nan_or_inf(double x) { return isnan(x) || isinf(x); }
static inline bool _Stl_is_inf(double x) { return isinf(x); }
static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && signbit(x); }
static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
# else
static inline bool _Stl_is_nan_or_inf(double x) { return false; }
static inline bool _Stl_is_inf(double x) { return false; }
static inline bool _Stl_is_neg_inf(double x) { return false; }
static inline bool _Stl_is_neg_nan(double x) { return false; }
# endif
# elif defined (__SYMBIAN32__)
static inline bool _Stl_is_nan_or_inf(double x) { return Math::IsNaN(x) || Math::IsInfinite(x); }
static inline bool _Stl_is_inf(double x) { return Math::IsInfinite(x); }
static inline bool _Stl_is_neg_inf(double x) { return Math::IsInfinite(x) && x < 0; }
static inline bool _Stl_is_neg_nan(double x) { return Math::IsNaN(x) && x < 0; }
# else // nothing from above
# define USE_SPRINTF_INSTEAD
# endif
#endif // !USE_SPRINTF_INSTEAD
#if !defined (USE_SPRINTF_INSTEAD)
// Reentrant versions of floating-point conversion functions. The argument
// lists look slightly different on different operating systems, so we're
// encapsulating the differences here.
# if defined (__CYGWIN__) || defined(__DJGPP)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvtbuf(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvtbuf(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return ecvtbuf(x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return fcvtbuf(x, n, pt, sign, buf); }
# endif
# elif defined (__SYMBIAN32__)
static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _symbian_ecvt(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _symbian_fcvt(x, n, pt, sign, buf); }
# elif defined (_STLP_USE_GLIBC)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return buf + ecvt_r(x, n, pt, sign, buf, NDIG+2); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return buf + fcvt_r(x, n, pt, sign, buf, NDIG+2); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return buf + qecvt_r(x, n, pt, sign, buf, NDIG+2); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return buf + qfcvt_r(x, n, pt, sign, buf, NDIG+2); }
# endif
# elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt(x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return ecvtl(x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return fcvtl(x, n, pt, sign); }
# endif
# elif defined (__sun)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return econvert(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fconvert(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qeconvert(&x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qfconvert(&x, n, pt, sign, buf); }
# endif
# elif defined (__DECCXX)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return (ecvt_r(x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return (fcvt_r(x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
# if !defined (_STLP_NO_LONG_DOUBLE)
// fbp : no "long double" conversions !
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (ecvt_r((double)x, n, pt, sign, buf, NDIG)==0 ? buf : 0) ; }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (fcvt_r((double)x, n, pt, sign, buf, NDIG)==0 ? buf : 0); }
# endif
# elif defined (__hpux)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt(x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
# if defined( _REENTRANT ) && (defined(_PTHREADS_DRAFT4) || defined(PTHREAD_THREADS_MAX))
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (_ldecvt_r(*(long_double*)&x, n, pt, sign, buf, NDIG+2)==0 ? buf : 0); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return (_ldfcvt_r(*(long_double*)&x, n, pt, sign, buf, NDIG+2)==0 ? buf : 0); }
# else
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _ldecvt(*(long_double*)&x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _ldfcvt(*(long_double*)&x, n, pt, sign); }
# endif
# endif
# elif defined (_AIX) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(ecvt, x, n, pt, sign, buf) }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(fcvt, x, n, pt, sign, buf) }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(ecvt, x, n, pt, sign, buf) }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ LOCK_CVT RETURN_CVT(fcvt, x, n, pt, sign, buf) }
# endif
# elif defined (__unix) && !defined (__APPLE__) && !defined (_CRAY)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return ecvt_r(x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return fcvt_r(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qecvt_r(x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return qfcvt_r(x, n, pt, sign, buf); }
# endif
# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
// those guys claim _cvt functions being reentrant.
# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_APPEND(a, b) a##b
# define _STLP_BUF_PARAMS , char* buf, size_t bsize
# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) _STLP_APPEND(F, _s)(buf, bsize, X, N, PT, SIGN); return buf
# else
# define _STLP_CVT_DONT_NEED_BUF
# define _STLP_BUF_PARAMS
# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) return F(X, N, PT, SIGN)
# endif
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_ecvt, x, n, pt, sign); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_fcvt, x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_ecvt, (double)x, n, pt, sign); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
{ _STLP_SECURE_FUN(_fcvt, (double)x, n, pt, sign); }
# endif
# undef _STLP_SECURE_FUN
# undef _STLP_BUF_PARAMS
# undef _STLP_APPEND
# elif defined (__ISCPP__)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
{ return _fp_ecvt( x, n, pt, sign, buf); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
{ return _fp_fcvt(x, n, pt, sign, buf); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _fp_ecvt( x, n, pt, sign, buf); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf)
{ return _fp_fcvt(x, n, pt, sign, buf); }
# endif
# elif defined (__MRC__) || defined (__SC__) || defined (_CRAY)
static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* )
{ return ecvt( x, n, pt, sign ); }
static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* )
{ return fcvt(x, n, pt, sign); }
# if !defined (_STLP_NO_LONG_DOUBLE)
static inline char* _Stl_qecvtR(long double x, int n, int* pt, int* sign, char* )
{ return ecvt( x, n, pt, sign ); }
static inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* )
{ return fcvt(x, n, pt, sign); }
# endif
# endif
# if defined (_STLP_CVT_DONT_NEED_BUF)
# define _STLP_CVT_BUFFER(B)
# elif !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_CVT_BUFFER(B) , B
# else
# define _STLP_CVT_BUFFER(B) , _STLP_ARRAY_AND_SIZE(B)
# endif
# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
# define _STLP_BUFFER(B) B
# else
# define _STLP_BUFFER(B) _STLP_ARRAY_AND_SIZE(B)
# endif
//----------------------------------------------------------------------
// num_put
// __format_float formats a mantissa and exponent as returned by
// one of the conversion functions (ecvt_r, fcvt_r, qecvt_r, qfcvt_r)
// according to the specified precision and format flags. This is
// based on doprnt but is much simpler since it is concerned only
// with floating point input and does not consider all formats. It
// also does not deal with blank padding, which is handled by
// __copy_float_and_fill.
static size_t __format_float_scientific( __iostring& buf, const char *bp,
int decpt, int sign, bool is_zero,
ios_base::fmtflags flags,
int precision, bool /* islong */)
{
// sign if required
if (sign)
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
// first digit of mantissa
buf += *bp++;
// start of grouping position, grouping won't occur in scientific notation
// as it is impossible to have something like 1234.0e04 but we return a correct
// group position for coherency with __format_float_fixed.
size_t __group_pos = buf.size();
// decimal point if required
if (precision != 0 || flags & ios_base::showpoint) {
buf += '.';
}
// rest of mantissa
int rz = precision;
while (rz-- > 0 && *bp != 0)
buf += *bp++;
// exponent
char expbuf[MAXESIZ + 2];
char *suffix = expbuf + MAXESIZ;
*suffix = 0;
if (!is_zero) {
int nn = decpt - 1;
if (nn < 0)
nn = -nn;
for (; nn > 9; nn /= 10)
*--suffix = (char) todigit(nn % 10);
*--suffix = (char) todigit(nn);
}
// prepend leading zeros to exponent
while (suffix > &expbuf[MAXESIZ - 2])
*--suffix = '0';
// put in the exponent sign
*--suffix = (char) ((decpt > 0 || is_zero ) ? '+' : '-');
// put in the e
*--suffix = flags & ios_base::uppercase ? 'E' : 'e';
// copy the suffix
buf += suffix;
return __group_pos;
}
static size_t __format_float_fixed( __iostring &buf, const char *bp,
int decpt, int sign, bool /* x */,
ios_base::fmtflags flags,
int precision, bool islong )
{
if ( sign && (decpt > -precision) && (*bp != 0) )
buf += '-';
else if ( flags & ios_base::showpos )
buf += '+';
int k = 0;
int maxfsig = islong ? 2*MAXFSIG : MAXFSIG;
// digits before decimal point
int nnn = decpt;
do {
buf += ((nnn <= 0 || *bp == 0 || k >= maxfsig) ? '0' : (++k, *bp++));
} while ( --nnn > 0 );
// start of grouping position
size_t __group_pos = buf.size();
// decimal point if needed
if ( flags & ios_base::showpoint || precision > 0 ) {
buf += '.';
}
// digits after decimal point if any
nnn = (min) (precision, MAXFCVT);
while ( --nnn >= 0 ) {
buf += (++decpt <= 0 || *bp == 0 || k >= maxfsig) ? '0' : (++k, *bp++);
}
// trailing zeros if needed
if ( precision > MAXFCVT ) {
buf.append( precision - MAXFCVT, '0' );
}
return __group_pos;
}
static void __format_nan_or_inf(__iostring& buf, double x, ios_base::fmtflags flags)
{
static const char* inf[2] = { "inf", "Inf" };
static const char* nan[2] = { "nan", "NaN" };
const char** inf_or_nan;
if (_Stl_is_inf(x)) { // Infinity
inf_or_nan = inf;
if (_Stl_is_neg_inf(x))
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
} else { // NaN
inf_or_nan = nan;
if (_Stl_is_neg_nan(x))
buf += '-';
else if (flags & ios_base::showpos)
buf += '+';
}
buf += inf_or_nan[flags & ios_base::uppercase ? 1 : 0];
}
template <class max_double_type>
static inline size_t __format_float( __iostring &buf, const char * bp,
int decpt, int sign, max_double_type x,
ios_base::fmtflags flags,
int precision, bool islong)
{
size_t __group_pos = 0;
// Output of infinities and NANs does not depend on the format flags
if (_Stl_is_nan_or_inf((double)x)) { // Infinity or NaN
__format_nan_or_inf(buf, (double)x, flags);
} else { // representable number
switch (flags & ios_base::floatfield) {
case ios_base::scientific:
__group_pos = __format_float_scientific( buf, bp, decpt, sign, x == 0.0,
flags, precision, islong);
break;
case ios_base::fixed:
__group_pos = __format_float_fixed( buf, bp, decpt, sign, true,
flags, precision, islong);
break;
default: // g format
// establish default precision
if (flags & ios_base::showpoint || precision > 0) {
if (precision == 0) precision = 1;
} else
precision = 6;
// reset exponent if value is zero
if (x == 0)
decpt = 1;
int kk = precision;
if (!(flags & ios_base::showpoint)) {
size_t n = strlen(bp);
if (n < (size_t)kk)
kk = (int)n;
while (kk >= 1 && bp[kk-1] == '0')
--kk;
}
if (decpt < -3 || decpt > precision) {
precision = kk - 1;
__group_pos = __format_float_scientific( buf, bp, decpt, sign, x == 0,
flags, precision, islong);
} else {
precision = kk - decpt;
__group_pos = __format_float_fixed( buf, bp, decpt, sign, true,
flags, precision, islong);
}
break;
} /* switch */
} /* else is_nan_or_inf */
return __group_pos;
}
#else /* USE_SPRINTF_INSTEAD */
struct GroupPos {
bool operator () (char __c) const {
return __c == '.' ||
__c == 'e' || __c == 'E';
}
};
// Creates a format string for sprintf()
static int __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier) {
fmtbuf[0] = '%';
int i = 1;
if (flags & ios_base::showpos)
fmtbuf[i++] = '+';
if (flags & ios_base::showpoint)
fmtbuf[i++] = '#';
fmtbuf[i++] = '.';
fmtbuf[i++] = '*';
if (long_modifier)
fmtbuf[i++] = long_modifier;
switch (flags & ios_base::floatfield)
{
case ios_base::scientific:
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'E' : 'e';
break;
case ios_base::fixed:
# if defined (__FreeBSD__)
fmtbuf[i++] = 'f';
# else
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'F' : 'f';
# endif
break;
default:
fmtbuf[i++] = (flags & ios_base::uppercase) ? 'G' : 'g';
break;
}
fmtbuf[i] = 0;
return i;
}
#endif /* USE_SPRINTF_INSTEAD */
size_t _STLP_CALL
__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
double x) {
#if defined (USE_SPRINTF_INSTEAD)
/* If we want 'abitrary' precision, we should use 'abitrary' buffer size
* below. - ptr
*/
char static_buf[128];
// char *static_buf = new char [128+precision];
char fmtbuf[32];
__fill_fmtbuf(fmtbuf, flags, 0);
// snprintf(static_buf, 128+precision, fmtbuf, precision, x);
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
# else
sprintf(static_buf, fmtbuf, precision, x);
# endif
buf = static_buf;
// delete [] static_buf;
return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
#else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
switch (flags & ios_base::floatfield) {
case ios_base::fixed:
bp = _Stl_fcvtR(x, (min) (precision, MAXFCVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
case ios_base::scientific :
bp = _Stl_ecvtR(x, (min) (precision + 1, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
default :
bp = _Stl_ecvtR(x, (min) (precision, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
}
return __format_float(buf, bp, decpt, sign, x, flags, precision, false);
#endif
}
#if !defined (_STLP_NO_LONG_DOUBLE)
size_t _STLP_CALL
__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
long double x) {
# if defined (USE_SPRINTF_INSTEAD)
/* If we want 'abitrary' precision, we should use 'abitrary' buffer size
* below. - ptr
*/
char static_buf[128];
// char *static_buf = new char [128+precision];
char fmtbuf[64];
int i = __fill_fmtbuf(fmtbuf, flags, 'L');
// snprintf(static_buf, 128+precision, fmtbuf, precision, x);
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
# else
sprintf(static_buf, fmtbuf, precision, x);
# endif
// we should be able to return buf + sprintf(), but we do not trust'em...
buf = static_buf;
// delete [] static_buf;
return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
# else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
switch (flags & ios_base::floatfield) {
case ios_base::fixed:
bp = _Stl_qfcvtR(x, (min) (precision, MAXFCVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
case ios_base::scientific:
bp = _Stl_qecvtR(x, (min) (precision + 1, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
default :
bp = _Stl_qecvtR(x, (min) (precision, MAXECVT), &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
break;
}
return __format_float(buf, bp, decpt, sign, x, flags, precision, true);
# endif /* USE_SPRINTF_INSTEAD */
}
#endif /* _STLP_NO_LONG_DOUBLE */
void _STLP_CALL __get_floor_digits(__iostring &out, _STLP_LONGEST_FLOAT_TYPE __x) {
#if defined (USE_SPRINTF_INSTEAD)
char cvtbuf[128];
# if !defined (_STLP_NO_LONG_DOUBLE)
# if !defined (N_PLAT_NLM)
snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%Lf", __x); // check for 1234.56!
# else
sprintf(cvtbuf, "%Lf", __x); // check for 1234.56!
# endif
# else
snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%f", __x); // check for 1234.56!
# endif
char *p = strchr( cvtbuf, '.' );
if ( p == 0 ) {
out.append( cvtbuf );
} else {
out.append( cvtbuf, p );
}
#else
# if !defined (_STLP_CVT_DONT_NEED_BUF)
char cvtbuf[NDIG + 2];
# endif
char * bp;
int decpt, sign;
# if !defined (_STLP_NO_LONG_DOUBLE)
bp = _Stl_qfcvtR(__x, 0, &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
# else
bp = _Stl_fcvtR(__x, 0, &decpt, &sign _STLP_CVT_BUFFER(cvtbuf));
# endif
if (sign) {
out += '-';
}
out.append(bp, bp + decpt);
#endif // USE_PRINTF_INSTEAD
}
#if !defined (_STLP_NO_WCHAR_T)
void _STLP_CALL __convert_float_buffer( __iostring const& str, __iowstring &out,
const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot)
{
string::const_iterator str_ite(str.begin()), str_end(str.end());
//First loop, check the dot char
if (__check_dot) {
while (str_ite != str_end) {
if (*str_ite != '.') {
out += ct.widen(*str_ite++);
} else {
out += dot;
break;
}
}
} else {
if (str_ite != str_end) {
out += ct.widen(*str_ite);
}
}
if (str_ite != str_end) {
//Second loop, dot has been found, no check anymore
while (++str_ite != str_end) {
out += ct.widen(*str_ite);
}
}
}
#endif
void _STLP_CALL
__adjust_float_buffer(__iostring &str, char dot) {
if ('.' != dot) {
size_t __dot_pos = str.find('.');
if (__dot_pos != string::npos) {
str[__dot_pos] = dot;
}
}
}
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
// Local Variables:
// mode:C++
// End:
| yeKcim/warmux | trunk/build/symbian/lib/stlport/src/num_put_float.cpp | C++ | gpl-2.0 | 34,762 |
// g2o - General Graph Optimization
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vertex_pointxyz.h"
#include <stdio.h>
#ifdef G2O_HAVE_OPENGL
#include "../../stuff/opengl_wrapper.h"
#endif
#include <typeinfo>
namespace g2o {
bool VertexPointXYZ::read(std::istream& is) {
Vector3d lv;
for (int i=0; i<3; i++)
is >> lv[i];
setEstimate(lv);
return true;
}
bool VertexPointXYZ::write(std::ostream& os) const {
Vector3d lv=estimate();
for (int i=0; i<3; i++){
os << lv[i] << " ";
}
return os.good();
}
#ifdef G2O_HAVE_OPENGL
VertexPointXYZDrawAction::VertexPointXYZDrawAction(): DrawAction(typeid(VertexPointXYZ).name()){
}
bool VertexPointXYZDrawAction::refreshPropertyPtrs(HyperGraphElementAction::Parameters* params_){
if (! DrawAction::refreshPropertyPtrs(params_))
return false;
if (_previousParams){
_pointSize = _previousParams->makeProperty<FloatProperty>(_typeName + "::POINT_SIZE", 1.);
} else {
_pointSize = 0;
}
return true;
}
HyperGraphElementAction* VertexPointXYZDrawAction::operator()(HyperGraph::HyperGraphElement* element,
HyperGraphElementAction::Parameters* params ){
if (typeid(*element).name()!=_typeName)
return 0;
refreshPropertyPtrs(params);
if (! _previousParams)
return this;
if (_show && !_show->value())
return this;
VertexPointXYZ* that = static_cast<VertexPointXYZ*>(element);
glPushAttrib(GL_ENABLE_BIT | GL_POINT_BIT);
glDisable(GL_LIGHTING);
glColor3f(0.8f,0.5f,0.3f);
if (_pointSize) {
glPointSize(_pointSize->value());
}
glBegin(GL_POINTS);
glVertex3f((float)that->estimate()(0),(float)that->estimate()(1),(float)that->estimate()(2));
glEnd();
glPopAttrib();
return this;
}
#endif
VertexPointXYZWriteGnuplotAction::VertexPointXYZWriteGnuplotAction() :
WriteGnuplotAction(typeid(VertexPointXYZ).name())
{
}
HyperGraphElementAction* VertexPointXYZWriteGnuplotAction::operator()(HyperGraph::HyperGraphElement* element, HyperGraphElementAction::Parameters* params_ )
{
if (typeid(*element).name()!=_typeName)
return 0;
WriteGnuplotAction::Parameters* params=static_cast<WriteGnuplotAction::Parameters*>(params_);
if (!params->os){
std::cerr << __PRETTY_FUNCTION__ << ": warning, no valid os specified" << std::endl;
return 0;
}
VertexPointXYZ* v = static_cast<VertexPointXYZ*>(element);
*(params->os) << v->estimate().x() << " " << v->estimate().y() << " " << v->estimate().z() << " " << std::endl;
return this;
}
}
| CreativeCimmons/ORB-SLAM-Android-app | slam_ext/Thirdparty/g2o/g2o/types/slam3d/vertex_pointxyz.cpp | C++ | gpl-2.0 | 3,993 |
<?php
/**
* Floating Social Bar is the best social media plugin for WordPress
* that adds a floating bar with share buttons to your content
* without slowing down your site.
*
* @package Floating Social Bar
* @author Syed Balkhi
* @author Thomas Griffin
* @license GPL-2.0+
* @link http://wpbeginner.com/floating-social-bar/
* @copyright 2013 WPBeginner. All rights reserved.
*
* @wordpress-plugin
* Plugin Name: Floating Social Bar
* Plugin URI: http://wpbeginner.com/floating-social-bar/
* Description: Floating Social Bar is the best social media plugin for WordPress that adds a floating bar with share buttons to your content without slowing down your site.
* Version: 1.1.7
* Author: Syed Balkhi and Thomas Griffin
* Author URI: http://wpbeginner.com/
* Text Domain: fsb
* Contributors: smub, griffinjt
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /lang
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
// Load the main plugin class and widget class.
require_once( plugin_dir_path( __FILE__ ) . 'class-floating-social-bar.php' );
// Register hooks for activation, deactivation and uninstall instances.
register_activation_hook( __FILE__, array( 'floating_social_bar', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'floating_social_bar', 'deactivate' ) );
register_uninstall_hook( __FILE__, array( 'floating_social_bar', 'uninstall' ) );
// Initialize the plugin.
$floating_social_bar = floating_social_bar::get_instance();
// Generate a template tag for use in template files.
if ( ! function_exists( 'floating_social_bar' ) ) {
/**
* Floating Social Bar template tag.
*
* Allows you to insert a floating social bar anywhere in your template files.
* The keys currently available are 'facebook', 'twitter', 'google',
* 'linkedin', and 'pinterest'. The value should be set to true if you want to
* display that social service in the bar. Services will be output in the order
* that you specify in the $args array.
*
* @package Floating Social Bar
* @param array $args Args used for the floating social bar.
* @param bool $return Flag for returning or echoing the slider content.
*/
function floating_social_bar( $args = array(), $return = false ) {
// Prepare the args to be output into query string shortcode format.
$output_args = '';
foreach ( $args as $k => $v )
$output_args .= $k . '=' . $v . ' ';
// Return or echo the content via shortcode.
if ( $return )
return do_shortcode( '[fsb-social-bar ' . trim( $output_args ) . ']' );
else
echo do_shortcode( '[fsb-social-bar ' . trim( $output_args ) . ']' );
}
} | AhmedSayedAhmed/MM_Portal | wp-content/plugins/floating-social-bar/floating-social-bar.php | PHP | gpl-2.0 | 2,794 |
//=set test "Test" | AlexanderDolgan/juliawp | wp-content/themes/node_modules/gulp-rigger/node_modules/rigger/test/input-settings/stringval.js | JavaScript | gpl-2.0 | 18 |
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
#include "emu.h"
#include "ti8x.h"
#define LOG_GENERAL (1U << 0)
#define LOG_BITPROTO (1U << 1)
#define LOG_BYTEPROTO (1U << 2)
//#define VERBOSE (LOG_GENERAL | LOG_BITPROTO | LOG_BYTEPROTO)
#define LOG_OUTPUT_FUNC device().logerror
#include "logmacro.h"
#define LOGBITPROTO(...) LOGMASKED(LOG_BITPROTO, __VA_ARGS__)
#define LOGBYTEPROTO(...) LOGMASKED(LOG_BYTEPROTO, __VA_ARGS__)
DEFINE_DEVICE_TYPE(TI8X_LINK_PORT, ti8x_link_port_device, "ti8x_link_port", "TI-8x Link Port")
ti8x_link_port_device::ti8x_link_port_device(
machine_config const &mconfig,
char const *tag,
device_t *owner,
uint32_t clock)
: ti8x_link_port_device(mconfig, TI8X_LINK_PORT, tag, owner, clock)
{
}
ti8x_link_port_device::ti8x_link_port_device(
machine_config const &mconfig,
device_type type,
char const *tag,
device_t *owner,
uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_single_card_slot_interface<device_ti8x_link_port_interface>(mconfig, *this)
, m_tip_handler(*this)
, m_ring_handler(*this)
, m_dev(nullptr)
, m_tip_in(true)
, m_tip_out(true)
, m_ring_in(true)
, m_ring_out(true)
{
}
WRITE_LINE_MEMBER(ti8x_link_port_device::tip_w)
{
if (bool(state) != m_tip_out)
{
m_tip_out = bool(state);
if (m_dev)
m_dev->input_tip(m_tip_out ? 1 : 0);
}
}
WRITE_LINE_MEMBER(ti8x_link_port_device::ring_w)
{
if (bool(state) != m_ring_out)
{
m_ring_out = bool(state);
if (m_dev)
m_dev->input_ring(m_ring_out ? 1 : 0);
}
}
void ti8x_link_port_device::device_start()
{
m_tip_handler.resolve_safe();
m_ring_handler.resolve_safe();
save_item(NAME(m_tip_in));
save_item(NAME(m_tip_out));
save_item(NAME(m_ring_in));
save_item(NAME(m_ring_out));
m_tip_in = m_tip_out = true;
m_ring_in = m_ring_out = true;
}
void ti8x_link_port_device::device_config_complete()
{
m_dev = get_card_device();
}
device_ti8x_link_port_interface::device_ti8x_link_port_interface(
machine_config const &mconfig,
device_t &device)
: device_interface(device, "ti8xlink")
, m_port(dynamic_cast<ti8x_link_port_device *>(device.owner()))
{
}
device_ti8x_link_port_bit_interface::device_ti8x_link_port_bit_interface(
machine_config const &mconfig,
device_t &device)
: device_ti8x_link_port_interface(mconfig, device)
, m_error_timer(nullptr)
, m_bit_phase(IDLE)
, m_tx_bit_buffer(EMPTY)
, m_tip_in(true)
, m_ring_in(true)
{
}
void device_ti8x_link_port_bit_interface::interface_pre_start()
{
device_ti8x_link_port_interface::interface_pre_start();
if (!m_error_timer)
m_error_timer = device().machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(device_ti8x_link_port_bit_interface::bit_timeout), this));
m_bit_phase = IDLE;
m_tx_bit_buffer = EMPTY;
m_tip_in = m_ring_in = true;
}
void device_ti8x_link_port_bit_interface::interface_post_start()
{
device_ti8x_link_port_interface::interface_post_start();
device().save_item(NAME(m_bit_phase));
device().save_item(NAME(m_tx_bit_buffer));
device().save_item(NAME(m_tip_in));
device().save_item(NAME(m_ring_in));
}
void device_ti8x_link_port_bit_interface::interface_pre_reset()
{
device_ti8x_link_port_interface::interface_pre_reset();
m_error_timer->reset();
m_bit_phase = (m_tip_in && m_ring_in) ? IDLE : WAIT_IDLE;
m_tx_bit_buffer = EMPTY;
output_tip(1);
output_ring(1);
}
void device_ti8x_link_port_bit_interface::send_bit(bool data)
{
LOGBITPROTO("queue %d bit\n", data ? 1 : 0);
if (EMPTY != m_tx_bit_buffer)
device().logerror("device_ti8x_link_port_bit_interface: warning: transmit buffer overrun\n");
m_tx_bit_buffer = data ? PENDING_1 : PENDING_0;
if (IDLE == m_bit_phase)
check_tx_bit_buffer();
else if (WAIT_IDLE == m_bit_phase)
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
}
void device_ti8x_link_port_bit_interface::accept_bit()
{
switch (m_bit_phase)
{
// can't accept a bit that isn't being held
case IDLE:
case WAIT_ACK_0:
case WAIT_ACK_1:
case WAIT_REL_0:
case WAIT_REL_1:
case ACK_0:
case ACK_1:
case WAIT_IDLE:
fatalerror("device_ti8x_link_port_bit_interface: attempt to accept bit when not holding");
break;
// release the acknowledgement - if the ring doesn't rise we've lost sync
case HOLD_0:
assert(m_tip_in);
output_ring(1);
if (m_ring_in)
{
LOGBITPROTO("accepted 0 bit\n");
check_tx_bit_buffer();
}
else
{
LOGBITPROTO("accepted 0 bit, ring low (collision) - waiting for bus idle\n");
m_error_timer->reset((EMPTY == m_tx_bit_buffer) ? attotime::never : attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_IDLE;
bit_collision();
}
break;
// release the acknowledgement - if the tip doesn't rise we've lost sync
case HOLD_1:
assert(m_ring_in);
output_tip(1);
if (m_tip_in)
{
LOGBITPROTO("accepted 1 bit\n");
check_tx_bit_buffer();
}
else
{
LOGBITPROTO("accepted 1 bit, tip low (collision) - waiting for bus idle\n");
m_error_timer->reset((EMPTY == m_tx_bit_buffer) ? attotime::never : attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_IDLE;
bit_collision();
}
break;
// something very bad happened (heap smash?)
default:
throw false;
}
}
WRITE_LINE_MEMBER(device_ti8x_link_port_bit_interface::input_tip)
{
m_tip_in = bool(state);
switch (m_bit_phase)
{
// if tip falls while idle, it's the beginning of an incoming 0
case IDLE:
if (!m_tip_in)
{
LOGBITPROTO("falling edge on tip, acknowledging 0 bit\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = ACK_0;
output_ring(0);
}
break;
// we're driving tip low in this state, ignore it
case WAIT_ACK_0:
case ACK_1:
case HOLD_1:
break;
// tip must fall to acknowledge outgoing 1
case WAIT_ACK_1:
if (!m_tip_in)
{
LOGBITPROTO("falling edge on tip, 1 bit acknowledged, confirming\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_REL_1;
output_ring(1);
}
break;
// if tip falls now, we've lost sync
case WAIT_REL_0:
case HOLD_0:
if (!m_tip_in)
{
LOGBITPROTO("falling edge on tip, lost sync, waiting for bus idle\n");
m_error_timer->reset((EMPTY == m_tx_bit_buffer) ? attotime::never : attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_IDLE;
output_ring(1);
bit_collision();
}
break;
// tip must rise to complete outgoing 1 sequence
case WAIT_REL_1:
if (m_tip_in)
{
assert(!m_ring_in);
LOGBITPROTO("rising edge on tip, 1 bit sent\n");
check_tx_bit_buffer();
bit_sent();
}
break;
// tip must rise to accept our acknowledgement
case ACK_0:
if (m_tip_in)
{
LOGBITPROTO("rising edge on tip, 0 bit acknowledge confirmed, holding\n");
m_error_timer->reset();
m_bit_phase = HOLD_0;
bit_received(false);
}
break;
// if the bus is available, check for bit to send
case WAIT_IDLE:
if (m_tip_in && m_ring_in)
{
LOGBITPROTO("rising edge on tip, bus idle detected\n");
check_tx_bit_buffer();
}
break;
// something very bad happened (heap smash?)
default:
throw false;
}
}
WRITE_LINE_MEMBER(device_ti8x_link_port_bit_interface::input_ring)
{
m_ring_in = bool(state);
switch (m_bit_phase)
{
// if ring falls while idle, it's the beginning of an incoming 1
case IDLE:
if (!m_ring_in)
{
LOGBITPROTO("falling edge on ring, acknowledging 1 bit\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = ACK_1;
output_tip(0);
}
break;
// ring must fall to acknowledge outgoing 0
case WAIT_ACK_0:
if (!m_ring_in)
{
LOGBITPROTO("falling edge on ring, 0 bit acknowledged, confirming\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_REL_0;
output_tip(1);
}
break;
// we're driving ring low in this state, ignore it
case WAIT_ACK_1:
case ACK_0:
case HOLD_0:
break;
// ring must rise to complete outgoing 0 sequence
case WAIT_REL_0:
if (m_ring_in)
{
assert(!m_tip_in);
LOGBITPROTO("rising edge on ring, 0 bit sent\n");
check_tx_bit_buffer();
bit_sent();
}
break;
// if ring falls now, we've lost sync
case WAIT_REL_1:
case HOLD_1:
if (!m_ring_in)
{
LOGBITPROTO("falling edge on ring, lost sync, waiting for bus idle\n");
m_error_timer->reset((EMPTY == m_tx_bit_buffer) ? attotime::never : attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_IDLE;
output_tip(1);
bit_collision();
}
break;
// ring must rise to accept our acknowledgement
case ACK_1:
if (m_ring_in)
{
LOGBITPROTO("rising edge on ring, 1 bit acknowledge confirmed, holding\n");
m_error_timer->reset();
m_bit_phase = HOLD_1;
bit_received(true);
}
break;
// if the bus is available, check for bit to send
case WAIT_IDLE:
if (m_tip_in && m_ring_in)
{
LOGBITPROTO("rising edge on tip, bus idle detected\n");
check_tx_bit_buffer();
}
break;
// something very bad happened (heap smash?)
default:
throw false;
}
}
TIMER_CALLBACK_MEMBER(device_ti8x_link_port_bit_interface::bit_timeout)
{
switch (m_bit_phase)
{
// something very bad happened (heap smash?)
case IDLE:
case HOLD_0:
case HOLD_1:
default:
throw false;
// receive timeout
case ACK_0:
case ACK_1:
LOGBITPROTO("timeout acknowledging %d bit\n", (ACK_0 == m_bit_phase) ? 0 : 1);
output_tip(1);
output_ring(1);
if (m_tip_in && m_ring_in)
{
check_tx_bit_buffer();
}
else
{
LOGBITPROTO("waiting for bus idle\n");
m_error_timer->reset((EMPTY == m_tx_bit_buffer) ? attotime::never : attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_IDLE;
}
bit_receive_timeout();
break;
// send timeout:
case WAIT_IDLE:
assert(EMPTY != m_tx_bit_buffer);
[[fallthrough]];
case WAIT_ACK_0:
case WAIT_ACK_1:
case WAIT_REL_0:
case WAIT_REL_1:
LOGBITPROTO("timeout sending bit\n");
m_error_timer->reset();
m_bit_phase = (m_tip_in && m_ring_in) ? IDLE : WAIT_IDLE;
m_tx_bit_buffer = EMPTY;
output_tip(1);
output_ring(1);
bit_send_timeout();
break;
}
}
void device_ti8x_link_port_bit_interface::check_tx_bit_buffer()
{
assert(m_tip_in);
assert(m_ring_in);
switch (m_tx_bit_buffer)
{
// nothing to do
case EMPTY:
LOGBITPROTO("no pending bit, entering idle state\n");
m_error_timer->reset();
m_bit_phase = IDLE;
break;
// pull tip low and wait for acknowledgement
case PENDING_0:
LOGBITPROTO("sending 0 bit, pulling tip low\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_ACK_0;
m_tx_bit_buffer = EMPTY;
output_tip(0);
break;
// pull ring low and wait for acknowledgement
case PENDING_1:
LOGBITPROTO("sending 1 bit, pulling ring low\n");
m_error_timer->reset(attotime(1, 0)); // TODO: configurable timeout
m_bit_phase = WAIT_ACK_1;
m_tx_bit_buffer = EMPTY;
output_ring(0);
break;
// something very bad happened (heap smash?)
default:
throw false;
}
}
device_ti8x_link_port_byte_interface::device_ti8x_link_port_byte_interface(
machine_config const &mconfig,
device_t &device)
: device_ti8x_link_port_bit_interface(mconfig, device)
, m_tx_byte_buffer(0U)
, m_rx_byte_buffer(0U)
{
}
void device_ti8x_link_port_byte_interface::interface_pre_start()
{
device_ti8x_link_port_bit_interface::interface_pre_start();
m_tx_byte_buffer = m_rx_byte_buffer = 0U;
}
void device_ti8x_link_port_byte_interface::interface_post_start()
{
device_ti8x_link_port_bit_interface::interface_post_start();
device().save_item(NAME(m_tx_byte_buffer));
device().save_item(NAME(m_rx_byte_buffer));
}
void device_ti8x_link_port_byte_interface::interface_pre_reset()
{
device_ti8x_link_port_bit_interface::interface_pre_reset();
m_tx_byte_buffer = m_rx_byte_buffer = 0U;
}
void device_ti8x_link_port_byte_interface::send_byte(u8 data)
{
if (m_tx_byte_buffer)
device().logerror("device_ti8x_link_port_byte_interface: warning: transmit buffer overrun\n");
LOGBYTEPROTO("sending byte 0x%02X\n", data);
m_tx_byte_buffer = 0x0080 | u16(data >> 1);
send_bit(BIT(data, 0));
}
void device_ti8x_link_port_byte_interface::accept_byte()
{
assert(BIT(m_rx_byte_buffer, 8));
LOGBYTEPROTO("accepting final bit of byte\n");
m_rx_byte_buffer = 0U;
accept_bit();
}
void device_ti8x_link_port_byte_interface::bit_collision()
{
LOGBYTEPROTO("bit collection, clearing byte buffers\n");
m_tx_byte_buffer = m_rx_byte_buffer = 0U;
byte_collision();
}
void device_ti8x_link_port_byte_interface::bit_send_timeout()
{
LOGBYTEPROTO("bit send timeout, clearing send byte buffer\n");
m_tx_byte_buffer = 0U;
byte_send_timeout();
}
void device_ti8x_link_port_byte_interface::bit_receive_timeout()
{
LOGBYTEPROTO("bit receive timeout, clearing receive byte buffer\n");
m_rx_byte_buffer = 0U;
byte_receive_timeout();
}
void device_ti8x_link_port_byte_interface::bit_sent()
{
assert(m_tx_byte_buffer);
bool const data(BIT(m_tx_byte_buffer, 0));
if (m_tx_byte_buffer >>= 1)
{
LOGBYTEPROTO("bit sent, sending next bit of byte\n");
send_bit(data);
}
else
{
assert(data);
LOGBYTEPROTO("final bit of byte sent\n");
byte_sent();
}
}
void device_ti8x_link_port_byte_interface::bit_received(bool data)
{
assert(!BIT(m_rx_byte_buffer, 8));
m_rx_byte_buffer = (!m_rx_byte_buffer ? 0x8000 : (m_rx_byte_buffer >> 1)) | (data ? 0x0080U : 0x0000U);
if (BIT(m_rx_byte_buffer, 8))
{
LOGBYTEPROTO("received final bit of byte 0x%02X\n", u8(m_rx_byte_buffer));
byte_received(u8(m_rx_byte_buffer));
}
else
{
LOGBYTEPROTO("bit received, accepting\n");
accept_bit();
}
}
#include "bitsocket.h"
#include "graphlinkhle.h"
#include "teeconn.h"
#include "tispeaker.h"
void default_ti8x_link_devices(device_slot_interface &device)
{
device.option_add("bitsock", TI8X_BIT_SOCKET);
device.option_add("glinkhle", TI8X_GRAPH_LINK_HLE);
device.option_add("tee", TI8X_TEE_CONNECTOR);
device.option_add("monospkr", TI8X_SPEAKER_MONO);
device.option_add("stereospkr", TI8X_SPEAKER_STEREO);
}
| johnparker007/mame | src/devices/bus/ti8x/ti8x.cpp | C++ | gpl-2.0 | 14,113 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOWEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces apostrophe character with its illegal double unicode counterpart
>>> tamper("1 AND '1'='1")
'1 AND %00%271%00%27=%00%271'
"""
return payload.replace('\'', "%00%27") if payload else payload
| golismero/golismero | tools/sqlmap/tamper/apostrophenullencode.py | Python | gpl-2.0 | 503 |
<?php
//============================================================+
// File name : example_2d_png.php
// Version : 1.0.000
// Begin : 2011-07-21
// Last Update : 2013-03-17
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
* @file
* Example for tcpdf_barcodes_2d.php class
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
*/
// include 2D barcode class
require_once(dirname(__FILE__).'/../../tcpdf_barcodes_2d.php');
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(4, 4, array(0,0,0));
//============================================================+
// END OF FILE
//============================================================+
| siteslab/profile | sites/all/libraries/tcpdf/examples/barcodes/example_2d_pdf417_png.php | PHP | gpl-2.0 | 1,979 |
/***************************************************************************
tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 ServiceRequester.hpp
ServiceRequester.hpp - description
-------------------
begin : Tue September 07 2010
copyright : (C) 2010 The SourceWorks
email : peter@thesourceworks.com
***************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public *
* License as published by the Free Software Foundation; *
* version 2 of the License. *
* *
* As a special exception, you may use this file as part of a free *
* software library without restriction. Specifically, if other files *
* instantiate templates or use macros or inline functions from this *
* file, or you compile this file and link it with other files to *
* produce an executable, this file does not by itself cause the *
* resulting executable to be covered by the GNU General Public *
* License. This exception does not however invalidate any other *
* reasons why the executable file might be covered by the GNU General *
* Public License. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307 USA *
* *
***************************************************************************/
#ifndef ORO_SERVICEREQUESTER_HPP_
#define ORO_SERVICEREQUESTER_HPP_
#include "rtt-config.h"
#include "rtt-fwd.hpp"
#include "base/OperationCallerBaseInvoker.hpp"
#include "Service.hpp"
#include <map>
#include <vector>
#include <string>
#include <boost/enable_shared_from_this.hpp>
#if BOOST_VERSION >= 104000 && BOOST_VERSION < 105300
#include <boost/smart_ptr/enable_shared_from_this2.hpp>
#endif
#if BOOST_VERSION >= 105300
#include <boost/smart_ptr/enable_shared_from_raw.hpp>
#endif
namespace RTT
{
/**
* An object that expresses you wish to use a service.
* The ServiceRequester is symmetrical to the Service.
* Where a Service registers operations that a component can
* execute ('provides'), the ServiceRequester registers the methods that a caller
* wishes to call ('requires'). One method in a ServiceRequester maps
* to one operation in a Service.
*
* Typical use is to inherit from ServiceRequester and add named OperationCaller objects
* to it using addOperationCaller. @see RTT::Scripting for an example.
* @ingroup Services
*/
class RTT_API ServiceRequester :
#if BOOST_VERSION >= 104000
#if BOOST_VERSION < 105300
public boost::enable_shared_from_this2<ServiceRequester>
#else
public boost::enable_shared_from_raw
#endif
#else
public boost::enable_shared_from_this<ServiceRequester>
#endif
{
public:
typedef std::vector<std::string> RequesterNames;
typedef std::vector<std::string> OperationCallerNames;
typedef boost::shared_ptr<ServiceRequester> shared_ptr;
typedef boost::shared_ptr<const ServiceRequester> shared_constptr;
#if BOOST_VERSION >= 105300
ServiceRequester::shared_ptr shared_from_this() { return boost::shared_from_raw(this); }
ServiceRequester::shared_constptr shared_from_this() const { return boost::shared_from_raw(this); }
#endif
ServiceRequester(const std::string& name, TaskContext* owner = 0);
virtual ~ServiceRequester();
const std::string& getRequestName() const { return mrname; }
RequesterNames getRequesterNames() const;
/**
* The owner is the top-level TaskContext owning this service
* (indirectly).
*/
TaskContext* getServiceOwner() const { return mrowner; }
/**
* Sets the owning TaskContext that is considered as the
* caller of requested operations.
*/
void setOwner(TaskContext* new_owner);
/**
* Returns the service we're referencing.
* In case you used connectTo to more than one service,
* this returns the service which was used when connectTo
* first returned true.
*/
Service::shared_ptr getReferencedService() { return mprovider; }
bool addOperationCaller( base::OperationCallerBaseInvoker& mbi);
OperationCallerNames getOperationCallerNames() const;
base::OperationCallerBaseInvoker* getOperationCaller(const std::string& name);
ServiceRequester::shared_ptr requires();
ServiceRequester::shared_ptr requires(const std::string& service_name);
/**
* Add a new ServiceRequester to this TaskContext.
*
* @param obj This object becomes owned by this TaskContext.
*
* @return true if it could be added, false if such
* service requester already exists.
*/
bool addServiceRequester(shared_ptr obj);
/**
* Query if this service requires certain sub-services.
* @param service_name
* @return
*/
bool requiresService(const std::string& service_name) {
return mrequests.find(service_name) != mrequests.end();
}
/**
* Connects this service's methods to the operations provided by op.
* This method tries to match as many as possible method-operation pairs.
*
* You may call this function with different instances of sp to 'resolve'
* missing functions, only the non-connected methods will be further filled in.
* @param sp An interface-compatible Service.
*
* @return true if all methods of that are required are provided, false
* if not all methods could yet be matched.
*/
virtual bool connectTo(Service::shared_ptr sp);
/**
* Returns true when all methods were resolved.
* @return
*/
virtual bool ready() const;
/**
* Disconnects all methods from their implementation.
*/
virtual void disconnect();
/**
* Remove all operation callers from this service requester.
*/
virtual void clear();
protected:
typedef std::map< std::string, ServiceRequester::shared_ptr > Requests;
/// the services we implement.
Requests mrequests;
/// Our methods
typedef std::map<std::string, base::OperationCallerBaseInvoker*> OperationCallers;
OperationCallers mmethods;
std::string mrname;
TaskContext* mrowner;
Service::shared_ptr mprovider;
};
}
#endif /* ORO_SERVICEREQUESTER_HPP_ */
| shyamalschandra/rtt | rtt/ServiceRequester.hpp | C++ | gpl-2.0 | 7,747 |
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php');
/**
* Registration controller class for Users.
*
* @since 1.6
*/
class UsersControllerRegistration extends UsersController
{
/**
* Method to activate a user.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function activate()
{
$user = JFactory::getUser();
$input = JFactory::getApplication()->input;
$uParams = JComponentHelper::getParams('com_users');
// Check for admin activation. Don't allow non-super-admin to delete a super admin
if ($uParams->get('useractivation') != 2 && $user->get('id'))
{
$this->setRedirect('index.php');
return true;
}
// If user registration or account activation is disabled, throw a 403.
if ($uParams->get('useractivation') == 0 || $uParams->get('allowUserRegistration') == 0)
{
JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
return false;
}
$model = $this->getModel('Registration', 'UsersModel');
$token = $input->getAlnum('token');
// Check that the token is in a valid format.
if ($token === null || strlen($token) !== 32)
{
JError::raiseError(403, JText::_('JINVALID_TOKEN'));
return false;
}
// Get the User ID
$userIdToActivate = $model->getUserIdFromToken($token);
if (!$userIdToActivate)
{
JError::raiseError(403, JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND'));
return false;
}
// Get the user we want to activate
$userToActivate = JFactory::getUser($userIdToActivate);
// Admin activation is on and admin is activating the account
if (($uParams->get('useractivation') == 2) && $userToActivate->getParam('activate', 0))
{
// If a user admin is not logged in, redirect them to the login page with a error message
if (!$user->authorise('core.create', 'com_users'))
{
$activationUrl = 'index.php?option=com_users&task=registration.activate&token=' . $token;
$loginUrl = 'index.php?option=com_users&view=login&return=' . base64_encode($activationUrl);
// In case we still run into this in the second step the user does not have the right permissions
$message = JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION_PERMISSIONS');
// When we are not logged in we should login
if ($user->guest)
{
$message = JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION');
}
$this->setMessage($message);
$this->setRedirect(JRoute::_($loginUrl, false));
return false;
}
}
// Attempt to activate the user.
$return = $model->activate($token);
// Check for errors.
if ($return === false)
{
// Redirect back to the home page.
$this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'error');
$this->setRedirect('index.php');
return false;
}
$useractivation = $uParams->get('useractivation');
// Redirect to the login screen.
if ($useractivation == 0)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
elseif ($useractivation == 1)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
elseif ($return->getParam('activate'))
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}
else
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}
return true;
}
/**
* Method to register a user.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function register()
{
// Check for request forgeries.
$this->checkToken();
// If registration is disabled - Redirect to login page.
if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0)
{
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
return false;
}
$app = JFactory::getApplication();
$model = $this->getModel('Registration', 'UsersModel');
// Get the user data.
$requestData = $this->input->post->get('jform', array(), 'array');
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
$data = $model->validate($form, $requestData);
// Check for validation errors.
if ($data === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'error');
}
else
{
$app->enqueueMessage($errors[$i], 'error');
}
}
// Save the data in the session.
$app->setUserState('com_users.registration.data', $requestData);
// Redirect back to the registration screen.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false));
return false;
}
// Attempt to save the data.
$return = $model->register($data);
// Check for errors.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('com_users.registration.data', $data);
// Redirect back to the edit screen.
$this->setMessage($model->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false));
return false;
}
// Flush the data from the session.
$app->setUserState('com_users.registration.data', null);
// Redirect to the profile screen.
if ($return === 'adminactivate')
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}
elseif ($return === 'useractivate')
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}
else
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
return true;
}
}
| tkaniowski/bj25 | components/com_users/controllers/registration.php | PHP | gpl-2.0 | 6,815 |
# -*- coding: utf-8 -*-
"""
This script initializes the plugin, making it known to QGIS.
"""
def classFactory(iface):
from HelloWorld import HelloWorld
return HelloWorld(iface)
| qgis/QGIS-Django | qgis-app/plugins/tests/HelloWorld/2.3-full-changed-repository/HelloWorld/__init__.py | Python | gpl-2.0 | 183 |
<?php
/**
* @author JoomlaShine.com http://www.joomlashine.com
* @copyright Copyright (C) 2008 - 2011 JoomlaShine.com. All rights reserved.
* @license GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access
defined('_JEXEC') or die('Restricted index access');
// Load template framework
if (!defined('JSN_PATH_TPLFRAMEWORK')) {
require_once JPATH_ROOT . '/plugins/system/jsntplframework/jsntplframework.defines.php';
require_once JPATH_ROOT . '/plugins/system/jsntplframework/libraries/joomlashine/loader.php';
}
define('YOURBASEPATH', dirname(__FILE__));
if (!isset($this->error))
{
$this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$this->debug = false;
}
// Preparing template parameters
JSNTplTemplateHelper::prepare(false, false);
// Retrieve document object
$document = JFactory::getDocument();
/* URL where logo image should link to (! without preceding slash !)
Leave this box empty if you want your logo to be clickable. */
$logoLink = $document->logoLink;
if (strpos($logoLink, "http")=== false && $logoLink != '')
{
$utils = JSNTplUtils::getInstance();
$logoLink = $utils->trimPreceddingSlash($logoLink);
$logoLink = $this->baseurl . '/' . $logoLink;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- <?php echo $document->template; ?> <?php echo $document->version ?> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<title><?php echo $this->error->getCode(); ?>-<?php echo $this->title; ?></title>
<link rel="stylesheet" href="<?php echo $this->baseurl . '/templates/' . $this->template ?>/css/error.css" type="text/css" />
</head>
<body id="jsn-master" class="jsn-color-<?php echo $document->templateColor ?>">
<div id="jsn-page">
<div id="jsn-page_inner">
<div id="jsn-header">
<div id="jsn-logo">
<a href="<?php echo $logoLink ?>" title="<?php echo $document->logoSlogan; ?>">
<?php
if ($document->logoFile != "")
$logo_path = $document->logoFile;
else
$logo_path = $this->baseurl . '/templates/' . $this->template . "/images/logo.png";
?>
<img src="<?php echo $logo_path; ?>" alt="<?php echo $document->logoSlogan; ?>" />
</a>
</div>
</div>
<div id="jsn-body" class="clearafter">
<div id="jsn-error-heading">
<h1><?php echo $this->error->getCode(); ?> <span class="heading-medium"><?php echo JText::_('JERROR_ERROR'); ?></span></h1>
</div>
<div id="jsn-error-content" class="jsn-error-page">
<div id="jsn-error-content_inner">
<h1><span class="heading-small"><?php echo $this->error->getMessage(); ?></span></h1>
<hr />
<h3><?php echo JText::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?></h3>
<ul>
<li><?php echo JText::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_MIS_TYPED_ADDRESS'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_REQUESTED_RESOURCE_WAS_NOT_FOUND'); ?></li>
<li><?php echo JText::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?></li>
</ul>
<hr />
<h3><?php echo JText::_('JSN_TPLFW_ERROR_LAYOUT_SEARCH_ON_THE_WEBSITE'); ?></h3>
<form id="search-form" method="post" action="index.php">
<div class="search">
<input type="text" onfocus="if(this.value=='search...') this.value='';" onblur="if(this.value=='') this.value='search...';" value="" size="20" class="inputbox" alt="Search" maxlength="20" id="mod-search-searchword" name="searchword">
<input type="submit" onclick="this.form.searchword.focus();" class="button link-button" value="Search">
</div>
<input type="hidden" value="search" name="task">
<input type="hidden" value="com_search" name="option">
<input type="hidden" value="435" name="Itemid">
</form>
<p id="link-goback">or <a href="<?php echo $this->baseurl; ?>/index.php" class="link-action" title="<?php echo JText::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?>"><?php echo JText::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?></a></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | Galene/svitanok.ck.ua | templates/jsn_yoyo_pro/error.php | PHP | gpl-2.0 | 4,569 |
/*
* Copyright (C) 2012-2013 Team XBMC
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "EventLoop.h"
#include "XBMCApp.h"
#include "AndroidExtra.h"
#include <dlfcn.h>
#define IS_FROM_SOURCE(v, s) ((v & s) == s)
CEventLoop::CEventLoop(android_app* application)
: m_enabled(false),
m_application(application),
m_activityHandler(NULL), m_inputHandler(NULL)
{
if (m_application == NULL)
return;
m_application->userData = this;
m_application->onAppCmd = activityCallback;
m_application->onInputEvent = inputCallback;
}
void CEventLoop::run(IActivityHandler &activityHandler, IInputHandler &inputHandler)
{
int ident;
int events;
struct android_poll_source* source;
m_activityHandler = &activityHandler;
m_inputHandler = &inputHandler;
CXBMCApp::android_printf("CEventLoop: starting event loop");
while (1)
{
// We will block forever waiting for events.
while ((ident = ALooper_pollAll(-1, NULL, &events, (void**)&source)) >= 0)
{
// Process this event.
if (source != NULL)
source->process(m_application, source);
// Check if we are exiting.
if (m_application->destroyRequested)
{
CXBMCApp::android_printf("CEventLoop: we are being destroyed");
return;
}
}
}
}
void CEventLoop::processActivity(int32_t command)
{
switch (command)
{
case APP_CMD_CONFIG_CHANGED:
m_activityHandler->onConfigurationChanged();
break;
case APP_CMD_INIT_WINDOW:
// The window is being shown, get it ready.
m_activityHandler->onCreateWindow(m_application->window);
// set the proper DPI value
m_inputHandler->setDPI(CXBMCApp::GetDPI());
break;
case APP_CMD_WINDOW_RESIZED:
// The window has been resized
m_activityHandler->onResizeWindow();
break;
case APP_CMD_TERM_WINDOW:
// The window is being hidden or closed, clean it up.
m_activityHandler->onDestroyWindow();
break;
case APP_CMD_GAINED_FOCUS:
m_activityHandler->onGainFocus();
break;
case APP_CMD_LOST_FOCUS:
m_activityHandler->onLostFocus();
break;
case APP_CMD_LOW_MEMORY:
m_activityHandler->onLowMemory();
break;
case APP_CMD_START:
m_activityHandler->onStart();
break;
case APP_CMD_RESUME:
m_activityHandler->onResume();
break;
case APP_CMD_SAVE_STATE:
// The system has asked us to save our current state. Do so.
m_activityHandler->onSaveState(&m_application->savedState, &m_application->savedStateSize);
break;
case APP_CMD_PAUSE:
m_activityHandler->onPause();
break;
case APP_CMD_STOP:
m_activityHandler->onStop();
break;
case APP_CMD_DESTROY:
m_activityHandler->onDestroy();
break;
default:
break;
}
}
int32_t CEventLoop::processInput(AInputEvent* event)
{
int32_t rtn = 0;
int32_t type = AInputEvent_getType(event);
int32_t source = AInputEvent_getSource(event);
// handle joystick input
if (IS_FROM_SOURCE(source, AINPUT_SOURCE_GAMEPAD) || IS_FROM_SOURCE(source, AINPUT_SOURCE_JOYSTICK))
{
if (m_inputHandler->onJoyStickEvent(event))
return true;
}
switch(type)
{
case AINPUT_EVENT_TYPE_KEY:
rtn = m_inputHandler->onKeyboardEvent(event);
break;
case AINPUT_EVENT_TYPE_MOTION:
if (IS_FROM_SOURCE(source, AINPUT_SOURCE_TOUCHSCREEN))
rtn = m_inputHandler->onTouchEvent(event);
else if (IS_FROM_SOURCE(source, AINPUT_SOURCE_MOUSE))
rtn = m_inputHandler->onMouseEvent(event);
break;
}
return rtn;
}
void CEventLoop::activityCallback(android_app* application, int32_t command)
{
if (application == NULL || application->userData == NULL)
return;
CEventLoop& eventLoop = *((CEventLoop*)application->userData);
eventLoop.processActivity(command);
}
int32_t CEventLoop::inputCallback(android_app* application, AInputEvent* event)
{
if (application == NULL || application->userData == NULL || event == NULL)
return 0;
CEventLoop& eventLoop = *((CEventLoop*)application->userData);
return eventLoop.processInput(event);
}
| ironman771/xbmc | xbmc/platform/android/activity/EventLoop.cpp | C++ | gpl-2.0 | 4,826 |
<?php
/**
* The template for displaying posts in the Audio post format
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php twentyfourteen_post_thumbnail(); ?>
<header class="entry-header">
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
<div class="entry-meta">
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
</div><!-- .entry-meta -->
<?php
endif;
if ( is_single() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
endif;
?>
<div class="entry-meta">
<span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'audio' ) ); ?>"><?php echo get_post_format_string( 'audio' ); ?></a>
</span>
<?php twentyfourteen_posted_on(); ?>
<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
esc_html__( 'Continue reading %s', 'twentyfourteen' ),
the_title( '<span class="screen-reader-text">', '</span> <span class="meta-nav">→</span>', false )
) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
</article><!-- #post-## -->
| di0fref/wordpress_fahlslstad | wp-content/themes/twentyfourteen/content-audio.php | PHP | gpl-2.0 | 2,316 |
<?php
namespace Drupal\Tests\node\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Test D6NodeDeriver.
*
* @group migrate_drupal_6
*/
class MigrateNodeDeriverTest extends MigrateDrupal6TestBase {
/**
* The migration plugin manager.
*
* @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface
*/
protected $pluginManager;
/**
* {@inheritdoc}
*/
public function setUp(): void {
parent::setUp();
$this->pluginManager = $this->container->get('plugin.manager.migration');
}
/**
* Tests node translation migrations with translation disabled.
*/
public function testNoTranslations() {
// Without content_translation, there should be no translation migrations.
$migrations = $this->pluginManager->createInstances('d6_node_translation');
$this->assertSame([], $migrations,
"No node translation migrations without content_translation");
}
/**
* Tests node translation migrations with translation enabled.
*/
public function testTranslations() {
// With content_translation, there should be translation migrations for
// each content type.
$this->enableModules(['language', 'content_translation']);
$this->assertTrue($this->container->get('plugin.manager.migration')->hasDefinition('d6_node_translation:story'), "Node translation migrations exist after content_translation installed");
}
}
| tobiasbuhrer/tobiasb | web/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php | PHP | gpl-2.0 | 1,430 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.