answer stringlengths 15 1.25M |
|---|
'use strict';
angular.module('mgcrea.ngStrap.datepicker', [
'mgcrea.ngStrap.helpers.dateParser',
'mgcrea.ngStrap.helpers.dateFormatter',
'mgcrea.ngStrap.tooltip'])
.provider('$datepicker', function() {
var defaults = this.defaults = {
animation: 'am-fade',
//uncommenting the following line will break backwards compatability
// prefixEvent: 'datepicker',
prefixClass: 'datepicker',
placement: 'bottom-left',
templateUrl: 'datepicker/datepicker.tpl.html',
trigger: 'focus',
container: false,
keyboard: true,
html: false,
delay: 0,
// lang: $locale.id,
useNative: false,
dateType: 'date',
dateFormat: 'shortDate',
timezone: null,
modelDateFormat: null,
dayFormat: 'dd',
monthFormat: 'MMM',
yearFormat: 'yyyy',
monthTitleFormat: 'MMMM yyyy',
yearTitleFormat: 'yyyy',
strictFormat: false,
autoclose: false,
minDate: -Infinity,
maxDate: +Infinity,
startView: 0,
minView: 0,
startWeek: 0,
daysOfWeekDisabled: '',
iconLeft: 'glyphicon <API key>',
iconRight: 'glyphicon <API key>'
};
this.$get = function($window, $document, $rootScope, $sce, $dateFormatter, datepickerViews, $tooltip, $timeout) {
var bodyEl = angular.element($window.document.body);
var isNative = /(ip(a|o)d|iphone|android)/ig.test($window.navigator.userAgent);
var isTouch = ('createTouch' in $window.document) && isNative;
if(!defaults.lang) defaults.lang = $dateFormatter.getDefaultLocale();
function DatepickerFactory(element, controller, config) {
var $datepicker = $tooltip(element, angular.extend({}, defaults, config));
var parentScope = config.scope;
var options = $datepicker.$options;
var scope = $datepicker.$scope;
if(options.startView) options.startView -= options.minView;
// View vars
var pickerViews = datepickerViews($datepicker);
$datepicker.$views = pickerViews.views;
var viewDate = pickerViews.viewDate;
scope.$mode = options.startView;
scope.$iconLeft = options.iconLeft;
scope.$iconRight = options.iconRight;
var $picker = $datepicker.$views[scope.$mode];
// Scope methods
scope.$select = function(date) {
$datepicker.select(date);
};
scope.$selectPane = function(value) {
$datepicker.$selectPane(value);
};
scope.$toggleMode = function() {
$datepicker.setMode((scope.$mode + 1) % $datepicker.$views.length);
};
// Public methods
$datepicker.update = function(date) {
// console.warn('$datepicker.update() newValue=%o', date);
if(angular.isDate(date) && !isNaN(date.getTime())) {
$datepicker.$date = date;
$picker.update.call($picker, date);
}
// Build only if pristine
$datepicker.$build(true);
};
$datepicker.updateDisabledDates = function(dateRanges) {
options.disabledDateRanges = dateRanges;
for(var i = 0, l = scope.rows.length; i < l; i++) {
angular.forEach(scope.rows[i], $datepicker.$setDisabledEl);
}
};
$datepicker.select = function(date, keep) {
// console.warn('$datepicker.select', date, scope.$mode);
if(!angular.isDate(controller.$dateValue)) controller.$dateValue = new Date(date);
if(!scope.$mode || keep) {
controller.$setViewValue(angular.copy(date));
controller.$render();
if(options.autoclose && !keep) {
$timeout(function() { $datepicker.hide(true); });
}
} else {
angular.extend(viewDate, {year: date.getFullYear(), month: date.getMonth(), date: date.getDate()});
$datepicker.setMode(scope.$mode - 1);
$datepicker.$build();
}
};
$datepicker.setMode = function(mode) {
// console.warn('$datepicker.setMode', mode);
scope.$mode = mode;
$picker = $datepicker.$views[scope.$mode];
$datepicker.$build();
};
// Protected methods
$datepicker.$build = function(pristine) {
// console.warn('$datepicker.$build() viewDate=%o', viewDate);
if(pristine === true && $picker.built) return;
if(pristine === false && !$picker.built) return;
$picker.build.call($picker);
};
$datepicker.$updateSelected = function() {
for(var i = 0, l = scope.rows.length; i < l; i++) {
angular.forEach(scope.rows[i], updateSelected);
}
};
$datepicker.$isSelected = function(date) {
return $picker.isSelected(date);
};
$datepicker.$setDisabledEl = function(el) {
el.disabled = $picker.isDisabled(el.date);
};
$datepicker.$selectPane = function(value) {
var steps = $picker.steps;
// set targetDate to first day of month to avoid problems with
// date values rollover. This assumes the viewDate does not
// depend on the day of the month
var targetDate = new Date(Date.UTC(viewDate.year + ((steps.year || 0) * value), viewDate.month + ((steps.month || 0) * value), 1));
angular.extend(viewDate, {year: targetDate.getUTCFullYear(), month: targetDate.getUTCMonth(), date: targetDate.getUTCDate()});
$datepicker.$build();
};
$datepicker.$onMouseDown = function(evt) {
// Prevent blur on mousedown on .dropdown-menu
evt.preventDefault();
evt.stopPropagation();
// Emulate click for mobile devices
if(isTouch) {
var targetEl = angular.element(evt.target);
if(targetEl[0].nodeName.toLowerCase() !== 'button') {
targetEl = targetEl.parent();
}
targetEl.triggerHandler('click');
}
};
$datepicker.$onKeyDown = function(evt) {
if (!/(38|37|39|40|13)/.test(evt.keyCode) || evt.shiftKey || evt.altKey) return;
evt.preventDefault();
evt.stopPropagation();
if(evt.keyCode === 13) {
if(!scope.$mode) {
return $datepicker.hide(true);
} else {
return scope.$apply(function() { $datepicker.setMode(scope.$mode - 1); });
}
}
// Navigate with keyboard
$picker.onKeyDown(evt);
parentScope.$digest();
};
// Private
function updateSelected(el) {
el.selected = $datepicker.$isSelected(el.date);
}
function focusElement() {
element[0].focus();
}
// Overrides
var _init = $datepicker.init;
$datepicker.init = function() {
if(isNative && options.useNative) {
element.prop('type', 'date');
element.css('-webkit-appearance', 'textfield');
return;
} else if(isTouch) {
element.prop('type', 'text');
element.attr('readonly', 'true');
element.on('click', focusElement);
}
_init();
};
var _destroy = $datepicker.destroy;
$datepicker.destroy = function() {
if(isNative && options.useNative) {
element.off('click', focusElement);
}
_destroy();
};
var _show = $datepicker.show;
$datepicker.show = function() {
_show();
// use timeout to hookup the events to prevent
// event bubbling from being processed imediately.
$timeout(function() {
// if $datepicker is no longer showing, don't setup events
if(!$datepicker.$isShown) return;
$datepicker.$element.on(isTouch ? 'touchstart' : 'mousedown', $datepicker.$onMouseDown);
if(options.keyboard) {
element.on('keydown', $datepicker.$onKeyDown);
}
}, 0, false);
};
var _hide = $datepicker.hide;
$datepicker.hide = function(blur) {
if(!$datepicker.$isShown) return;
$datepicker.$element.off(isTouch ? 'touchstart' : 'mousedown', $datepicker.$onMouseDown);
if(options.keyboard) {
element.off('keydown', $datepicker.$onKeyDown);
}
_hide(blur);
};
return $datepicker;
}
DatepickerFactory.defaults = defaults;
return DatepickerFactory;
};
})
.directive('bsDatepicker', function($window, $parse, $q, $dateFormatter, $dateParser, $datepicker) {
var defaults = $datepicker.defaults;
var isNative = /(ip(a|o)d|iphone|android)/ig.test($window.navigator.userAgent);
return {
restrict: 'EAC',
require: 'ngModel',
link: function postLink(scope, element, attr, controller) {
// Directive options
var options = {scope: scope};
angular.forEach(['template', 'templateUrl', 'controller', 'controllerAs', 'placement', 'container', 'delay', 'trigger', 'html', 'animation', 'autoclose', 'dateType', 'dateFormat', 'timezone', 'modelDateFormat', 'dayFormat', 'strictFormat', 'startWeek', 'startDate', 'useNative', 'lang', 'startView', 'minView', 'iconLeft', 'iconRight', 'daysOfWeekDisabled', 'id', 'prefixClass', 'prefixEvent'], function(key) {
if(angular.isDefined(attr[key])) options[key] = attr[key];
});
// use string regex match boolean attr falsy values, leave truthy values be
var falseValueRegExp = /^(false|0|)$/i;
angular.forEach(['html', 'container', 'autoclose', 'useNative'], function(key) {
if(angular.isDefined(attr[key]) && falseValueRegExp.test(attr[key]))
options[key] = false;
});
// Visibility binding support
attr.bsShow && scope.$watch(attr.bsShow, function(newValue, oldValue) {
if(!datepicker || !angular.isDefined(newValue)) return;
if(angular.isString(newValue)) newValue = !!newValue.match(/true|,?(datepicker),?/i);
newValue === true ? datepicker.show() : datepicker.hide();
});
// Initialize datepicker
var datepicker = $datepicker(element, controller, options);
options = datepicker.$options;
// Set expected iOS format
if(isNative && options.useNative) options.dateFormat = 'yyyy-MM-dd';
var lang = options.lang;
var formatDate = function(date, format) {
return $dateFormatter.formatDate(date, format, lang);
};
var dateParser = $dateParser({format: options.dateFormat, lang: lang, strict: options.strictFormat});
// Observe attributes for changes
angular.forEach(['minDate', 'maxDate'], function(key) {
// console.warn('attr.$observe(%s)', key, attr[key]);
angular.isDefined(attr[key]) && attr.$observe(key, function(newValue) {
// console.warn('attr.$observe(%s)=%o', key, newValue);
datepicker.$options[key] = dateParser.getDateForAttribute(key, newValue);
// Build only if dirty
!isNaN(datepicker.$options[key]) && datepicker.$build(false);
<API key>(controller.$dateValue);
});
});
// Watch model for changes
scope.$watch(attr.ngModel, function(newValue, oldValue) {
datepicker.update(controller.$dateValue);
}, true);
// Normalize undefined/null/empty array,
// so that we don't treat changing from undefined->null as a change.
function normalizeDateRanges(ranges) {
if (!ranges || !ranges.length) return null;
return ranges;
}
if (angular.isDefined(attr.disabledDates)) {
scope.$watch(attr.disabledDates, function(disabledRanges, previousValue) {
disabledRanges = normalizeDateRanges(disabledRanges);
previousValue = normalizeDateRanges(previousValue);
if (disabledRanges) {
datepicker.updateDisabledDates(disabledRanges);
}
});
}
function <API key>(parsedDate) {
if (!angular.isDate(parsedDate)) return;
var isMinValid = isNaN(datepicker.$options.minDate) || parsedDate.getTime() >= datepicker.$options.minDate;
var isMaxValid = isNaN(datepicker.$options.maxDate) || parsedDate.getTime() <= datepicker.$options.maxDate;
var isValid = isMinValid && isMaxValid;
controller.$setValidity('date', isValid);
controller.$setValidity('min', isMinValid);
controller.$setValidity('max', isMaxValid);
// Only update the model when we have a valid date
if(isValid) controller.$dateValue = parsedDate;
}
// viewValue -> $parsers -> modelValue
controller.$parsers.unshift(function(viewValue) {
// console.warn('$parser("%s"): viewValue=%o', element.attr('ng-model'), viewValue);
var date;
// Null values should correctly reset the model value & validity
if(!viewValue) {
controller.$setValidity('date', true);
// BREAKING CHANGE:
// return null (not undefined) when input value is empty, so angularjs 1.3
// ngModelController can go ahead and run validators, like ngRequired
return null;
}
var parsedDate = dateParser.parse(viewValue, controller.$dateValue);
if(!parsedDate || isNaN(parsedDate.getTime())) {
controller.$setValidity('date', false);
// return undefined, causes ngModelController to
// invalidate model value
return;
} else {
<API key>(parsedDate);
}
if(options.dateType === 'string') {
date = dateParser.<API key>(parsedDate, options.timezone, true);
return formatDate(date, options.modelDateFormat || options.dateFormat);
}
date = dateParser.<API key>(controller.$dateValue, options.timezone, true);
if(options.dateType === 'number') {
return date.getTime();
} else if(options.dateType === 'unix') {
return date.getTime() / 1000;
} else if(options.dateType === 'iso') {
return date.toISOString();
} else {
return new Date(date);
}
});
// modelValue -> $formatters -> viewValue
controller.$formatters.push(function(modelValue) {
// console.warn('$formatter("%s"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);
var date;
if(angular.isUndefined(modelValue) || modelValue === null) {
date = NaN;
} else if(angular.isDate(modelValue)) {
date = modelValue;
} else if(options.dateType === 'string') {
date = dateParser.parse(modelValue, null, options.modelDateFormat);
} else if(options.dateType === 'unix') {
date = new Date(modelValue * 1000);
} else {
date = new Date(modelValue);
}
// Setup default value?
// if(isNaN(date.getTime())) {
// var today = new Date();
// date = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0);
controller.$dateValue = dateParser.<API key>(date, options.timezone);
return <API key>();
});
// viewValue -> element
controller.$render = function() {
// console.warn('$render("%s"): viewValue=%o', element.attr('ng-model'), controller.$viewValue);
element.val(<API key>());
};
function <API key>() {
return !controller.$dateValue || isNaN(controller.$dateValue.getTime()) ? '' : formatDate(controller.$dateValue, options.dateFormat);
}
// Garbage collection
scope.$on('$destroy', function() {
if(datepicker) datepicker.destroy();
options = null;
datepicker = null;
});
}
};
})
.provider('datepickerViews', function() {
var defaults = this.defaults = {
dayFormat: 'dd',
daySplit: 7
};
// Split array into smaller arrays
function split(arr, size) {
var arrays = [];
while(arr.length > 0) {
arrays.push(arr.splice(0, size));
}
return arrays;
}
// Modulus operator
function mod(n, m) {
return ((n % m) + m) % m;
}
this.$get = function($dateFormatter, $dateParser, $sce) {
return function(picker) {
var scope = picker.$scope;
var options = picker.$options;
var lang = options.lang;
var formatDate = function(date, format) {
return $dateFormatter.formatDate(date, format, lang);
};
var dateParser = $dateParser({format: options.dateFormat, lang: lang, strict: options.strictFormat});
var weekDaysMin = $dateFormatter.weekdaysShort(lang);
var weekDaysLabels = weekDaysMin.slice(options.startWeek).concat(weekDaysMin.slice(0, options.startWeek));
var weekDaysLabelsHtml = $sce.trustAsHtml('<th class="dow text-center">' + weekDaysLabels.join('</th><th class="dow text-center">') + '</th>');
var startDate = picker.$date || (options.startDate ? dateParser.getDateForAttribute('startDate', options.startDate) : new Date());
var viewDate = {year: startDate.getFullYear(), month: startDate.getMonth(), date: startDate.getDate()};
var views = [{
format: options.dayFormat,
split: 7,
steps: { month: 1 },
update: function(date, force) {
if(!this.built || force || date.getFullYear() !== viewDate.year || date.getMonth() !== viewDate.month) {
angular.extend(viewDate, {year: picker.$date.getFullYear(), month: picker.$date.getMonth(), date: picker.$date.getDate()});
picker.$build();
} else if(date.getDate() !== viewDate.date || date.getDate() === 1) {
// chaging picker current month will cause viewDate.date to be set to first day of the month,
// in $datepicker.$selectPane, so picker would not update selected day display if
// user picks first day of the new month.
// As a workaround, we are always forcing update when picked date is first day of month.
viewDate.date = picker.$date.getDate();
picker.$updateSelected();
}
},
build: function() {
var firstDayOfMonth = new Date(viewDate.year, viewDate.month, 1), <API key> = firstDayOfMonth.getTimezoneOffset();
var firstDate = new Date(+firstDayOfMonth - mod(firstDayOfMonth.getDay() - options.startWeek, 7) * 864e5), firstDateOffset = firstDate.getTimezoneOffset();
var today = dateParser.<API key>(new Date(), options.timezone).toDateString();
// Handle daylight time switch
if(firstDateOffset !== <API key>) firstDate = new Date(+firstDate + (firstDateOffset - <API key>) * 60e3);
var days = [], day;
for(var i = 0; i < 42; i++) { // < 7 * 6
day = dateParser.<API key>(new Date(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate() + i));
days.push({date: day, isToday: day.toDateString() === today, label: formatDate(day, this.format), selected: picker.$date && this.isSelected(day), muted: day.getMonth() !== viewDate.month, disabled: this.isDisabled(day)});
}
scope.title = formatDate(firstDayOfMonth, options.monthTitleFormat);
scope.showLabels = true;
scope.labels = weekDaysLabelsHtml;
scope.rows = split(days, this.split);
this.built = true;
},
isSelected: function(date) {
return picker.$date && date.getFullYear() === picker.$date.getFullYear() && date.getMonth() === picker.$date.getMonth() && date.getDate() === picker.$date.getDate();
},
isDisabled: function(date) {
var time = date.getTime();
// Disabled because of min/max date.
if (time < options.minDate || time > options.maxDate) return true;
// Disabled due to being a disabled day of the week
if (options.daysOfWeekDisabled.indexOf(date.getDay()) !== -1) return true;
// Disabled because of disabled date range.
if (options.disabledDateRanges) {
for (var i = 0; i < options.disabledDateRanges.length; i++) {
if (time >= options.disabledDateRanges[i].start && time <= options.disabledDateRanges[i].end) {
return true;
}
}
}
return false;
},
onKeyDown: function(evt) {
if (!picker.$date) {
return;
}
var actualTime = picker.$date.getTime();
var newDate;
if(evt.keyCode === 37) newDate = new Date(actualTime - 1 * 864e5);
else if(evt.keyCode === 38) newDate = new Date(actualTime - 7 * 864e5);
else if(evt.keyCode === 39) newDate = new Date(actualTime + 1 * 864e5);
else if(evt.keyCode === 40) newDate = new Date(actualTime + 7 * 864e5);
if (!this.isDisabled(newDate)) picker.select(newDate, true);
}
}, {
name: 'month',
format: options.monthFormat,
split: 4,
steps: { year: 1 },
update: function(date, force) {
if(!this.built || date.getFullYear() !== viewDate.year) {
angular.extend(viewDate, {year: picker.$date.getFullYear(), month: picker.$date.getMonth(), date: picker.$date.getDate()});
picker.$build();
} else if(date.getMonth() !== viewDate.month) {
angular.extend(viewDate, {month: picker.$date.getMonth(), date: picker.$date.getDate()});
picker.$updateSelected();
}
},
build: function() {
var firstMonth = new Date(viewDate.year, 0, 1);
var months = [], month;
for (var i = 0; i < 12; i++) {
month = new Date(viewDate.year, i, 1);
months.push({date: month, label: formatDate(month, this.format), selected: picker.$isSelected(month), disabled: this.isDisabled(month)});
}
scope.title = formatDate(month, options.yearTitleFormat);
scope.showLabels = false;
scope.rows = split(months, this.split);
this.built = true;
},
isSelected: function(date) {
return picker.$date && date.getFullYear() === picker.$date.getFullYear() && date.getMonth() === picker.$date.getMonth();
},
isDisabled: function(date) {
var lastDate = +new Date(date.getFullYear(), date.getMonth() + 1, 0);
return lastDate < options.minDate || date.getTime() > options.maxDate;
},
onKeyDown: function(evt) {
if (!picker.$date) {
return;
}
var actualMonth = picker.$date.getMonth();
var newDate = new Date(picker.$date);
if(evt.keyCode === 37) newDate.setMonth(actualMonth - 1);
else if(evt.keyCode === 38) newDate.setMonth(actualMonth - 4);
else if(evt.keyCode === 39) newDate.setMonth(actualMonth + 1);
else if(evt.keyCode === 40) newDate.setMonth(actualMonth + 4);
if (!this.isDisabled(newDate)) picker.select(newDate, true);
}
}, {
name: 'year',
format: options.yearFormat,
split: 4,
steps: { year: 12 },
update: function(date, force) {
if(!this.built || force || parseInt(date.getFullYear()/20, 10) !== parseInt(viewDate.year/20, 10)) {
angular.extend(viewDate, {year: picker.$date.getFullYear(), month: picker.$date.getMonth(), date: picker.$date.getDate()});
picker.$build();
} else if(date.getFullYear() !== viewDate.year) {
angular.extend(viewDate, {year: picker.$date.getFullYear(), month: picker.$date.getMonth(), date: picker.$date.getDate()});
picker.$updateSelected();
}
},
build: function() {
var firstYear = viewDate.year - viewDate.year % (this.split * 3);
var years = [], year;
for (var i = 0; i < 12; i++) {
year = new Date(firstYear + i, 0, 1);
years.push({date: year, label: formatDate(year, this.format), selected: picker.$isSelected(year), disabled: this.isDisabled(year)});
}
scope.title = years[0].label + '-' + years[years.length - 1].label;
scope.showLabels = false;
scope.rows = split(years, this.split);
this.built = true;
},
isSelected: function(date) {
return picker.$date && date.getFullYear() === picker.$date.getFullYear();
},
isDisabled: function(date) {
var lastDate = +new Date(date.getFullYear() + 1, 0, 0);
return lastDate < options.minDate || date.getTime() > options.maxDate;
},
onKeyDown: function(evt) {
if (!picker.$date) {
return;
}
var actualYear = picker.$date.getFullYear(),
newDate = new Date(picker.$date);
if(evt.keyCode === 37) newDate.setYear(actualYear - 1);
else if(evt.keyCode === 38) newDate.setYear(actualYear - 4);
else if(evt.keyCode === 39) newDate.setYear(actualYear + 1);
else if(evt.keyCode === 40) newDate.setYear(actualYear + 4);
if (!this.isDisabled(newDate)) picker.select(newDate, true);
}
}];
return {
views: options.minView ? Array.prototype.slice.call(views, options.minView) : views,
viewDate: viewDate
};
};
};
}); |
body {
background-image: url(img/fondito3.png);
font-family: arial, helvetica, sans-serif;
margin: 0px auto;
padding: 0px;
color: #333;
text-align: center;
font-size: 14px;
line-height: 140%;
}
#contenedor {
margin: 0px auto;
width: 590px;
position:relative;
}
#contenido {
background: white;
margin: 40px 0 40px 0;
border: 1px solid #999;
clear: both;
padding: 15px 25px 25px 15px;
-moz-box-shadow: rgba(0, 0, 0, 0.25) 1px 1px 1px;
-webkit-box-shadow: rgba(0, 0, 0, 0.95) 1px 1px 1px;
border-bottom: 1px solid #999;
-<API key>:5px;
-moz-border-radius: 5px;
}
#bloque-imagen {
float: left;
width: auto;
}
#bloque-imagen2 {
float: left;
margin-left: 6px;
}
div, img, form, ul, td, th {
margin: 0px;
padding: 0px;
border: 0px;
text-align: left;
}
p {
margin: 0 0 20px 0;
}
h3 {
color: #666666;
text-shadow: 0 0 1px #999999;
}
.explicacion ul
{
list-style:inside circle;
margin-bottom:10px;
margin-left: 20px;
}
.explicacion {
position: relative;
}
.explicacion .titulo
{
position: absolute;
background-image: url(img/titulo.png);
background-repeat: no-repeat;
display: block;
height: 49px;
width:590px;
padding-left: 10px;
padding-top: 7px;
font-family: 'Open Sans', sans-serif;
font-weight: 800;
font-size: 17px;
color: #503e21;
text-shadow: 0px 1px 1px rgba(255, 255, 255, .5);
}
pre {
margin: 10px 0px;
padding: 0;
}
code {
display: block;
background-color: #F7F4DD;
padding: 10px;
overflow: auto;
}
#footer {
clear: both;
width: 100%;
height: 129px;
background: transparent url('img/bgfoo.png') repeat-x top right;
text-align: center;
}
.clearfix:after, .container:after {
content:"\0020";
display:block;
height:0;
clear:both;
visibility:hidden;
overflow:hidden;
}
.clearfix, .container {
display:block;
}
.clear {
clear:both;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#slider {
height: 200px;
width: 560px;
}
.chocoslider {
position:relative;
margin-bottom: 50px;
}
.chocoslider img {
position:absolute;
top:0px;
left:0px;
}
.chocoslider a.choco-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:60;
display:none;
}
.choco-slice {
display:block;
position:absolute;
z-index:50;
height:100%;
}
.choco-title {
position:absolute;
left:0px;
bottom:0px;
background:#000;
color:#fff;
opacity:0.8;
width:100%;
z-index:89;
}
.choco-title p {
padding:5px;
margin:0;
}
.choco-title a {
display:inline !important;
}
.choco-html-title {
display:none;
}
.<API key> {
position:absolute;
right:0%;
bottom:-30px;
}
.<API key> a {
text-indent: -999999px;
text-transform:uppercase;
text-decoration:none;
height:20px;
width:18px;
display:block;
cursor: pointer;
background: transparent url(img/controlls.gif) center bottom no-repeat;
float:left;
outline: none;
}
.<API key> a.active {
background: transparent url(img/controlls.gif) center top no-repeat;
} |
from decimal import Decimal as D
from django.conf import settings
from django.core.exceptions import <API key>
from django.template.defaultfilters import striptags, truncatechars
from django.utils.translation import gettext_lazy as _
from paypalcheckoutsdk.core import LiveEnvironment, PayPalHttpClient, SandboxEnvironment
from paypalcheckoutsdk.orders import (
<API key>, <API key>, OrdersCreateRequest, OrdersGetRequest)
from paypalcheckoutsdk.payments import <API key>, <API key>, <API key>
INTENT_AUTHORIZE = 'AUTHORIZE'
INTENT_CAPTURE = 'CAPTURE'
<API key> = {
INTENT_AUTHORIZE: <API key>,
INTENT_CAPTURE: <API key>,
}
LANDING_PAGE_LOGIN = 'LOGIN'
<API key> = 'BILLING'
<API key> = 'NO_PREFERENCE'
<API key> = 'CONTINUE'
USER_ACTION_PAY_NOW = 'PAY_NOW'
<API key> = lambda: getattr(settings, '<API key>', False)
def format_description(description):
return truncatechars(striptags(description), 127) if description else ''
def format_amount(amount):
return str(amount.quantize(D('0.01')))
def get_landing_page():
landing_page = getattr(settings, 'PAYPAL_LANDING_PAGE', <API key>)
if landing_page not in (LANDING_PAGE_LOGIN, <API key>, <API key>):
message = _("'%s' is not a valid landing page") % landing_page
raise <API key>(message)
return landing_page
class PaymentProcessor:
client = None
def __init__(self):
credentials = {
'client_id': settings.PAYPAL_CLIENT_ID,
'client_secret': settings.<API key>,
}
if getattr(settings, 'PAYPAL_SANDBOX_MODE', True):
environment = SandboxEnvironment(**credentials)
else:
environment = LiveEnvironment(**credentials)
self.client = PayPalHttpClient(environment)
def <API key>(
self, basket, currency, return_url, cancel_url, order_total,
address=None, shipping_charge=None, intent=None,
):
application_context = {
'return_url': return_url,
'cancel_url': cancel_url,
'landing_page': get_landing_page(),
'shipping_preference': '<API key>' if address is not None else 'NO_SHIPPING', # TODO: ???
'user_action': 'PAY_NOW' if <API key>() else 'CONTINUE',
}
if getattr(settings, 'PAYPAL_BRAND_NAME', None) is not None:
application_context['brand_name'] = settings.PAYPAL_BRAND_NAME
breakdown = {
'item_total': {
'currency_code': currency,
'value': format_amount(basket.<API key>),
},
'discount': {
'currency_code': currency,
'value': format_amount(sum([
discount['discount']
for discount
in basket.offer_discounts + basket.voucher_discounts
], D(0))),
},
'shipping_discount': {
'currency_code': currency,
'value': format_amount(sum([
discount['discount']
for discount
in basket.shipping_discounts
], D(0))),
}
}
if shipping_charge is not None:
breakdown['shipping'] = {
'currency_code': currency,
'value': format_amount(shipping_charge),
}
purchase_unit = {
'amount': {
'currency_code': currency,
'value': format_amount(order_total),
'breakdown': breakdown,
}
}
items = []
for line in basket.all_lines():
product = line.product
item = {
'name': product.get_title(),
'description': format_description(product.description),
'sku': product.upc if product.upc else '',
'unit_amount': {
'currency_code': currency,
'value': format_amount(line.unit_price_incl_tax)
},
'quantity': line.quantity,
'category': 'PHYSICAL_GOODS' if product.<API key> else 'DIGITAL_GOODS'
}
items.append(item)
purchase_unit['items'] = items
if address is not None:
purchase_unit['shipping'] = {
'name': {
'full_name': address.name
},
'address': {
'address_line_1': address.line1,
'address_line_2': address.line2,
'admin_area_2': address.line4,
'admin_area_1': address.state,
'postal_code': address.postcode,
'country_code': address.country.iso_3166_1_a2
}
}
body = {
'intent': intent,
'application_context': application_context,
'purchase_units': [purchase_unit]
}
return body
def <API key>(self, amount, currency):
return {
'amount': {
'value': format_amount(amount),
'currency_code': currency
}
}
def create_order(
self, basket, currency, return_url, cancel_url, order_total,
address=None, shipping_charge=None, intent=None, preferred_response='minimal',
):
request = OrdersCreateRequest()
request.prefer(f'return={preferred_response}')
request.request_body(self.<API key>(
basket=basket,
currency=currency,
return_url=return_url,
cancel_url=cancel_url,
order_total=order_total,
intent=intent,
address=address,
shipping_charge=shipping_charge,
))
response = self.client.execute(request)
return response.result
def get_order(self, token):
request = OrdersGetRequest(token)
response = self.client.execute(request)
return response.result
def get_<API key>(self):
return {}
def authorize_order(self, order_id, preferred_response='minimal'):
request = <API key>(order_id)
request.prefer(f'return={preferred_response}')
request.request_body(self.get_<API key>())
response = self.client.execute(request)
return response.result
def <API key>(self, authorization_id):
request = <API key>(authorization_id)
self.client.execute(request)
def refund_order(self, capture_id, amount, currency, preferred_response='minimal'):
request = <API key>(capture_id)
request.prefer(f'return={preferred_response}')
request.request_body(self.<API key>(amount, currency))
response = self.client.execute(request)
return response.result
def capture_order(self, token, intent, preferred_response='minimal'):
capture_request = <API key>[intent]
request = capture_request(token)
request.prefer(f'return={preferred_response}')
response = self.client.execute(request)
return response.result |
<?php
namespace Pimcore\Controller\Plugin;
class Webmastertools extends \<API key> {
/**
* @param \<API key> $request
*/
public function routeStartup(\<API key> $request) {
$conf = \Pimcore\Config::getReportConfig();
if($conf->webmastertools->sites) {
$sites = $conf->webmastertools->sites->toArray();
if(is_array($sites)) {
foreach ($sites as $site) {
if($site["verification"]) {
if($request->getRequestUri() == ("/".$site["verification"])) {
echo "<API key>: " . $site["verification"];
exit;
}
}
}
}
}
}
} |
<!doctype html>
<!-- This file is generated by build.py. -->
<title>Reference for video wide.jpg; overflow:hidden; -o-object-fit:none; -o-object-position:2cm 50%</title>
<link rel="stylesheet" href="../../support/reftests.css">
<style>
.helper { overflow:hidden }
.helper > * { left:2cm; top:36.0px; }
</style>
<div id="ref">
<span class="helper"><img src="../../support/wide.jpg"></span>
</div> |
# include "incls/_precompiled.incl"
# include "incls/_vframe_prims.cpp.incl"
TRACE_FUNC(TraceVframePrims, "vframe")
int vframeOopPrimitives::number_of_calls;
#define ASSERT_RECEIVER assert(receiver->is_vframe(), "receiver must be vframe")
PRIM_DECL_1(vframeOopPrimitives::process, oop receiver) {
PROLOGUE_1("process", receiver);
ASSERT_RECEIVER;
return vframeOop(receiver)->process();
}
PRIM_DECL_1(vframeOopPrimitives::index, oop receiver) {
PROLOGUE_1("index", receiver);
ASSERT_RECEIVER;
return as_smiOop(vframeOop(receiver)->index());
}
PRIM_DECL_1(vframeOopPrimitives::time_stamp, oop receiver) {
PROLOGUE_1("time_stamp", receiver);
ASSERT_RECEIVER;
return as_smiOop(vframeOop(receiver)->time_stamp());
}
PRIM_DECL_1(vframeOopPrimitives::<API key>, oop receiver) {
PROLOGUE_1("<API key>", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
return vf->is_delta_frame() ? trueObj : falseObj;
}
PRIM_DECL_1(vframeOopPrimitives::byte_code_index, oop receiver) {
PROLOGUE_1("byte_code_index", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
return as_smiOop(((deltaVFrame*) vf)->bci());
}
PRIM_DECL_1(vframeOopPrimitives::expression_stack, oop receiver) {
PROLOGUE_1("expression_stack", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
BlockScavenge bs;
GrowableArray<oop>* stack = ((deltaVFrame*) vf)->expression_stack();
return oopFactory::new_objArray(stack);
}
PRIM_DECL_1(vframeOopPrimitives::method, oop receiver) {
PROLOGUE_1("method", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
return ((deltaVFrame*) vf)->method();
}
PRIM_DECL_1(vframeOopPrimitives::receiver, oop recv) {
PROLOGUE_1("receiver", recv);
assert(recv->is_vframe(), "receiver must be vframe")
ResourceMark rm;
vframe* vf = vframeOop(recv)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
return ((deltaVFrame*) vf)->receiver();
}
PRIM_DECL_1(vframeOopPrimitives::temporaries, oop receiver) {
PROLOGUE_1("temporaries", receiver);
ASSERT_RECEIVER;
return receiver;
}
PRIM_DECL_1(vframeOopPrimitives::arguments, oop receiver) {
PROLOGUE_1("arguments", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
BlockScavenge bs;
GrowableArray<oop>* stack = ((deltaVFrame*) vf)->arguments();
return oopFactory::new_objArray(stack);
}
class vframeStream: public <API key> {
void begin_highlight() { set_highlight(true); print_char(27); }
void end_highlight() { set_highlight(false); print_char(27); }
};
PRIM_DECL_1(vframeOopPrimitives::pretty_print, oop receiver) {
PROLOGUE_1("receiver", receiver);
ASSERT_RECEIVER;
ResourceMark rm;
BlockScavenge bs;
vframe* vf = vframeOop(receiver)->get_vframe();
if (vf == NULL)
return markSymbol(vmSymbols::<API key>());
if (!vf->is_delta_frame())
return markSymbol(vmSymbols::external_activation());
<API key>* stream = new vframeStream;
prettyPrinter::print_body((deltaVFrame*) vf, stream);
return stream->asByteArray();
} |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import datetime
import dateutil.parser
import dateutil.tz
import gzip
import json
import logging
import os
import pickle
import sys
from collections import OrderedDict
from functools import partial
from itertools import count, groupby
from six.moves.urllib.request import urlopen, Request
logging.basicConfig(level=logging.INFO)
API_PARAMS = {
'base_url': 'https://api.github.com/repos',
'owner': 'bokeh',
'repo': 'bokeh',
}
IGNORE_ISSUE_TYPE = {
'type: discussion',
'type: tracker',
}
LOG_SECTION = OrderedDict([ # issue type label -> log section heading
('type: bug', 'bugfixes'),
('type: feature', 'features'),
('type: task', 'tasks'),
])
ISSUES_SORT_KEY = lambda issue: (issue_section_order(issue), int(issue['number']))
ISSUES_BY_SECTION = lambda issue: issue_section(issue)
# Object Storage
def save_object(filename, obj):
"""Compresses and pickles given object to the given filename."""
logging.info('saving {}...'.format(filename))
try:
with gzip.GzipFile(filename, 'wb') as f:
f.write(pickle.dumps(obj, 1))
except Exception as e:
logging.error('save failure: {}'.format(e))
raise
def load_object(filename):
"""Unpickles and decompresses the given filename and returns the created object."""
logging.info('loading {}...'.format(filename))
try:
with gzip.GzipFile(filename, 'rb') as f:
buf = ''
while True:
data = f.read()
if data == '':
break
buf += data
return pickle.loads(buf)
except Exception as e:
logging.error('load failure: {}'.format(e))
raise
# Issues
def issue_section_order(issue):
"""Returns the section order for the given issue."""
try:
return LOG_SECTION.values().index(issue_section(issue))
except:
return -1
def issue_completed(issue):
"""Returns True iff this issue is has been resolved as completed."""
labels = issue.get('labels', [])
return any(label['name'] == 'reso: completed' for label in labels)
def issue_section(issue):
"""Returns the section heading for the issue, or None if this issue should be ignored."""
labels = issue.get('labels', [])
for label in labels:
if not label['name'].startswith('type: '):
continue
if label['name'] in LOG_SECTION:
return LOG_SECTION[label['name']]
elif label['name'] in IGNORE_ISSUE_TYPE:
return None
else:
logging.warning('unknown issue type: "{}" for: {}'.format(label['name'], issue_line(issue)))
return None
def issue_tags(issue):
"""Returns list of tags for this issue."""
labels = issue.get('labels', [])
return [label['name'].replace('tag: ', '') for label in labels if label['name'].startswith('tag: ')]
def closed_issue(issue, after=None):
"""Returns True iff this issue was closed after given date. If after not given, only checks if issue is closed."""
if issue['state'] == 'closed':
if after is None or parse_timestamp(issue['closed_at']) > after:
return True
return False
def relevent_issue(issue, after):
"""Returns True iff this issue is something we should show in the changelog."""
return (closed_issue(issue, after) and
issue_completed(issue) and
issue_section(issue))
def relevant_issues(issues, after):
"""Yields relevant closed issues (closed after a given datetime) given a list of issues."""
logging.info('finding relevant issues after {}...'.format(after))
seen = set()
for issue in issues:
if relevent_issue(issue, after) and issue['title'] not in seen:
seen.add(issue['title'])
yield issue
def closed_issues(issues, after):
"""Yields closed issues (closed after a given datetime) given a list of issues."""
logging.info('finding closed issues after {}...'.format(after))
seen = set()
for issue in issues:
if closed_issue(issue, after) and issue['title'] not in seen:
seen.add(issue['title'])
yield issue
def all_issues(issues):
"""Yields unique set of issues given a list of issues."""
logging.info('finding issues...')
seen = set()
for issue in issues:
if issue['title'] not in seen:
seen.add(issue['title'])
yield issue
# GitHub API
def get_labels_url():
"""Returns github API URL for querying labels."""
return '{base_url}/{owner}/{repo}/labels'.format(**API_PARAMS)
def get_issues_url(page, after):
"""Returns github API URL for querying tags."""
template = '{base_url}/{owner}/{repo}/issues?state=closed&per_page=100&page={page}&since={after}'
return template.format(page=page, after=after.isoformat(), **API_PARAMS)
def get_tags_url():
"""Returns github API URL for querying tags."""
return '{base_url}/{owner}/{repo}/tags'.format(**API_PARAMS)
def parse_timestamp(timestamp):
"""Parse ISO8601 timestamps given by github API."""
dt = dateutil.parser.parse(timestamp)
return dt.astimezone(dateutil.tz.tzutc())
def read_url(url):
"""Reads given URL as JSON and returns data as loaded python object."""
logging.debug('reading {url} ...'.format(url=url))
token = os.environ.get("<API key>")
headers = {}
if token:
headers['Authorization'] = 'token %s' % token
request = Request(url, headers=headers)
response = urlopen(request).read()
return json.loads(response.decode("UTF-8"))
def query_tags():
"""Hits the github API for repository tags and returns the data."""
return read_url(get_tags_url())
def query_issues(page, after):
"""Hits the github API for a single page of closed issues and returns the data."""
return read_url(get_issues_url(page, after))
def query_all_issues(after):
"""Hits the github API for all closed issues after the given date, returns the data."""
page = count(1)
data = []
while True:
page_data = query_issues(next(page), after)
if not page_data:
break
data.extend(page_data)
return data
def dateof(tag_name, tags):
"""Given a list of tags, returns the datetime of the tag with the given name; Otherwise None."""
for tag in tags:
if tag['name'] == tag_name:
commit = read_url(tag['commit']['url'])
return parse_timestamp(commit['commit']['committer']['date'])
return None
def get_data(query_func, load_data=False, save_data=False):
"""Gets data from query_func, optionally saving that data to a file; or loads data from a file."""
if hasattr(query_func, '__name__'):
func_name = query_func.__name__
elif hasattr(query_func, 'func'):
func_name = query_func.func.__name__
pickle_file = '{}.pickle'.format(func_name)
if load_data:
data = load_object(pickle_file)
else:
data = query_func()
if save_data:
save_object(pickle_file, data)
return data
# Validation
def check_issue(issue, after):
have_warnings = False
labels = issue.get('labels', [])
if 'pull_request' in issue:
if not any(label['name'].startswith('status: ') for label in labels):
logging.warning('pull request without status label: {}'.format(issue_line(issue)))
have_warnings = True
else:
if not any(label['name'].startswith('type: ') for label in labels):
if not any(label['name']=="reso: duplicate" for label in labels):
logging.warning('issue with no type label: {}'.format(issue_line((issue))))
have_warnings = True
if closed_issue(issue, after):
if not any(label['name'].startswith('reso: ') for label in labels):
if not any(label['name'] in IGNORE_ISSUE_TYPE for label in labels):
logging.warning('closed issue with no reso label: {}'.format(issue_line((issue))))
have_warnings = True
return have_warnings
def check_issues(issues, after=None):
"""Checks issues for BEP 1 compliance."""
issues = closed_issues(issues, after) if after else all_issues(issues)
issues = sorted(issues, key=ISSUES_SORT_KEY)
have_warnings = False
for section, issue_group in groupby(issues, key=ISSUES_BY_SECTION):
for issue in issue_group:
have_warnings |= check_issue(issue, after)
return have_warnings
# Changelog
def issue_line(issue):
"""Returns log line for given issue."""
template = '#{number} {tags}{title}'
tags = issue_tags(issue)
params = {
'title': issue['title'].capitalize().rstrip('.'),
'number': issue['number'],
'tags': ' '.join('[{}]'.format(tag) for tag in tags) + (' ' if tags else '')
}
return template.format(**params)
def generate_changelog(issues, after, heading, rtag=False):
"""Prints out changelog."""
relevent = relevant_issues(issues, after)
relevent = sorted(relevent, key=ISSUES_BY_SECTION)
def write(func, endofline="", append=""):
func(heading + '\n' + '-' * 20 + endofline)
for section, issue_group in groupby(relevent, key=ISSUES_BY_SECTION):
func(' * {}:'.format(section) + endofline)
for issue in reversed(list(issue_group)):
func(' - {}'.format(issue_line(issue)) + endofline)
func(endofline + append)
if rtag is not False:
with open("../CHANGELOG", "r+") as f:
content = f.read()
f.seek(0)
write(f.write, '\n', content)
else:
write(print)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Creates a bokeh changelog using the github API.')
limit_group = parser.<API key>(required=True)
limit_group.add_argument('-d', '--since-date', metavar='DATE',
help='select issues that occurred after the given ISO8601 date')
limit_group.add_argument('-p', '--since-tag', metavar='TAG',
help='select issues that occurred after the given git tag')
parser.add_argument('-c', '--check', action='store_true', default=False,
help='check closed issues for BEP 1 compliance')
parser.add_argument('-r', '--release-tag', metavar='RELEASE',
help='the proposed new release tag.\n'
'NOTE: this will automatically write the output to the CHANGELOG')
data_group = parser.<API key>()
data_group.add_argument('-s', '--save-data', action='store_true', default=False,
help='save api query result data; useful for testing')
data_group.add_argument('-l', '--load-data', action='store_true', default=False,
help='load api data from previously saved data; useful for testing')
args = parser.parse_args()
if args.since_tag:
tags = get_data(query_tags, load_data=args.load_data, save_data=args.save_data)
after = dateof(args.since_tag, tags)
heading = 'Since {:>14}:'.format(args.since_tag)
elif args.since_date:
after = dateutil.parser.parse(args.since_date)
after = after.replace(tzinfo=dateutil.tz.tzlocal())
heading = 'Since {:>14}:'.format(after.date().isoformat())
issues = get_data(partial(query_all_issues, after), load_data=args.load_data, save_data=args.save_data)
if args.check:
have_warnings = check_issues(issues)
if have_warnings:
sys.exit(1)
sys.exit(0)
if args.release_tag:
heading = '{} {:>8}:'.format(str(datetime.date.today()), args.release_tag)
generate_changelog(issues, after, heading, args.release_tag)
else:
generate_changelog(issues, after, heading) |
/*Grid*/
.ui-jqgrid {position: relative;}
.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em; font-size:11px;}
/* caption*/
.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
.ui-jqgrid .<API key> { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .<API key> span { display: block; margin: 1px; }
.ui-jqgrid .<API key>:hover { padding: 0; }
/* header*/
.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
.ui-first-th-ltr {border-right: 1px solid; }
.ui-first-th-rtl {border-left: 1px solid; }
.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
/* body */
.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
.ui-jqgrid tr.jqgrow { outline-style: none; }
.ui-jqgrid tr.jqgroup { outline-style: none; }
.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
.ui-jqgrid .<API key> { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none; z-index: 99999;}
/* footer */
.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
/* Pager*/
.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;font-size:11px;}
.ui-jqgrid .ui-pager-control {position: relative;}
.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
.ui-jqgrid .ui-pg-button { height:19px !important;}
.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;position:relative;}
.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
.ui-jqgrid td textarea {width:auto;height:auto;}
.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-div {padding:1px 0;float:left;position:relative;}
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-button { cursor:pointer; }
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
/*subgrid*/
.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
.ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0px none !important;}
.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
.ui-jqgrid .ui-th-subgrid {height:20px;}
/* loading */
.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important; font-size:11px;}
.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
/* end loading div */
/* toolbar */
.ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px none; height : 21px;overflow: hidden; }
/*Modal Window */
.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
.ui-jqdialog .<API key> { padding: .3em .2em; position: relative; }
.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; }
.ui-jqdialog .<API key> { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-jqdialog .<API key> span { display: block; margin: 1px; }
.ui-jqdialog .<API key>:hover, .ui-jqdialog .<API key>:focus { padding: 0; }
.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
/* end Modal window*/
/* Form edit */
.ui-jqdialog-content .FormGrid {margin: 0px;}
.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
.EditTable td textarea { width:auto; height:auto;}
.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
.ui-jqdialog-content input.FormElement {padding:.3em}
.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
.ui-jqdialog-content .CaptionTD {vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
.ui-jqdialog-content .form-view-data {white-space:pre}
.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
.fm-button-icon-left { padding-left: 1.9em; }
.<API key> { padding-right: 1.9em; }
.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
.<API key> .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
/* End Eorm edit */
/*.ui-jqgrid .edit-cell {}*/
.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
/* inline edit actions button*/
.ui-inline-del.ui-state-hover span, .ui-inline-edit.ui-state-hover span,
.ui-inline-save.ui-state-hover span, .ui-inline-cancel.ui-state-hover span {
margin: -1px;
}
/* Tree Grid */
.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
.ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
.ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;}
.ui-jqgrid .treeclick {cursor: pointer;}
/* moda dialog */
* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
/* RTL Support */
.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
.ui-jqgrid .<API key> {float: right;margin: -2px -2px -2px 0px;}
.ui-jqgrid .<API key> {float: left;margin: -2px 0px -1px -3px;}
.ui-jqgrid .ui-sort-rtl {left:0px;}
.ui-jqgrid .tree-wrap-ltr {float: left;}
.ui-jqgrid .tree-wrap-rtl {float: right;}
.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis;} |
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/capability.h>
#include <linux/fs.h>
#include "ext4_jbd2.h"
#include "ext4.h"
#include "xattr.h"
#include "acl.h"
/*
* Convert from filesystem to in-memory representation.
*/
static struct posix_acl *
ext4_acl_from_disk(const void *value, size_t size)
{
const char *end = (char *)value + size;
int n, count;
struct posix_acl *acl;
if (!value)
return NULL;
if (size < sizeof(ext4_acl_header))
return ERR_PTR(-EINVAL);
if (((ext4_acl_header *)value)->a_version !=
cpu_to_le32(EXT4_ACL_VERSION))
return ERR_PTR(-EINVAL);
value = (char *)value + sizeof(ext4_acl_header);
count = ext4_acl_count(size);
if (count < 0)
return ERR_PTR(-EINVAL);
if (count == 0)
return NULL;
acl = posix_acl_alloc(count, GFP_NOFS);
if (!acl)
return ERR_PTR(-ENOMEM);
for (n = 0; n < count; n++) {
ext4_acl_entry *entry =
(ext4_acl_entry *)value;
if ((char *)value + sizeof(<API key>) > end)
goto fail;
acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
switch (acl->a_entries[n].e_tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
value = (char *)value +
sizeof(<API key>);
acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
break;
case ACL_USER:
case ACL_GROUP:
value = (char *)value + sizeof(ext4_acl_entry);
if ((char *)value > end)
goto fail;
acl->a_entries[n].e_id =
le32_to_cpu(entry->e_id);
break;
default:
goto fail;
}
}
if (value != end)
goto fail;
return acl;
fail:
posix_acl_release(acl);
return ERR_PTR(-EINVAL);
}
/*
* Convert from in-memory to filesystem representation.
*/
static void *
ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
{
ext4_acl_header *ext_acl;
char *e;
size_t n;
*size = ext4_acl_size(acl->a_count);
ext_acl = kmalloc(sizeof(ext4_acl_header) + acl->a_count *
sizeof(ext4_acl_entry), GFP_NOFS);
if (!ext_acl)
return ERR_PTR(-ENOMEM);
ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION);
e = (char *)ext_acl + sizeof(ext4_acl_header);
for (n = 0; n < acl->a_count; n++) {
ext4_acl_entry *entry = (ext4_acl_entry *)e;
entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
switch (acl->a_entries[n].e_tag) {
case ACL_USER:
case ACL_GROUP:
entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
e += sizeof(ext4_acl_entry);
break;
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
e += sizeof(<API key>);
break;
default:
goto fail;
}
}
return (char *)ext_acl;
fail:
kfree(ext_acl);
return ERR_PTR(-EINVAL);
}
/*
* Inode operation get_posix_acl().
*
* inode->i_mutex: don't care
*/
struct posix_acl *
ext4_get_acl(struct inode *inode, int type)
{
int name_index;
char *value = NULL;
struct posix_acl *acl;
int retval;
if (!test_opt(inode->i_sb, POSIX_ACL))
return NULL;
acl = get_cached_acl(inode, type);
if (acl != ACL_NOT_CACHED)
return acl;
switch (type) {
case ACL_TYPE_ACCESS:
name_index = <API key>;
break;
case ACL_TYPE_DEFAULT:
name_index = <API key>;
break;
default:
BUG();
}
retval = ext4_xattr_get(inode, name_index, "", NULL, 0);
if (retval > 0) {
value = kmalloc(retval, GFP_NOFS);
if (!value)
return ERR_PTR(-ENOMEM);
retval = ext4_xattr_get(inode, name_index, "", value, retval);
}
if (retval > 0)
acl = ext4_acl_from_disk(value, retval);
else if (retval == -ENODATA || retval == -ENOSYS)
acl = NULL;
else
acl = ERR_PTR(retval);
kfree(value);
if (!IS_ERR(acl))
set_cached_acl(inode, type, acl);
return acl;
}
/*
* Set the access or default ACL of an inode.
*
* inode->i_mutex: down unless called from ext4_new_inode
*/
static int
ext4_set_acl(handle_t *handle, struct inode *inode, int type,
struct posix_acl *acl)
{
int name_index;
void *value = NULL;
size_t size = 0;
int error;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
switch (type) {
case ACL_TYPE_ACCESS:
name_index = <API key>;
if (acl) {
error = <API key>(acl, &inode->i_mode);
if (error < 0)
return error;
else {
inode->i_ctime = ext4_current_time(inode);
<API key>(handle, inode);
if (error == 0)
acl = NULL;
}
}
break;
case ACL_TYPE_DEFAULT:
name_index = <API key>;
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
break;
default:
return -EINVAL;
}
if (acl) {
value = ext4_acl_to_disk(acl, &size);
if (IS_ERR(value))
return (int)PTR_ERR(value);
}
error = <API key>(handle, inode, name_index, "",
value, size, 0);
kfree(value);
if (!error)
set_cached_acl(inode, type, acl);
return error;
}
/*
* Initialize the ACLs of a new inode. Called from ext4_new_inode.
*
* dir->i_mutex: down
* inode->i_mutex: up (access to inode is still exclusive)
*/
int
ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
{
struct posix_acl *acl = NULL;
int error = 0;
if (!S_ISLNK(inode->i_mode)) {
if (test_opt(dir->i_sb, POSIX_ACL)) {
acl = ext4_get_acl(dir, ACL_TYPE_DEFAULT);
if (IS_ERR(acl))
return PTR_ERR(acl);
}
if (!acl)
inode->i_mode &= ~current_umask();
}
if (test_opt(inode->i_sb, POSIX_ACL) && acl) {
if (S_ISDIR(inode->i_mode)) {
error = ext4_set_acl(handle, inode,
ACL_TYPE_DEFAULT, acl);
if (error)
goto cleanup;
}
error = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
if (error < 0)
return error;
if (error > 0) {
/* This is an extended ACL */
error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
}
}
cleanup:
posix_acl_release(acl);
return error;
}
int
ext4_acl_chmod(struct inode *inode)
{
struct posix_acl *acl;
handle_t *handle;
int retries = 0;
int error;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
if (!test_opt(inode->i_sb, POSIX_ACL))
return 0;
acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR(acl) || !acl)
return PTR_ERR(acl);
error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
if (error)
return error;
retry:
handle = ext4_journal_start(inode,
<API key>(inode->i_sb));
if (IS_ERR(handle)) {
error = PTR_ERR(handle);
ext4_std_error(inode->i_sb, error);
goto out;
}
error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl);
ext4_journal_stop(handle);
if (error == -ENOSPC &&
<API key>(inode->i_sb, &retries))
goto retry;
out:
posix_acl_release(acl);
return error;
}
/*
* Extended attribute handlers
*/
static size_t
<API key>(struct dentry *dentry, char *list, size_t list_len,
const char *name, size_t name_len, int type)
{
const size_t size = sizeof(<API key>);
if (!test_opt(dentry->d_sb, POSIX_ACL))
return 0;
if (list && size <= list_len)
memcpy(list, <API key>, size);
return size;
}
static size_t
<API key>(struct dentry *dentry, char *list, size_t list_len,
const char *name, size_t name_len, int type)
{
const size_t size = sizeof(<API key>);
if (!test_opt(dentry->d_sb, POSIX_ACL))
return 0;
if (list && size <= list_len)
memcpy(list, <API key>, size);
return size;
}
static int
ext4_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer,
size_t size, int type)
{
struct posix_acl *acl;
int error;
if (strcmp(name, "") != 0)
return -EINVAL;
if (!test_opt(dentry->d_sb, POSIX_ACL))
return -EOPNOTSUPP;
acl = ext4_get_acl(dentry->d_inode, type);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
return -ENODATA;
error = posix_acl_to_xattr(acl, buffer, size);
posix_acl_release(acl);
return error;
}
static int
ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags, int type)
{
struct inode *inode = dentry->d_inode;
handle_t *handle;
struct posix_acl *acl;
int error, retries = 0;
if (strcmp(name, "") != 0)
return -EINVAL;
if (!test_opt(inode->i_sb, POSIX_ACL))
return -EOPNOTSUPP;
if (!<API key>(inode))
return -EPERM;
if (value) {
acl = <API key>(value, size);
if (IS_ERR(acl))
return PTR_ERR(acl);
else if (acl) {
error = posix_acl_valid(acl);
if (error)
goto release_and_out;
}
} else
acl = NULL;
retry:
handle = ext4_journal_start(inode, <API key>(inode->i_sb));
if (IS_ERR(handle))
return PTR_ERR(handle);
error = ext4_set_acl(handle, inode, type, acl);
ext4_journal_stop(handle);
if (error == -ENOSPC && <API key>(inode->i_sb, &retries))
goto retry;
release_and_out:
posix_acl_release(acl);
return error;
}
const struct xattr_handler <API key> = {
.prefix = <API key>,
.flags = ACL_TYPE_ACCESS,
.list = <API key>,
.get = ext4_xattr_get_acl,
.set = ext4_xattr_set_acl,
};
const struct xattr_handler <API key> = {
.prefix = <API key>,
.flags = ACL_TYPE_DEFAULT,
.list = <API key>,
.get = ext4_xattr_get_acl,
.set = ext4_xattr_set_acl,
}; |
module Spree
module Api
class <API key> < Spree::Api::BaseController
def index
@taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(:root => :children).
ransack(params[:q]).result.
page(params[:page]).per(params[:per_page])
respond_with(@taxonomies)
end
def show
@taxonomy = Taxonomy.accessible_by(current_ability, :read).find(params[:id])
respond_with(@taxonomy)
end
# Because JSTree wants parameters in a *slightly* different format
def jstree
show
end
def create
authorize! :create, Taxonomy
@taxonomy = Taxonomy.new(params[:taxonomy])
if @taxonomy.save
respond_with(@taxonomy, :status => 201, :default_template => :show)
else
invalid_resource!(@taxonomy)
end
end
def update
authorize! :update, taxonomy
if taxonomy.update_attributes(params[:taxonomy])
respond_with(taxonomy, :status => 200, :default_template => :show)
else
invalid_resource!(taxonomy)
end
end
def destroy
authorize! :destroy, taxonomy
taxonomy.destroy
respond_with(taxonomy, :status => 204)
end
private
def taxonomy
@taxonomy ||= Taxonomy.accessible_by(current_ability, :read).find(params[:id])
end
end
end
end |
module.exports = {
Node: require('./lib/node'),
Broker: require('./lib/broker')
} |
app.service('<API key>', [function () {
var pleaseWaitDiv = $('<div class="modal hide" id="pleaseWaitDialog" data-backdrop="static" data-keyboard="false"><div class="modal-header"><h1>Processing...</h1></div><div class="modal-body"><div class="progress"><div class="progress-bar progress-striped active" role="progressbar" aria-valuenow="100" aria-valuemax="100" style="width: 100%;"></div></div></div></div>');
this.show = function() {
pleaseWaitDiv.modal();
}
this.hide = function() {
pleaseWaitDiv.modal('hide');
}
}]); |
package im.actor.runtime.function;
import com.google.j2objc.annotations.Property;
import org.jetbrains.annotations.Nullable;
public class Tuple4<T1, T2, T3, T4> {
@Nullable
@Property("readonly, nonatomic")
private final T1 t1;
@Nullable
@Property("readonly, nonatomic")
private final T2 t2;
@Nullable
@Property("readonly, nonatomic")
private final T3 t3;
@Nullable
@Property("readonly, nonatomic")
private final T4 t4;
public Tuple4(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4) {
this.t1 = t1;
this.t2 = t2;
this.t3 = t3;
this.t4 = t4;
}
@Nullable
public T1 getT1() {
return t1;
}
@Nullable
public T2 getT2() {
return t2;
}
@Nullable
public T3 getT3() {
return t3;
}
@Nullable
public T4 getT4() {
return t4;
}
} |
import {PrebootOptions} from '../interfaces/preboot_options';
import {PrebootEvent} from '../interfaces/event';
import {Element} from '../interfaces/element';
function logOptions(opts: PrebootOptions) {
console.log('preboot options are:');
console.log(opts);
}
function logEvents(events: PrebootEvent[]) {
console.log('preboot events captured are:');
console.log(events);
}
function replaySuccess(serverNode: Element, clientNode: Element, event: any) {
console.log('replaying:');
console.log({
serverNode: serverNode,
clientNode: clientNode,
event: event
});
}
function missingClientNode(serverNode: Element) {
console.log('preboot could not find client node for:');
console.log(serverNode);
}
function remainingEvents(events: PrebootEvent[]) {
if (events && events.length) {
console.log('the following events were not replayed:');
console.log(events);
}
}
function noRefocus(serverNode: Element) {
console.log('Could not find node on client to match server node for refocus:');
console.log(serverNode);
}
let logMap = {
'1': logOptions,
'2': logEvents,
'3': replaySuccess,
'4': missingClientNode,
'5': remainingEvents,
'6': noRefocus
};
/**
* Idea here is simple. If debugging turned on and this module exists, we
* log various things that happen in preboot. The calling code only references
* a number (keys in logMap) to a handling function. By doing this, we are
* able to cut down on the amount of logging code in preboot when no in debug mode.
*/
export function log(...args) {
if (!args.length) { return; }
let id = args[0] + '';
let fn = logMap[id];
if (fn) {
fn(...args.slice(1));
} else {
console.log('log: ' + JSON.stringify(args));
}
} |
class <API key> < ActiveRecord::Migration[4.2]
def change
add_column :courses, :upload_count, :integer, default: 0
add_column :courses, :<API key>, :integer, default: 0
add_column :courses, :upload_usages_count, :integer, default: 0
end
end |
<?php
$type = ( isset( $type ) ) ? $type : 'notice-info';
$dismissible = ( isset( $dismissible ) ) ? $dismissible : false;
$inline = ( isset( $inline ) ) ? $inline : false;
$id = ( isset( $id ) ) ? 'id="' . $id . '"' : '';
$style = ( isset( $style ) ) ? $style : '';
$auto_p = ( isset( $auto_p ) ) ? $auto_p : 'true';
$class = ( isset( $class ) ) ? $class : '';
$show_callback = ( isset( $show_callback ) && false !== $show_callback ) ? array( $GLOBALS[ $show_callback[0] ], $show_callback[1] ) : false;
$callback_args = ( isset( $callback_args ) ) ? $callback_args : array();
?>
<div <?php echo $id; ?> class="notice <?php echo $type; ?><?php echo ( $dismissible ) ? ' is-dismissible' : ''; ?> wposes-notice <?php echo ( $inline ) ? ' inline' : ''; ?> <?php echo ( '' !== $class ) ? ' ' . $class : ''; ?>" style="<?php echo $style; ?>">
<?php if ( $auto_p ) : ?>
<p>
<?php endif; ?>
<?php echo $message; // xss ok ?>
<?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
<a href="#" class="<API key>" data-hide="<?php _e( 'Hide', 'wp-offload-ses' ); ?>"><?php _e( 'Show', 'wp-offload-ses' ); ?></a>
<?php endif; ?>
<?php if ( $auto_p ) : ?>
</p>
<?php endif; ?>
<?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
<div class="<API key>" style="display: none;">
<?php <API key>( $show_callback, $callback_args ); ?>
</div>
<?php endif; ?>
</div> |
#include "HalideRuntime.h"
extern "C" {
typedef long dispatch_once_t;
extern void dispatch_once_f(dispatch_once_t *, void *context, void (*initializer)(void *));
typedef struct dispatch_queue_s *dispatch_queue_t;
typedef long <API key>;
extern dispatch_queue_t <API key>(
<API key> priority, unsigned long flags);
extern void dispatch_apply_f(size_t iterations, dispatch_queue_t queue,
void *context, void (*work)(void *, size_t));
extern void dispatch_async_f(dispatch_queue_t queue, void *context, void (*work)(void *));
typedef struct <API key> *<API key>;
typedef uint64_t dispatch_time_t;
#define <API key> (~0ull)
extern <API key> <API key>(long value);
extern long <API key>(<API key> dsema, dispatch_time_t timeout);
extern long <API key>(<API key> dsema);
extern void dispatch_release(void *object);
}
namespace Halide { namespace Runtime { namespace Internal {
struct spawned_thread {
void (*f)(void *);
void *closure;
<API key> join_semaphore;
};
WEAK void spawn_thread_helper(void *arg) {
spawned_thread *t = (spawned_thread *)arg;
t->f(t->closure);
<API key>(t->join_semaphore);
}
}}} // namespace Halide::Runtime::Internal
WEAK halide_thread *halide_spawn_thread(void (*f)(void *), void *closure) {
spawned_thread *thread = (spawned_thread *)malloc(sizeof(spawned_thread));
thread->f = f;
thread->closure = closure;
thread->join_semaphore = <API key>(0);
dispatch_async_f(<API key>(0, 0), thread, spawn_thread_helper);
return (halide_thread *)thread;
}
WEAK void halide_join_thread(halide_thread *thread_arg) {
spawned_thread *thread = (spawned_thread *)thread_arg;
<API key>(thread->join_semaphore, <API key>);
free(thread);
}
// Join thread and condition variables intentionally unimplemented for
// now on OS X. Use of them will result in linker errors. Currently
// only the common thread pool uses them.
namespace Halide { namespace Runtime { namespace Internal {
WEAK int custom_num_threads = 0;
struct gcd_mutex {
dispatch_once_t once;
<API key> semaphore;
};
WEAK void init_mutex(void *mutex_arg) {
gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
mutex->semaphore = <API key>(1);
}
struct halide_gcd_job {
int (*f)(void *, int, uint8_t *);
void *user_context;
uint8_t *closure;
int min;
int exit_status;
};
// Take a call from <API key>'s parallel for loop, and
// make a call to Halide's do task
WEAK void halide_do_gcd_task(void *job, size_t idx) {
halide_gcd_job *j = (halide_gcd_job *)job;
j->exit_status = halide_do_task(j->user_context, j->f, j->min + (int)idx,
j->closure);
}
}}} // namespace Halide::Runtime::Internal
extern "C" {
WEAK int <API key>(void *user_context, int (*f)(void *, int, uint8_t *),
int idx, uint8_t *closure) {
return f(user_context, idx, closure);
}
WEAK int <API key>(void *user_context, halide_task_t f,
int min, int size, uint8_t *closure) {
if (custom_num_threads == 1 || size == 1) {
// GCD doesn't really allow us to limit the threads,
// so ensure that there's no parallelism by executing serially.
for (int x = min; x < min + size; x++) {
int result = halide_do_task(user_context, f, x, closure);
if (result) {
return result;
}
}
return 0;
}
halide_gcd_job job;
job.f = f;
job.user_context = user_context;
job.closure = closure;
job.min = min;
job.exit_status = 0;
dispatch_apply_f(size, <API key>(0, 0), &job, &halide_do_gcd_task);
return job.exit_status;
}
} // extern "C"
namespace Halide { namespace Runtime { namespace Internal {
WEAK halide_do_task_t custom_do_task = <API key>;
WEAK halide_do_par_for_t custom_do_par_for = <API key>;
}}} // namespace Halide::Runtime::Internal
extern "C" {
WEAK void <API key>(halide_mutex *mutex_arg) {
gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
if (mutex->once != 0) {
dispatch_release(mutex->semaphore);
memset(mutex_arg, 0, sizeof(halide_mutex));
}
}
WEAK void halide_mutex_lock(halide_mutex *mutex_arg) {
gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
dispatch_once_f(&mutex->once, mutex, init_mutex);
<API key>(mutex->semaphore, <API key>);
}
WEAK void halide_mutex_unlock(halide_mutex *mutex_arg) {
gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
<API key>(mutex->semaphore);
}
WEAK void <API key>() {
}
WEAK int <API key>(int n) {
if (n < 0) {
halide_error(NULL, "<API key>: must be >= 0.");
}
int <API key> = custom_num_threads;
custom_num_threads = n;
return <API key>;
}
WEAK halide_do_task_t <API key>(halide_do_task_t f) {
halide_do_task_t result = custom_do_task;
custom_do_task = f;
return result;
}
WEAK halide_do_par_for_t <API key>(halide_do_par_for_t f) {
halide_do_par_for_t result = custom_do_par_for;
custom_do_par_for = f;
return result;
}
WEAK int halide_do_task(void *user_context, halide_task_t f, int idx,
uint8_t *closure) {
return (*custom_do_task)(user_context, f, idx, closure);
}
WEAK int halide_do_par_for(void *user_context, halide_task_t f,
int min, int size, uint8_t *closure) {
return (*custom_do_par_for)(user_context, f, min, size, closure);
}
} |
// Make code portable to Node.js without any changes
try {
var autobahn = require('autobahn');
} catch (e) {
// when running in browser, AutobahnJS will
// be included without a module system
}
var log = function(msg) {
document.getElementById('log').innerHTML = msg;
};
// Set up WAMP connection to router
var protocol = location.protocol == 'https:' ? 'wss:' : 'ws:'
var connection = new autobahn.Connection({
url: protocol + '//'+ location.host + '/wampchat',
realm: 'tutorialrpc'}
);
// Set up 'onopen' handler
connection.onopen = function (session) {
log("Session opened - Id: " + session.id);
// Define the remote procedure
function utcnow() {
now = new Date();
log(now.toISOString());
return now.toISOString();
}
// Register the remote procedure with the router
session.register('com.timeservice.now', utcnow).then(
function (registration) {
log("Procedure registered: " + registration.id);
},
function (error) {
log("Registration failed: " + error);
}
);
};
// Open connection
connection.open(); |
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using GraphX.PCL.Common.Enums;
using ShowcaseApp.WPF.Annotations;
using ShowcaseApp.WPF.Models;
namespace ShowcaseApp.WPF.Pages.Mini
{
<summary>
Interaction logic for LayoutVCP.xaml
</summary>
public partial class EdgesParallel : UserControl, <API key>
{
private int _edgeDistance;
public int EdgeDistance { get { return _edgeDistance; }
set
{
_edgeDistance = value;
graphArea.LogicCore.<API key> = value;
graphArea.UpdateAllEdges(true);
OnPropertyChanged("EdgeDistance");
} }
public EdgesParallel()
{
InitializeComponent();
DataContext = this;
Loaded += ControlLoaded;
cbEnablePE.IsChecked = true;
_edgeDistance = 10;
cbEnablePE.Checked += <API key>;
cbEnablePE.Unchecked += <API key>;
}
private void <API key>(object sender, RoutedEventArgs routedEventArgs)
{
graphArea.LogicCore.EnableParallelEdges = (bool) cbEnablePE.IsChecked;
graphArea.UpdateAllEdges(true);
}
void ControlLoaded(object sender, RoutedEventArgs e)
{
OnPropertyChanged("EdgeDistance");
GenerateGraph();
}
private void GenerateGraph()
{
var logicCore = new LogicCoreExample()
{
Graph = ShowcaseHelper.GenerateDataGraph(3, false)
};
var vList = logicCore.Graph.Vertices.ToList();
//add edges
ShowcaseHelper.AddEdge(logicCore.Graph, vList[0], vList[1]);
ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[0]);
ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[2]);
ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[2]);
ShowcaseHelper.AddEdge(logicCore.Graph, vList[2], vList[1]);
graphArea.LogicCore = logicCore;
//set positions
var posList = new Dictionary<DataVertex, Point>()
{
{vList[0], new Point(0, -150)},
{vList[1], new Point(300, 0)},
{vList[2], new Point(600, -150)},
};
//settings
graphArea.LogicCore.EnableParallelEdges = true;
graphArea.LogicCore.EdgeCurvingEnabled = true;
graphArea.LogicCore.<API key> = _edgeDistance;
graphArea.LogicCore.<API key> = <API key>.SimpleER;
//preload graph
graphArea.PreloadGraph(posList);
//behaviors
graphArea.SetVerticesDrag(true, true);
graphArea.ShowAllEdgesLabels();
graphArea.AlignAllEdgesLabels();
zoomControl.MaxZoom = 50;
//manual edge corrections
var eList = graphArea.EdgesList.Values.ToList();
eList[0].LabelVerticalOffset = 12;
eList[1].LabelVerticalOffset = 12;
eList[2].ShowLabel = false;
eList[3].LabelVerticalOffset = 12;
eList[4].LabelVerticalOffset = 12;
//PS: to see how parallel edges logic works go to GraphArea::<API key>() method
zoomControl.ZoomToFill();
}
public event <API key> PropertyChanged;
[<API key>]
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new <API key>(propertyName));
}
}
} |
#ifndef SIMULATE
#ifndef _UART_H_
#define _UART_H_
/**
* \file uart.h
* \brief UART (USB serial port) functionality.
*
* The Happyboard has a FT232RL USB serial bridge chip on board, which makes it
* appear as a serial port on most OS's (Windows/Mac/Linux). Users can print
* information to the UART and monitor it on a computer using a terminal
* emulator program such as hyperterminal or minicom.
*
* The Happyboard configures the UART for 19200 baud, 8N1.
*/
#include <inttypes.h>
#include <stdio.h>
//notice that printf defaults to using PSTR(), while scanf does not.
#define printf(statement, ...) uart_printf_P(PSTR(statement), ## __VA_ARGS__)
#define printf_P(statement, ...) uart_printf_P(statement, ## __VA_ARGS__)
#define scanf(statement, ...) uart_scanf(statement, ## __VA_ARGS__)
#define scanf_P(statement, ...) uart_scanf_P(PSTR(statement), ## __VA_ARGS__)
/**
* Send a character over UART.
*/
int uart_send(char ch);
/**
* putc function used by printf.
*/
int uart_put(char, FILE *);
/**
* Print an unformated string directly to UART.
*/
void uart_print(const char *string);
int uart_vprintf(const char *fmt, va_list ap);
#endif
/**
* Print a formated string to UART.
*/
int uart_printf(const char *fmt, ...);
#ifndef SIMULATE
int uart_vprintf_P(const char *fmt, va_list ap);
int uart_printf_P(const char *fmt, ...);
char uart_recv();
int uart_get(FILE *f);
uint8_t uart_has_char();
int uart_vscanf_P(const char *fmt, va_list ap);
#endif
/**
* Parse a formatted string from UART.
*/
int uart_scanf(const char *fmt, ...);
#ifndef SIMULATE
int uart_vscanf_P(const char *fmt, va_list ap);
int uart_scanf_P(const char *fmt, ...);
/**
* Initialize the UART driver.
*/
void uart_init(uint16_t baudRate);
#endif
#endif |
require 'rvg/rvg'
Magick::RVG.dpi = 90
TEXT_STYLES = {:writing_mode=>'lr',
:<API key>=>0,
:fill=>'red4',
:font_weight=>'bold',
:font_size=>16}
TEXT_STYLES2 = {:writing_mode=>'lr',
:<API key>=>180,
:fill=>'green',
:font_weight=>'bold',
:font_size=>16}
rvg = Magick::RVG.new(3.in, 1.in).viewbox(0,0,300,100) do |canvas|
canvas.background_fill = 'white'
canvas.text(15, 40, ':<API key>=0').styles(TEXT_STYLES)
canvas.text(15, 80, ':<API key>=180').styles(TEXT_STYLES2)
canvas.rect(299, 99).styles(:fill=>'none',:stroke=>'blue')
end
rvg.draw.write('writing_mode02.gif') |
package org.spongepowered.common.mixin.core.entity.living.golem;
import net.minecraft.entity.monster.EntitySnowman;
import org.spongepowered.api.entity.living.golem.SnowGolem;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Mixin;
@NonnullByDefault
@Mixin(EntitySnowman.class)
@Implements(@Interface(iface = SnowGolem.class, prefix = "snowman$"))
public abstract class MixinEntitySnowman extends MixinEntityGolem {
} |
<?php
namespace Doctrine\Tests\ODM\PHPCR\Functional\Translation;
use Doctrine\Tests\Models\Translation\Article;
use Doctrine\Tests\Models\Translation\Comment;
use Doctrine\Tests\Models\Translation\InvalidMapping;
use Doctrine\Tests\Models\Translation\DerivedArticle;
use Doctrine\Tests\Models\CMS\CmsArticle;
use Doctrine\Tests\ODM\PHPCR\<API key>;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
use Doctrine\ODM\PHPCR\Translation\LocaleChooser\LocaleChooser;
use Doctrine\ODM\PHPCR\PHPCRException;
class DocumentManagerTest extends <API key>
{
protected $testNodeName = '__my_test_node__';
/**
* @var \Doctrine\ODM\PHPCR\DocumentManager
*/
protected $dm;
/**
* @var \PHPCR\SessionInterface
*/
protected $session;
/**
* @var \PHPCR\NodeInterface
*/
protected $node;
/**
* @var ClassMetadata
*/
protected $metadata;
/**
* @var Article
*/
protected $doc;
/**
* @var string
*/
protected $class = 'Doctrine\Tests\Models\Translation\Article';
/**
* @var string
*/
protected $childrenClass = 'Doctrine\Tests\Models\Translation\Comment';
protected $localePrefs = array(
'en' => array('de', 'fr'),
'fr' => array('de', 'en'),
'de' => array('en'),
'it' => array('fr', 'de', 'en'),
);
public function setUp()
{
$this->dm = $this-><API key>();
$this->dm-><API key>(new LocaleChooser($this->localePrefs, 'en'));
$this->node = $this->resetFunctionalNode($this->dm);
$this->dm->clear();
$this->session = $this->dm->getPhpcrSession();
$this->metadata = $this->dm->getClassMetadata($this->class);
$this->doc = new Article();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->doc->author = 'John Doe';
$this->doc->topic = 'Some interesting subject';
$this->doc->setText('Lorem ipsum...');
$this->doc->setSettings(array());
$this->doc->assoc = array('key' => 'value');
}
protected function getTestNode()
{
return $this->session->getNode('/functional/'.$this->testNodeName);
}
protected function <API key>()
{
$node = $this->getTestNode();
$this->assertNotNull($node);
$this->assertFalse($node->hasProperty('topic'));
$this->assertTrue($node->hasProperty(<API key>::<API key>('en', 'topic')));
$this->assertEquals('Some interesting subject', $node->getPropertyValue(<API key>::<API key>('en', 'topic')));
$this->assertTrue($node->hasProperty(<API key>::<API key>('fr', 'topic')));
$this->assertEquals('Un sujet intéressant', $node->getPropertyValue(<API key>::<API key>('fr', 'topic')));
$this->assertEquals('fr', $this->doc->locale);
}
public function testPersistNew()
{
$this->dm->persist($this->doc);
$this->dm->flush();
// Assert the node exists
$node = $this->getTestNode();
$this->assertNotNull($node);
$this->assertFalse($node->hasProperty('topic'));
$this->assertTrue($node->hasProperty(<API key>::<API key>('en', 'topic')));
$this->assertEquals('Some interesting subject', $node->getPropertyValue(<API key>::<API key>('en', 'topic')));
$this->assertTrue($node->hasProperty('author'));
$this->assertEquals('John Doe', $node->getPropertyValue('author'));
$this->assertEquals('en', $this->doc->locale);
}
public function testBindTranslation()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
$this->doc->topic = 'Un sujet intéressant';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this-><API key>();
}
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
$this->assertEquals(array('en'), $this->dm->getLocalesFor($this->doc));
$this->doc->topic = 'Un sujet intéressant';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this->dm->clear();
$this->doc = $this->dm->findTranslation(null, $this->doc->id, 'fr');
$this->assertEquals(array('en', 'fr'), $this->dm->getLocalesFor($this->doc));
$this->dm->removeTranslation($this->doc, 'en');
$this->assertEquals(array('fr'), $this->dm->getLocalesFor($this->doc));
$this->dm->clear();
$this->doc = $this->dm->findTranslation(null, $this->doc->id, 'fr');
$this->assertEquals(array('en', 'fr'), $this->dm->getLocalesFor($this->doc));
$this->dm->removeTranslation($this->doc, 'en');
$this->dm->flush();
$this->assertEquals(array('fr'), $this->dm->getLocalesFor($this->doc));
$this->dm->clear();
$this->doc = $this->dm->find(null, $this->doc->id);
$this->assertEquals(array('fr'), $this->dm->getLocalesFor($this->doc));
try {
$this->dm->removeTranslation($this->doc, 'fr');
$this->fail('Last translation should not be removable');
} catch (PHPCRException $e) {
}
}
/**
* find translation in non-default language and then save it back has to keep language
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
$this->doc->topic = 'Un intéressant';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this->dm->clear();
$node = $this->getTestNode();
$this->assertNotNull($node);
$this->assertEquals('Un intéressant', $node->getPropertyValue(<API key>::<API key>('fr', 'topic')));
$this->doc = $this->dm->findTranslation(null, '/functional/' . $this->testNodeName, 'fr');
$this->doc->topic = 'Un sujet intéressant';
$this->dm->flush();
$this-><API key>();
}
/**
* changing the locale and flushing should pick up changes automatically
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
$this->doc->topic = 'Un sujet intéressant';
$this->doc->locale = 'fr';
$this->dm->flush();
$this-><API key>();
// Get de translation via fallback en
$this->doc = $this->dm->findTranslation(null, '/functional/' . $this->testNodeName, 'de');
$this->doc->topic = 'Ein interessantes Thema';
//set locale explicitly
$this->doc->locale = 'de';
$this->dm->flush();
$node = $this->getTestNode();
// ensure the new translation was bound and persisted
$this->assertEquals('Ein interessantes Thema', $node->getPropertyValue(<API key>::<API key>('de', 'topic')));
}
public function testFlush()
{
$this->dm->persist($this->doc);
$this->doc->topic = 'Un sujet intéressant';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this->doc->topic = 'Un autre sujet';
$this->dm->flush();
$node = $this->getTestNode();
$this->assertNotNull($node);
$this->assertTrue($node->hasProperty(<API key>::<API key>('fr', 'topic')));
$this->assertEquals('Un autre sujet', $node->getPropertyValue(<API key>::<API key>('fr', 'topic')));
$this->assertEquals('fr', $this->doc->locale);
}
public function testFind()
{
$this->dm->persist($this->doc);
$this->dm->flush();
$this->doc = $this->dm->find($this->class, '/functional/' . $this->testNodeName);
$this->assertNotNull($this->doc);
$this->assertEquals('en', $this->doc->locale);
$node = $this->getTestNode();
$this->assertNotNull($node);
$this->assertTrue($node->hasProperty(<API key>::<API key>('en', 'topic')));
$this->assertEquals('Some interesting subject', $node->getPropertyValue(<API key>::<API key>('en', 'topic')));
}
public function testFindTranslation()
{
$this->doc->topic = 'Un autre sujet';
$this->doc->locale = 'fr';
$this->dm->persist($this->doc);
$this->dm->flush();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'fr');
$this->assertNotNull($this->doc);
$this->assertEquals('fr', $this->doc->locale);
$this->assertEquals('Un autre sujet', $this->doc->topic);
}
/**
* Test that children are retrieved in the parent locale
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$comment = new Comment();
$comment->name = 'new-comment';
$comment->parent = $this->doc;
$this->dm->persist($comment);
$comment->setText('This is a great article');
$this->dm->bindTranslation($comment, 'en');
$comment->setText('Très bon article');
$this->dm->bindTranslation($comment, 'fr');
$this->dm->flush();
$this->dm->clear();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'fr');
$this->assertEquals('en', $this->doc->locale);
$children = $this->doc->getChildren();
foreach ($children as $comment) {
$this->assertEquals('fr', $comment->locale);
$this->assertEquals('Très bon article', $comment->getText());
}
$this->doc->topic = 'Un autre sujet';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'fr');
$this->assertEquals('fr', $this->doc->locale);
$children = $this->doc->getChildren();
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertEquals('fr', $comment->locale);
$this->assertEquals('Très bon article', $comment->getText());
}
$children = $this->dm->getChildren($this->doc);
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertEquals('fr', $comment->locale);
$this->assertEquals('Très bon article', $comment->getText());
}
$this->metadata->mappings['children']['cascade'] = ClassMetadata::CASCADE_TRANSLATION;
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'en');
$this->assertEquals('en', $this->doc->locale);
$children = $this->doc->getChildren();
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertEquals('en', $comment->locale);
$this->assertEquals('This is a great article', $comment->getText());
}
$children = $this->dm->getChildren($this->doc);
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertEquals('en', $comment->locale);
$this->assertEquals('This is a great article', $comment->getText());
}
}
/**
* Test that children are retrieved in the parent locale
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->doc->topic = 'Un autre sujet';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$testNode = $this->node->getNode($this->testNodeName);
$testNode->addNode('new-comment');
$this->session->save();
$this->dm->clear();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'fr');
$this->assertEquals('fr', $this->doc->locale);
$children = $this->doc->getChildren();
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertInstanceOf('Doctrine\ODM\PHPCR\Document\Generic', $comment);
$this->assertNull($this->dm->getUnitOfWork()->getCurrentLocale($comment));
}
$this->dm->clear();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'en');
$children = $this->dm->getChildren($this->doc);
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertInstanceOf('Doctrine\ODM\PHPCR\Document\Generic', $comment);
$this->assertNull($this->dm->getUnitOfWork()->getCurrentLocale($comment));
}
}
public function testFindByUUID()
{
$this->doc->topic = 'Un autre sujet';
$this->doc->locale = 'fr';
$this->dm->persist($this->doc);
$this->dm->flush();
$node = $this->session->getNode('/functional/'.$this->testNodeName);
$node->addMixin('mix:referenceable');
$this->session->save();
$this->document = $this->dm->findTranslation($this->class, $node->getIdentifier(), 'fr');
$this->assertInstanceOf($this->class, $this->document);
}
/**
* Italian translation does not exist so as defined in $this->localePrefs we
* will get french as it has higher priority than english
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->doc->topic = 'Un autre sujet';
$this->doc->text = 'Text';
$this->doc->locale = 'fr';
$this->dm->flush();
$this->dm-><API key>()->setLocale('it');
$this->doc = $this->dm->find($this->class, '/functional/' . $this->testNodeName);
$this->assertNotNull($this->doc);
$this->assertEquals('fr', $this->doc->locale);
$this->assertEquals('Un autre sujet', $this->doc->topic);
$this->assertEquals('Text', $this->doc->text);
}
/**
* Same as <API key>, but all properties are nullable.
*/
public function <API key>()
{
$doc = new Comment();
$doc->id = '/functional/fallback-nullable';
$doc->setText('Un commentaire');
$doc->locale = 'fr';
$this->dm->persist($doc);
$this->dm->flush();
$this->dm->clear();
$this->dm-><API key>()->setLocale('it');
$doc = $this->dm->find(null, '/functional/fallback-nullable');
$this->assertNotNull($doc);
$this->assertEquals('fr', $doc->locale);
$this->assertEquals('Un commentaire', $doc->getText());
}
/**
* Italian translation does not exist so as defined in $this->localePrefs we
* will get french as it has higher priority than english
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->doc->topic = 'Un autre sujet';
$this->doc->locale = 'fr';
$this->dm->flush();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'it');
$this->assertNotNull($this->doc);
$this->assertEquals('fr', $this->doc->locale);
$this->assertEquals('Un autre sujet', $this->doc->topic);
}
/**
* @expectedException \Doctrine\ODM\PHPCR\Translation\<API key>
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->flush();
$this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'es');
}
/**
* Italian translation does not exist so as defined in $this->localePrefs we
* will get french as it has higher priority than english
*/
public function <API key>()
{
$this->dm->persist($this->doc);
$this->dm->flush();
// if we do not flush, the translation node does not exist
$doc = $this->dm->findTranslation($this->class, $this->doc->id, 'it', true);
$this->assertInstanceOf('Doctrine\Tests\Models\Translation\Article', $doc);
$this->assertEquals('John Doe', $doc->author);
$this->assertEquals('en', $doc->locale);
$this-><API key>('Doctrine\ODM\PHPCR\Translation\<API key>');
$this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'it', false);
}
/**
* Test what happens if all document fields are nullable and actually null.
*/
public function <API key>()
{
$path = $this->node->getPath() . '/only-null';
$doc = new Comment();
$doc->id = $path;
$this->dm->persist($doc);
$this->dm->flush();
$this->dm->clear();
$doc = $this->dm->find(null, $path);
$this->assertInstanceOf('Doctrine\Tests\Models\Translation\Comment', $doc);
$this->assertNull($doc->getText());
}
/**
* We only validate when saving, never when loading. This has to find the
* incomplete english translation.
*/
public function <API key>()
{
$node = $this->node->addNode('find');
$node->setProperty('phpcr:class', 'Doctrine\Tests\Models\Translation\Article');
$node->setProperty(<API key>::<API key>('en', 'topic'), 'title');
$node->setProperty(<API key>::<API key>('de', 'topic'), 'Titel');
$this->dm->getPhpcrSession()->save();
$this->dm->clear();
/** @var $doc Article */
$doc = $this->dm->find(null, $this->node->getPath().'/find');
$this->assertEquals('en', $doc->locale);
$this->assertEquals('title', $doc->topic);
$this->assertNull($doc->text);
}
/**
* No translation whatsoever is available. All translated fields have to be
* null as we do not validate on loading.
*/
public function <API key>()
{
$node = $this->node->addNode('find');
$node->setProperty('phpcr:class', 'Doctrine\Tests\Models\Translation\Article');
$this->dm->getPhpcrSession()->save();
$this->dm->clear();
/** @var $doc Article */
$doc = $this->dm->find(null, $this->node->getPath().'/find');
$this->assertEquals('en', $doc->locale);
$this->assertNull($doc->topic);
$this->assertNull($doc->text);
}
/**
* @expectedException \Doctrine\ODM\PHPCR\PHPCRException
*/
public function <API key>()
{
$doc = new Article();
$doc->id = $this->node->getPath().'/flush';
$doc->topic = 'title';
$doc->locale = 'en';
$this->dm->persist($doc);
$this->dm->flush();
}
public function <API key>()
{
$doc = new Article();
$doc->id = $this->node->getPath().'/flush';
$doc->topic = 'title';
$doc->text = 'text';
$doc->locale = 'en';
$this->dm->persist($doc);
$this->dm->flush();
$this-><API key>('Doctrine\ODM\PHPCR\PHPCRException');
$doc->topic = null;
$this->dm->flush();
}
public function testGetLocaleFor()
{
// Only 1 language is persisted
$this->dm->persist($this->doc);
$this->dm->flush();
$locales = $this->dm->getLocalesFor($this->doc);
$this->assertEquals(array('en'), $locales);
// A second language is persisted
$this->dm->bindTranslation($this->doc, 'fr');
// Check that french is now also returned even without having flushed
$locales = $this->dm->getLocalesFor($this->doc);
$this->assertCount(2, $locales);
$this->assertTrue(in_array('en', $locales));
$this->assertTrue(in_array('fr', $locales));
$this->dm->flush();
$locales = $this->dm->getLocalesFor($this->doc);
$this->assertCount(2, $locales);
$this->assertTrue(in_array('en', $locales));
$this->assertTrue(in_array('fr', $locales));
// A third language is bound but not yet flushed
$this->dm->bindTranslation($this->doc, 'de');
$locales = $this->dm->getLocalesFor($this->doc);
$this->assertCount(3, $locales);
$this->assertTrue(in_array('en', $locales));
$this->assertTrue(in_array('fr', $locales));
$this->assertTrue(in_array('de', $locales));
}
public function testRemove()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$this->dm->remove($this->doc);
$this->dm->flush();
$this->dm->clear();
$this->doc = $this->dm->find($this->class, '/functional/' . $this->testNodeName);
$this->assertNull($this->doc, 'Document must be null after deletion');
$this->doc = new Article();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->doc->author = 'John Doe';
$this->doc->topic = 'Some interesting subject';
$this->doc->setText('Lorem ipsum...');
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
$locales = $this->dm->getLocalesFor($this->doc);
$this->assertEquals(array('en'), $locales, 'Removing a document must remove all translations');
}
/**
* @expectedException \Doctrine\ODM\PHPCR\Exception\<API key>
*/
public function <API key>()
{
$this->doc = new InvalidMapping();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->doc->topic = 'foo';
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->dm->flush();
}
/**
* bindTranslation with a document that is not persisted should fail
*
* @expectedException \Doctrine\ODM\PHPCR\Exception\<API key>
*/
public function <API key>()
{
$this->doc = new CmsArticle();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->dm->bindTranslation($this->doc, 'en');
}
/**
* bindTranslation with a document that is not translatable should fail
*
* @expectedException \Doctrine\ODM\PHPCR\PHPCRException
*/
public function <API key>()
{
$this->doc = new CmsArticle();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
}
/**
* bindTranslation with a document inheriting from a translatable document
* should not fail
*/
public function <API key>()
{
$this->doc = new DerivedArticle();
$this->doc->id = '/functional/' . $this->testNodeName;
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->assertEquals('en', $this->doc->locale);
}
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->title = 'Hello';
$this->dm->persist($a);
$translations = array(
'en' => array('topic' => 'Welcome', 'assoc_value' => 'in en'),
'fr' => array('topic' => 'Bienvenue', 'assoc_value' => 'in fr'),
'de' => array('topic' => 'Wilkommen', 'assoc_value' => 'in de'),
);
foreach ($translations as $locale => $values) {
$a->topic = $values['topic'];
$a->assoc = array('key' => $values['assoc_value']);
$this->dm->bindTranslation($a, $locale);
}
foreach ($translations as $locale => $values) {
$trans = $this->dm->findTranslation(
'Doctrine\Tests\Models\Translation\Article',
'/functional/' . $this->testNodeName,
$locale
);
$this->assertNotNull($trans, 'Finding translation with locale "'.$locale.'"');
$this->assertInstanceOf('Doctrine\Tests\Models\Translation\Article', $trans);
$this->assertEquals($values['topic'], $trans->topic);
$this->assertEquals($values['assoc_value'], $trans->assoc['key']);
$this->assertEquals($locale, $trans->locale);
}
$locales = $this->dm->getLocalesFor($a);
$this->assertEquals(array('en', 'fr', 'de'), $locales);
}
/**
* When loading the "it" locale, the fallback is "de" and we have a not yet
* flushed translation for that.
*/
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'Some text';
$this->dm->persist($a);
$this->dm->flush();
$a->topic = 'Guten tag';
$this->dm->bindTranslation($a, 'de');
// find the italian translation
$trans = $this->dm->findTranslation(
null,
'/functional/' . $this->testNodeName,
'it'
);
$this->assertNotNull($trans);
$this->assertInstanceOf('Doctrine\Tests\Models\Translation\Article', $trans);
$this->assertEquals('Guten tag', $trans->topic);
$this->assertEquals('de', $trans->locale);
}
/*
* A series of edge cases:
*
* We already have a translation for a locale (de), load the document in a
* different locale (en) and set some value, then try to bind it in the
* first locale (de). This would result in overwriting fields of the german
* translation.
*
* Rather than allow this confusing behavior we throw an exception.
*/
/**
* The locale is only in memory.
*
* @expectedException \Doctrine\ODM\PHPCR\Exception\RuntimeException
* @<API key> Translation "de" already exists
*/
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'This is an article in English';
$this->dm->persist($a);
$this->dm->flush();
$a->topic = 'Guten tag';
$a->text = 'Dies ist ein Artikel Deutsch';
$this->dm->persist($a);
$this->dm->bindTranslation($a, 'de');
$a = $this->dm->findTranslation(null, '/functional/' . $this->testNodeName, 'en');
$a->topic = 'Hallo';
// this would kill the $a->text and set it back to the english text
$this->dm->bindTranslation($a, 'de');
}
/**
* The locale is flushed.
*
* @expectedException \Doctrine\ODM\PHPCR\Exception\RuntimeException
* @<API key> Translation "de" already exists
*/
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'This is an article in English';
$this->dm->persist($a);
$this->dm->flush();
$a->topic = 'Guten tag';
$a->text = 'Dies ist ein Artikel Deutsch';
$this->dm->persist($a);
$this->dm->bindTranslation($a, 'de');
$this->dm->flush();
$a = $this->dm->findTranslation(null, '/functional/' . $this->testNodeName, 'en');
$a->topic = 'Hallo';
// this would kill the $a->text and set it back to the english text
$this->dm->bindTranslation($a, 'de');
}
/**
* The locale is not even currently loaded
*
* @expectedException \Doctrine\ODM\PHPCR\Exception\RuntimeException
* @<API key> Translation "de" already exists
*/
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'This is an article in English';
$this->dm->persist($a);
$this->dm->flush();
$a->topic = 'Guten tag';
$a->text = 'Dies ist ein Artikel Deutsch';
$this->dm->persist($a);
$this->dm->bindTranslation($a, 'de');
$this->dm->flush();
$this->dm->clear();
$a = $this->dm->find(null, '/functional/' . $this->testNodeName);
$a->topic = 'Hallo';
// this would kill the $a->text and set it back to the english text
$this->dm->bindTranslation($a, 'de');
}
public function testAssocWithNulls()
{
$assoc = array('foo' => 'bar', 'test' => null, 2 => 'huhu');
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'This is an article in English';
$a->assoc = $assoc;
$this->dm->persist($a);
$this->dm->bindTranslation($a, 'de');
$this->dm->flush();
$this->dm->clear();
$a = $this->dm->find(null, '/functional/' . $this->testNodeName);
$this->assertEquals($assoc, $a->assoc);
}
public function <API key>()
{
$a = new Article();
$a->id = '/functional/' . $this->testNodeName;
$a->topic = 'Hello';
$a->text = 'Some text';
$this->dm->persist($a);
$this->dm->flush();
$a->topic = 'Guten tag';
$trans = $this->dm->findTranslation(
null,
'/functional/' . $this->testNodeName,
'en'
);
$this->assertEquals('Guten tag', $trans->topic);
}
} |
<?php
/**
* Add an image transformation preset
*/
return [
'<API key>' => [
'graythumb' => [
'thumbnail',
'desaturate',
],
],
]; |
using UnityEngine;
using UnityEditor;
using System;
namespace UnityToolbag
{
[<API key>(typeof(<API key>))]
public class SortingLayerDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var sortingLayerNames = SortingLayerHelper.sortingLayerNames;
if (property.propertyType != <API key>.Integer) {
EditorGUI.HelpBox(position, string.Format("{0} is not an integer but has [SortingLayer].", property.name), MessageType.Error);
}
else if (sortingLayerNames != null) {
EditorGUI.BeginProperty(position, label, property);
// Look up the layer name using the current layer ID
string oldName = SortingLayerHelper.<API key>(property.intValue);
// Use the name to look up our array index into the names list
int oldLayerIndex = Array.IndexOf(sortingLayerNames, oldName);
// Show the popup for the names
int newLayerIndex = EditorGUI.Popup(position, label.text, oldLayerIndex, sortingLayerNames);
// If the index changes, look up the ID for the new index to store as the new ID
if (newLayerIndex != oldLayerIndex) {
property.intValue = SortingLayerHelper.<API key>(newLayerIndex);
}
EditorGUI.EndProperty();
}
else {
EditorGUI.BeginProperty(position, label, property);
int newValue = EditorGUI.IntField(position, label.text, property.intValue);
if (newValue != property.intValue) {
property.intValue = newValue;
}
EditorGUI.EndProperty();
}
}
}
} |
#include <catch/catch.hpp>
#include <Collision/PolygonalCollider.hpp>
#include <Utils/MathUtils.hpp>
using namespace obe::Utils::Math;
TEST_CASE("A double should be truncated to an int without data loss"
" (including floating point precision)",
"[obe.Utils.Math.isDoubleInt]")
{
SECTION("Correct Positive values")
{
REQUIRE(isDoubleInt(0.0) == true);
REQUIRE(isDoubleInt(42.0) == true);
REQUIRE(isDoubleInt(7894561) == true);
REQUIRE(isDoubleInt(2147483647) == true);
}
SECTION("Correct Negative values")
{
REQUIRE(isDoubleInt(-123456) == true);
REQUIRE(isDoubleInt(-2147483647) == true);
}
SECTION("Overflow values")
{
REQUIRE(isDoubleInt(2147483648) == false);
REQUIRE(isDoubleInt(-9000000000) == false);
}
SECTION("Floating point precision loss")
{
REQUIRE(isDoubleInt(4.5) == false);
REQUIRE(isDoubleInt(-1.1) == false);
}
}
TEST_CASE("A value should be converted from degrees to radians",
"[obe.Utils.Math.convertToRadian]")
{
SECTION("Positive Known Angles")
{
REQUIRE(convertToRadian(0) == 0);
REQUIRE(convertToRadian(90) == Approx(pi / 2));
REQUIRE(convertToRadian(180) == Approx(pi).margin(0.1));
REQUIRE(convertToRadian(270) == Approx(pi + pi / 2));
}
SECTION("Negative Known Angles")
{
REQUIRE(convertToRadian(-90) == Approx(-pi / 2));
REQUIRE(convertToRadian(-180) == Approx(-pi));
REQUIRE(convertToRadian(-270) == Approx(-pi - pi / 2));
REQUIRE(convertToRadian(-360) == Approx(-2 * pi));
}
SECTION("Random Angles")
{
REQUIRE(convertToRadian(22) == Approx(0.383972));
REQUIRE(convertToRadian(42) == Approx(0.733038));
REQUIRE(convertToRadian(-59) == Approx(-1.02974));
REQUIRE(convertToRadian(-196) == Approx(-3.42085));
}
}
TEST_CASE("A value should be converted from radians to degrees",
"[obe.Utils.Math.convertToDegree]")
{
SECTION("Positive Known Angles")
{
REQUIRE(convertToDegree(0) == 0);
REQUIRE(convertToDegree(pi / 2) == Approx(90));
REQUIRE(convertToDegree(pi) == Approx(180));
REQUIRE(convertToDegree(pi + pi / 2) == Approx(270));
}
SECTION("Negative Known Angles")
{
REQUIRE(convertToDegree(-pi / 2) == Approx(-90));
REQUIRE(convertToDegree(-pi) == Approx(-180));
REQUIRE(convertToDegree(-pi - pi / 2) == Approx(-270));
REQUIRE(convertToDegree(-2 * pi) == Approx(-360));
}
SECTION("Random Angles")
{
REQUIRE(convertToDegree(1) == Approx(57.2958));
REQUIRE(convertToDegree(22) == Approx(1260.51));
REQUIRE(convertToDegree(-2.5) == Approx(-143.239));
REQUIRE(convertToDegree(0.7) == Approx(40.107));
}
}
TEST_CASE("A value should be normalised from start to end", "[obe.Utils.Math.normalise]")
{
SECTION("Angle normalisation")
{
REQUIRE(normalize(0, 0, 360) == 0);
REQUIRE(normalize(360, 0, 360) == 0);
REQUIRE(normalize(361, 0, 360) == 1);
REQUIRE(normalize(720, 0, 360) == 0);
REQUIRE(normalize(1000, 0, 360) == 280);
REQUIRE(normalize(-650, 0, 360) == 70);
}
}
TEST_CASE(
"A random number should be between min and max value", "[obe.Utils.Math.randint]")
{
SECTION("Positive bounds")
{
REQUIRE(randint(0, 100) >= 0);
REQUIRE(randint(0, 100) <= 100);
}
}
TEST_CASE("A random number should be between 0 and 1", "[obe.Utils.Math.randfloat]")
{
SECTION("100 random float")
{
for (unsigned int i = 0; i < 100; i++)
{
float value = randfloat();
REQUIRE(value >= 0.f);
REQUIRE(value <= 1.f);
}
}
} |
'use strict';
/**
* The collection of alerts.
*/
class AlertList extends Array {
/**
* Create a AlertList.
* @member {string} [nextLink] The URI of the next page of alerts.
*/
constructor() {
super();
}
/**
* Defines the metadata of AlertList
*
* @returns {object} metadata of AlertList
*
*/
mapper() {
return {
required: false,
serializedName: 'AlertList',
type: {
name: 'Composite',
className: 'AlertList',
modelProperties: {
value: {
required: true,
serializedName: '',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'AlertElementType',
type: {
name: 'Composite',
className: 'Alert'
}
}
}
},
nextLink: {
required: false,
serializedName: 'nextLink',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = AlertList; |
package org.spongepowered.common.mixin.command.multiworld;
import net.minecraft.command.CommandWeather;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(CommandWeather.class)
public abstract class MixinCommandWeather {
@Redirect(method = "execute", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/World;getWorldInfo()Lnet/minecraft/world/storage/WorldInfo;"))
private WorldInfo onGetWorldInfo(World world, MinecraftServer server, ICommandSender sender, String[] args) {
return sender.getEntityWorld().getWorldInfo();
}
} |
var parent = require('../../actual/reflect/apply');
module.exports = parent; |
using System;
using System.Globalization;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Microsoft.Samples.VisualStudio.<API key>.SccProvider
{
<summary>
Summary description for <API key>.
</summary>
public class <API key> : UserControl
{
private Label label1;
public <API key>()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
}
<summary>
Let this control process the mnemonics.
</summary>
protected override bool ProcessDialogChar(char charCode)
{
// If we're the top-level form or control, we need to do the mnemonic handling
if (charCode != ' ' && ProcessMnemonic(charCode))
{
return true;
}
return base.ProcessDialogChar(charCode);
}
#region Component Designer generated code
<summary>
Required method for Designer support - do not modify
the contents of this method with the code editor.
</summary>
private void InitializeComponent()
{
<API key> resources = new <API key>(typeof(<API key>));
label1 = new Label();
SuspendLayout();
// label1
resources.ApplyResources( label1, "label1");
label1.Name = "label1";
// <API key>
BackColor = SystemColors.Window;
Controls.Add(label1);
Name = "<API key>";
resources.ApplyResources(this, "$this");
ResumeLayout(false);
PerformLayout();
}
#endregion
}
} |
<?php
namespace FOS\JsRoutingBundle\Extractor;
class ExtractedRoute
{
private $tokens;
private $defaults;
private $requirements;
public function __construct(array $tokens, array $defaults, array $requirements)
{
$this->tokens = $tokens;
$this->defaults = $defaults;
$this->requirements = $requirements;
}
public function getTokens()
{
return $this->tokens;
}
public function getDefaults()
{
return $this->defaults;
}
public function getRequirements()
{
return $this->requirements;
}
} |
require 'spec_helper'
describe OmniAuth::Strategies::OpenID do
end
# require File.dirname(__FILE__) + '/../../spec_helper'
# describe OmniAuth::Strategies::OpenID, :type => :strategy do
# include OmniAuth::Test::StrategyTestCase
# def strategy
# [OmniAuth::Strategies::OpenID]
# end
# describe '/auth/open_id without an identifier URL' do
# before do
# get '/auth/open_id'
# end
# it 'should respond with OK' do
# last_response.should be_ok
# end
# it 'should respond with HTML' do
# last_response.content_type.should == 'text/html'
# end
# it 'should render an identifier URL input' do
# last_response.body.should =~ %r{<input[^>]*#{OmniAuth::Strategies::OpenID::<API key>}}
# end
# end
# describe '/auth/open_id with an identifier URL' do
# before do
# # TODO: change this mock to actually return some sort of OpenID response
# stub_request(:get, @identifier_url)
# get '/auth/open_id?openid_url=' + @identifier_url
# end
# it 'should redirect to the OpenID identity URL' do
# last_response.should be_redirect
# last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*}
# end
# it 'should tell the OpenID server to return to the callback URL' do
# return_to = CGI.escape(last_request.url + '/callback')
# last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}}
# end
# end
# describe 'followed by /auth/open_id/callback' do
# before do
# # TODO: change this mock to actually return some sort of OpenID response
# stub_request(:get, @identifier_url)
# get '/auth/open_id/callback'
# end
# sets_an_auth_hash
# sets_provider_to 'open_id'
# it 'should call through to the master app' do
# last_response.body.should == 'true'
# end
# end
# end |
/*
W3C Sample Code Library libwww SQL Interface
!
W3C Sample Code Library libwww SQL Interface
!
*/
/*
This module is an easy to use interface to SQL databases. It contains both
a generic interface and some specific examples of how this can be used to
connect a Web client to an SQL server. This requires that you have linked
against the MySQL library. See the
installation instructions for details.
*/
#ifndef WWWSQL_H
#define WWWSQL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
(
System dependencies
)
The wwwsys.h file includes system-specific include
files and flags for I/O to network and disk. The only reason for this file
is that the Internet world is more complicated than Posix and ANSI.
*/
#include "wwwsys.h"
/*
(
Basic SQL Interface
)
This module interacts with the MYSQL C client library to perform SQL operations.
It is not intended as a complete SQL API but handles most of the typical
error situations talking to an SQL server so that the caller doesn't have
to think about it.
*/
#ifdef HT_MYSQL
#include "HTSQL.h"
#endif
/*
(
SQL Client Side Logging
)
This SQL based log class generates a SQL database and a set of tables storing
the results of a request. The result is stored in different tables depending
on whether it is information about the request or the resource returned.
*/
#ifdef HT_MYSQL
#include "HTSQLLog.h"
#endif
#ifdef __cplusplus
} /* end extern C definitions */
#endif
#endif /* WWWSQL_H */
/*
@(#) $Id: WWWSQL.html,v 2.1 1998/05/24 19:39:40 frystyk Exp $
*/ |
#pragma once
#include <string>
/**
* \brief Some Classes and Functions to manipulate Engine Execution
*/
namespace obe::Utils::Exec
{
/**
* TODO: Replace RunArgsParser with a real argument parsing library
* \brief Parses the execution arguments
*/
class RunArgsParser
{
private:
char** start;
int size;
public:
/**
* \brief Constructor of RunArgsParser takes argc and argv in parameters
* \param size This is argc
* \param start This is argv
*/
RunArgsParser(int size, char** start);
/**
* \brief Check if a argument has been entered
* \param arg Name of the argument you want to check existence
* \return true if the argument exists, false otherwise
*/
[[nodiscard]] bool argumentExists(const std::string& arg) const;
/**
* \brief Get the given argument's value
* \param arg Name of the argument you want to retrieve the value
* \return The value of the argument
*/
[[nodiscard]] std::string getArgumentValue(const std::string& arg) const;
};
} // namespace obe::Utils::Exec |
require 'spec_helper'
describe RailsSettingsUi::ValueTypes::Boolean do
describe "#cast" do
it "should cast to true" do
boolean_type = RailsSettingsUi::ValueTypes::Boolean.new("on")
expect(boolean_type.cast).to eq(true)
end
end
end |
require 'spec_helper'
class <API key>
include PageObject
end
class CustomPlatform
end
describe PageObject do
let(:watir_browser) { mock_watir_browser }
let(:selenium_browser) { <API key> }
let(:watir_page_object) { <API key>.new(watir_browser) }
let(:<API key>) { <API key>.new(selenium_browser) }
context "setting values on the PageObject module" do
it "should set the javascript framework" do
expect(PageObject::<API key>).to receive(:framework=)
PageObject.<API key> = :foo
end
it "should add a new Javascript Framework" do
expect(PageObject::<API key>).to receive(:add_framework)
PageObject.add_framework(:foo, :bar)
end
it "should set a default page wait value" do
PageObject.default_page_wait = 20
wait = PageObject.<API key>("@page_wait")
expect(wait).to eql 20
end
it "should provide the default page wait value" do
PageObject.<API key>("@page_wait", 10)
expect(PageObject.default_page_wait).to eql 10
end
it "should default the page wait value to 30" do
PageObject.<API key>("@page_wait", nil)
expect(PageObject.default_page_wait).to eql 30
end
it "should set the default element wait value" do
PageObject.<API key> = 20
wait = PageObject.<API key>("@element_wait")
expect(wait).to eql 20
end
it "should provide the default element wait value" do
PageObject.<API key>("@element_wait", 10)
expect(PageObject.<API key>).to eql 10
end
it "should default the element wait to 5" do
PageObject.<API key>("@element_wait", nil)
expect(PageObject.<API key>).to eql 5
end
end
context "setting values on the PageObject class instance" do
it "should set the params value" do
<API key>.params = {:some => :value}
params = <API key>.<API key>("@params")
expect(params[:some]).to eql :value
end
it "should provide the params value" do
<API key>.<API key>("@params", {:value => :updated})
expect(<API key>.params[:value]).to eql :updated
end
it "should default the params to an empty hash" do
<API key>.<API key>("@params", nil)
expect(<API key>.params).to eql Hash.new
end
end
context "when created with a watir-webdriver browser" do
it "should include the WatirPageObject module" do
expect(watir_page_object.platform).to be_kind_of PageObject::Platforms::WatirWebDriver::PageObject
end
end
context "when created with a selenium browser" do
it "should include the SeleniumPageObject module" do
expect(<API key>.platform).to be_kind_of PageObject::Platforms::SeleniumWebDriver::PageObject
end
end
context "when created with a non_bundled adapter" do
let(:custom_adapter) { mock_adapter(:custom_browser, CustomPlatform) }
it "should be an instance of whatever that objects adapter is" do
mock_adapters({:custom_adapter=>custom_adapter})
custom_page_object = <API key>.new(:custom_browser)
expect(custom_page_object.platform).to be custom_adapter.create_page_object
end
end
context "when created with an object we do not understand" do
it "should throw an error" do
expect {
TestPageObject.new("blah")
}.to raise_error
end
end
describe "page level functionality" do
context "for all drivers" do
it "should try a second time after sleeping when attach to window fails" do
expect(watir_page_object.platform).to receive(:attach_to_window).once.and_throw "error"
expect(watir_page_object.platform).to receive(:attach_to_window)
watir_page_object.attach_to_window("blah")
end
it "should call initialize_page if it exists" do
class CallbackPage
include PageObject
attr_reader :<API key>
def initialize_page
@<API key> = true
end
end
@page = CallbackPage.new(watir_browser)
expect(@page.<API key>).to be true
end
it "should call <API key> if it exists" do
class CallbackPage
include PageObject
attr_reader :<API key>
def <API key>
@<API key> = true
end
end
@page = CallbackPage.new(watir_browser)
expect(@page.<API key>).to be true
end
it "should call <API key> before initialize_page if both exist" do
class CallbackPage
include PageObject
attr_reader :initialize_page, :<API key>
def initialize_page
@<API key> = Time.now
end
def initialize_page
@<API key> = Time.now
end
end
@page = CallbackPage.new(watir_browser)
expect(@page.<API key>.usec).to be <= @page.initialize_page.usec
end
it "should know which element has focus" do
expect(watir_browser).to receive(:execute_script).and_return(watir_browser)
expect(watir_browser).to receive(:tag_name).twice.and_return(:input)
expect(watir_browser).to receive(:type).and_return(:submit)
expect(watir_page_object.element_with_focus.class).to eql PageObject::Elements::Button
end
end
context "when using WatirPageObject" do
it "should display the page text" do
expect(watir_browser).to receive(:element).and_return(watir_browser)
expect(watir_browser).to receive(:text).and_return("browser text")
expect(watir_page_object.text).to eql "browser text"
end
it "should display the html of the page" do
expect(watir_browser).to receive(:html).and_return("<html>Some Sample HTML</html>")
expect(watir_page_object.html).to eql "<html>Some Sample HTML</html>"
end
it "should display the title of the page" do
expect(watir_browser).to receive(:title).and_return("I am the title of a page")
expect(watir_page_object.title).to eql "I am the title of a page"
end
it "should be able to navigate to a page" do
expect(watir_browser).to receive(:goto).with("cheezyworld.com")
watir_page_object.navigate_to("cheezyworld.com")
end
it "should wait until a block returns true" do
expect(watir_browser).to receive(:wait_until).with(5, "too long")
watir_page_object.wait_until(5, "too long")
end
it "should use the overriden timeout value when set" do
PageObject.default_page_wait = 10
expect(watir_browser).to receive(:wait_until).with(10, nil)
watir_page_object.wait_until
end
it "should wait until there are no pending ajax requests" do
expect(PageObject::<API key>).to receive(:pending_requests).and_return('pending requests')
expect(watir_browser).to receive(:execute_script).with('pending requests').and_return(0)
watir_page_object.wait_for_ajax
end
it "should override alert popup behavior" do
expect(watir_browser).to receive(:alert).exactly(3).times.and_return(watir_browser)
expect(watir_browser).to receive(:exists?).and_return(true)
expect(watir_browser).to receive(:text)
expect(watir_browser).to receive(:ok)
watir_page_object.alert do
end
end
it "should override confirm popup behavior" do
expect(watir_browser).to receive(:alert).exactly(3).times.and_return(watir_browser)
expect(watir_browser).to receive(:exists?).and_return(true)
expect(watir_browser).to receive(:text)
expect(watir_browser).to receive(:ok)
watir_page_object.confirm(true) do
end
end
it "should override prompt popup behavior" do
expect(watir_browser).to receive(:wd).twice.and_return(watir_browser)
expect(watir_browser).to receive(:execute_script).twice
watir_page_object.prompt("blah") do
end
end
it "should execute javascript on the browser" do
expect(watir_browser).to receive(:execute_script).and_return("abc")
expect(watir_page_object.execute_script("333")).to eql "abc"
end
it "should convert a modal popup to a window" do
expect(watir_browser).to receive(:execute_script)
watir_page_object.modal_dialog {}
end
it "should switch to a new window with a given title" do
expect(watir_browser).to receive(:window).with(:title => /My\ Title/).and_return(watir_browser)
expect(watir_browser).to receive(:use)
watir_page_object.attach_to_window(:title => "My Title")
end
it "should switch to a new window with a given url" do
expect(watir_browser).to receive(:window).with(:url => /success\.html/).and_return(watir_browser)
expect(watir_browser).to receive(:use)
watir_page_object.attach_to_window(:url => "success.html")
end
it "should refresh the page contents" do
expect(watir_browser).to receive(:refresh)
watir_page_object.refresh
end
it "should know how to go back" do
expect(watir_browser).to receive(:back)
watir_page_object.back
end
it "should know how to go forward" do
expect(watir_browser).to receive(:forward)
watir_page_object.forward
end
it "should know its' current url" do
expect(watir_browser).to receive(:url).and_return("cheezyworld.com")
expect(watir_page_object.current_url).to eql "cheezyworld.com"
end
it "should know how to clear all of the cookies from the browser" do
expect(watir_browser).to receive(:cookies).and_return(watir_browser)
expect(watir_browser).to receive(:clear)
watir_page_object.clear_cookies
end
it "should be able to save a screenshot" do
expect(watir_browser).to receive(:wd).and_return(watir_browser)
expect(watir_browser).to receive(:save_screenshot)
watir_page_object.save_screenshot("test.png")
end
end
context "when using SeleniumPageObject" do
it "should display the page text" do
expect(selenium_browser).to receive_messages(find_element: selenium_browser, text: 'browser text')
expect(<API key>.text).to eql "browser text"
end
it "should display the html of the page" do
expect(selenium_browser).to receive(:page_source).and_return("<html>Some Sample HTML</html>")
expect(<API key>.html).to eql "<html>Some Sample HTML</html>"
end
it "should display the title of the page" do
expect(selenium_browser).to receive(:title).and_return("I am the title of a page")
expect(<API key>.title).to eql "I am the title of a page"
end
it "should be able to navigate to a page" do
expect(selenium_browser).to receive_messages(navigate: selenium_browser, to: 'cheezyworld.com')
<API key>.navigate_to('cheezyworld.com')
end
it "should wait until a block returns true" do
wait = double('wait')
expect(Selenium::WebDriver::Wait).to receive(:new).with({:timeout => 5, :message => 'too long'}).and_return(wait)
expect(wait).to receive(:until)
<API key>.wait_until(5, 'too long')
end
it "should wait until there are no pending ajax requests" do
expect(PageObject::<API key>).to receive(:pending_requests).and_return('pending requests')
expect(selenium_browser).to receive(:execute_script).with('pending requests').and_return(0)
<API key>.wait_for_ajax
end
it "should override alert popup behavior" do
expect(selenium_browser).to receive(:switch_to).and_return(selenium_browser)
expect(selenium_browser).to receive(:alert).and_return(selenium_browser)
expect(selenium_browser).to receive(:text)
expect(selenium_browser).to receive(:accept)
<API key>.alert do
end
end
it "should override confirm popup behavior" do
expect(selenium_browser).to receive(:switch_to).and_return(selenium_browser)
expect(selenium_browser).to receive(:alert).and_return(selenium_browser)
expect(selenium_browser).to receive(:text)
expect(selenium_browser).to receive(:accept)
<API key>.confirm(true) do
end
end
it "should override prompt popup behavior" do
expect(selenium_browser).to receive(:execute_script).twice
<API key>.prompt("blah") do
end
end
it "should convert a modal popup to a window" do
expect(selenium_browser).to receive(:execute_script)
<API key>.modal_dialog {}
end
it "should execute javascript on the browser" do
expect(selenium_browser).to receive(:execute_script).and_return("abc")
expect(<API key>.execute_script("333")).to eql "abc"
end
it "should switch to a new window with a given title" do
expect(selenium_browser).to receive(:window_handles).and_return(["win1"])
expect(selenium_browser).to receive(:switch_to).twice.and_return(selenium_browser)
expect(selenium_browser).to receive(:window).twice.with("win1").and_return(selenium_browser)
expect(selenium_browser).to receive(:title).and_return("My Title")
<API key>.attach_to_window(:title => "My Title")
end
it "should switch to a new window with a given url" do
expect(selenium_browser).to receive(:window_handles).and_return(["win1"])
expect(selenium_browser).to receive(:switch_to).twice.and_return(selenium_browser)
expect(selenium_browser).to receive(:window).twice.with("win1").and_return(selenium_browser)
expect(selenium_browser).to receive(:current_url).and_return("page.html")
<API key>.attach_to_window(:url => "page.html")
end
it "should refresh the page contents" do
expect(selenium_browser).to receive(:navigate).and_return(selenium_browser)
expect(selenium_browser).to receive(:refresh)
<API key>.refresh
end
it "should know how to go back" do
expect(selenium_browser).to receive(:navigate).and_return(selenium_browser)
expect(selenium_browser).to receive(:back)
<API key>.back
end
it "should know how to go forward" do
expect(selenium_browser).to receive(:navigate).and_return(selenium_browser)
expect(selenium_browser).to receive(:forward)
<API key>.forward
end
it "should know its' current url" do
expect(selenium_browser).to receive(:current_url).and_return("cheezyworld.com")
expect(<API key>.current_url).to eql "cheezyworld.com"
end
it "should clear all of the cookies from the browser" do
expect(selenium_browser).to receive(:manage).and_return(selenium_browser)
expect(selenium_browser).to receive(:delete_all_cookies)
<API key>.clear_cookies
end
it "should be able to save a screenshot" do
expect(selenium_browser).to receive(:save_screenshot)
<API key>.save_screenshot("test.png")
end
end
end
end |
<?php
namespace FOS\RestBundle\Controller\Annotations;
use Sensio\Bundle\<API key>\Configuration\Template;
/**
* View annotation class.
* @Annotation
* @Target("METHOD")
*/
class View extends Template
{
/**
* @var string
*/
protected $templateVar;
/**
* @var int
*/
protected $statusCode;
/**
* @var array
*/
protected $serializerGroups;
/**
* @var Boolean
*/
protected $populateDefaultVars = true;
/**
* @var bool
*/
protected $<API key>;
/**
* Returns the annotation alias name.
*
* @return string
* @see Sensio\Bundle\<API key>\Configuration\<API key>
*/
public function getAliasName()
{
return 'view';
}
/**
* Sets the template var name to be used for templating formats.
*
* @param string $templateVar
*/
public function setTemplateVar($templateVar)
{
$this->templateVar = $templateVar;
}
/**
* Returns the template var name to be used for templating formats.
*
* @return string
*/
public function getTemplateVar()
{
return $this->templateVar;
}
/**
* @param int $statusCode
*/
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
}
/**
* @return int
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* @var array $serializerGroups
*/
public function setSerializerGroups($serializerGroups)
{
$this->serializerGroups = $serializerGroups;
}
/**
* @return array
*/
public function getSerializerGroups()
{
return $this->serializerGroups;
}
/**
* @param Boolean $populateDefaultVars
*/
public function <API key>($populateDefaultVars)
{
$this->populateDefaultVars = (Boolean) $populateDefaultVars;
}
/**
* @return Boolean
*/
public function <API key>()
{
return $this->populateDefaultVars;
}
/**
* @param bool $<API key>
*/
public function <API key>($<API key>)
{
$this-><API key> = $<API key>;
}
/**
* @return bool
*/
public function <API key>()
{
return $this-><API key>;
}
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<TITLE>
CTConnection (POI API Documentation)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CTConnection (POI API Documentation)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CTConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/poi/sl/draw/binding/<API key>.html" title="class in org.apache.poi.sl.draw.binding"><B>PREV CLASS</B></A>
<A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnectionSite.html" title="class in org.apache.poi.sl.draw.binding"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/poi/sl/draw/binding/CTConnection.html" target="_top"><B>FRAMES</B></A>
<A HREF="CTConnection.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<H2>
<FONT SIZE="-1">
org.apache.poi.sl.draw.binding</FONT>
<BR>
Class CTConnection</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.poi.sl.draw.binding.CTConnection</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>CTConnection</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<p>Java class for CT_Connection complex type.
<p>The following schema fragment specifies the expected content contained within this class.
<pre>
<complexType name="CT_Connection">
<complexContent>
<restriction base="{http:
<attribute name="id" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_DrawingElementId" />
<attribute name="idx" use="required" type="{http:
</restriction>
</complexContent>
</complexType>
</pre>
<P>
<P>
<HR>
<P>
<A NAME="field_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#id">id</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#idx">idx</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="constructor_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#CTConnection()">CTConnection</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="method_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#getId()">getId</A></B>()</CODE>
<BR>
Gets the value of the id property.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#getIdx()">getIdx</A></B>()</CODE>
<BR>
Gets the value of the idx property.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#isSetId()">isSetId</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#isSetIdx()">isSetIdx</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#setId(long)">setId</A></B>(long value)</CODE>
<BR>
Sets the value of the id property.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnection.html#setIdx(long)">setIdx</A></B>(long value)</CODE>
<BR>
Sets the value of the idx property.</TD>
</TR>
</TABLE>
<A NAME="<API key>.lang.Object"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<A NAME="field_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="id"></A><H3>
id</H3>
<PRE>
protected long <B>id</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="idx"></A><H3>
idx</H3>
<PRE>
protected long <B>idx</B></PRE>
<DL>
<DL>
</DL>
</DL>
<A NAME="constructor_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="CTConnection()"></A><H3>
CTConnection</H3>
<PRE>
public <B>CTConnection</B>()</PRE>
<DL>
</DL>
<A NAME="method_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getId()"></A><H3>
getId</H3>
<PRE>
public long <B>getId</B>()</PRE>
<DL>
<DD>Gets the value of the id property.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setId(long)"></A><H3>
setId</H3>
<PRE>
public void <B>setId</B>(long value)</PRE>
<DL>
<DD>Sets the value of the id property.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isSetId()"></A><H3>
isSetId</H3>
<PRE>
public boolean <B>isSetId</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getIdx()"></A><H3>
getIdx</H3>
<PRE>
public long <B>getIdx</B>()</PRE>
<DL>
<DD>Gets the value of the idx property.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setIdx(long)"></A><H3>
setIdx</H3>
<PRE>
public void <B>setIdx</B>(long value)</PRE>
<DL>
<DD>Sets the value of the idx property.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isSetIdx()"></A><H3>
isSetIdx</H3>
<PRE>
public boolean <B>isSetIdx</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CTConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/poi/sl/draw/binding/<API key>.html" title="class in org.apache.poi.sl.draw.binding"><B>PREV CLASS</B></A>
<A HREF="../../../../../../org/apache/poi/sl/draw/binding/CTConnectionSite.html" title="class in org.apache.poi.sl.draw.binding"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/poi/sl/draw/binding/CTConnection.html" target="_top"><B>FRAMES</B></A>
<A HREF="CTConnection.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
<i>Copyright 2016 The Apache Software Foundation or
its licensors, as applicable.</i>
</BODY>
</HTML> |
"use strict";
var assert = require("assert");
var testUtils = require("./helpers/util.js");
describe("all", function () {
it("fulfills when passed an empty array", function () {
return Promise.all([]);
});
if (testUtils.<API key>) {
it("supports iterables", function () {
return Promise.all(new Set([1, 2, 3])).then(function(v) {
assert.deepEqual([1,2,3].sort(), v.sort());
});
});
}
it("rejects after any constituent promise is rejected", function () {
var toResolve = Promise.defer(); // never resolve
var toReject = Promise.defer();
var promises = [toResolve.promise, toReject.promise];
var promise = Promise.all(promises);
toReject.reject(new Error("Rejected"));
promise.then(assert.fail, function(e){
//Unhandled rejection
});
return Promise.delay(1)
.then(function () {
assert.equal(promise.isRejected(), true);
})
.timeout(1000);
});
it("resolves foreign thenables", function () {
var normal = Promise.resolve(1);
var foreign = { then: function (f) { f(2); } };
return Promise.all([normal, foreign])
.then(function (result) {
assert.deepEqual(result,[1, 2]);
});
});
it("fulfills when passed an sparse array", function () {
var toResolve = Promise.defer();
var promises = [];
promises[0] = Promise.resolve(0);
promises[2] = toResolve.promise;
var promise = Promise.all(promises);
toResolve.resolve(2);
return promise.then(function (result) {
assert.deepEqual(result, [0, void 0, 2]);
});
});
});
describe("Promise.all-test", function () {
specify("should resolve empty input", function() {
return Promise.all([]).then(
function(result) {
assert.deepEqual(result, []);
}, assert.fail
);
});
specify("should resolve values array", function() {
var input = [1, 2, 3];
return Promise.all(input).then(
function(results) {
assert.deepEqual(results, input);
}, assert.fail
);
});
specify("should resolve promises array", function() {
var input = [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
return Promise.all(input).then(
function(results) {
assert.deepEqual(results, [1, 2, 3]);
}, assert.fail
);
});
specify("should not resolve sparse array input", function() {
var input = [, 1, , 1, 1 ];
return Promise.all(input).then(
function(results) {
assert.deepEqual(results, [void 0, 1, void 0, 1, 1]);
}, assert.fail
);
});
specify("should reject if any input promise rejects", function() {
var input = [Promise.resolve(1), Promise.reject(2), Promise.resolve(3)];
return Promise.all(input).then(
assert.fail,
function(err) {
assert.deepEqual(err, 2);
}
);
});
specify("should accept a promise for an array", function() {
var expected, input;
expected = [1, 2, 3];
input = Promise.resolve(expected);
return Promise.all(input).then(
function(results) {
assert.deepEqual(results, expected);
}, assert.fail
);
});
specify("should reject when input promise does not resolve to array", function() {
return Promise.all(Promise.resolve(1)).caught(TypeError, function(e){
});
});
}); |
import {provide, Component, ComponentRef} from '@angular/core';
import {bootstrap} from '@angular/<API key>';
import {
CanDeactivate,
RouteConfig,
RouteParams,
<API key>,
ROUTER_DIRECTIVES
} from '@angular/router-deprecated';
import {APP_BASE_HREF} from '@angular/common';
// #docregion routerCanDeactivate
@Component({
selector: 'note-cmp',
template: `
<div>
<h2>id: {{id}}</h2>
<textarea cols="40" rows="10"></textarea>
</div>`
})
class NoteCmp implements CanDeactivate {
id: string;
constructor(params: RouteParams) { this.id = params.get('id'); }
routerCanDeactivate(next: <API key>, prev: <API key>) {
return confirm('Are you sure you want to leave?');
}
}
// #enddocregion
@Component({
selector: 'note-index-cmp',
template: `
<h1>Your Notes</h1>
<div>
Edit <a [routerLink]="['/NoteCmp', {id: 1}]" id="note-1-link">Note 1</a> |
Edit <a [routerLink]="['/NoteCmp', {id: 2}]" id="note-2-link">Note 2</a>
</div>
`,
directives: [ROUTER_DIRECTIVES]
})
class NoteIndexCmp {
}
@Component({
selector: 'example-app',
template: `
<h1>My App</h1>
<router-outlet></router-outlet>
`,
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: '/note/:id', component: NoteCmp, name: 'NoteCmp'},
{path: '/', component: NoteIndexCmp, name: 'NoteIndexCmp'}
])
export class AppCmp {
}
export function main(): Promise<ComponentRef<AppCmp>> {
return bootstrap(
AppCmp, [provide(APP_BASE_HREF, {useValue: '/@angular/examples/router/ts/can_deactivate'})]);
} |
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.Management.Sql;
using Microsoft.Azure.Management.Sql.Models;
using System.Collections.Generic;
using Xunit;
namespace Sql.Tests
{
public class <API key>
{
[Fact]
public void TestCopyDatabase()
{
using (<API key> context = new <API key>(this))
{
ResourceGroup resourceGroup = context.CreateResourceGroup();
SqlManagementClient sqlClient = context.GetClient<SqlManagementClient>();
//Create two servers
var server = context.CreateServer(resourceGroup);
var server2 = context.CreateServer(resourceGroup);
// Create a database with all parameters specified
string dbName = <API key>.GenerateName();
var dbInput = new Database()
{
Location = server.Location,
Collation = SqlTestConstants.DefaultCollation,
Sku = SqlTestConstants.DefaultDatabaseSku(),
// Make max size bytes less than default, to ensure that copy follows this parameter
MaxSizeBytes = 500 * 1024L * 1024L,
CreateMode = "Default"
};
var db = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, dbInput);
Assert.NotNull(db);
// Create a database as copy of the first database
dbName = <API key>.GenerateName();
var dbInputCopy = new Database()
{
Location = server2.Location,
CreateMode = CreateMode.Copy,
SourceDatabaseId = db.Id
};
var dbCopy = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server2.Name, dbName, dbInputCopy);
<API key>.ValidateDatabase(db, dbCopy, dbCopy.Name);
}
}
}
} |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.commons.math3.distribution.<API key> (Apache Commons Math 3.5 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.commons.math3.distribution.<API key> (Apache Commons Math 3.5 API)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/commons/math3/distribution/<API key>.html" title="class in org.apache.commons.math3.distribution">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=<API key>"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/distribution//<API key>.html" target="_top">FRAMES</a></li>
<li><a href="<API key>.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<h2 title="Uses of Class org.apache.commons.math3.distribution.<API key>" class="title">Uses of Class<br>org.apache.commons.math3.distribution.<API key></h2>
</div>
<div class="classUseContainer">No usage of org.apache.commons.math3.distribution.<API key></div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/commons/math3/distribution/<API key>.html" title="class in org.apache.commons.math3.distribution">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=<API key>"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/distribution//<API key>.html" target="_top">FRAMES</a></li>
<li><a href="<API key>.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small>Copyright &
</body>
</html> |
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Csla.Testing.Business.DataPortal
{
[Serializable]
public class SingleWithException : BusinessBase<SingleWithException>
{
public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(c => c.Name);
public string Name
{
get { return GetProperty(NameProperty); }
set { SetProperty(NameProperty, value); }
}
private static readonly PropertyInfo<string> <API key> = RegisterProperty(new PropertyInfo<string>("MethodCalled", "MethodCalled"));
public string MethodCalled
{
get { return GetProperty(<API key>); }
set { SetProperty(<API key>, value); }
}
public void SetAsChild()
{
MarkAsChild();
}
protected override void DataPortal_Create()
{
MethodCalled = "Created";
base.DataPortal_Create();
}
protected override void DataPortal_Insert()
{
MethodCalled = "Inserted";
throw new DataException("boom");
}
protected override void DataPortal_Update()
{
MethodCalled = "Updated";
throw new DataException("boom");
}
protected override void <API key>()
{
throw new DataException("boom");
}
private void DataPortal_Delete(int id)
{
throw new DataException("boom");
}
}
} |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
#if CORECLR
using System.Runtime.Loader;
#endif
using System.Reflection;
using System.IO;
class InstanceFieldTest : MyClass
{
public int Value;
}
class InstanceFieldTest2 : InstanceFieldTest
{
public int Value2;
}
[StructLayout(LayoutKind.Sequential)]
class <API key> : MyClassWithLayout
{
public int Value;
}
class GrowingBase
{
MyGrowingStruct s;
}
class <API key> : GrowingBase
{
public int x;
}
static class <API key>
{
public static string <API key>(this string x, string foo)
{
return x + ", " + foo;
}
}
class Program
{
static void <API key>()
{
var o = new MyClass();
Assert.AreEqual(o.VirtualMethod(), "Virtual method result");
var iface = (IMyInterface)o;
Assert.AreEqual(iface.InterfaceMethod(" "), "Interface result");
Assert.AreEqual(MyClass.TestInterfaceMethod(iface, "+"), "Interface+result");
}
static void <API key>()
{
var o = new MyChildClass();
Assert.AreEqual(o.MovedToBaseClass(), "MovedToBaseClass");
Assert.AreEqual(o.ChangedToVirtual(), "ChangedToVirtual");
if (!LLILCJitEnabled)
{
o = null;
try
{
o.MovedToBaseClass();
}
catch (<API key>)
{
try
{
o.ChangedToVirtual();
}
catch (<API key>)
{
return;
}
}
Assert.AreEqual("<API key>", "thrown");
}
}
static void <API key>()
{
using (MyStruct s = new MyStruct())
{
((Object)s).ToString();
}
}
static void <API key>()
{
MyStruct s = new MyStruct();
s.ToString();
}
static void TestInterop()
{
// Verify both intra-module and inter-module PInvoke interop
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
MyClass.GetTickCount();
}
else
{
MyClass.GetCurrentThreadId();
}
MyClass.TestInterop();
}
static void TestStaticFields()
{
MyClass.StaticObjectField = 894;
MyClass.StaticLongField = 4392854;
MyClass.<API key> = new Guid("<API key>");
MyClass.<API key> = "Hello";
MyClass.<API key> = 735;
MyClass.<API key> = new DateTime(2011, 1, 1);
MyClass.TestStaticFields();
#if false // TODO: Enable once LDFTN is supported
Task.Run(() => {
MyClass.<API key> = "Garbage";
MyClass.<API key> = 0xBAAD;
MyClass.<API key> = DateTime.Now;
}).Wait();
#endif
Assert.AreEqual(MyClass.StaticObjectField, 894 + 12345678 /* + 1234 */);
Assert.AreEqual(MyClass.StaticLongField, (long)(4392854 * 456 ));
Assert.AreEqual(MyClass.<API key>, null);
Assert.AreEqual(MyClass.<API key>, "HelloWorld");
Assert.AreEqual(MyClass.<API key>, 735/78);
Assert.AreEqual(MyClass.<API key>, new DateTime(2011, 1, 1) + new TimeSpan(123));
}
static void <API key>()
{
var a = new int[] { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
int sum = 0;
foreach (var e in a) sum += e;
Assert.AreEqual(sum, 1023);
}
static void TestMultiDimmArray()
{
var a = new int[2,3,4];
a[0,1,2] = a[0,0,0] + a[1,1,1];
a.ToString();
}
static void <API key>()
{
var o = new MyGeneric<String, Object>();
Assert.AreEqual(o.<API key><Program, IEnumerable<String>>(),
"System.StringSystem.ObjectProgramSystem.Collections.Generic.IEnumerable`1[System.String]");
}
static void <API key>()
{
var o = new MyChildGeneric<Object>();
Assert.AreEqual(o.MovedToBaseClass<WeakReference>(), typeof(List<WeakReference>).ToString());
Assert.AreEqual(o.ChangedToVirtual<WeakReference>(), typeof(List<WeakReference>).ToString());
if (!LLILCJitEnabled)
{
o = null;
try
{
o.MovedToBaseClass<WeakReference>();
}
catch (<API key>)
{
try
{
o.ChangedToVirtual<WeakReference>();
}
catch (<API key>)
{
return;
}
}
Assert.AreEqual("<API key>", "thrown");
}
}
static void TestInstanceFields()
{
var t = new InstanceFieldTest2();
t.Value = 123;
t.Value2 = 234;
t.InstanceField = 345;
Assert.AreEqual(typeof(InstanceFieldTest).GetRuntimeField("Value").GetValue(t), 123);
Assert.AreEqual(typeof(InstanceFieldTest2).GetRuntimeField("Value2").GetValue(t), 234);
Assert.AreEqual(typeof(MyClass).GetRuntimeField("InstanceField").GetValue(t), 345);
}
static void <API key>()
{
var t = new <API key>();
t.Value = 123;
Assert.AreEqual(typeof(<API key>).GetRuntimeField("Value").GetValue(t), 123);
}
static void <API key>()
{
var o = new <API key>();
o.x = 6780;
Assert.AreEqual(typeof(<API key>).GetRuntimeField("x").GetValue(o), 6780);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestGrowingStruct()
{
MyGrowingStruct s = MyGrowingStruct.Construct();
MyGrowingStruct.Check(ref s);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestChangingStruct()
{
MyChangingStruct s = MyChangingStruct.Construct();
s.x++;
MyChangingStruct.Check(ref s);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void <API key>()
{
MyChangingHFAStruct s = MyChangingHFAStruct.Construct();
MyChangingHFAStruct.Check(s);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestGetType()
{
new MyClass().GetType().ToString();
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestStaticBaseCSE()
{
// There should be just one call to <API key>
// in the generated code.
s++;
s++;
Assert.AreEqual(s, 2);
s = 0;
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestIsInstCSE()
{
// There should be just one call to <API key>
// in the generated code.
object o1 = (s < 1) ? (object)"foo" : (object)1;
Assert.AreEqual(o1 is string, true);
Assert.AreEqual(o1 is string, true);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void TestCastClassCSE()
{
// There should be just one call to <API key>
// in the generated code.
object o1 = (s < 1) ? (object)"foo" : (object)1;
string str1 = (string)o1;
string str2 = (string)o1;
Assert.AreEqual(str1, str2);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static void <API key>()
{
// Range checks for array accesses should be eliminated by the compiler.
int[] array = new int[5];
array[2] = 2;
Assert.AreEqual(array[2], 2);
}
#if CORECLR
class MyLoadContext : AssemblyLoadContext
{
public MyLoadContext()
{
}
public void TestMultipleLoads()
{
Assembly a = <API key>(Path.Combine(Directory.GetCurrentDirectory(), "test.ni.dll"));
Assert.AreEqual(AssemblyLoadContext.GetLoadContext(a), this);
}
protected override Assembly Load(AssemblyName an)
{
throw new <API key>();
}
}
static void TestMultipleLoads()
{
if (!LLILCJitEnabled) {
try
{
new MyLoadContext().TestMultipleLoads();
}
catch (FileLoadException e)
{
Assert.AreEqual(e.ToString().Contains("Native image cannot be loaded multiple times"), true);
return;
}
Assert.AreEqual("FileLoadException", "thrown");
}
}
#endif
static void <API key>()
{
// This test is verifying consistent field layout when ReadyToRun images are combined with NGen images
// "ngen install /nodependencies main.exe" to exercise the interesting case
var o = new ByteChildClass(67);
Assert.AreEqual(o.ChildByte, (byte)67);
}
static void <API key>()
{
// This test is verifying the the fixups for open vs. closed delegate created against the same target
// method are encoded correctly.
Func<string, string, object> idOpen = <API key>.<API key>;
Assert.AreEqual(idOpen("World", "foo"), "World, foo");
Func<string, object> idClosed = "World".<API key>;
Assert.AreEqual(idClosed("hey"), "World, hey");
}
static void RunAllTests()
{
<API key>();
<API key>();
<API key>();
<API key>();
TestInterop();
TestStaticFields();
<API key>();
TestMultiDimmArray();
<API key>();
<API key>();
TestInstanceFields();
<API key>();
<API key>();
TestGrowingStruct();
TestChangingStruct();
<API key>();
TestGetType();
#if CORECLR
TestMultipleLoads();
#endif
<API key>();
TestStaticBaseCSE();
TestIsInstCSE();
TestCastClassCSE();
<API key>();
<API key>();
}
static int Main()
{
// Code compiled by LLILC jit can't catch exceptions yet so the tests
// don't throw them if LLILC jit is enabled. This should be removed once
// exception catching is supported by LLILC jit.
string AltJitName = System.Environment.<API key>("complus_altjitname");
LLILCJitEnabled =
((AltJitName != null) && AltJitName.ToLower().StartsWith("llilcjit") &&
((System.Environment.<API key>("complus_altjit") != null) ||
(System.Environment.<API key>("complus_altjitngen") != null)));
// Run all tests 3x times to exercise both slow and fast paths work
for (int i = 0; i < 3; i++)
RunAllTests();
Console.WriteLine("PASSED");
return Assert.HasAssertFired ? 1 : 100;
}
static bool LLILCJitEnabled;
static int s;
} |
package org.spongycastle.asn1.cms;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.<API key>;
import org.spongycastle.asn1.ASN1Set;
import org.spongycastle.asn1.DERSet;
/**
* This is helper tool to construct {@link Attributes} sets.
*/
public class AttributeTable
{
private Hashtable attributes = new Hashtable();
public AttributeTable(
Hashtable attrs)
{
attributes = copyTable(attrs);
}
public AttributeTable(
ASN1EncodableVector v)
{
for (int i = 0; i != v.size(); i++)
{
Attribute a = Attribute.getInstance(v.get(i));
addAttribute(a.getAttrType(), a);
}
}
public AttributeTable(
ASN1Set s)
{
for (int i = 0; i != s.size(); i++)
{
Attribute a = Attribute.getInstance(s.getObjectAt(i));
addAttribute(a.getAttrType(), a);
}
}
public AttributeTable(
Attribute attr)
{
addAttribute(attr.getAttrType(), attr);
}
public AttributeTable(
Attributes attrs)
{
this(ASN1Set.getInstance(attrs.toASN1Primitive()));
}
private void addAttribute(
<API key> oid,
Attribute a)
{
Object value = attributes.get(oid);
if (value == null)
{
attributes.put(oid, a);
}
else
{
Vector v;
if (value instanceof Attribute)
{
v = new Vector();
v.addElement(value);
v.addElement(a);
}
else
{
v = (Vector)value;
v.addElement(a);
}
attributes.put(oid, v);
}
}
/**
* Return the first attribute matching the OBJECT IDENTIFIER oid.
*
* @param oid type of attribute required.
* @return first attribute found of type oid.
*/
public Attribute get(
<API key> oid)
{
Object value = attributes.get(oid);
if (value instanceof Vector)
{
return (Attribute)((Vector)value).elementAt(0);
}
return (Attribute)value;
}
/**
* Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be
* empty if there are no attributes of the required type present.
*
* @param oid type of attribute required.
* @return a vector of all the attributes found of type oid.
*/
public ASN1EncodableVector getAll(
<API key> oid)
{
ASN1EncodableVector v = new ASN1EncodableVector();
Object value = attributes.get(oid);
if (value instanceof Vector)
{
Enumeration e = ((Vector)value).elements();
while (e.hasMoreElements())
{
v.add((Attribute)e.nextElement());
}
}
else if (value != null)
{
v.add((Attribute)value);
}
return v;
}
public int size()
{
int size = 0;
for (Enumeration en = attributes.elements(); en.hasMoreElements();)
{
Object o = en.nextElement();
if (o instanceof Vector)
{
size += ((Vector)o).size();
}
else
{
size++;
}
}
return size;
}
public Hashtable toHashtable()
{
return copyTable(attributes);
}
public ASN1EncodableVector <API key>()
{
ASN1EncodableVector v = new ASN1EncodableVector();
Enumeration e = attributes.elements();
while (e.hasMoreElements())
{
Object value = e.nextElement();
if (value instanceof Vector)
{
Enumeration en = ((Vector)value).elements();
while (en.hasMoreElements())
{
v.add(Attribute.getInstance(en.nextElement()));
}
}
else
{
v.add(Attribute.getInstance(value));
}
}
return v;
}
public Attributes toASN1Structure()
{
return new Attributes(this.<API key>());
}
private Hashtable copyTable(
Hashtable in)
{
Hashtable out = new Hashtable();
Enumeration e = in.keys();
while (e.hasMoreElements())
{
Object key = e.nextElement();
out.put(key, in.get(key));
}
return out;
}
/**
* Return a new table with the passed in attribute added.
*
* @param attrType
* @param attrValue
* @return
*/
public AttributeTable add(<API key> attrType, ASN1Encodable attrValue)
{
AttributeTable newTable = new AttributeTable(attributes);
newTable.addAttribute(attrType, new Attribute(attrType, new DERSet(attrValue)));
return newTable;
}
public AttributeTable remove(<API key> attrType)
{
AttributeTable newTable = new AttributeTable(attributes);
newTable.attributes.remove(attrType);
return newTable;
}
} |
define(['exports'], function (exports) {
'use strict';
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var ValidationLocale = (function () {
function ValidationLocale(defaults, data) {
_classCallCheck(this, ValidationLocale);
this.defaults = defaults;
this.currentLocale = data;
}
ValidationLocale.prototype.getValueFor = function getValueFor(identifier, category) {
var <API key> = undefined;
var defaultSetting = undefined;
if (this.currentLocale && this.currentLocale[category]) {
<API key> = this.currentLocale[category][identifier];
if (<API key> !== undefined && <API key> !== null) {
return <API key>;
}
}
if (this.defaults[category]) {
defaultSetting = this.defaults[category][identifier];
if (defaultSetting !== undefined && defaultSetting !== null) {
return defaultSetting;
}
}
throw new Error('validation: I18N: Could not find: ' + identifier + ' in category: ' + category);
};
ValidationLocale.prototype.setting = function setting(settingIdentifier) {
return this.getValueFor(settingIdentifier, 'settings');
};
ValidationLocale.prototype.translate = function translate(<API key>, newValue, threshold) {
var translation = this.getValueFor(<API key>, 'messages');
if (typeof translation === 'function') {
return translation(newValue, threshold);
}
if (typeof translation === 'string') {
return translation;
}
throw new Error('Validation message for ' + <API key> + 'was in an unsupported format');
};
return ValidationLocale;
})();
exports.ValidationLocale = ValidationLocale;
var <API key> = (function () {
function <API key>() {
_classCallCheck(this, <API key>);
this['default'] = null;
this.instances = new Map();
this.defaults = {
settings: {
'numericRegex': /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/
},
messages: {}
};
}
<API key>.prototype.load = function load(localeIdentifier, basePath) {
var _this = this;
if (!basePath) {
basePath = 'aurelia-validation/resources/';
}
return new Promise(function (resolve, reject) {
if (_this.instances.has(localeIdentifier)) {
var locale = _this.instances.get(localeIdentifier);
resolve(locale);
} else {
System['import'](basePath + localeIdentifier).then(function (resource) {
var locale = _this.addLocale(localeIdentifier, resource.data);
resolve(locale);
});
}
});
};
<API key>.prototype.addLocale = function addLocale(localeIdentifier, data) {
var instance = new ValidationLocale(this.defaults, data);
this.instances.set(localeIdentifier, instance);
if (this['default'] === null) {
this['default'] = instance;
}
return instance;
};
return <API key>;
})();
ValidationLocale.Repository = new <API key>();
}); |
#if !UNITY_WINRT || UNITY_EDITOR || (UNITY_WP8 && !UNITY_WP_8_1)
// 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,
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
// included in all copies or substantial portions of the Software.
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// 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.
#endregion
using System;
using System.Runtime.Serialization;
using System.Reflection;
using System.Globalization;
using Newtonsoft.Json.Utilities;
#pragma warning disable 436
namespace Newtonsoft.Json.Serialization
{
<summary>
The default serialization binder used when resolving and loading classes from type names.
</summary>
public class <API key> : SerializationBinder
{
internal static readonly <API key> Instance = new <API key>();
private readonly ThreadSafeStore<TypeNameKey, Type> _typeCache = new ThreadSafeStore<TypeNameKey, Type>(<API key>);
private static Type <API key>(TypeNameKey typeNameKey)
{
string assemblyName = typeNameKey.AssemblyName;
string typeName = typeNameKey.TypeName;
if (assemblyName != null)
{
Assembly assembly;
#if !(UNITY_WP8 || UNITY_WP_8_1) && !UNITY_WEBPLAYER && (!UNITY_WINRT || UNITY_EDITOR) && !UNITY_ANDROID
// look, I don't like using obsolete methods as much as you do but this is the only way
// Assembly.Load won't check the GAC for a partial name
#pragma warning disable 618,612
assembly = Assembly.LoadWithPartialName(assemblyName);
#pragma warning restore 618,612
#else
assembly = Assembly.Load(assemblyName);
#endif
if (assembly == null)
throw new <API key>("Could not load assembly '{0}'.".FormatWith(CultureInfo.InvariantCulture, assemblyName));
Type type = assembly.GetType(typeName);
if (type == null)
throw new <API key>("Could not find type '{0}' in assembly '{1}'.".FormatWith(CultureInfo.InvariantCulture, typeName, assembly.FullName));
return type;
}
else
{
return Type.GetType(typeName);
}
}
internal struct TypeNameKey
#if !(UNITY_ANDROID || (UNITY_IOS || UNITY_IPHONE))
: IEquatable<TypeNameKey>
#endif
{
internal readonly string AssemblyName;
internal readonly string TypeName;
public TypeNameKey(string assemblyName, string typeName)
{
AssemblyName = assemblyName;
TypeName = typeName;
}
public override int GetHashCode()
{
return ((AssemblyName != null) ? AssemblyName.GetHashCode() : 0) ^ ((TypeName != null) ? TypeName.GetHashCode() : 0);
}
public override bool Equals(object obj)
{
if (!(obj is TypeNameKey))
return false;
return Equals((TypeNameKey)obj);
}
public bool Equals(TypeNameKey other)
{
return (AssemblyName == other.AssemblyName && TypeName == other.TypeName);
}
}
<summary>
When overridden in a derived class, controls the binding of a serialized object to a type.
</summary>
<param name="assemblyName">Specifies the <see cref="T:System.Reflection.Assembly"/> name of the serialized object.</param>
<param name="typeName">Specifies the <see cref="T:System.Type"/> name of the serialized object.</param>
<returns>
The type of the object the formatter creates a new instance of.
</returns>
public override Type BindToType(string assemblyName, string typeName)
{
return _typeCache.Get(new TypeNameKey(assemblyName, typeName));
}
}
}
#pragma warning restore 436
#endif |
#!/bin/bash
FN="ye6100subacdf_2.18.0.tar.gz"
URLS=(
"https://bioconductor.org/packages/3.8/data/annotation/src/contrib/ye6100subacdf_2.18.0.tar.gz"
"https://bioarchive.galaxyproject.org/ye6100subacdf_2.18.0.tar.gz"
"https://depot.galaxyproject.org/software/<API key>/<API key>.18.0_src_all.tar.gz"
)
MD5="<API key>"
# Use a staging area in the conda dir rather than temp dirs, both to avoid
# manner.
STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM
mkdir -p $STAGING
TARBALL=$STAGING/$FN
SUCCESS=0
for URL in ${URLS[@]}; do
wget -O- -q $URL > $TARBALL
[[ $? == 0 ]] || continue
# Platform-specific md5sum checks.
if [[ $(uname -s) == "Linux" ]]; then
if md5sum -c <<<"$MD5 $TARBALL"; then
SUCCESS=1
break
fi
else if [[ $(uname -s) == "Darwin" ]]; then
if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then
SUCCESS=1
break
fi
fi
fi
done
if [[ $SUCCESS != 1 ]]; then
echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:"
printf '%s\n' "${URLS[@]}"
exit 1
fi
# Install and clean up
R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL
rm $TARBALL
rmdir $STAGING |
module ActiveAdmin
module Views
IndexAsBlock.class_eval do
def build(page_presenter, collection)
add_class "index"
if active_admin_config.dsl.sortable_options
set_attribute "data-sortable-type", "plain"
sort_url = if (( sort_url_block = active_admin_config.dsl.sortable_options[:sort_url] ))
sort_url_block.call(self)
else
url_for(:action => :sort)
end
set_attribute "data-sortable-url", sort_url
collection = collection.sort_by do |a|
a.send(active_admin_config.dsl.sortable_options[:sorting_attribute]) || 1
end
end
<API key> if active_admin_config.batch_actions.any?
collection.each do |obj|
instance_exec(obj, &page_presenter.block)
end
end
end
end
end |
using System.IO;
using Cassette.IO;
using Should;
using Xunit;
using IsolatedStorageFile = System.IO.IsolatedStorage.IsolatedStorageFile;
#if NET35
using Cassette.Utilities;
#endif
namespace Cassette
{
public class <API key>
{
[Fact]
public void <API key>()
{
using (var store = IsolatedStorageFile.<API key>())
{
using (var writer = new StreamWriter(store.OpenFile("test.txt", FileMode.Create, FileAccess.Write)))
{
writer.Write("test");
writer.Flush();
}
var directory = new <API key>(() => store);
var file = directory.GetFile("test.txt");
file.Exists.ShouldBeTrue();
using (var reader = new StreamReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
{
reader.ReadToEnd().ShouldEqual("test");
}
file.Delete();
store.FileExists("test.txt").ShouldBeFalse();
}
}
}
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Package org.apache.commons.math3.ml (Commons Math 3.2 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package org.apache.commons.math3.ml (Commons Math 3.2 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/commons/math3/ml/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Package<br>org.apache.commons.math3.ml</B></H2>
</CENTER>
No usage of org.apache.commons.math3.ml
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/commons/math3/ml/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML> |
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// 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.
#include "../../Precompiled.h"
#include "../../Graphics/Graphics.h"
#include "../../Graphics/GraphicsImpl.h"
#include "../../Graphics/VertexBuffer.h"
#include "../../IO/Log.h"
#include "../../DebugNew.h"
namespace Urho3D
{
void VertexBuffer::OnDeviceLost()
{
GPUObject::OnDeviceLost();
}
void VertexBuffer::OnDeviceReset()
{
if (!object_.name_)
{
Create();
dataLost_ = !UpdateToGPU();
}
else if (dataPending_)
dataLost_ = !UpdateToGPU();
dataPending_ = false;
}
void VertexBuffer::Release()
{
Unlock();
if (object_.name_)
{
if (!graphics_)
return;
if (!graphics_->IsDeviceLost())
{
for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
{
if (graphics_->GetVertexBuffer(i) == this)
graphics_->SetVertexBuffer(0);
}
graphics_->SetVBO(0);
glDeleteBuffers(1, &object_.name_);
}
object_.name_ = 0;
}
}
bool VertexBuffer::SetData(const void* data)
{
if (!data)
{
URHO3D_LOGERROR("Null pointer for vertex buffer data");
return false;
}
if (!vertexSize_)
{
URHO3D_LOGERROR("Vertex elements not defined, can not set vertex buffer data");
return false;
}
if (shadowData_ && data != shadowData_.Get())
memcpy(shadowData_.Get(), data, vertexCount_ * vertexSize_);
if (object_.name_)
{
if (!graphics_->IsDeviceLost())
{
graphics_->SetVBO(object_.name_);
glBufferData(GL_ARRAY_BUFFER, vertexCount_ * vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
}
else
{
URHO3D_LOGWARNING("Vertex buffer data assignment while device is lost");
dataPending_ = true;
}
}
dataLost_ = false;
return true;
}
bool VertexBuffer::SetDataRange(const void* data, unsigned start, unsigned count, bool discard)
{
if (start == 0 && count == vertexCount_)
return SetData(data);
if (!data)
{
URHO3D_LOGERROR("Null pointer for vertex buffer data");
return false;
}
if (!vertexSize_)
{
URHO3D_LOGERROR("Vertex elements not defined, can not set vertex buffer data");
return false;
}
if (start + count > vertexCount_)
{
URHO3D_LOGERROR("Illegal range for setting new vertex buffer data");
return false;
}
if (!count)
return true;
if (shadowData_ && shadowData_.Get() + start * vertexSize_ != data)
memcpy(shadowData_.Get() + start * vertexSize_, data, count * vertexSize_);
if (object_.name_)
{
if (!graphics_->IsDeviceLost())
{
graphics_->SetVBO(object_.name_);
if (!discard || start != 0)
glBufferSubData(GL_ARRAY_BUFFER, start * vertexSize_, count * vertexSize_, data);
else
glBufferData(GL_ARRAY_BUFFER, count * vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
}
else
{
URHO3D_LOGWARNING("Vertex buffer data assignment while device is lost");
dataPending_ = true;
}
}
return true;
}
void* VertexBuffer::Lock(unsigned start, unsigned count, bool discard)
{
if (lockState_ != LOCK_NONE)
{
URHO3D_LOGERROR("Vertex buffer already locked");
return 0;
}
if (!vertexSize_)
{
URHO3D_LOGERROR("Vertex elements not defined, can not lock vertex buffer");
return 0;
}
if (start + count > vertexCount_)
{
URHO3D_LOGERROR("Illegal range for locking vertex buffer");
return 0;
}
if (!count)
return 0;
lockStart_ = start;
lockCount_ = count;
discardLock_ = discard;
if (shadowData_)
{
lockState_ = LOCK_SHADOW;
return shadowData_.Get() + start * vertexSize_;
}
else if (graphics_)
{
lockState_ = LOCK_SCRATCH;
lockScratchData_ = graphics_-><API key>(count * vertexSize_);
return lockScratchData_;
}
else
return 0;
}
void VertexBuffer::Unlock()
{
switch (lockState_)
{
case LOCK_SHADOW:
SetDataRange(shadowData_.Get() + lockStart_ * vertexSize_, lockStart_, lockCount_, discardLock_);
lockState_ = LOCK_NONE;
break;
case LOCK_SCRATCH:
SetDataRange(lockScratchData_, lockStart_, lockCount_, discardLock_);
if (graphics_)
graphics_->FreeScratchBuffer(lockScratchData_);
lockScratchData_ = 0;
lockState_ = LOCK_NONE;
break;
default:
break;
}
}
bool VertexBuffer::Create()
{
if (!vertexCount_ || !elementMask_)
{
Release();
return true;
}
if (graphics_)
{
if (graphics_->IsDeviceLost())
{
URHO3D_LOGWARNING("Vertex buffer creation while device is lost");
return true;
}
if (!object_.name_)
glGenBuffers(1, &object_.name_);
if (!object_.name_)
{
URHO3D_LOGERROR("Failed to create vertex buffer");
return false;
}
graphics_->SetVBO(object_.name_);
glBufferData(GL_ARRAY_BUFFER, vertexCount_ * vertexSize_, 0, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
}
return true;
}
bool VertexBuffer::UpdateToGPU()
{
if (object_.name_ && shadowData_)
return SetData(shadowData_.Get());
else
return false;
}
void* VertexBuffer::MapBuffer(unsigned start, unsigned count, bool discard)
{
// Never called on OpenGL
return 0;
}
void VertexBuffer::UnmapBuffer()
{
// Never called on OpenGL
}
} |
#nullable disable
using System;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using static Roslyn.Test.Utilities.TestMetadata;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
public class SymbolDisplayTests : CSharpTestBase
{
[Fact]
public void <API key>()
{
var text = "class A {}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.NameOnly);
<API key>(
text,
findSymbol,
format,
"A",
<API key>.ClassName);
}
[Fact, WorkItem(46985, "https://github.com/dotnet/roslyn/issues/46985")]
public void <API key>()
{
var text = "record A {}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.NameOnly);
<API key>(
text,
findSymbol,
format,
"A",
<API key>.RecordName);
}
[Fact, WorkItem(46985, "https://github.com/dotnet/roslyn/issues/46985")]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
record R1 {
record R2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("R1").Single().
GetTypeMembers("R2").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.NameOnly);
<API key>(
text,
findSymbol,
format,
"R2",
<API key>.RecordName);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.NameOnly);
<API key>(
text,
findSymbol,
format,
"C2",
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single();
<API key>(
text,
findSymbol,
SymbolDisplayFormat.<API key>,
"global::N1.N2.N3.C1.C2",
<API key>.Keyword, <API key>.Punctuation,
<API key>.NamespaceName, <API key>.Punctuation,
<API key>.NamespaceName, <API key>.Punctuation,
<API key>.NamespaceName, <API key>.Punctuation,
<API key>.ClassName, <API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = "class A {}";
Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("A", 0).Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"A",
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"C1.C2",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
class A {
void M() {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat();
<API key>(
text,
findSymbol,
format,
"M",
<API key>.MethodName);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {
public static int[] M(int? x, C1 c) {} } } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat();
<API key>(
text,
findSymbol,
format,
"M",
<API key>.MethodName);
}
[Fact]
public void <API key>()
{
var text = @"
class A {
void M() {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeModifiers | <API key>.<API key> | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"private void M()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {
public static int[] M(int? x, C1 c) {} } } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeModifiers | <API key>.<API key> | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public static int[] M(int? x, C1 c)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1<T> { }
class C2 {
public static TSource M<TSource>(this C1<TSource> source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.StaticMethod,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public static TSource C2.M<TSource>(this C1<TSource> source, int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName, //source
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1<T> { }
class C2 {
public static TSource M<TSource>(this C1<TSource> source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.InstanceMethod,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public TSource C1<TSource>.M<TSource>(int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.ExtensionMethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1<T> { }
class C2 {
public static TSource M<TSource>(this C1<TSource> source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.Default,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public static TSource C2.M<TSource>(this C1<TSource> source, int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName, //source
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1 { }
class C2 {
public static TSource M<TSource>(this C1 source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var type = global.GetTypeMember("C1");
var method = (MethodSymbol)global.GetTypeMember("C2").GetMember("M");
return method.<API key>(type, null!);
};
var format = new SymbolDisplayFormat(
<API key>: <API key>.StaticMethod,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public static TSource C2.M<TSource>(this C1 source, int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName, //source
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1 { }
class C2 {
public static TSource M<TSource>(this C1 source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var type = global.GetTypeMember("C1");
var method = (MethodSymbol)global.GetTypeMember("C2").GetMember("M");
return method.<API key>(type, null!);
};
var format = new SymbolDisplayFormat(
<API key>: <API key>.InstanceMethod,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public TSource C1.M<TSource>(int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ExtensionMethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C1 { }
class C2 {
public static TSource M<TSource>(this C1 source, int index) {} }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var type = global.GetTypeMember("C1");
var method = (MethodSymbol)global.GetTypeMember("C2").GetMember("M");
return method.<API key>(type, null!);
};
var format = new SymbolDisplayFormat(
<API key>: <API key>.Default,
genericsOptions:
<API key>.<API key> |
<API key>.IncludeVariance,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.<API key> |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"public TSource C1.M<TSource>(int index)",
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName, //TSource
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ExtensionMethodName,
<API key>.Punctuation,
<API key>.TypeParameterName, //TSource
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //index
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"class C2 { private protected void M() {} }";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C2").Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeModifiers |
<API key>.<API key> |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"private protected void C2.M()",
<API key>.Keyword, // private
<API key>.Space,
<API key>.Keyword, // protected
<API key>.Space,
<API key>.Keyword, // void
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void TestNullParameters()
{
var text = @"
class A {
int[][,][,,] f; }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single().
GetMembers("f").Single();
SymbolDisplayFormat format = null;
<API key>(
text,
findSymbol,
format,
"A.f",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.FieldName);
}
[Fact]
public void TestArrayRank()
{
var text = @"
class A {
int[][,][,,] f; }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("A", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"int[][,][,,] f",
<API key>.Keyword, //int
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F([Optional]bool arg) { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(bool arg)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C
{
void F(string s = ""f\t\r\noo"") { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
@"void F(string s = ""f\t\r\noo"")",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.StringLiteral,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F([Optional]C arg) { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(C arg)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F<T>([Optional]T arg) where T : class { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(T arg)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F<T>([Optional]T arg) where T : struct { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(T arg)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F<T>([Optional]T arg) { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(T arg)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
using System.Runtime.InteropServices;
class C
{
void F<T>(int a, [Optional]double[] arg, int b, [Optional]System.Type t) { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("F").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"void F(int a, double[] arg, int b, Type t)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword, // int
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // double
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName, // arg
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // int
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName, // Type
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class @true {
@true @false(@true @true, bool @bool = true) { return @true; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("true", 0).Single().
GetMembers("false").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"@true @false(@true @true, bool @bool = true)",
<API key>.ClassName,
<API key>.Space,
<API key>.MethodName, //@false
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName, //@true
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, //@bool
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class @true {
@true @false(@true @true, bool @bool = true) { return @true; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("true", 0).Single().
GetMembers("false").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"true false(true true, bool bool = true)",
<API key>.ClassName,
<API key>.Space,
<API key>.MethodName, // @false
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName, // @true
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName, // @bool
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
interface I {
void M(); }
class C : I {
void I.M() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("I.M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.None);
<API key>(
text,
findSymbol,
format,
"M",
<API key>.MethodName);
}
[Fact]
public void <API key>()
{
var text = @"
interface I {
void M(); }
class C : I {
void I.M() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("I.M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"I.M",
<API key>.InterfaceName,
<API key>.Punctuation,
<API key>.MethodName);
}
[Fact]
public void <API key>()
{
var text = @"
interface I {
void M(); }
class C : I {
void I.M() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("I.M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.<API key> | <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"C.I.M",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.InterfaceName,
<API key>.Punctuation,
<API key>.MethodName);
}
[Fact]
public void <API key>()
{
var text = @"
class C { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
<API key>: <API key>.Included);
<API key>(
text,
findSymbol,
format,
"global::C",
<API key>.Keyword, //global
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
class C { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global;
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
<API key>: <API key>.Included);
<API key>(
text,
findSymbol,
format,
"<global namespace>",
<API key>.Text);
}
[Fact]
public void TestSpecialTypes()
{
var text = @"
class C {
int f; }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"int f",
<API key>.Keyword,
<API key>.Space,
<API key>.FieldName);
}
[Fact]
public void TestArrayAsterisks()
{
var text = @"
class C {
int[][,][,,] f; }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"Int32[][*,*][*,*,*] f",
<API key>.StructName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
C() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers(".ctor").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
".ctor",
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
class C<T, U, V> { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 3).Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"C`3",
<API key>.ClassName,
<API key>.Arity);
}
[Fact]
public void <API key>()
{
var text = @"
class C<in T, out U, V> { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 3).Single();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"C<T, U, V>",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C<in T, out U, V> { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 3).Single();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key> | <API key>.IncludeVariance);
<API key>(
text,
findSymbol,
format,
"C<in T, out U, V>",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C<T> where T : C<T> { }
";
Func<NamespaceSymbol, Symbol> findType = global =>
global.GetMember<NamedTypeSymbol>("C");
Func<NamespaceSymbol, Symbol> findTypeParameter = global =>
global.GetMember<NamedTypeSymbol>("C").TypeParameters.Single();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key> | <API key>.<API key>);
<API key>(text, findType,
format,
"C<T> where T : C<T>",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation);
<API key>(text, findTypeParameter,
format,
"T",
<API key>.TypeParameterName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
void M<in T, out U, V>() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"M<T, U, V>",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
void M<in T, out U, V>() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key> | <API key>.IncludeVariance);
<API key>(
text,
findSymbol,
format,
"M<T, U, V>",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C<T>
{
void M<U, V>() where V : class, U, T {}
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("C").GetMember<MethodSymbol>("M");
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key> | <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"M<U, V> where V : class, U, T",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.TypeParameterName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
void M(int p) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.None);
<API key>(
text,
findSymbol,
format,
"M",
<API key>.MethodName);
}
[Fact]
public void TestMemberMethodAll()
{
var text = @"
class C {
void M(int p) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private void C.M()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void TestMemberFieldNone()
{
var text = @"
class C {
int f; }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.None);
<API key>(
text,
findSymbol,
format,
"f",
<API key>.FieldName);
}
[Fact]
public void TestMemberFieldAll()
{
var text =
@"class C {
int f;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private Int32 C.f",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.FieldName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
int P { get; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("P").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.None);
<API key>(
text,
findSymbol,
format,
"P",
<API key>.PropertyName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
int P { get; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("P").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private Int32 C.P",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.PropertyName);
}
[Fact]
public void <API key>()
{
var text = @"
class C
{
int P { get; }
object Q { set; }
object R { get { return null; } set { } }
}
";
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
propertyStyle: <API key>.<API key>);
<API key>(
text,
global => global.GetTypeMembers("C", 0).Single().GetMembers("P").Single(),
format,
"Int32 P { get; }",
<API key>.StructName,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
<API key>(
text,
global => global.GetTypeMembers("C", 0).Single().GetMembers("Q").Single(),
format,
"Object Q { set; }",
<API key>.ClassName,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
<API key>(
text,
global => global.GetTypeMembers("C", 0).Single().GetMembers("R").Single(),
format,
"Object R { get; set; }",
<API key>.ClassName,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
int P { get; set; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("get_P").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private Int32 C.P.get",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
int P { get; set; } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("set_P").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private void C.P.set",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void TestMemberEventAll()
{
var text = @"
class C {
event System.Action E;
event System.Action F { add { } remove { } } }
";
Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMembers("E").Where(m => m.Kind == SymbolKind.Event).Single();
Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMember<EventSymbol>("F");
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol1,
format,
"private Action C.E",
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
<API key>(
text,
findSymbol2,
format,
"private Action C.F",
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
event System.Action E;
event System.Action F { add { } remove { } } }
";
Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMembers("E").Where(m => m.Kind == SymbolKind.Event).Single();
Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMember<EventSymbol>("F");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType,
propertyStyle: <API key>.<API key>); // Does not affect events (did before rename).
<API key>(
text,
findSymbol1,
format,
"Action E",
<API key>.DelegateName,
<API key>.Space,
<API key>.EventName);
<API key>(
text,
findSymbol2,
format,
"Action F",
<API key>.DelegateName,
<API key>.Space,
<API key>.EventName);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
event System.Action E { add { } remove { } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMembers("add_E").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private void C.E.add",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
event System.Action E { add { } remove { } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMembers("remove_E").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"private void C.E.remove",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
var text = @"
static class C {
static void M(this object obj, ref short s, int i = 1) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions: <API key>.None);
<API key>(
text,
findSymbol,
format,
"M()",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
static class C {
static int M() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"System.Int32 M()",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
static class C {
static void M() { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
"void M()",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
void M(ref short s, int i, params string[] args) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions:
<API key>.IncludeParamsRefOut |
<API key>.IncludeType |
<API key>.IncludeName);
<API key>(
text,
findSymbol,
format,
"M(ref Int16 s, Int32 i, params String[] args)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName, //args
<API key>.Punctuation);
// Without <API key>.IncludeParamsRefOut.
<API key>(
text,
findSymbol,
format.<API key>(<API key>.IncludeType | <API key>.IncludeName),
"M(Int16 s, Int32 i, String[] args)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
// Without <API key>.IncludeType, drops
// ref/out/params modifiers. (VB retains ByRef/ParamArray.)
<API key>(
text,
findSymbol,
format.<API key>(<API key>.IncludeParamsRefOut | <API key>.IncludeName),
"M(s, i, args)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact()]
public void <API key>()
{
var text = @"
static class C {
static void M(this object self, ref short s, int i = 1, params string[] args) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions:
<API key>.IncludeParamsRefOut |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.<API key> |
<API key>.IncludeDefaultValue);
<API key>(
text,
findSymbol,
format,
"M(this Object self, ref Int16 s, Int32 i = 1, params String[] args)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Space,
<API key>.ParameterName, //self
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName, //args
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
class C {
void M(int i = 0) { } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("M").Single();
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions:
<API key>.IncludeParamsRefOut |
<API key>.IncludeType |
<API key>.IncludeName |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"M([Int32 i])",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Punctuation);
}
<summary>
"public" and "abstract" should not be included for interface members.
</summary>
[Fact]
public void <API key>()
{
var text = @"
interface I
{
int P { get; }
object F();
}
abstract class C
{
public abstract object F();
interface I
{
void M();
}
}";
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType,
propertyStyle: <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
global => global.GetTypeMembers("I", 0).Single().GetMembers("P").Single(),
format,
"int P { get; }");
<API key>(
text,
global => global.GetTypeMembers("I", 0).Single().GetMembers("F").Single(),
format,
"object F()");
<API key>(
text,
global => global.GetTypeMembers("C", 0).Single().GetMembers("F").Single(),
format,
"public abstract object F()");
<API key>(
text,
global => global.GetTypeMembers("C", 0).Single().GetTypeMembers("I", 0).Single().GetMembers("M").Single(),
format,
"void M()");
}
[WorkItem(537447, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537447")]
[Fact]
public void TestBug2239()
{
var text = @"
public class GC1<T> {}
public class X : GC1<BOGUS> {}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("X", 0).Single().
BaseType();
var format = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"GC1<BOGUS>",
<API key>.ClassName, //GC1
<API key>.Punctuation,
<API key>.ErrorTypeName, //BOGUS
<API key>.Punctuation);
}
[Fact]
public void TestAlias1()
{
var text = @"
using Goo = N1.N2.N3;
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"Goo.C1.C2",
text.IndexOf("namespace", StringComparison.Ordinal),
true,
<API key>.AliasName,
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void TestAlias2()
{
var text = @"
using Goo = N1.N2.N3.C1;
namespace N1 {
namespace N2.N3 {
class C1 {
class C2 {} } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3").
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single();
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"Goo.C2",
text.IndexOf("namespace", StringComparison.Ordinal),
true,
<API key>.AliasName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void TestAlias3()
{
var text = @"
using Goo = N1.C1;
namespace N1 {
class Goo { }
class C1 { }
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetTypeMembers("C1").Single();
var format = SymbolDisplayFormat.<API key>;
<API key>(
text,
findSymbol,
format,
"C1",
text.IndexOf("class Goo", StringComparison.Ordinal),
true,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
namespace N1 {
namespace N2 {
namespace N3 {
class C1 {
class C2 {} } } } }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetNestedNamespace("N1").
GetNestedNamespace("N2").
GetNestedNamespace("N3");
var format = new SymbolDisplayFormat();
<API key>(text, findSymbol, format,
"N1.N2.N3",
text.IndexOf("N1", StringComparison.Ordinal),
true,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.NamespaceName);
<API key>(text, findSymbol, format,
"N2.N3",
text.IndexOf("N2", StringComparison.Ordinal),
true,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.NamespaceName);
<API key>(text, findSymbol, format,
"N3",
text.IndexOf("N3", StringComparison.Ordinal),
true,
<API key>.NamespaceName);
<API key>(text, findSymbol, format,
"N3",
text.IndexOf("C1", StringComparison.Ordinal),
true,
<API key>.NamespaceName);
<API key>(text, findSymbol, format,
"N3",
text.IndexOf("C2", StringComparison.Ordinal),
true,
<API key>.NamespaceName);
}
public class ScriptGlobals
{
public void Method(int p) { Event.Invoke(); }
public delegate void MyDelegate(int x);
public int Field;
public int Property => 1;
public event Action Event;
public class NestedType
{
public void Method(int p) { Event.Invoke(); }
public delegate void MyDelegate(int x);
public int Field;
public int Property => 1;
public event Action Event;
}
}
[Fact]
public void <API key>()
{
var text = @"1";
var tree = SyntaxFactory.ParseSyntaxTree(text, TestOptions.Script);
var hostReference = MetadataReference.CreateFromFile(typeof(ScriptGlobals).Assembly.Location);
var comp = CSharpCompilation.<API key>(
"submission1",
tree,
TargetFrameworkUtil.GetReferences(TargetFramework.Standard).Concat(hostReference),
returnType: typeof(object),
globalsType: typeof(ScriptGlobals));
var model = comp.GetSemanticModel(tree);
var hostTypeSymbol = comp.<API key>();
var methodSymbol = hostTypeSymbol.GetMember("Method");
var delegateSymbol = hostTypeSymbol.GetMember("MyDelegate");
var fieldSymbol = hostTypeSymbol.GetMember("Field");
var propertySymbol = hostTypeSymbol.GetMember("Property");
var eventSymbol = hostTypeSymbol.GetMember("Event");
var nestedTypeSymbol = (TypeSymbol)hostTypeSymbol.GetMember("NestedType");
var nestedMethodSymbol = nestedTypeSymbol.GetMember("Method");
var <API key> = nestedTypeSymbol.GetMember("MyDelegate");
var nestedFieldSymbol = nestedTypeSymbol.GetMember("Field");
var <API key> = nestedTypeSymbol.GetMember("Property");
var nestedEventSymbol = nestedTypeSymbol.GetMember("Event");
Verify(methodSymbol.<API key>(model, position: 0, <API key>),
"void Method(int p)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(delegateSymbol.<API key>(model, position: 0, <API key>),
"MyDelegate(int x)",
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(fieldSymbol.<API key>(model, position: 0, <API key>),
"int Field",
<API key>.Keyword,
<API key>.Space,
<API key>.FieldName);
Verify(propertySymbol.<API key>(model, position: 0, <API key>),
"int Property { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(eventSymbol.<API key>(model, position: 0, <API key>),
"event System.Action Event",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.EventName);
Verify(nestedTypeSymbol.<API key>(model, position: 0, <API key>),
"NestedType",
<API key>.ClassName);
Verify(nestedMethodSymbol.<API key>(model, position: 0, <API key>),
"void NestedType.Method(int p)",
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(<API key>.<API key>(model, position: 0, <API key>),
"NestedType.MyDelegate(int x)",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(nestedFieldSymbol.<API key>(model, position: 0, <API key>),
"int NestedType.Field",
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.FieldName);
Verify(<API key>.<API key>(model, position: 0, <API key>),
"int NestedType.Property { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(nestedEventSymbol.<API key>(model, position: 0, <API key>),
"event System.Action NestedType.Event",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
}
private static readonly SymbolDisplayFormat <API key> =
new SymbolDisplayFormat(
<API key>: <API key>.Omitted,
genericsOptions: <API key>.<API key> | <API key>.<API key>,
memberOptions:
<API key>.IncludeRef |
<API key>.IncludeType |
<API key>.IncludeParameters |
<API key>.<API key>,
delegateStyle:
<API key>.NameAndSignature,
kindOptions:
<API key>.<API key>,
propertyStyle:
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.<API key> |
<API key>.IncludeDefaultValue |
<API key>.<API key>,
localOptions:
<API key>.IncludeRef |
<API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes |
<API key>.<API key> |
<API key>.<API key> |
<API key>.AllowDefaultLiteral);
[Fact]
public void <API key>()
{
var text = @"
class class1Attribute : System.Attribute { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("class1Attribute").Single();
<API key>(text, findSymbol,
new SymbolDisplayFormat(),
"class1Attribute",
<API key>.ClassName);
<API key>(text, findSymbol,
new SymbolDisplayFormat(<API key>: <API key>.<API key>),
"class1",
0,
true,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
class classAttribute : System.Attribute { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("classAttribute").Single();
<API key>(text, findSymbol,
new SymbolDisplayFormat(),
"classAttribute",
<API key>.ClassName);
<API key>(text, findSymbol,
new SymbolDisplayFormat(<API key>: <API key>.<API key>),
"classAttribute",
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
class class1Attribute { }
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("class1Attribute").Single();
<API key>(text, findSymbol,
new SymbolDisplayFormat(),
"class1Attribute",
<API key>.ClassName);
<API key>(text, findSymbol,
new SymbolDisplayFormat(<API key>: <API key>.<API key>),
"class1Attribute",
<API key>.ClassName);
}
[Fact]
public void TestMinimalClass1()
{
var text = @"
using System.Collections.Generic;
class C1 {
private System.Collections.Generic.IDictionary<System.Collections.Generic.IList<System.Int32>, System.String> goo;
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
((FieldSymbol)global.GetTypeMembers("C1").Single().GetMembers("goo").Single()).Type;
var format = SymbolDisplayFormat.<API key>;
<API key>(text, findSymbol, format,
"IDictionary<IList<int>, string>",
text.IndexOf("goo", StringComparison.Ordinal),
true,
<API key>.InterfaceName,
<API key>.Punctuation,
<API key>.InterfaceName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var assemblies = MetadataTestHelpers.<API key>(new[]
{
TestReferences.SymbolsTests.CustomModifiers.Modifiers.dll,
Net40.mscorlib
});
var globalNamespace = assemblies[0].GlobalNamespace;
var @class = globalNamespace.GetMember<NamedTypeSymbol>("<API key>");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
<API key>: <API key>.UseSpecialTypes,
<API key>: <API key>.<API key>);
Verify(@class.GetMember<MethodSymbol>("Method1111").ToDisplayParts(format),
"int modopt(IsConst) [] modopt(IsConst) Method1111(int modopt(IsConst) [] modopt(IsConst) a)",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(@class.GetMember<MethodSymbol>("Method1000").ToDisplayParts(format),
"int modopt(IsConst) [] Method1000(int[] a)",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(@class.GetMember<MethodSymbol>("Method0100").ToDisplayParts(format),
"int[] modopt(IsConst) Method0100(int[] a)",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(@class.GetMember<MethodSymbol>("Method0010").ToDisplayParts(format),
"int[] Method0010(int modopt(IsConst) [] a)",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(@class.GetMember<MethodSymbol>("Method0001").ToDisplayParts(format),
"int[] Method0001(int[] modopt(IsConst) a)",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(@class.GetMember<MethodSymbol>("Method0000").ToDisplayParts(format),
"int[] Method0000(int[] a)",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var assemblies = MetadataTestHelpers.<API key>(new[]
{
TestReferences.SymbolsTests.CustomModifiers.Modifiers.dll,
Net40.mscorlib
});
var globalNamespace = assemblies[0].GlobalNamespace;
var @class = globalNamespace.GetMember<NamedTypeSymbol>("<API key>");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
<API key>: <API key>.UseSpecialTypes,
<API key>: <API key>.<API key>);
Verify(@class.GetMember<PropertySymbol>("Property11").ToDisplayParts(format),
"int modopt(IsConst) [] modopt(IsConst) Property11",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.PropertyName);
Verify(@class.GetMember<PropertySymbol>("Property10").ToDisplayParts(format),
"int modopt(IsConst) [] Property10",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.PropertyName);
Verify(@class.GetMember<PropertySymbol>("Property01").ToDisplayParts(format),
"int[] modopt(IsConst) Property01",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.PropertyName);
Verify(@class.GetMember<PropertySymbol>("Property00").ToDisplayParts(format),
"int[] Property00",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.PropertyName);
}
[Fact]
public void <API key>()
{
var assemblies = MetadataTestHelpers.<API key>(new[]
{
TestReferences.SymbolsTests.CustomModifiers.Modifiers.dll,
Net40.mscorlib
});
var globalNamespace = assemblies[0].GlobalNamespace;
var @class = globalNamespace.GetMember<NamedTypeSymbol>("<API key>");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
<API key>: <API key>.UseSpecialTypes,
<API key>: <API key>.<API key>);
Verify(@class.GetMember<FieldSymbol>("field11").ToDisplayParts(format),
"int modopt(IsConst) [] modopt(IsConst) field11",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.FieldName);
Verify(@class.GetMember<FieldSymbol>("field10").ToDisplayParts(format),
"int modopt(IsConst) [] field10",
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
Verify(@class.GetMember<FieldSymbol>("field01").ToDisplayParts(format),
"int[] modopt(IsConst) field01",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.FieldName);
Verify(@class.GetMember<FieldSymbol>("field00").ToDisplayParts(format),
"int[] field00",
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact]
public void <API key>()
{
var assemblies = MetadataTestHelpers.<API key>(new[]
{
TestReferences.SymbolsTests.CustomModifiers.Modifiers.dll,
Net40.mscorlib
});
var globalNamespace = assemblies[0].GlobalNamespace;
var @class = globalNamespace.GetMember<NamedTypeSymbol>("Modifiers");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
<API key>: <API key>.UseSpecialTypes,
<API key>: <API key>.<API key>);
Verify(@class.GetMember<MethodSymbol>("F3").ToDisplayParts(format),
"void F3(int modopt(int) modopt(IsConst) modopt(IsConst) p)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.Keyword, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.Other, <API key>.Punctuation, <API key>.ClassName, <API key>.Punctuation, //modopt
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
private static void <API key>(
string source,
Func<NamespaceSymbol, Symbol> findSymbol,
SymbolDisplayFormat format,
string expectedText,
int position,
bool minimal,
params <API key>[] expectedKinds)
{
var comp = CreateCompilation(source);
var tree = comp.SyntaxTrees.First();
var model = comp.GetSemanticModel(tree);
var global = comp.GlobalNamespace;
var symbol = findSymbol(global);
var description = minimal
? symbol.<API key>(model, position, format)
: symbol.ToDisplayParts(format);
Verify(description, expectedText, expectedKinds);
}
private static void <API key>(
string source,
Func<NamespaceSymbol, Symbol> findSymbol,
SymbolDisplayFormat format,
string expectedText,
params <API key>[] expectedKinds)
{
<API key>(source, findSymbol, format, null, expectedText, expectedKinds);
}
private static void <API key>(
string source,
Func<NamespaceSymbol, Symbol> findSymbol,
SymbolDisplayFormat format,
CSharpParseOptions parseOptions,
string expectedText,
params <API key>[] expectedKinds)
{
var comp = CreateCompilation(source, parseOptions: parseOptions);
var global = comp.GlobalNamespace;
var symbol = findSymbol(global);
var description = symbol.ToDisplayParts(format);
Verify(description, expectedText, expectedKinds);
}
private static void Verify(ImmutableArray<SymbolDisplayPart> actualParts, string expectedText, params <API key>[] expectedKinds)
{
Assert.Equal(expectedText, actualParts.ToDisplayString());
if (expectedKinds.Length > 0)
{
AssertEx.Equal(expectedKinds, actualParts.Select(p => p.Kind), itemInspector: p => $" <API key>.{p}");
}
}
[Fact]
public void <API key>()
{
var text = "public delegate void D(D param);";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("D", 0).Single();
var format = new SymbolDisplayFormat(<API key>: SymbolDisplayFormat.<API key>.<API key>,
<API key>: SymbolDisplayFormat.<API key>.<API key>,
genericsOptions: SymbolDisplayFormat.<API key>.GenericsOptions,
memberOptions: SymbolDisplayFormat.<API key>.MemberOptions,
parameterOptions: SymbolDisplayFormat.<API key>.ParameterOptions,
propertyStyle: SymbolDisplayFormat.<API key>.PropertyStyle,
localOptions: SymbolDisplayFormat.<API key>.LocalOptions,
kindOptions: <API key>.<API key> | <API key>.IncludeTypeKeyword,
delegateStyle: <API key>.NameAndSignature,
<API key>: SymbolDisplayFormat.<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"delegate void D(D)",
<API key>.Keyword, <API key>.Space, <API key>.Keyword, <API key>.Space, <API key>.DelegateName,
<API key>.Punctuation, <API key>.DelegateName, <API key>.Punctuation);
format = new SymbolDisplayFormat(parameterOptions: <API key>.IncludeName | <API key>.IncludeType,
delegateStyle: <API key>.NameAndSignature,
<API key>: SymbolDisplayFormat.<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"void D(D param)",
<API key>.Keyword, <API key>.Space, <API key>.DelegateName,
<API key>.Punctuation, <API key>.DelegateName, <API key>.Space, <API key>.ParameterName, <API key>.Punctuation);
}
[Fact]
public void GlobalNamespace1()
{
var text = @"public class Test
{
public class System
{
public class Action
{
}
}
public global::System.Action field;
public System.Action field2;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var field = global.GetTypeMembers("Test", 0).Single().GetMembers("field").Single() as FieldSymbol;
return field.Type;
};
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"global::System.Action",
text.IndexOf("global::System.Action", StringComparison.Ordinal),
true /* minimal */,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName);
}
[Fact]
public void GlobalNamespace2()
{
var text = @"public class Test
{
public class System
{
public class Action
{
}
}
public global::System.Action field;
public System.Action field2;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var field = global.GetTypeMembers("Test", 0).Single().GetMembers("field").Single() as FieldSymbol;
return field.Type;
};
var format =
new SymbolDisplayFormat(
<API key>: <API key>.OmittedAsContaining,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"System.Action",
text.IndexOf("global::System.Action", StringComparison.Ordinal),
true /* minimal */,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName);
}
[Fact]
public void GlobalNamespace3()
{
var text = @"public class Test
{
public class System
{
public class Action
{
}
}
public System.Action field2;
public global::System.Action field;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
{
var field = global.GetTypeMembers("Test", 0).Single().GetMembers("field2").Single() as FieldSymbol;
return field.Type;
};
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
"System.Action",
text.IndexOf("System.Action", StringComparison.Ordinal),
true /* minimal */,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
var text = @"
struct S
{
void M(
int i = 1,
string str = ""hello"",
object o = null
S s = default(S))
{
}
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("M");
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(text, findSymbol,
format,
@"void S.M(int i = 1, string str = ""hello"", object o = null, S s = default(S))",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.StringLiteral,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
struct S
{
void M<T>(T t = default(T))
{
}
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("M");
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(text, findSymbol,
format,
@"void S.M<T>(T t = default(T))",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
enum E
{
A = 1,
B = 2,
C = 5,
}
struct S
{
void P(E e = (E)1)
{
}
void Q(E e = (E)3)
{
}
void R(E e = (E)5)
{
}
}";
Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("P");
Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("Q");
Func<NamespaceSymbol, Symbol> findSymbol3 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("R");
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(text, findSymbol1,
format,
@"void S.P(E e = E.A)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation);
<API key>(text, findSymbol2,
format,
@"void S.Q(E e = (E)3)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.NumericLiteral,
<API key>.Punctuation);
<API key>(text, findSymbol3,
format,
@"void S.R(E e = E.C)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
[System.FlagsAttribute]
enum E
{
A = 1,
B = 2,
C = 5,
}
struct S
{
void P(E e = (E)1)
{
}
void Q(E e = (E)3)
{
}
void R(E e = (E)5)
{
}
}";
Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("P");
Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("Q");
Func<NamespaceSymbol, Symbol> findSymbol3 = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("R");
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(text, findSymbol1,
format,
@"void S.P(E e = E.A)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation);
<API key>(text, findSymbol2,
format,
@"void S.Q(E e = E.A | E.B)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation);
<API key>(text, findSymbol3,
format,
@"void S.R(E e = E.C)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text = @"
[System.FlagsAttribute]
enum E : sbyte
{
A = -2,
A1 = -2,
B = 1,
B1 = 1,
C = 0,
C1 = 0,
}
struct S
{
void P(E e = (E)(-2), E f = (E)(-1), E g = (E)0, E h = (E)(-3))
{
}
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("S").GetMember<MethodSymbol>("P");
var format =
new SymbolDisplayFormat(
<API key>: <API key>.Included,
genericsOptions: <API key>.<API key>,
memberOptions:
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>,
parameterOptions:
<API key>.IncludeName |
<API key>.IncludeType |
<API key>.IncludeParamsRefOut |
<API key>.IncludeDefaultValue,
localOptions: <API key>.IncludeType,
<API key>:
<API key>.<API key> |
<API key>.UseSpecialTypes);
<API key>(text, findSymbol,
format,
@"void S.P(E e = E.A, E f = E.A | E.B, E g = E.C, E h = (E)-3)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.NumericLiteral,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var text =
@"class C {
const int f = 1;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"private const Int32 C.f = 1",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ConstantName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral);
}
[Fact]
public void <API key>()
{
var text =
@"
enum E { A, B, C }
class C {
const E f = E.B;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"private const E C.f = E.B",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.EnumName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ConstantName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName);
}
[Fact]
public void <API key>()
{
var text =
@"
[System.FlagsAttribute]
enum E { A = 1, B = 2, C = 4, D = A | B | C }
class C {
const E f = E.D;
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("C", 0).Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"private const E C.f = E.D",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.EnumName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.ConstantName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName);
}
[Fact]
public void TestEnumMember()
{
var text =
@"enum E { A, B, C }";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("E", 0).Single().
GetMembers("B").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"E.B = 1",
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral);
}
[Fact]
public void <API key>()
{
var text =
@"[System.FlagsAttribute]
enum E { A = 1, B = 2, C = 4, D = A | B | C }";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("E", 0).Single().
GetMembers("D").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"E.D = E.A | E.B | E.C",
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName);
}
[Fact]
public void <API key>()
{
var text =
@"enum E { A = 1, B = 2, C = 4, D = A | B | C }";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetTypeMembers("E", 0).Single().
GetMembers("D").Single();
var format = new SymbolDisplayFormat(
memberOptions:
<API key>.<API key> |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeParameters |
<API key>.IncludeType |
<API key>.<API key>);
<API key>(
text,
findSymbol,
format,
"E.D = 7",
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral);
}
[Fact, WorkItem(545462, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545462")]
public void <API key>()
{
var text = @"
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
class C
{
static void Goo([Optional][DateTimeConstant(100)] DateTime d) { }
}";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("C").
GetMember<MethodSymbol>("Goo");
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeType |
<API key>.IncludeName |
<API key>.IncludeDefaultValue);
<API key>(
text,
findSymbol,
format,
"Goo(DateTime d)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact, WorkItem(545681, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545681")]
public void <API key>()
{
var src1 = @"
public class LibG<T>
{
}
";
var src2 = @"
public class Gen<V>
{
public void M(LibG<V> p)
{
}
}
";
var complib = CreateCompilation(src1, assemblyName: "Lib");
var compref = new <API key>(complib);
var comp1 = CreateCompilation(src2, references: new MetadataReference[] { compref }, assemblyName: "Comp1");
var mtdata = comp1.EmitToArray();
var mtref = MetadataReference.CreateFromImage(mtdata);
var comp2 = CreateCompilation("", references: new MetadataReference[] { mtref }, assemblyName: "Comp2");
var tsym1 = comp1.SourceModule.GlobalNamespace.GetMember<NamedTypeSymbol>("Gen");
Assert.NotNull(tsym1);
var msym1 = tsym1.GetMember<MethodSymbol>("M");
Assert.NotNull(msym1);
Assert.Equal("Gen<V>.M(LibG<V>)", msym1.ToDisplayString());
var tsym2 = comp2.GlobalNamespace.GetMember<NamedTypeSymbol>("Gen");
Assert.NotNull(tsym2);
var msym2 = tsym2.GetMember<MethodSymbol>("M");
Assert.NotNull(msym2);
Assert.Equal(msym1.ToDisplayString(), msym2.ToDisplayString());
}
[Fact, WorkItem(545625, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545625")]
public void <API key>()
{
var text = @"
public class C
{
C[][,] F;
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.GetMember<NamedTypeSymbol>("C").GetMember<FieldSymbol>("F").Type;
var normalFormat = new SymbolDisplayFormat();
var reverseFormat = new SymbolDisplayFormat(
<API key>: <API key>.<API key>);
<API key>(
text,
findSymbol,
normalFormat,
"C[][,]",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation);
<API key>(
text,
findSymbol,
reverseFormat,
"C[,][]",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact, WorkItem(546638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546638")]
public void <API key>()
{
var text = @"
public class C
{
void M(
sbyte p1 = (sbyte)-1,
short p2 = (short)-1,
int p3 = (int)-1,
long p4 = (long)-1,
float p5 = (float)-0.5,
double p6 = (double)-0.5,
decimal p7 = (decimal)-0.5)
{
}
}
";
var newCulture = (CultureInfo)CultureInfo.CurrentUICulture.Clone();
newCulture.NumberFormat.NegativeSign = "~";
newCulture.NumberFormat.<API key> = ",";
using (new CultureContext(newCulture))
{
var compilation = CreateCompilation(text);
compilation.VerifyDiagnostics();
var symbol = compilation.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMember<MethodSymbol>("M");
Assert.Equal("void C.M(" +
"[System.SByte p1 = -1], " +
"[System.Int16 p2 = -1], " +
"[System.Int32 p3 = -1], " +
"[System.Int64 p4 = -1], " +
"[System.Single p5 = -0.5], " +
"[System.Double p6 = -0.5], " +
"[System.Decimal p7 = -0.5])", symbol.ToTestDisplayString());
}
}
[Fact]
public void TestMethodVB()
{
var text = @"
Class A
Public Sub Goo(a As Integer)
End Sub
End Class";
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeModifiers | <API key>.<API key> | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeDefaultValue,
<API key>: <API key>.UseSpecialTypes);
var comp = <API key>("c", text);
var a = (ITypeSymbol)comp.GlobalNamespace.GetMembers("A").Single();
var goo = a.GetMembers("Goo").Single();
var parts = Microsoft.CodeAnalysis.CSharp.SymbolDisplay.ToDisplayParts(goo, format);
Verify(
parts,
"public void Goo(int a)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var source = @"
class C
{
event System.Action E;
}
";
var format = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
memberOptions: <API key>.<API key> | <API key>.IncludeType | <API key>.IncludeParameters | <API key>.<API key>);
var comp = <API key>(source, WinRtRefs, TestOptions.ReleaseWinMD);
var eventSymbol = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMember<EventSymbol>("E");
Assert.True(eventSymbol.<API key>);
Verify(
eventSymbol.ToDisplayParts(format),
"Action C.E",
<API key>.DelegateName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
Verify(
eventSymbol.AddMethod.ToDisplayParts(format),
"<API key> C.E.add",
<API key>.StructName,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(
eventSymbol.RemoveMethod.ToDisplayParts(format),
"void C.E.remove",
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
}
[WorkItem(791756, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/791756")]
[Fact]
public void KindOptions()
{
var source = @"
namespace N
{
class C
{
event System.Action E;
}
}
";
var memberFormat = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
memberOptions: <API key>.<API key>,
kindOptions: <API key>.<API key>);
var typeFormat = new SymbolDisplayFormat(
memberOptions: <API key>.<API key>,
<API key>: <API key>.<API key>,
kindOptions: <API key>.IncludeTypeKeyword);
var namespaceFormat = new SymbolDisplayFormat(
<API key>: <API key>.<API key>,
memberOptions: <API key>.<API key>,
kindOptions: <API key>.<API key>);
var comp = CreateCompilation(source);
var namespaceSymbol = comp.GlobalNamespace.GetMember<NamespaceSymbol>("N");
var typeSymbol = namespaceSymbol.GetMember<NamedTypeSymbol>("C");
var eventSymbol = typeSymbol.GetMember<EventSymbol>("E");
Verify(
namespaceSymbol.ToDisplayParts(memberFormat),
"N",
<API key>.NamespaceName);
Verify(
namespaceSymbol.ToDisplayParts(typeFormat),
"N",
<API key>.NamespaceName);
Verify(
namespaceSymbol.ToDisplayParts(namespaceFormat),
"namespace N",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName);
Verify(
typeSymbol.ToDisplayParts(memberFormat),
"N.C",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
Verify(
typeSymbol.ToDisplayParts(typeFormat),
"class N.C",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
Verify(
typeSymbol.ToDisplayParts(namespaceFormat),
"N.C",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
Verify(
eventSymbol.ToDisplayParts(memberFormat),
"event N.C.E",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
Verify(
eventSymbol.ToDisplayParts(typeFormat),
"N.C.E",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
Verify(
eventSymbol.ToDisplayParts(namespaceFormat),
"N.C.E",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.EventName);
}
[WorkItem(765287, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/765287")]
[Fact]
public void TestVbSymbols()
{
var vbComp = <API key>(@"
Class Outer
Class Inner(Of T)
End Class
Sub M(Of U)()
End Sub
WriteOnly Property P() As String
Set(value)
End Set
End Property
Private F As Integer
Event E()
Delegate Sub D()
Function [Error]() As Missing
End Function
End Class
", assemblyName: "VB");
var outer = (INamedTypeSymbol)vbComp.GlobalNamespace.GetMembers("Outer").Single();
var type = outer.GetMembers("Inner").Single();
var method = outer.GetMembers("M").Single();
var property = outer.GetMembers("P").Single();
var field = outer.GetMembers("F").Single();
var @event = outer.GetMembers("E").Single();
var @delegate = outer.GetMembers("D").Single();
var error = outer.GetMembers("Error").Single();
Assert.False(type is Symbol);
Assert.False(method is Symbol);
Assert.False(property is Symbol);
Assert.False(field is Symbol);
Assert.False(@event is Symbol);
Assert.False(@delegate is Symbol);
Assert.False(error is Symbol);
// 1) Looks like C
// 2) Doesn't blow up.
Assert.Equal("Outer.Inner<T>", CSharp.SymbolDisplay.ToDisplayString(type, SymbolDisplayFormat.TestFormat));
Assert.Equal("void Outer.M<U>()", CSharp.SymbolDisplay.ToDisplayString(method, SymbolDisplayFormat.TestFormat));
Assert.Equal("System.String Outer.P { set; }", CSharp.SymbolDisplay.ToDisplayString(property, SymbolDisplayFormat.TestFormat));
Assert.Equal("System.Int32 Outer.F", CSharp.SymbolDisplay.ToDisplayString(field, SymbolDisplayFormat.TestFormat));
Assert.Equal("event Outer.EEventHandler Outer.E", CSharp.SymbolDisplay.ToDisplayString(@event, SymbolDisplayFormat.TestFormat));
Assert.Equal("Outer.D", CSharp.SymbolDisplay.ToDisplayString(@delegate, SymbolDisplayFormat.TestFormat));
Assert.Equal("Missing Outer.Error()", CSharp.SymbolDisplay.ToDisplayString(error, SymbolDisplayFormat.TestFormat));
}
[Fact]
public void FormatPrimitive()
{
// basic tests, more cases are covered by <API key>
Assert.Equal("1", SymbolDisplay.FormatPrimitive(1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((uint)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((byte)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((sbyte)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((short)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((ushort)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((long)1, quoteStrings: false, <API key>: false));
Assert.Equal("1", SymbolDisplay.FormatPrimitive((ulong)1, quoteStrings: false, <API key>: false));
Assert.Equal("x", SymbolDisplay.FormatPrimitive('x', quoteStrings: false, <API key>: false));
Assert.Equal("true", SymbolDisplay.FormatPrimitive(true, quoteStrings: false, <API key>: false));
Assert.Equal("1.5", SymbolDisplay.FormatPrimitive(1.5, quoteStrings: false, <API key>: false));
Assert.Equal("1.5", SymbolDisplay.FormatPrimitive((float)1.5, quoteStrings: false, <API key>: false));
Assert.Equal("1.5", SymbolDisplay.FormatPrimitive((decimal)1.5, quoteStrings: false, <API key>: false));
Assert.Equal("null", SymbolDisplay.FormatPrimitive(null, quoteStrings: false, <API key>: false));
Assert.Equal("abc", SymbolDisplay.FormatPrimitive("abc", quoteStrings: false, <API key>: false));
Assert.Null(SymbolDisplay.FormatPrimitive(SymbolDisplayFormat.TestFormat, quoteStrings: false, <API key>: false));
}
[WorkItem(879984, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/879984")]
[Fact]
public void <API key>()
{
var source = @"
using System;
class Program
{
static void M(E1 e1 = (E1)1, E2 e2 = (E2)1)
{
}
}
enum E1
{
B = 1,
A = 1,
}
[Flags]
enum E2 // Identical to E1, but has [Flags]
{
B = 1,
A = 1,
}
";
var comp = CreateCompilation(source);
var method = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("Program").GetMember<MethodSymbol>("M");
var memberFormat = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters,
parameterOptions: <API key>.IncludeName | <API key>.IncludeDefaultValue);
Assert.Equal("M(e1 = A, e2 = A)", method.ToDisplayString(memberFormat)); // Alphabetically first candidate chosen for both enums.
}
[Fact, WorkItem(1028003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1028003")]
public void <API key>()
{
var il = @"
.class public auto ansi sealed DTest
extends [mscorlib]System.MulticastDelegate
{
.method public hidebysig specialname rtspecialname
instance void .ctor(object 'object',
native int 'method') runtime managed
{
} // end of method DTest::.ctor
.method public hidebysig newslot virtual
instance void Invoke() runtime managed
{
} // end of method DTest::Invoke
.method public hidebysig newslot virtual
instance class [mscorlib]System.IAsyncResult
BeginInvoke(class [mscorlib]System.AsyncCallback callback,
object 'object') runtime managed
{
} // end of method DTest::BeginInvoke
.method public hidebysig newslot virtual
instance void EndInvoke(class [mscorlib]System.IAsyncResult result) runtime managed
{
} // end of method DTest::EndInvoke
} // end of class DTest
.class interface public abstract auto ansi ITest
{
.method public hidebysig newslot abstract virtual
instance void M1() cil managed
{
} // end of method ITest::M1
.method public hidebysig newslot specialname abstract virtual
instance int32 get_P1() cil managed
{
} // end of method ITest::get_P1
.method public hidebysig newslot specialname abstract virtual
instance void set_P1(int32 'value') cil managed
{
} // end of method ITest::set_P1
.method public hidebysig newslot specialname abstract virtual
instance void add_E1(class DTest 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.<API key>::.ctor() = ( 01 00 00 00 )
} // end of method ITest::add_E1
.method public hidebysig newslot specialname abstract virtual
instance void remove_E1(class DTest 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.<API key>::.ctor() = ( 01 00 00 00 )
} // end of method ITest::remove_E1
.event DTest E1
{
.addon instance void ITest::add_E1(class DTest)
.removeon instance void ITest::remove_E1(class DTest)
} // end of event ITest::E1
.property instance int32 P1()
{
.get instance int32 ITest::get_P1()
.set instance void ITest::set_P1(int32)
} // end of property ITest::P1
} // end of class ITest
.class public auto ansi beforefieldinit CTest
extends [mscorlib]System.Object
implements ITest
{
.method public hidebysig newslot specialname virtual final
instance int32 get_P1() cil managed
{
.override ITest::get_P1
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.<API key>::.ctor()
IL_0006: throw
} // end of method CTest::ITest.get_P1
.method public hidebysig newslot specialname virtual final
instance void set_P1(int32 'value') cil managed
{
.override ITest::set_P1
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.<API key>::.ctor()
IL_0006: throw
} // end of method CTest::ITest.set_P1
.method public hidebysig newslot specialname virtual final
instance void add_E1(class DTest 'value') cil managed
{
.override ITest::add_E1
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.<API key>::.ctor()
IL_0006: throw
} // end of method CTest::ITest.add_E1
.method public hidebysig newslot specialname virtual final
instance void remove_E1(class DTest 'value') cil managed
{
.override ITest::remove_E1
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.<API key>::.ctor()
IL_0006: throw
} // end of method CTest::ITest.remove_E1
.method public hidebysig newslot virtual final
instance void M1() cil managed
{
.override ITest::M1
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.<API key>::.ctor()
IL_0006: throw
} // end of method CTest::ITest.M1
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method CTest::.ctor
.event DTest E1
{
.addon instance void CTest::add_E1(class DTest)
.removeon instance void CTest::remove_E1(class DTest)
} // end of event CTest::ITest.E1
.property instance int32 P1()
{
.get instance int32 CTest::get_P1()
.set instance void CTest::set_P1(int32)
} // end of property CTest::ITest.P1
} // end of class CTest
";
var text = @"";
var comp = <API key>(text, il);
var format = new SymbolDisplayFormat(
memberOptions: <API key>.<API key>);
var cTest = comp.<API key>("CTest");
var m1 = cTest.GetMember("M1");
Assert.Equal("M1", m1.Name);
Assert.Equal("M1", m1.ToDisplayString(format));
var p1 = cTest.GetMember("P1");
Assert.Equal("P1", p1.Name);
Assert.Equal("P1", p1.ToDisplayString(format));
var e1 = cTest.GetMember("E1");
Assert.Equal("E1", e1.Name);
Assert.Equal("E1", e1.ToDisplayString(format));
}
[WorkItem(6262, "https://github.com/dotnet/roslyn/issues/6262")]
[Fact]
public void <API key>()
{
var source =
@"class A { }
class B { }
class C<T> { }";
var compilation = CreateCompilation(source);
var sA = compilation.GetMember<NamedTypeSymbol>("A");
var sB = compilation.GetMember<NamedTypeSymbol>("B");
var sC = compilation.GetMember<NamedTypeSymbol>("C");
var f1 = new SymbolDisplayFormat();
var f2 = new SymbolDisplayFormat(memberOptions: <API key>.IncludeParameters);
Assert.False(new FormattedSymbol(sA, f1).Equals((object)sA));
Assert.False(new FormattedSymbol(sA, f1).Equals(null));
Assert.True(new FormattedSymbol(sA, f1).Equals(new FormattedSymbol(sA, f1)));
Assert.False(new FormattedSymbol(sA, f1).Equals(new FormattedSymbol(sA, f2)));
Assert.False(new FormattedSymbol(sA, f1).Equals(new FormattedSymbol(sB, f1)));
Assert.False(new FormattedSymbol(sA, f1).Equals(new FormattedSymbol(sB, f2)));
Assert.False(new FormattedSymbol(sC, f1).Equals(new FormattedSymbol(sC.Construct(sA), f1)));
Assert.True(new FormattedSymbol(sC.Construct(sA), f1).Equals(new FormattedSymbol(sC.Construct(sA), f1)));
Assert.False(new FormattedSymbol(sA, new SymbolDisplayFormat()).Equals(new FormattedSymbol(sA, new SymbolDisplayFormat())));
Assert.True(new FormattedSymbol(sA, f1).GetHashCode().Equals(new FormattedSymbol(sA, f1).GetHashCode()));
}
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void Tuple()
{
var text = @"
public class C
{
public (int, string) f;
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.
GetTypeMembers("C").Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(memberOptions: <API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
TestOptions.Regular,
"(Int32, String) f",
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName, // String
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")]
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void TupleWith1Arity()
{
var text = @"
using System;
public class C
{
public ValueTuple<int> f;
}
" + TestResources.NetFX.ValueTuple.tuplelib_cs;
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.
GetTypeMembers("C").Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(memberOptions: <API key>.IncludeType,
genericsOptions: <API key>.<API key>);
<API key>(
text,
findSymbol,
format,
TestOptions.Regular,
"ValueTuple<Int32> f",
<API key>.StructName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void TupleWithNames()
{
var text = @"
public class C
{
public (int x, string y) f;
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.
GetTypeMembers("C").Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(memberOptions: <API key>.IncludeType);
<API key>(
text,
findSymbol,
format,
TestOptions.Regular,
"(Int32 x, String y) f",
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Space,
<API key>.FieldName,
<API key>.Punctuation,
<API key>.Space,
<API key>.ClassName, // String
<API key>.Space,
<API key>.FieldName,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void <API key>()
{
var text = @"
public class C
{
public (int, string, bool, byte, long, ulong, short, ushort) f;
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.
GetTypeMembers("C").Single().
GetMembers("f").Single();
var format = new SymbolDisplayFormat(memberOptions: <API key>.IncludeType,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
TestOptions.Regular,
"(int, string, bool, byte, long, ulong, short, ushort) f",
<API key>.Punctuation,
<API key>.Keyword, // int
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // string
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // bool
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // byte
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // long
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // ulong
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // short
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // ushort
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
}
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void TupleProperty()
{
var text = @"
class C
{
(int Item1, string Item2) P { get; set; }
}
";
Func<NamespaceSymbol, Symbol> findSymbol = global =>
global.
GetTypeMembers("C").Single().
GetMembers("P").Single();
var format = new SymbolDisplayFormat(memberOptions: <API key>.IncludeType,
<API key>: <API key>.UseSpecialTypes);
<API key>(
text,
findSymbol,
format,
TestOptions.Regular,
"(int Item1, string Item2) P",
<API key>.Punctuation,
<API key>.Keyword, // int
<API key>.Space,
<API key>.FieldName, // Item1
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // string
<API key>.Space,
<API key>.FieldName, // Item2
<API key>.Punctuation,
<API key>.Space,
<API key>.PropertyName);
}
[Fact, CompilerTrait(CompilerFeature.Tuples)]
public void TupleQualifiedNames()
{
var text =
@"using NAB = N.A.B;
namespace N
{
class A
{
internal class B {}
}
class C<T>
{
// offset 1
}
}
class C
{
#pragma warning disable CS0169
(int One, N.C<(object[], NAB Two)>, int, object Four, int, object, int, object, N.A Nine) f;
#pragma warning restore CS0169
// offset 2
}";
var format = new SymbolDisplayFormat(
<API key>: <API key>.Included,
<API key>: <API key>.<API key>,
genericsOptions: <API key>.<API key>,
memberOptions: <API key>.IncludeType,
<API key>: <API key>.UseSpecialTypes);
var comp = (Compilation)<API key>(text, references: new[] { <API key>, ValueTupleRef });
comp.VerifyDiagnostics();
var symbol = comp.GetMember("C.f");
// Fully qualified format.
Verify(
SymbolDisplay.ToDisplayParts(symbol, format),
"(int One, global::N.C<(object[], global::N.A.B Two)>, int, object Four, int, object, int, object, global::N.A Nine) f");
// Minimally qualified format.
Verify(
SymbolDisplay.ToDisplayParts(symbol, SymbolDisplayFormat.<API key>),
"(int One, C<(object[], B Two)>, int, object Four, int, object, int, object, A Nine) C.f");
// <API key>.
var model = comp.GetSemanticModel(comp.SyntaxTrees.First());
Verify(
SymbolDisplay.<API key>(symbol, model, text.IndexOf("offset 1"), format),
"(int One, C<(object[], NAB Two)>, int, object Four, int, object, int, object, A Nine) f");
Verify(
SymbolDisplay.<API key>(symbol, model, text.IndexOf("offset 2"), format),
"(int One, N.C<(object[], NAB Two)>, int, object Four, int, object, int, object, N.A Nine) f");
}
[Fact]
[WorkItem(23970, "https://github.com/dotnet/roslyn/pull/23970")]
public void ThisDisplayParts()
{
var text =
@"
class A
{
void M(int @this)
{
this.M(@this);
}
}";
var comp = CreateCompilation(text);
comp.VerifyDiagnostics();
var tree = comp.SyntaxTrees.Single();
var model = comp.GetSemanticModel(tree);
var invocation = tree.GetRoot().DescendantNodes().OfType<<API key>>().Single();
Assert.Equal("this.M(@this)", invocation.ToString());
var actualThis = ((<API key>)invocation.Expression).Expression;
Assert.Equal("this", actualThis.ToString());
Verify(
SymbolDisplay.ToDisplayParts(model.GetSymbolInfo(actualThis).Symbol, SymbolDisplayFormat.<API key>),
"A this",
<API key>.ClassName,
<API key>.Space,
<API key>.Keyword);
var escapedThis = invocation.ArgumentList.Arguments[0].Expression;
Assert.Equal("@this", escapedThis.ToString());
Verify(
SymbolDisplay.ToDisplayParts(model.GetSymbolInfo(escapedThis).Symbol, SymbolDisplayFormat.<API key>),
"int @this",
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName);
}
[WorkItem(11356, "https://github.com/dotnet/roslyn/issues/11356")]
[Fact]
public void RefReturn()
{
var sourceA =
@"public delegate ref int D();
public class C
{
public ref int F(ref int i) => ref i;
int _p;
public ref int P => ref _p;
public ref int this[int i] => ref _p;
}";
var compA = <API key>(sourceA, new[] { MscorlibRef });
compA.VerifyDiagnostics();
var refA = compA.<API key>();
// From C# symbols.
RefReturnInternal(compA);
var compB = <API key>(GetUniqueName(), "", <API key>: new[] { MscorlibRef, refA });
compB.VerifyDiagnostics();
// From VB symbols.
RefReturnInternal(compB);
}
private static void RefReturnInternal(Compilation comp)
{
var formatBase = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeParamsRefOut,
propertyStyle: <API key>.<API key>,
delegateStyle: <API key>.NameAndSignature,
<API key>: <API key>.UseSpecialTypes);
var formatWithoutRef = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeType);
var formatWithRef = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeType | <API key>.IncludeRef);
var <API key> = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeRef);
var global = comp.GlobalNamespace;
var type = global.GetTypeMembers("C").Single();
var method = type.GetMembers("F").Single();
var property = type.GetMembers("P").Single();
var indexer = type.GetMembers().Where(m => m.Kind == SymbolKind.Property && ((IPropertySymbol)m).IsIndexer).Single();
var @delegate = global.GetTypeMembers("D").Single();
// Method without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithoutRef),
"int F(ref int)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
// Property without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(property, formatWithoutRef),
"int P { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Indexer without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithoutRef),
"int this[int] { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Delegate without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(@delegate, formatWithoutRef),
"int D()",
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Punctuation);
// Method with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithRef),
"ref int F(ref int)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
// Property with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(property, formatWithRef),
"ref int P { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Indexer with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithRef),
"ref int this[int] { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Delegate with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(@delegate, formatWithRef),
"ref int D()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Punctuation);
// Method without IncludeType, with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"F(ref int)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
}
[Fact]
[CompilerTrait(CompilerFeature.ReadOnlyReferences)]
public void RefReadonlyReturn()
{
var sourceA =
@"public delegate ref readonly int D();
public class C
{
public ref readonly int F(in int i) => ref i;
int _p;
public ref readonly int P => ref _p;
public ref readonly int this[in int i] => ref _p;
}";
var compA = CreateCompilation(sourceA);
compA.VerifyDiagnostics();
var refA = compA.<API key>();
// From C# symbols.
<API key>(compA);
var compB = <API key>(GetUniqueName(), "", <API key>: new[] { MscorlibRef, refA });
compB.VerifyDiagnostics();
// From VB symbols.
//<API key>(compB);
}
[Fact]
[CompilerTrait(CompilerFeature.ReadOnlyReferences)]
public void RefReadonlyReturn1()
{
var sourceA =
@"public delegate ref readonly int D();
public class C
{
public ref readonly int F(in int i) => ref i;
int _p;
public ref readonly int P => ref _p;
public ref readonly int this[in int i] => ref _p;
}";
var compA = CreateCompilation(sourceA);
compA.VerifyDiagnostics();
var refA = compA.<API key>();
// From C# symbols.
<API key>(compA);
var compB = <API key>(GetUniqueName(), "", <API key>: new[] { MscorlibRef, refA });
compB.VerifyDiagnostics();
// From VB symbols.
//<API key>(compB);
}
private static void <API key>(Compilation comp)
{
var formatBase = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeParamsRefOut,
propertyStyle: <API key>.<API key>,
delegateStyle: <API key>.NameAndSignature,
<API key>: <API key>.UseSpecialTypes);
var formatWithoutRef = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeType);
var formatWithRef = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeType | <API key>.IncludeRef);
var <API key> = formatBase.WithMemberOptions(
<API key>.IncludeParameters | <API key>.IncludeRef);
var global = comp.GlobalNamespace;
var type = global.GetTypeMembers("C").Single();
var method = type.GetMembers("F").Single();
var property = type.GetMembers("P").Single();
var indexer = type.GetMembers().Where(m => m.Kind == SymbolKind.Property && ((IPropertySymbol)m).IsIndexer).Single();
var @delegate = global.GetTypeMembers("D").Single();
// Method without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithoutRef),
"int F(in int)",
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
// Property without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(property, formatWithoutRef),
"int P { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Indexer without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithoutRef),
"int this[in int] { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Delegate without IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(@delegate, formatWithoutRef),
"int D()",
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Punctuation);
// Method with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithRef),
"ref readonly int F(in int)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
// Property with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(property, formatWithRef),
"ref readonly int P { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Indexer with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithRef),
"ref readonly int this[in int] { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
// Delegate with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(@delegate, formatWithRef),
"ref readonly int D()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.Punctuation);
// Method without IncludeType, with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"F(in int)",
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation);
}
[WorkItem(5002, "https://github.com/dotnet/roslyn/issues/5002")]
[Fact]
public void <API key>()
{
var text =
@"using A = N.M;
namespace N.M
{
class B
{
}
}
class C
{
static void M()
{
}
}";
var comp = CreateCompilation(text);
var tree = comp.SyntaxTrees.First();
var model = comp.GetSemanticModel(tree);
var methodDecl = tree.<API key>().DescendantNodes().OfType<<API key>>().First();
int position = methodDecl.Body.SpanStart;
tree = CSharpSyntaxTree.ParseText(@"
class C
{
static void M()
{
}
}");
methodDecl = tree.<API key>().DescendantNodes().OfType<<API key>>().First();
Assert.True(model.<API key>(position, methodDecl, out model));
var symbol = comp.GetMember<NamedTypeSymbol>("N.M.B");
position = methodDecl.Body.SpanStart;
var description = symbol.<API key>(model, position, SymbolDisplayFormat.<API key>);
Verify(description, "A.B", <API key>.AliasName, <API key>.Punctuation, <API key>.ClassName);
}
[Fact]
public void <API key>()
{
var source = @"
class A<T>
{
}
class B
{
static object F1(object? o) => null!;
static object?[] F2(object[]? o) => null;
static A<object>? F3(A<object?> o) => null;
}";
var comp = (Compilation)CreateCompilation(new[] { source }, parseOptions: TestOptions.Regular8, options: <API key>());
var <API key> = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType | <API key>.IncludeModifiers,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeParamsRefOut,
genericsOptions: <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes | <API key>.<API key>);
var <API key> = <API key>
.<API key>(<API key>.<API key> | <API key>.<API key>)
.<API key>(<API key>.None);
var method = comp.GetMember<IMethodSymbol>("B.F1");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object F1(object? o)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object! F1(object? o)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
method = comp.GetMember<IMethodSymbol>("B.F2");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object?[] F2(object[]? o)");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object?[]! F2(object![]? o)");
method = comp.GetMember<IMethodSymbol>("B.F3");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static A<object>? F3(A<object?> o)");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static A<object!>? F3(A<object?>! o)");
}
[Fact]
public void <API key>()
{
var source =
@"class A<T>
{
}
class B
{
static object F1(object? o) => null!;
static object?[] F2(object[]? o) => null;
static A<object>? F3(A<object?> o) => null;
}";
var comp = (Compilation)CreateCompilation(source, parseOptions: TestOptions.Regular8);
var <API key> = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType | <API key>.IncludeModifiers,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeParamsRefOut,
genericsOptions: <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes);
var <API key> = <API key>
.<API key>(<API key>.<API key>)
.<API key>(<API key>.None);
var method = comp.GetMember<IMethodSymbol>("B.F1");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object F1(object o)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object F1(object? o)",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
method = comp.GetMember<IMethodSymbol>("B.F2");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object[] F2(object[] o)");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static object?[] F2(object[]? o)");
method = comp.GetMember<IMethodSymbol>("B.F3");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static A<object> F3(A<object> o)");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static A<object>? F3(A<object?> o)");
}
[WorkItem(31700, "https://github.com/dotnet/roslyn/issues/31700")]
[Fact]
public void NullableArrays()
{
var source =
@"#nullable enable
class C
{
static object?[,][] F1;
static object[,]?[] F2;
static object[,][]? F3;
}";
var comp = (Compilation)CreateCompilation(source, parseOptions: TestOptions.Regular8);
var <API key> = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeType | <API key>.IncludeModifiers,
<API key>: <API key>.UseSpecialTypes);
var <API key> = <API key>.<API key>(<API key>.<API key>);
var <API key> = <API key>.<API key>(<API key>.<API key>);
var member = comp.GetMember("C.F1");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object[,][] F1",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object?[,][] F1",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object?[]![,]! F1",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.FieldName);
member = comp.GetMember("C.F2");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object[][,] F2");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object[,]?[] F2");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object![,]?[]! F2");
member = comp.GetMember("C.F3");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object[,][] F3");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object[,][]? F3");
Verify(
SymbolDisplay.ToDisplayParts(member, <API key>),
"static object![]![,]? F3");
}
[Fact]
public void AllowDefaultLiteral()
{
var source =
@"using System.Threading;
class C
{
void Method(Cancellation<API key> = default(CancellationToken)) => throw null;
}
";
var compilation = (Compilation)CreateCompilation(source);
var <API key> = SymbolDisplayFormat.<API key>;
Assert.False(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var <API key> = <API key>.<API key>(<API key>.AllowDefaultLiteral);
Assert.True(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var method = compilation.GetMember<IMethodSymbol>("C.Method");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"void C.Method(Cancellation<API key> = default(CancellationToken))");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"void C.Method(Cancellation<API key> = default)");
}
[Fact]
public void <API key>()
{
var source =
@"#nullable enable
class C
{
T F0<T>() => default;
T? F1<T>() => default;
T F2<T>() where T : class => default;
T? F3<T>() where T : class => default;
T F4<T>() where T : class? => default;
T? F5<T>() where T : class? => default;
T F6<T>() where T : struct => default;
T? F7<T>() where T : struct => default;
T F8<T>() where T : notnull => default;
T F9<T>() where T : unmanaged => default;
}";
var comp = (Compilation)CreateCompilation(source, parseOptions: TestOptions.Regular8);
var <API key> = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
genericsOptions: <API key>.<API key> | <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes);
var <API key> = <API key>.<API key>(<API key>.<API key>);
var <API key> = <API key>.<API key>(<API key>.<API key>);
verify("C.F0", "T F0<T>()", "T F0<T>()", "T F0<T>()");
verify("C.F1", "T F1<T>()", "T? F1<T>()", "T? F1<T>()");
verify("C.F2", "T F2<T>() where T : class", "T F2<T>() where T : class", "T! F2<T>() where T : class!");
verify("C.F3", "T F3<T>() where T : class", "T? F3<T>() where T : class", "T? F3<T>() where T : class!");
verify("C.F4", "T F4<T>() where T : class", "T F4<T>() where T : class?", "T F4<T>() where T : class?");
verify("C.F5", "T F5<T>() where T : class", "T? F5<T>() where T : class?", "T? F5<T>() where T : class?");
verify("C.F6", "T F6<T>() where T : struct", "T F6<T>() where T : struct", "T F6<T>() where T : struct");
verify("C.F7", "T? F7<T>() where T : struct", "T? F7<T>() where T : struct", "T? F7<T>() where T : struct");
verify("C.F8", "T F8<T>() where T : notnull", "T F8<T>() where T : notnull", "T F8<T>() where T : notnull");
verify("C.F9", "T F9<T>() where T : unmanaged", "T F9<T>() where T : unmanaged", "T F9<T>() where T : unmanaged");
void verify(string memberName, string withoutModifiers, string <API key>, string withBothModifiers)
{
var member = comp.GetMember(memberName);
Verify(SymbolDisplay.ToDisplayParts(member, <API key>), withoutModifiers);
Verify(SymbolDisplay.ToDisplayParts(member, <API key>), <API key>);
Verify(SymbolDisplay.ToDisplayParts(member, <API key>), withBothModifiers);
}
}
[Fact]
public void <API key>()
{
var source =
@"#nullable enable
interface I<T> { }
class C
{
T? F<T>(T?[] x, I<T?> y) => default;
}";
var comp = (Compilation)CreateCompilation(source, parseOptions: TestOptions.Regular8);
var format = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName,
genericsOptions: <API key>.<API key> | <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes | <API key>.<API key>);
var method = (IMethodSymbol)comp.GetMember("C.F");
Verify(
SymbolDisplay.ToDisplayParts(method, format),
"T? F<T>(T?[] x, I<T?> y)",
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.InterfaceName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
var type = method.GetSymbol<MethodSymbol>().<API key>;
Assert.Equal("T?", type.ToDisplayString(format));
}
[Theory]
[InlineData("int", "0")]
[InlineData("string", "null")]
public void <API key>(string type, string defaultValue)
{
var source =
$@"
class C
{{
void Method1({type} parameter = {defaultValue}) => throw null;
void Method2({type} parameter = default({type})) => throw null;
void Method3({type} parameter = default) => throw null;
}}
";
var compilation = (Compilation)CreateCompilation(source);
var <API key> = SymbolDisplayFormat.<API key>;
Assert.False(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var <API key> = <API key>.<API key>(<API key>.AllowDefaultLiteral);
Assert.True(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var method1 = compilation.GetMember<IMethodSymbol>("C.Method1");
Verify(
SymbolDisplay.ToDisplayParts(method1, <API key>),
$"void C.Method1({type} parameter = {defaultValue})");
Verify(
SymbolDisplay.ToDisplayParts(method1, <API key>),
$"void C.Method1({type} parameter = {defaultValue})");
var method2 = compilation.GetMember<IMethodSymbol>("C.Method2");
Verify(
SymbolDisplay.ToDisplayParts(method2, <API key>),
$"void C.Method2({type} parameter = {defaultValue})");
Verify(
SymbolDisplay.ToDisplayParts(method2, <API key>),
$"void C.Method2({type} parameter = {defaultValue})");
var method3 = compilation.GetMember<IMethodSymbol>("C.Method3");
Verify(
SymbolDisplay.ToDisplayParts(method3, <API key>),
$"void C.Method3({type} parameter = {defaultValue})");
Verify(
SymbolDisplay.ToDisplayParts(method3, <API key>),
$"void C.Method3({type} parameter = {defaultValue})");
}
[Theory]
[InlineData("int", "2")]
[InlineData("string", "\"value\"")]
public void <API key>(string type, string defaultValue)
{
var source =
$@"
class C
{{
void Method({type} parameter = {defaultValue}) => throw null;
}}
";
var compilation = (Compilation)CreateCompilation(source);
var <API key> = SymbolDisplayFormat.<API key>;
Assert.False(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var <API key> = <API key>.<API key>(<API key>.AllowDefaultLiteral);
Assert.True(<API key>.<API key>.IncludesOption(<API key>.AllowDefaultLiteral));
var method = compilation.GetMember<IMethodSymbol>("C.Method");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
$"void C.Method({type} parameter = {defaultValue})");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
$"void C.Method({type} parameter = {defaultValue})");
}
[Fact]
public void <API key>()
{
var source =
@"
class B
{
static (int, (string, long)) F1((int, int)[] t) => throw null;
}";
var comp = (Compilation)CreateCompilation(source);
var <API key> = new SymbolDisplayFormat(
memberOptions: <API key>.IncludeParameters | <API key>.IncludeType | <API key>.IncludeModifiers,
parameterOptions: <API key>.IncludeType | <API key>.IncludeName | <API key>.IncludeParamsRefOut,
genericsOptions: <API key>.<API key>,
<API key>: <API key>.UseSpecialTypes);
var <API key> = <API key>.<API key>(
<API key>.UseValueTuple);
var method = comp.GetMember<IMethodSymbol>("B.F1");
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static (int, (string, long)) F1((int, int)[] t)",
<API key>.Keyword,
<API key>.Space,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
Verify(
SymbolDisplay.ToDisplayParts(method, <API key>),
"static ValueTuple<int, ValueTuple<string, long>> F1(ValueTuple<int, int>[] t)",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
[CompilerTrait(CompilerFeature.LocalFunctions)]
public void LocalFunction()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
class C
{
void M()
{
void Local() {}
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var local = root.DescendantNodes()
.Where(n => n.Kind() == SyntaxKind.<API key>)
.Single();
var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local);
Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind);
Verify(localSymbol.ToDisplayParts(SymbolDisplayFormat.TestFormat),
"void Local()",
<API key>.Keyword, // void
<API key>.Space,
<API key>.MethodName, // Local
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
[CompilerTrait(CompilerFeature.LocalFunctions)]
public void <API key>()
{
SymbolDisplayFormat <API key> = new SymbolDisplayFormat(
genericsOptions: <API key>.<API key>,
<API key>: <API key>.<API key> | <API key>.UseSpecialTypes,
<API key>: <API key>.StaticMethod,
memberOptions:
<API key>.IncludeType |
<API key>.<API key> |
<API key>.<API key> |
<API key>.IncludeModifiers |
<API key>.IncludeRef);
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
class C
{
void M()
{
void Local() {}
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(srcTree);
var local = root.DescendantNodes()
.Where(n => n.Kind() == SyntaxKind.<API key>)
.Single();
var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local);
Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind);
Verify(localSymbol.ToDisplayParts(<API key>),
"void Local",
<API key>.Keyword, // void
<API key>.Space,
<API key>.MethodName // Local
);
}
[Fact]
[CompilerTrait(CompilerFeature.LocalFunctions)]
public void LocalFunction2()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
using System.Threading.Tasks;
class C
{
void M()
{
async unsafe Task<int> Local(ref int* x, out char? c)
{
}
}
}");
var root = srcTree.GetRoot();
var comp = <API key>(new[] { srcTree });
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var local = root.DescendantNodes()
.Where(n => n.Kind() == SyntaxKind.<API key>)
.Single();
var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local);
Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind);
Verify(localSymbol.ToDisplayParts(SymbolDisplayFormat.TestFormat),
"System.Threading.Tasks.Task<System.Int32> Local(ref System.Int32* x, out System.Char? c)",
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.NamespaceName, // Threading
<API key>.Punctuation,
<API key>.NamespaceName, // Tasks
<API key>.Punctuation,
<API key>.ClassName, // Task
<API key>.Punctuation,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName, // Local
<API key>.Punctuation,
<API key>.Keyword, // ref
<API key>.Space,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // out
<API key>.Space,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Char
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void RangeVariable()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
using System.Linq;
class C
{
void M()
{
var q = from x in new[] { 1, 2, 3 } where x < 3 select x;
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var queryExpression = root.DescendantNodes().OfType<<API key>>().First();
var <API key> = (<API key>)semanticModel.GetDeclaredSymbol(queryExpression.FromClause);
Verify(
<API key>.<API key>(
semanticModel,
queryExpression.FromClause.Identifier.SpanStart,
SymbolDisplayFormat.<API key>),
"int x",
<API key>.Keyword, //int
<API key>.Space,
<API key>.RangeVariableName);
}
[Fact]
[CompilerTrait(CompilerFeature.LocalFunctions)]
public void LocalFunction3()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
using System.Threading.Tasks;
class C
{
void M()
{
async unsafe Task<int> Local(in int* x, out char? c)
{
}
}
}");
var root = srcTree.GetRoot();
var comp = <API key>(new[] { srcTree });
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var local = root.DescendantNodes()
.Where(n => n.Kind() == SyntaxKind.<API key>)
.Single();
var localSymbol = (IMethodSymbol)semanticModel.GetDeclaredSymbol(local);
Assert.Equal(MethodKind.LocalFunction, localSymbol.MethodKind);
Verify(localSymbol.ToDisplayParts(SymbolDisplayFormat.TestFormat),
"System.Threading.Tasks.Task<System.Int32> Local(in System.Int32* x, out System.Char? c)",
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.NamespaceName, // Threading
<API key>.Punctuation,
<API key>.NamespaceName, // Tasks
<API key>.Punctuation,
<API key>.ClassName, // Task
<API key>.Punctuation,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Punctuation,
<API key>.Space,
<API key>.MethodName, // Local
<API key>.Punctuation,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Int32
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword, // out
<API key>.Space,
<API key>.NamespaceName, // System
<API key>.Punctuation,
<API key>.StructName, // Char
<API key>.Punctuation,
<API key>.Space,
<API key>.ParameterName,
<API key>.Punctuation);
}
[Fact]
public void LocalVariable_01()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
class C
{
void M()
{
int x = 0;
x++;
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarator = root.DescendantNodes().OfType<<API key>>().Single();
var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator);
Verify(
local.<API key>(
semanticModel,
declarator.SpanStart,
SymbolDisplayFormat.<API key>.AddLocalOptions(<API key>.IncludeRef)),
"int x",
<API key>.Keyword, //int
<API key>.Space,
<API key>.LocalName);
Assert.False(local.IsRef);
Assert.Equal(RefKind.None, local.RefKind);
}
[Fact]
public void LocalVariable_02()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
class C
{
void M(int y)
{
ref int x = y;
x++;
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarator = root.DescendantNodes().OfType<<API key>>().Single();
var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator);
Verify(
local.<API key>(
semanticModel,
declarator.SpanStart,
SymbolDisplayFormat.<API key>.AddLocalOptions(<API key>.IncludeRef)),
"ref int x",
<API key>.Keyword, //ref
<API key>.Space,
<API key>.Keyword, //int
<API key>.Space,
<API key>.LocalName);
Verify(
local.<API key>(
semanticModel,
declarator.SpanStart,
SymbolDisplayFormat.<API key>),
"int x",
<API key>.Keyword, //int
<API key>.Space,
<API key>.LocalName);
Assert.True(local.IsRef);
Assert.Equal(RefKind.Ref, local.RefKind);
}
[Fact]
public void LocalVariable_03()
{
var srcTree = SyntaxFactory.ParseSyntaxTree(@"
class C
{
void M(int y)
{
ref readonly int x = y;
x++;
}
}");
var root = srcTree.GetRoot();
var comp = CreateCompilation(srcTree);
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarator = root.DescendantNodes().OfType<<API key>>().Single();
var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator);
Verify(
local.<API key>(
semanticModel,
declarator.SpanStart,
SymbolDisplayFormat.<API key>.AddLocalOptions(<API key>.IncludeRef)),
"ref readonly int x",
<API key>.Keyword, //ref
<API key>.Space,
<API key>.Keyword, //readonly
<API key>.Space,
<API key>.Keyword, //int
<API key>.Space,
<API key>.LocalName);
Verify(
local.<API key>(
semanticModel,
declarator.SpanStart,
SymbolDisplayFormat.<API key>),
"int x",
<API key>.Keyword, //int
<API key>.Space,
<API key>.LocalName);
Assert.True(local.IsRef);
Assert.Equal(RefKind.RefReadOnly, local.RefKind);
}
[Fact]
[WorkItem(22507, "https://github.com/dotnet/roslyn/issues/22507")]
public void <API key>()
{
// A bad comparer could cause sorting the enum fields
// to throw an exception due to inconsistency. See Repro22507
// for an example of this problem.
var lhs = new EnumField("E1", 0);
var rhs = new EnumField("E2", <API key>);
// This is a "reverse" comparer, so if lhs < rhs, return
// value should be > 0
// If the comparer subtracts and converts, result will be zero since
// the bottom 32 bits are zero
Assert.InRange(EnumField.Comparer.Compare(lhs, rhs), 1, int.MaxValue);
lhs = new EnumField("E1", 0);
rhs = new EnumField("E2", <API key>);
Assert.InRange(EnumField.Comparer.Compare(lhs, rhs), 1, int.MaxValue);
lhs = new EnumField("E1", <API key>);
rhs = new EnumField("E2", 0);
Assert.InRange(EnumField.Comparer.Compare(lhs, rhs), int.MinValue, -1);
lhs = new EnumField("E1", 0);
rhs = new EnumField("E2", <API key>);
Assert.InRange(EnumField.Comparer.Compare(lhs, rhs), 1, int.MaxValue);
}
[Fact]
[WorkItem(22507, "https://github.com/dotnet/roslyn/issues/22507")]
public void Repro22507()
{
var text = @"
using System;
[Flags]
enum E : long
{
A = 0x0,
B = 0x400,
C = 0x100000,
D = 0x200000,
E = 0x2000000,
F = 0x4000000,
G = 0x8000000,
H = 0x40000000,
I = 0x80000000,
J = 0x20000000000,
K = 0x40000000000,
L = 0x4000000000000,
M = 0x8000000000000,
N = 0x10000000000000,
O = 0x20000000000000,
P = 0x40000000000000,
Q = 0x2000000000000000,
}
";
<API key>(
text,
g => g.GetTypeMembers("E").Single().GetField("A"),
SymbolDisplayFormat.<API key>
.AddMemberOptions(<API key>.<API key>),
"E.A = 0",
<API key>.EnumName,
<API key>.Punctuation,
<API key>.EnumMemberName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NumericLiteral);
}
[Fact]
public void TestRefStructs()
{
var source = @"
ref struct X { }
namespace Nested
{
ref struct Y { }
}
";
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<<API key>>().ToArray();
Assert.Equal(2, declarations.Length);
var format = SymbolDisplayFormat.TestFormat.AddKindOptions(<API key>.IncludeTypeKeyword);
Verify(semanticModel.GetDeclaredSymbol(declarations[0]).ToDisplayParts(format),
"ref struct X",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName);
Verify(semanticModel.GetDeclaredSymbol(declarations[1]).ToDisplayParts(format),
"ref struct Nested.Y",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.StructName);
}
[Fact]
public void TestReadOnlyStructs()
{
var source = @"
readonly struct X { }
namespace Nested
{
readonly struct Y { }
}
";
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<<API key>>().ToArray();
Assert.Equal(2, declarations.Length);
var format = SymbolDisplayFormat.TestFormat.AddKindOptions(<API key>.IncludeTypeKeyword);
Verify(semanticModel.GetDeclaredSymbol(declarations[0]).ToDisplayParts(format),
"readonly struct X",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName);
Verify(semanticModel.GetDeclaredSymbol(declarations[1]).ToDisplayParts(format),
"readonly struct Nested.Y",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.StructName);
}
[Fact]
public void <API key>()
{
var source = @"
readonly ref struct X { }
namespace Nested
{
readonly ref struct Y { }
}
";
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<<API key>>().ToArray();
Assert.Equal(2, declarations.Length);
var format = SymbolDisplayFormat.TestFormat.AddKindOptions(<API key>.IncludeTypeKeyword);
Verify(semanticModel.GetDeclaredSymbol(declarations[0]).ToDisplayParts(format),
"readonly ref struct X",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName);
Verify(semanticModel.GetDeclaredSymbol(declarations[1]).ToDisplayParts(format),
"readonly ref struct Nested.Y",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.StructName);
}
[Fact]
public void <API key>()
{
var source = @"
struct X
{
int P1 { }
readonly int P2 { }
readonly event System.Action E1 { }
readonly event System.Action E2 { remove { } }
}
";
var format = SymbolDisplayFormat.TestFormat
.AddMemberOptions(<API key>.IncludeModifiers)
.<API key>(<API key>.UseSpecialTypes);
var comp = CreateCompilation(source).VerifyDiagnostics(
// (4,9): error CS0548: 'X.P1': property or indexer must have at least one accessor
// int P1 { }
Diagnostic(ErrorCode.<API key>, "P1").WithArguments("X.P1").WithLocation(4, 9),
// (5,18): error CS0548: 'X.P2': property or indexer must have at least one accessor
// readonly int P2 { }
Diagnostic(ErrorCode.<API key>, "P2").WithArguments("X.P2").WithLocation(5, 18),
// (6,34): error CS0065: 'X.E1': event property must have both add and remove accessors
// readonly event System.Action E1 { }
Diagnostic(ErrorCode.<API key>, "E1").WithArguments("X.E1").WithLocation(6, 34),
// (7,34): error CS0065: 'X.E2': event property must have both add and remove accessors
// readonly event System.Action E2 { remove { } }
Diagnostic(ErrorCode.<API key>, "E2").WithArguments("X.E2").WithLocation(7, 34));
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declaration = (<API key>)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
var members = semanticModel.GetDeclaredSymbol(declaration).GetMembers();
Verify(members[0].ToDisplayParts(format), "int X.P1 { }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[1].ToDisplayParts(format), "int X.P2 { }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[2].ToDisplayParts(format), "event System.Action X.E1",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName);
Verify(members[3].ToDisplayParts(format), "readonly event System.Action X.E2",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName);
}
[Fact]
public void TestReadOnlyMembers()
{
var source = @"
struct X
{
readonly void M() { }
readonly int P1 { get => 123; }
readonly int P2 { set {} }
readonly int P3 { get => 123; set {} }
int P4 { readonly get => 123; set {} }
int P5 { get => 123; readonly set {} }
readonly event System.Action E { add {} remove {} }
}
";
var format = SymbolDisplayFormat.TestFormat
.AddMemberOptions(<API key>.IncludeModifiers)
.<API key>(<API key>.UseSpecialTypes);
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declaration = (<API key>)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
var members = semanticModel.GetDeclaredSymbol(declaration).GetMembers();
Verify(members[0].ToDisplayParts(format),
"readonly void X.M()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
Verify(members[1].ToDisplayParts(format),
"readonly int X.P1 { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[2].ToDisplayParts(format),
"readonly int X.P1.get",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[3].ToDisplayParts(format),
"readonly int X.P2 { set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[4].ToDisplayParts(format),
"readonly void X.P2.set",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[5].ToDisplayParts(format),
"readonly int X.P3 { get; set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[6].ToDisplayParts(format),
"readonly int X.P3.get",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[7].ToDisplayParts(format),
"readonly void X.P3.set",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[8].ToDisplayParts(format),
"int X.P4 { readonly get; set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[9].ToDisplayParts(format),
"readonly int X.P4.get",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[10].ToDisplayParts(format),
"void X.P4.set",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[11].ToDisplayParts(format),
"int X.P5 { get; readonly set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[12].ToDisplayParts(format),
"int X.P5.get",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[13].ToDisplayParts(format),
"readonly void X.P5.set",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[14].ToDisplayParts(format),
"readonly event System.Action X.E",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName);
Verify(members[15].ToDisplayParts(format),
"readonly void X.E.add",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[16].ToDisplayParts(format),
"readonly void X.E.remove",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
var source = @"
readonly struct X
{
void M() { }
int P1 { get => 123; }
int P2 { set {} }
int P3 { get => 123; readonly set {} }
event System.Action E { add {} remove {} }
}
";
var format = SymbolDisplayFormat.TestFormat
.AddMemberOptions(<API key>.IncludeModifiers)
.<API key>(<API key>.UseSpecialTypes);
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declaration = (<API key>)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
var members = semanticModel.GetDeclaredSymbol(declaration).GetMembers();
Verify(members[0].ToDisplayParts(format),
"void X.M()",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
Verify(members[1].ToDisplayParts(format),
"int X.P1 { get; }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[2].ToDisplayParts(format),
"int X.P1.get",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[3].ToDisplayParts(format),
"int X.P2 { set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[4].ToDisplayParts(format),
"void X.P2.set",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[5].ToDisplayParts(format),
"int X.P3 { get; set; }",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.Punctuation);
Verify(members[6].ToDisplayParts(format),
"int X.P3.get",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[7].ToDisplayParts(format),
"void X.P3.set",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.PropertyName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[8].ToDisplayParts(format),
"event System.Action X.E",
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.DelegateName,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName);
Verify(members[9].ToDisplayParts(format),
"void X.E.add",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
Verify(members[10].ToDisplayParts(format),
"void X.E.remove",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName,
<API key>.Punctuation,
<API key>.EventName,
<API key>.Punctuation,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
var source = @"
namespace Nested
{
struct X
{
readonly void M() { }
}
}
";
var format = SymbolDisplayFormat.TestFormat
.AddMemberOptions(<API key>.IncludeModifiers)
.<API key>(<API key>.UseSpecialTypes);
var comp = CreateCompilation(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var declaration = (<API key>)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
var members = semanticModel.GetDeclaredSymbol(declaration).GetMembers();
Verify(members[0].ToDisplayParts(format),
"readonly void Nested.X.M()",
<API key>.Keyword,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.StructName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.Punctuation);
}
[Fact]
public void <API key>()
{
var source = @"
Structure X
End Structure";
var comp = <API key>(source).VerifyDiagnostics();
var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single());
var structure = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.RawKind == (int)VisualBasic.SyntaxKind.StructureStatement);
var format = SymbolDisplayFormat.TestFormat.AddKindOptions(<API key>.IncludeTypeKeyword);
Verify(SymbolDisplay.ToDisplayParts(semanticModel.GetDeclaredSymbol(structure), format),
"struct X",
<API key>.Keyword,
<API key>.Space,
<API key>.StructName);
}
[Fact]
public void EnumConstraint_Type()
{
<API key>(
"class X<T> where T : System.Enum { }",
global => global.GetTypeMember("X"),
SymbolDisplayFormat.TestFormat.WithGenericsOptions(<API key>.<API key> | <API key>.<API key>),
"X<T> where T : System.Enum",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void EnumConstraint()
{
<API key>(
"class X<T> where T : System.Enum { }",
global => global.GetTypeMember("X").TypeParameters.Single().ConstraintTypes().Single(),
SymbolDisplayFormat.TestFormat,
"System.Enum",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
<API key>(
"class X<T> where T : System.Delegate { }",
global => global.GetTypeMember("X"),
SymbolDisplayFormat.TestFormat.WithGenericsOptions(<API key>.<API key> | <API key>.<API key>),
"X<T> where T : System.Delegate",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void DelegateConstraint()
{
<API key>(
"class X<T> where T : System.Delegate { }",
global => global.GetTypeMember("X").TypeParameters.Single().ConstraintTypes().Single(),
SymbolDisplayFormat.TestFormat,
"System.Delegate",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
<API key>(
"class X<T> where T : System.MulticastDelegate { }",
global => global.GetTypeMember("X"),
SymbolDisplayFormat.TestFormat.WithGenericsOptions(<API key>.<API key> | <API key>.<API key>),
"X<T> where T : System.MulticastDelegate",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
<API key>(
"class X<T> where T : System.MulticastDelegate { }",
global => global.GetTypeMember("X").TypeParameters.Single().ConstraintTypes().Single(),
SymbolDisplayFormat.TestFormat,
"System.MulticastDelegate",
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.ClassName);
}
[Fact]
public void <API key>()
{
<API key>(
"class X<T> where T : unmanaged { }",
global => global.GetTypeMember("X"),
SymbolDisplayFormat.TestFormat.AddGenericsOptions(<API key>.<API key>),
"X<T> where T : unmanaged",
<API key>.ClassName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword);
}
[Fact]
public void <API key>()
{
<API key>(@"
class X
{
void M<T>() where T : unmanaged, System.IDisposable { }
}",
global => global.GetTypeMember("X").GetMethod("M"),
SymbolDisplayFormat.TestFormat.AddGenericsOptions(<API key>.<API key>),
"void X.M<T>() where T : unmanaged, System.IDisposable",
<API key>.Keyword,
<API key>.Space,
<API key>.ClassName,
<API key>.Punctuation,
<API key>.MethodName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Punctuation,
<API key>.Space,
<API key>.NamespaceName,
<API key>.Punctuation,
<API key>.InterfaceName);
}
[Fact]
public void <API key>()
{
<API key>(
"delegate void D<T>() where T : unmanaged;",
global => global.GetTypeMember("D"),
SymbolDisplayFormat.TestFormat.AddGenericsOptions(<API key>.<API key>),
"D<T> where T : unmanaged",
<API key>.DelegateName,
<API key>.Punctuation,
<API key>.TypeParameterName,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword,
<API key>.Space,
<API key>.TypeParameterName,
<API key>.Space,
<API key>.Punctuation,
<API key>.Space,
<API key>.Keyword);
}
[Fact, WorkItem(27104, "https://github.com/dotnet/roslyn/issues/27104")]
public void <API key>()
{
var source = @"
class C
{
void M()
{ |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<TITLE>
Uses of Class org.apache.poi.ss.formula.functions.ImReal (POI API Documentation)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.poi.ss.formula.functions.ImReal (POI API Documentation)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/poi/ss/formula/functions/ImReal.html" title="class in org.apache.poi.ss.formula.functions"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/poi/ss/formula/functions/\class-useImReal.html" target="_top"><B>FRAMES</B></A>
<A HREF="ImReal.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.poi.ss.formula.functions.ImReal</B></H2>
</CENTER>
No usage of org.apache.poi.ss.formula.functions.ImReal
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/poi/ss/formula/functions/ImReal.html" title="class in org.apache.poi.ss.formula.functions"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/poi/ss/formula/functions/\class-useImReal.html" target="_top"><B>FRAMES</B></A>
<A HREF="ImReal.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
<i>Copyright 2016 The Apache Software Foundation or
its licensors, as applicable.</i>
</BODY>
</HTML> |
describe FastlaneCore do
describe FastlaneCore::PrintTable do
before do
@options = [
FastlaneCore::ConfigItem.new(key: :cert_name,
env_name: "<API key>",
description: "Set the profile name",
verify_block: nil),
FastlaneCore::ConfigItem.new(key: :output,
env_name: "SIGH_OUTPUT_PATH",
description: "Directory in which the profile should be stored",
default_value: ".",
verify_block: proc do |value|
UI.user_error!("Could not find output directory '#{value}'") unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :a_bool,
description: "Metadata: A bool",
optional: true,
is_string: false,
default_value: true),
FastlaneCore::ConfigItem.new(key: :a_sensitive,
description: "Metadata: A sensitive option",
optional: true,
sensitive: true,
is_string: true,
default_value: "Some secret"),
FastlaneCore::ConfigItem.new(key: :a_hash,
description: "Metadata: A hash",
optional: true,
is_string: false)
]
@values = {
cert_name: "asdf",
output: "..",
a_bool: true,
a_hash: {}
}
@config = FastlaneCore::Configuration.create(@options, @values)
end
it "supports nil config" do
value = FastlaneCore::PrintTable.print_values
expect(value).to eq({ rows: [] })
end
it "prints out all the information in a nice table" do
title = "Custom Title"
value = FastlaneCore::PrintTable.print_values(config: @config, title: title, hide_keys: [:a_sensitive])
expect(value[:title]).to eq(title.green)
expect(value[:rows]).to eq([['cert_name', "asdf"], ['output', '..'], ["a_bool", true]])
end
it "automatically masks sensitive options" do
value = FastlaneCore::PrintTable.print_values(config: @config)
expect(value[:rows]).to eq([["cert_name", "asdf"], ["output", ".."], ["a_bool", true], ["a_sensitive", "********"]])
end
it "supports mask_keys property with symbols and strings" do
value = FastlaneCore::PrintTable.print_values(config: @config, mask_keys: [:cert_name, 'a_bool'])
expect(value[:rows]).to eq([["cert_name", "********"], ["output", ".."], ["a_bool", "********"], ["a_sensitive", "********"]])
end
it "supports hide_keys property with symbols and strings" do
value = FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [:cert_name, "a_bool", :a_sensitive])
expect(value[:rows]).to eq([['output', '..']])
end
it "recurses over hashes" do
@config[:a_hash][:foo] = 'bar'
@config[:a_hash][:bar] = { foo: 'bar' }
value = FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [:cert_name, :a_bool])
expect(value[:rows]).to eq([["output", ".."], ["a_hash.foo", "bar"], ["a_hash.bar.foo", "bar"], ["a_sensitive", "********"]])
end
it "supports hide_keys property in hashes" do
@config[:a_hash][:foo] = 'bar'
@config[:a_hash][:bar] = { foo: 'bar' }
value = FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [:cert_name, :a_bool, 'a_hash.foo', 'a_hash.bar.foo'])
expect(value[:rows]).to eq([["output", ".."], ["a_sensitive", "********"]])
end
it "supports printing default values and ignores missing unset ones " do
@config[:cert_name] = nil # compulsory without default
@config[:output] = nil # compulsory with default
value = FastlaneCore::PrintTable.print_values(config: @config)
expect(value[:rows]).to eq([["output", "."], ["a_bool", true], ["a_sensitive", "********"]])
end
it "breaks down long lines" do
long_breakable_text = 'bar ' * 40
@config[:cert_name] = long_breakable_text
value = FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [:output, :a_bool, :a_sensitive])
expect(value[:rows].count).to eq(1)
expect(value[:rows][0][1]).to end_with '...'
expect(value[:rows][0][1].length).to be < long_breakable_text.length
end
it "supports non-Configuration prints" do
value = FastlaneCore::PrintTable.print_values(config: { key: "value" }, title: "title")
expect(value[:rows]).to eq([["key", "value"]])
end
end
end |
using System;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
using UnitTests.GrainInterfaces;
using UnitTests.Tester;
using Xunit;
namespace UnitTests
{
public class ProviderTests : <API key>
{
[Fact, TestCategory("Functional"), TestCategory("Providers")]
public void <API key>()
{
IExtensionTestGrain grain = GrainClient.GrainFactory.GetGrain<IExtensionTestGrain>(GetRandomGrainId());
ITestExtension extension = grain.AsReference<ITestExtension>();
bool exceptionThrown = true;
try
{
var p1 = extension.CheckExtension_1();
p1.Wait();
exceptionThrown = false;
}
catch (<API key>)
{
// This is the expected behavior
}
catch (AggregateException ex)
{
var baseEx = ex.GetBaseException();
if (baseEx is <API key>)
{
// This is also the expected behavior
}
else
{
Assert.True(false, "Incorrect exception thrown when an unimplemented method is invoked: " + baseEx);
}
}
catch (Exception ex1)
{
Assert.True(false, "Incorrect exception thrown when an unimplemented method is invoked: " + ex1);
}
if (!exceptionThrown)
{
Assert.True(false, "Expected exception not thrown when no extension configured");
}
var p2 = grain.InstallExtension("test");
p2.Wait();
try
{
var p1 = extension.CheckExtension_1();
p1.Wait();
Assert.Equal("test", p1.Result);
}
catch (Exception exc)
{
Assert.True(false, "Unexpected exception thrown when extension is configured. Exc = " + exc);
}
try
{
var p1 = extension.CheckExtension_2();
p1.Wait();
Assert.Equal("23", p1.Result);
}
catch (Exception exc)
{
Assert.True(false, "Unexpected exception thrown when extension is configured. Exc = " + exc);
}
}
[Fact, TestCategory("Functional"), TestCategory("Providers"), TestCategory("BVT"), TestCategory("Cast"), TestCategory("Generics")]
public async Task <API key>()
{
var grain = GrainClient.GrainFactory.GetGrain<<API key><int>>(GetRandomGrainId());
var extension = grain.AsReference<ISimpleExtension>(); //generic base grain not yet activated - virt refs only
try
{
var res = await extension.CheckExtension_1(); //now activation occurs, but with non-generic reference
}
catch (Exception ex)
{
Assert.True(false, "No exception should have been thrown. Ex: " + ex.Message);
}
Assert.True(true);
}
[Fact, TestCategory("Functional"), TestCategory("Providers"), TestCategory("BVT"), TestCategory("Cast"), TestCategory("Generics")]
public async Task <API key>() {
var grain = GrainClient.GrainFactory.GetGrain<<API key><int>>(GetRandomGrainId());
await grain.DoSomething(); //original generic grain activates here
var extension = grain.AsReference<ISimpleExtension>();
try {
var res = await extension.CheckExtension_1();
}
catch(Exception ex) {
Assert.True(false, "No exception should have been thrown. Ex: " + ex.Message);
}
Assert.True(true);
}
}
} |
$DONOTEVALUATE();
/\p{Script}/u; |
<?php
namespace Zend\Validator\File;
use Zend\Validator\AbstractValidator;
use Zend\Validator\Exception;
/**
* Validator for the maximum size of a file up to a max of 2GB
*/
class UploadFile extends AbstractValidator
{
/**
* @const string Error constants
*/
const INI_SIZE = '<API key>';
const FORM_SIZE = '<API key>';
const PARTIAL = '<API key>';
const NO_FILE = '<API key>';
const NO_TMP_DIR = '<API key>';
const CANT_WRITE = '<API key>';
const EXTENSION = '<API key>';
const ATTACK = '<API key>';
const FILE_NOT_FOUND = '<API key>';
const UNKNOWN = '<API key>';
/**
* @var array Error message templates
*/
protected $messageTemplates = array(
self::INI_SIZE => "File exceeds the defined ini size",
self::FORM_SIZE => "File exceeds the defined form size",
self::PARTIAL => "File was only partially uploaded",
self::NO_FILE => "File was not uploaded",
self::NO_TMP_DIR => "No temporary directory was found for file",
self::CANT_WRITE => "File can't be written",
self::EXTENSION => "A PHP extension returned an error while uploading the file",
self::ATTACK => "File was illegally uploaded. This could be a possible attack",
self::FILE_NOT_FOUND => "File was not found",
self::UNKNOWN => "Unknown error while uploading file",
);
/**
* Returns true if and only if the file was uploaded without errors
*
* @param string $value File to check for upload errors
* @return bool
* @throws Exception\<API key>
*/
public function isValid($value)
{
if (is_array($value)) {
if (!isset($value['tmp_name']) || !isset($value['name']) || !isset($value['error'])) {
throw new Exception\<API key>(
'Value array must be in $_FILES format'
);
}
$file = $value['tmp_name'];
$filename = $value['name'];
$error = $value['error'];
} else {
$file = $value;
$filename = basename($file);
$error = 0;
}
$this->setValue($filename);
switch ($error) {
case UPLOAD_ERR_OK:
if (empty($file) || false === is_file($file)) {
$this->error(self::FILE_NOT_FOUND);
} elseif (! is_uploaded_file($file)) {
$this->error(self::ATTACK);
}
break;
case UPLOAD_ERR_INI_SIZE:
$this->error(self::INI_SIZE);
break;
case <API key>:
$this->error(self::FORM_SIZE);
break;
case UPLOAD_ERR_PARTIAL:
$this->error(self::PARTIAL);
break;
case UPLOAD_ERR_NO_FILE:
$this->error(self::NO_FILE);
break;
case <API key>:
$this->error(self::NO_TMP_DIR);
break;
case <API key>:
$this->error(self::CANT_WRITE);
break;
case <API key>:
$this->error(self::EXTENSION);
break;
default:
$this->error(self::UNKNOWN);
break;
}
if (count($this->getMessages()) > 0) {
return false;
}
return true;
}
} |
this["JST"] = this["JST"] || {};;;;;;this["JST"]["test/fixtures/basic.hbs"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "Basic template that does nothing.";
},"useData":true}); |
package org.spongepowered.common.mixin.core.item.data;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemWrittenBook;
import org.spongepowered.api.data.manipulator.DataManipulator;
import org.spongepowered.api.data.manipulator.mutable.item.AuthorData;
import org.spongepowered.api.data.manipulator.mutable.item.GenerationData;
import org.spongepowered.api.data.manipulator.mutable.item.PagedData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.common.mixin.core.item.MixinItem;
import java.util.List;
@Mixin(ItemWrittenBook.class)
/**
* This is actually the written, uneditable book class (the MCP name is bad)
*/
public abstract class <API key> extends MixinItem {
@Override
public void getManipulatorsFor(ItemStack itemStack, List<DataManipulator<?, ?>> list) {
super.getManipulatorsFor(itemStack, list);
org.spongepowered.api.item.inventory.ItemStack spongeStack = (org.spongepowered.api.item.inventory.ItemStack) itemStack;
spongeStack.get(AuthorData.class).ifPresent(list::add);
spongeStack.get(PagedData.class).ifPresent(list::add);
spongeStack.get(GenerationData.class).ifPresent(list::add);
}
} |
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Windows Virtual Shields for Arduino: C:/Users/jgord/Documents/ms-iot/<API key>/VirtualShield/LightSensor.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Shields300x300.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Windows Virtual Shields for Arduino
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="<API key>">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="<API key>.html">ms-iot</a></li><li class="navelem"><a class="el" href="<API key>.html"><API key></a></li><li class="navelem"><a class="el" href="<API key>.html">VirtualShield</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">LightSensor.h</div> </div>
</div><!--header
<div class="contents">
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#ifndef LightSensor_h</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#define LightSensor_h</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="_sensor_8h.html">Sensor.h</a>"</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "<a class="code" href="_shield_event_8h.html">ShieldEvent.h</a>"</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include <ArduinoJson.h></span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include "Arduino.h"</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="class_light_sensor.html"> 34</a></span> <span class="keyword">class </span><a class="code" href="class_light_sensor.html">LightSensor</a> : <span class="keyword">public</span> <a class="code" href="class_sensor.html">Sensor</a> {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="class_light_sensor.html#<API key>"> 36</a></span>  <span class="keywordtype">double</span> <a class="code" href="class_light_sensor.html#<API key>">Lux</a>;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="code" href="class_light_sensor.html#<API key>">LightSensor</a>(<span class="keyword">const</span> <a class="code" href="<API key>.html">VirtualShield</a> &<a class="code" href="class_sensor.html#<API key>">shield</a>);</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordtype">void</span> <a class="code" href="class_light_sensor.html#<API key>">onJsonReceived</a>(JsonObject& root, <a class="code" href="struct_shield_event.html">ShieldEvent</a>* shieldEvent) <span class="keyword">override</span>;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> };</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor">#endif</span></div>
<div class="ttc" id="class_sensor_html"><div class="ttname"><a href="class_sensor.html">Sensor</a></div><div class="ttdef"><b>Definition:</b> Sensor.h:51</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="<API key>.html">VirtualShield</a></div><div class="ttdef"><b>Definition:</b> VirtualShield.h:50</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="class_sensor.html#<API key>">Sensor::shield</a></div><div class="ttdeci">VirtualShield & shield</div><div class="ttdef"><b>Definition:</b> Sensor.h:55</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="class_light_sensor.html#<API key>">LightSensor::LightSensor</a></div><div class="ttdeci">LightSensor(const VirtualShield &shield)</div><div class="ttdoc">Initializes a new instance of the LightSensor class. </div><div class="ttdef"><b>Definition:</b> LightSensor.cpp:36</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="class_light_sensor.html">LightSensor</a></div><div class="ttdef"><b>Definition:</b> LightSensor.h:34</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="class_light_sensor.html#<API key>">LightSensor::onJsonReceived</a></div><div class="ttdeci">void onJsonReceived(JsonObject &root, ShieldEvent *shieldEvent) override</div><div class="ttdoc">Event called when a valid json message was received. Consumes the proper values for this sensor...</div><div class="ttdef"><b>Definition:</b> LightSensor.cpp:45</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="class_light_sensor.html#<API key>">LightSensor::Lux</a></div><div class="ttdeci">double Lux</div><div class="ttdef"><b>Definition:</b> LightSensor.h:36</div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="_shield_event_8h.html">ShieldEvent.h</a></div></div>
<div class="ttc" id="<API key>"><div class="ttname"><a href="struct_shield_event.html">ShieldEvent</a></div><div class="ttdef"><b>Definition:</b> ShieldEvent.h:35</div></div>
<div class="ttc" id="_sensor_8h_html"><div class="ttname"><a href="_sensor_8h.html">Sensor.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Apr 29 2015 17:37:05 for Windows Virtual Shields for Arduino by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html> |
/**
@file include/mysql.h
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
The ABI should never be changed in a released product of MySQL,
thus you need to take great care when changing the file. In case
the file is changed so the ABI is broken, you must also update
the <API key> in cmake/mysql_version.cmake
*/
#ifndef _mysql_h
#define _mysql_h
#ifndef MYSQL_ABI_CHECK
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#endif
// Legacy definition for the benefit of old code. Use uint64_t in new code.
// If you get warnings from printf, use the PRIu64 macro, or, if you need
// compatibility with older versions of the client library, cast
// before printing.
typedef uint64_t my_ulonglong;
#ifndef my_socket_defined
#define my_socket_defined
#ifdef _WIN32
#include <windows.h>
#ifdef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#endif
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* _WIN32 */
#endif /* my_socket_defined */
// Small extra definition to avoid pulling in my_compiler.h in client code.
// IWYU pragma: no_include "my_compiler.h"
#ifndef <API key>
#if !defined(_WIN32)
#define STDCALL
#else
#define STDCALL __stdcall
#endif
#endif /* <API key> */
#include "field_types.h"
#include "my_list.h"
#include "mysql_com.h"
/* Include declarations of plug-in API */
#include "mysql/client_plugin.h" // IWYU pragma: keep
/*
The client should be able to know which version it is compiled against,
even if mysql.h doesn't use this information directly.
*/
#include "mysql_version.h" // IWYU pragma: keep
// MYSQL_TIME is part of our public API.
#include "mysql_time.h" // IWYU pragma: keep
// The error messages are part of our public API.
#include "errmsg.h" // IWYU pragma: keep
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int mysql_port;
extern char *mysql_unix_port;
#define <API key> 1 /* Retry count */
#define <API key> 365 * 24 * 3600 /* Timeout on read */
#define <API key> 365 * 24 * 3600 /* Timeout on write */
#define IS_PRI_KEY(n) ((n)&PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n)&NOT_NULL_FLAG)
#define IS_BLOB(n) ((n)&BLOB_FLAG)
/**
Returns true if the value is a number which does not need quotes for
the sql_lex.cc parser to parse correctly.
*/
#define IS_NUM(t) \
(((t) <= MYSQL_TYPE_INT24 && (t) != <API key>) || \
(t) == MYSQL_TYPE_YEAR || (t) == <API key>)
#define IS_LONGDATA(t) ((t) >= <API key> && (t) <= MYSQL_TYPE_STRING)
typedef struct MYSQL_FIELD {
char *name; /* Name of column */
char *org_name; /* Original column name, if an alias */
char *table; /* Table of column if column was a field */
char *org_table; /* Org table name, if table was an alias */
char *db; /* Database for table */
char *catalog; /* Catalog for table */
char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column (create length) */
unsigned long max_length; /* Max width for selected set */
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* Character set */
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
void *extension;
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#define MYSQL_COUNT_ERROR (~(uint64_t)0)
/* backward compatibility define - to be removed eventually */
#define <API key> WARN_DATA_TRUNCATED
typedef struct MYSQL_ROWS {
struct MYSQL_ROWS *next; /* list of rows */
MYSQL_ROW data;
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
struct MEM_ROOT;
typedef struct MYSQL_DATA {
MYSQL_ROWS *data;
struct MEM_ROOT *alloc;
uint64_t rows;
unsigned int fields;
} MYSQL_DATA;
enum mysql_option {
<API key>,
MYSQL_OPT_COMPRESS,
<API key>,
MYSQL_INIT_COMMAND,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
MYSQL_OPT_PROTOCOL,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
MYSQL_OPT_RECONNECT,
MYSQL_PLUGIN_DIR,
MYSQL_DEFAULT_AUTH,
MYSQL_OPT_BIND,
MYSQL_OPT_SSL_KEY,
MYSQL_OPT_SSL_CERT,
MYSQL_OPT_SSL_CA,
<API key>,
<API key>,
MYSQL_OPT_SSL_CRL,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
MYSQL_OPT_SSL_MODE,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
};
/**
@todo remove the "extension", move st_mysql_options completely
out of mysql.h
*/
struct <API key>;
struct st_mysql_options {
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
unsigned long client_flag;
char *host, *user, *password, *unix_socket, *db;
struct Init_commands_array *init_commands;
char *my_cnf_file, *my_cnf_group, *charset_dir, *charset_name;
char *ssl_key; /* PEM key file */
char *ssl_cert; /* PEM cert file */
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
char *<API key>;
unsigned long max_allowed_packet;
bool compress, named_pipe;
/**
The local address to bind when connecting to remote server.
*/
char *bind_address;
/* 0 - never report, 1 - always report (default) */
bool <API key>;
/* function pointers for local infile support */
int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *<API key>;
struct <API key> *extension;
};
enum mysql_status {
MYSQL_STATUS_READY,
<API key>,
<API key>,
<API key>
};
enum mysql_protocol_type {
<API key>,
MYSQL_PROTOCOL_TCP,
<API key>,
MYSQL_PROTOCOL_PIPE,
<API key>
};
enum mysql_ssl_mode {
SSL_MODE_DISABLED = 1,
SSL_MODE_PREFERRED,
SSL_MODE_REQUIRED,
SSL_MODE_VERIFY_CA,
<API key>
};
enum mysql_ssl_fips_mode {
SSL_FIPS_MODE_OFF = 0,
SSL_FIPS_MODE_ON = 1,
<API key>
};
typedef struct character_set {
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* collation name */
const char *name; /* character set name */
const char *comment; /* comment */
const char *dir; /* character set directory */
unsigned int mbminlen; /* min. length for multibyte strings */
unsigned int mbmaxlen; /* max. length for multibyte strings */
} MY_CHARSET_INFO;
struct MYSQL_METHODS;
struct MYSQL_STMT;
typedef struct MYSQL {
NET net; /* Communication parameters */
unsigned char *connector_fd; /* ConnectorFd for SSL */
char *host, *user, *passwd, *unix_socket, *server_version, *host_info;
char *info, *db;
struct CHARSET_INFO *charset;
MYSQL_FIELD *fields;
struct MEM_ROOT *field_alloc;
uint64_t affected_rows;
uint64_t insert_id; /* id if insert on table with NEXTNR */
uint64_t extra_info; /* Not used */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
unsigned long client_flag, server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count;
struct st_mysql_options options;
enum mysql_status status;
enum <API key> resultset_metadata;
bool free_me; /* If free in mysql_close */
bool reconnect; /* set to 1 if automatic reconnect */
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH + 1];
LIST *stmts; /* list of all statements */
const struct MYSQL_METHODS *methods;
void *thd;
/*
Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
from mysql_stmt_close if close had to cancel result set of this object.
*/
bool *<API key>;
void *extension;
} MYSQL;
typedef struct MYSQL_RES {
uint64_t row_count;
MYSQL_FIELD *fields;
struct MYSQL_DATA *data;
MYSQL_ROWS *data_cursor;
unsigned long *lengths; /* column lengths of current row */
MYSQL *handle; /* for unbuffered reads */
const struct MYSQL_METHODS *methods;
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
struct MEM_ROOT *field_alloc;
unsigned int field_count, current_field;
bool eof; /* Used by mysql_fetch_row */
/* mysql_stmt_close() had to cancel this result */
bool <API key>;
enum <API key> metadata;
void *extension;
} MYSQL_RES;
/**
Flag to indicate that <API key> should
be used rather than COM_BINLOG_DUMP in the @sa mysql_binlog_open().
*/
#define MYSQL_RPL_GTID (1 << 16)
/**
Skip HEARBEAT events in the @sa mysql_binlog_fetch().
*/
#define <API key> (1 << 17)
/**
Struct for information about a replication stream.
@sa mysql_binlog_open()
@sa mysql_binlog_fetch()
@sa mysql_binlog_close()
*/
typedef struct MYSQL_RPL {
size_t file_name_length; /** Length of the 'file_name' or 0 */
const char *file_name; /** Filename of the binary log to read */
uint64_t start_position; /** Position in the binary log to */
/* start reading from */
unsigned int server_id; /** Server ID to use when identifying */
/* with the master */
unsigned int flags; /** Flags, e.g. MYSQL_RPL_GTID */
/** Size of gtid set data */
size_t <API key>;
/** Callback function which is called */
/* from @sa mysql_binlog_open() to */
/* fill command packet gtid set */
void (*fix_gtid_set)(struct MYSQL_RPL *rpl, unsigned char *packet_gtid_set);
void *gtid_set_arg; /** GTID set data or an argument for */
/* fix_gtid_set() callback function */
unsigned long size; /** Size of the packet returned by */
/* mysql_binlog_fetch() */
const unsigned char *buffer; /** Pointer to returned data */
} MYSQL_RPL;
/*
Set up and bring down the server; to ensure that applications will
work when linked against either the standard client library or the
embedded server library, these functions should be called.
*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
/*
mysql_server_init/end need to be called when using libmysqld or
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
you don't need to call it explicitely; but you need to call
mysql_server_end() to free memory). The names are a bit misleading
(mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
names which suit well whether you're using libmysqld or libmysqlclient. We
intend to promote these aliases over the mysql_server* ones.
*/
#define mysql_library_init mysql_server_init
#define mysql_library_end mysql_server_end
/*
Set up and bring down a thread; these function should be called
for each thread in an application which opens at least one MySQL
connection. All uses of the connection(s) should be between these
function calls.
*/
bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
/*
Functions to get information from the MYSQL and MYSQL_RES structures
Should definitely be used if one uses shared libraries.
*/
uint64_t STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD *STDCALL <API key>(MYSQL_RES *res,
unsigned int fieldnr);
MYSQL_FIELD *STDCALL mysql_fetch_fields(MYSQL_RES *res);
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
enum <API key> STDCALL <API key>(MYSQL_RES *result);
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
uint64_t STDCALL mysql_affected_rows(MYSQL *mysql);
uint64_t STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char *STDCALL mysql_error(MYSQL *mysql);
const char *STDCALL mysql_sqlstate(MYSQL *mysql);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char *STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char *STDCALL <API key>(MYSQL *mysql);
int STDCALL <API key>(MYSQL *mysql, const char *csname);
MYSQL *STDCALL mysql_init(MYSQL *mysql);
bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
const char *ca, const char *capath,
const char *cipher);
const char *STDCALL <API key>(MYSQL *mysql);
bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL *STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd,
const char *db, unsigned int port,
const char *unix_socket,
unsigned long clientflag);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length);
MYSQL_RES *STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_use_result(MYSQL *mysql);
enum net_async_status STDCALL <API key>(
MYSQL *mysql, const char *host, const char *user, const char *passwd,
const char *db, unsigned int port, const char *unix_socket,
unsigned long clientflag);
enum net_async_status STDCALL <API key>(
MYSQL *mysql, const char *query, unsigned long length);
enum net_async_status STDCALL <API key>(
MYSQL *mysql, const char *query, unsigned long length);
enum net_async_status STDCALL
<API key>(MYSQL *mysql, MYSQL_RES **result);
enum net_async_status STDCALL <API key>(MYSQL *mysql);
enum net_async_status STDCALL <API key>(MYSQL *mysql,
const char *db,
bool *error);
void STDCALL <API key>(MYSQL *mysql,
MY_CHARSET_INFO *charset);
int STDCALL <API key>(MYSQL *mysql,
enum <API key> type,
const char **data, size_t *length);
int STDCALL <API key>(MYSQL *mysql,
enum <API key> type,
const char **data, size_t *length);
/* local infile support */
#define <API key> 512
void <API key>(
MYSQL *mysql, int (*local_infile_init)(void **, const char *, void *),
int (*local_infile_read)(void *, char *, unsigned int),
void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char *, unsigned int), void *);
void <API key>(MYSQL *mysql);
int STDCALL mysql_shutdown(MYSQL *mysql,
enum <API key> shutdown_level);
int STDCALL <API key>(MYSQL *mysql);
int STDCALL mysql_refresh(MYSQL *mysql, unsigned int refresh_options);
int STDCALL mysql_kill(MYSQL *mysql, unsigned long pid);
int STDCALL <API key>(MYSQL *mysql,
enum <API key> option);
int STDCALL mysql_ping(MYSQL *mysql);
const char *STDCALL mysql_stat(MYSQL *mysql);
const char *STDCALL <API key>(MYSQL *mysql);
const char *STDCALL <API key>(void);
unsigned long STDCALL <API key>(void);
const char *STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned long STDCALL <API key>(MYSQL *mysql);
unsigned int STDCALL <API key>(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_list_dbs(MYSQL *mysql, const char *wild);
MYSQL_RES *STDCALL mysql_list_tables(MYSQL *mysql, const char *wild);
MYSQL_RES *STDCALL <API key>(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
const void *arg);
int STDCALL mysql_options4(MYSQL *mysql, enum mysql_option option,
const void *arg1, const void *arg2);
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option,
const void *arg);
void STDCALL mysql_free_result(MYSQL_RES *result);
enum net_async_status STDCALL <API key>(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result, uint64_t offset);
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
MYSQL_ROW_OFFSET offset);
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
enum net_async_status STDCALL <API key>(MYSQL_RES *res,
MYSQL_ROW *row);
unsigned long *STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD *STDCALL mysql_fetch_field(MYSQL_RES *result);
MYSQL_RES *STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
unsigned long STDCALL mysql_escape_string(char *to, const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_hex_string(char *to, const char *from,
unsigned long from_length);
unsigned long STDCALL <API key>(MYSQL *mysql, char *to,
const char *from,
unsigned long length);
unsigned long STDCALL <API key>(MYSQL *mysql, char *to,
const char *from,
unsigned long length,
char quote);
void STDCALL mysql_debug(const char *debug);
void STDCALL <API key>(MYSQL *mysql, char *name);
unsigned int STDCALL mysql_thread_safe(void);
bool STDCALL <API key>(MYSQL *mysql);
int STDCALL <API key>(MYSQL *mysql);
int STDCALL mysql_binlog_open(MYSQL *mysql, MYSQL_RPL *rpl);
int STDCALL mysql_binlog_fetch(MYSQL *mysql, MYSQL_RPL *rpl);
void STDCALL mysql_binlog_close(MYSQL *mysql, MYSQL_RPL *rpl);
/*
The following definitions are added for the enhanced
client-server protocol
*/
/* statement state */
enum <API key> {
<API key> = 1,
<API key>,
<API key>,
<API key>
};
/*
This structure is used to define bind information, and
internally by the client library.
Public members with their descriptions are listed below
(conventionally `On input' refers to the binds given to
<API key>, `On output' refers to the binds given
to <API key>):
buffer_type - One of the MYSQL_* types, used to describe
the host language type of buffer.
On output: if column type is different from
buffer_type, column value is automatically converted
to buffer_type before it is stored in the buffer.
buffer - On input: points to the buffer with input data.
On output: points to the buffer capable to store
output data.
The type of memory pointed by buffer must correspond
to buffer_type. See the correspondence table in
the comment to <API key>.
The two above members are mandatory for any kind of bind.
buffer_length - the length of the buffer. You don't have to set
it for any fixed length buffer: float, double,
int, etc. It must be set however for variable-length
types, such as BLOBs or STRINGs.
length - On input: in case when lengths of input values
are different for each execute, you can set this to
point at a variable containining value length. This
way the value length can be different in each execute.
If length is not NULL, buffer_length is not used.
Note, length can even point at buffer_length if
you keep bind structures around while fetching:
this way you can change buffer_length before
each execution, everything will work ok.
On output: if length is set, mysql_stmt_fetch will
write column length into it.
is_null - On input: points to a boolean variable that should
be set to TRUE for NULL values.
This member is useful only if your data may be
NULL in some but not all cases.
If your data is never NULL, is_null should be set to 0.
If your data is always NULL, set buffer_type
to MYSQL_TYPE_NULL, and is_null will not be used.
is_unsigned - On input: used to signify that values provided for one
of numeric types are unsigned.
On output describes signedness of the output buffer.
If, taking into account is_unsigned flag, column data
is out of range of the output buffer, data for this column
is regarded truncated. Note that this has no correspondence
to the sign of result set column, if you need to find it out
use <API key>.
error - where to write a truncation error if it is present.
possible error value is:
0 no truncation
1 value is out of range or buffer is too small
Please note that MYSQL_BIND also has internals members.
*/
typedef struct MYSQL_BIND {
unsigned long *length; /* output length pointer */
bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
/* set this if you want to track data truncations happened during fetch */
bool *error;
unsigned char *row_ptr; /* for the current data position */
void (*store_param_func)(NET *net, struct MYSQL_BIND *param);
void (*fetch_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
void (*skip_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
/* output buffer length, must be set when fetching str/binary */
unsigned long buffer_length;
unsigned long offset; /* offset position for char/binary fetch */
unsigned long length_value; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
unsigned int pack_length; /* Internal length for packed data */
enum enum_field_types buffer_type; /* buffer type */
bool error_value; /* used if error is 0 */
bool is_unsigned; /* set if integer type is unsigned */
bool long_data_used; /* If used with <API key> */
bool is_null_value; /* Used if is_null is 0 */
void *extension;
} MYSQL_BIND;
struct MYSQL_STMT_EXT;
/* statement handler */
typedef struct MYSQL_STMT {
struct MEM_ROOT *mem_root; /* root allocations */
LIST list; /* list to keep track of all stmts */
MYSQL *mysql; /* connection handle */
MYSQL_BIND *params; /* input parameters */
MYSQL_BIND *bind; /* output parameters */
MYSQL_FIELD *fields; /* result set metadata */
MYSQL_DATA result; /* cached result set */
MYSQL_ROWS *data_cursor; /* current row in cached result */
/*
mysql_stmt_fetch() calls this function to fetch one row (it's different
for buffered, unbuffered and cursor fetch).
*/
int (*read_row_func)(struct MYSQL_STMT *stmt, unsigned char **row);
/* copy of mysql->affected_rows after statement execution */
uint64_t affected_rows;
uint64_t insert_id; /* copy of mysql->insert_id */
unsigned long stmt_id; /* Id for prepared statement */
unsigned long flags; /* i.e. type of cursor to open */
unsigned long prefetch_rows; /* number of rows per one COM_FETCH */
/*
Copied from mysql->server_status after execute/fetch to know
server-side cursor status for this statement.
*/
unsigned int server_status;
unsigned int last_errno; /* error code */
unsigned int param_count; /* input parameter count */
unsigned int field_count; /* number of columns in result set */
enum <API key> state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
char sqlstate[SQLSTATE_LENGTH + 1];
/* Types of input parameters should be sent to server */
bool <API key>;
bool bind_param_done; /* input buffers were supplied */
unsigned char bind_result_done; /* output buffers were supplied */
/* mysql_stmt_close() had to cancel this result */
bool <API key>;
/*
Is set to true if we need to calculate field->max_length for
metadata fields when doing <API key>.
*/
bool update_max_length;
struct MYSQL_STMT_EXT *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type {
/*
When doing <API key> calculate max_length attribute
of statement metadata. This is to be consistent with the old API,
where this was done automatically.
In the new API we do that only by request because it slows down
<API key> sufficiently.
*/
<API key>,
/*
unsigned long with combination of cursor flags (read only, for update,
etc)
*/
<API key>,
/*
Amount of rows to retrieve from server per one fetch if using cursors.
Accepts unsigned long attribute in the range 1 - ulong_max
*/
<API key>
};
bool STDCALL mysql_bind_param(MYSQL *mysql, unsigned n_params,
MYSQL_BIND *binds, const char **names);
MYSQL_STMT *STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL <API key>(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
unsigned int column, unsigned long offset);
int STDCALL <API key>(MYSQL_STMT *stmt);
unsigned long STDCALL <API key>(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
const void *attr);
bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
void *attr);
bool STDCALL <API key>(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
bool STDCALL <API key>(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt);
bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt);
bool STDCALL <API key>(MYSQL_STMT *stmt);
bool STDCALL <API key>(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data, unsigned long length);
MYSQL_RES *STDCALL <API key>(MYSQL_STMT *stmt);
MYSQL_RES *STDCALL <API key>(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT *stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT *stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT *stmt);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
void STDCALL <API key>(MYSQL_STMT *stmt, uint64_t offset);
uint64_t STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
uint64_t STDCALL <API key>(MYSQL_STMT *stmt);
uint64_t STDCALL <API key>(MYSQL_STMT *stmt);
unsigned int STDCALL <API key>(MYSQL_STMT *stmt);
bool STDCALL mysql_commit(MYSQL *mysql);
bool STDCALL mysql_rollback(MYSQL *mysql);
bool STDCALL mysql_autocommit(MYSQL *mysql, bool auto_mode);
bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
int STDCALL <API key>(MYSQL_STMT *stmt);
void STDCALL mysql_close(MYSQL *sock);
/* Public key reset */
void STDCALL <API key>(void);
/* status return codes */
#define MYSQL_NO_DATA 100
#define <API key> 101
#define mysql_reload(mysql) mysql_refresh((mysql), REFRESH_GRANT)
#define <API key>
MYSQL *STDCALL <API key>(MYSQL *mysql,
const char *dns_srv_name,
const char *user, const char *passwd,
const char *db,
unsigned long client_flag);
#ifdef __cplusplus
}
#endif
#endif /* _mysql_h */ |
package com.microsoft.azure.management.appservice.implementation;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Diagnostics for an App Service Environment.
*/
public class <API key> {
/**
* Name/identifier of the diagnostics.
*/
@JsonProperty(value = "name")
private String name;
/**
* Diagnostics output.
*/
@JsonProperty(value = "diagnosicsOutput")
private String diagnosicsOutput;
/**
* Get the name value.
*
* @return the name value
*/
public String name() {
return this.name;
}
/**
* Set the name value.
*
* @param name the name value to set
* @return the <API key> object itself.
*/
public <API key> withName(String name) {
this.name = name;
return this;
}
/**
* Get the diagnosicsOutput value.
*
* @return the diagnosicsOutput value
*/
public String diagnosicsOutput() {
return this.diagnosicsOutput;
}
/**
* Set the diagnosicsOutput value.
*
* @param diagnosicsOutput the diagnosicsOutput value to set
* @return the <API key> object itself.
*/
public <API key> <API key>(String diagnosicsOutput) {
this.diagnosicsOutput = diagnosicsOutput;
return this;
}
} |
var ItemFormatter = Class.create();
ItemFormatter.TMPL = Template.get("inbox_items");
ItemFormatter.extend({
initialize: function(){
this.tmpl = new Template(ItemFormatter.TMPL);
var filters = {
created_on : Filter.created_on,
modified_on : Filter.modified_on,
author : Filter.author,
enclosure : Filter.enclosure,
category : Filter.category
};
this.tmpl.add_filters(filters);
},
compile: function(){
return this.tmpl.compile();
},
reset_count: function(){
this.item_count = 0;
}
}); |
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Collections
{
internal class CodeElementSnapshot : Snapshot
{
private readonly ImmutableArray<EnvDTE.CodeElement> _elements;
public CodeElementSnapshot(ICodeElements codeElements)
{
var count = codeElements.Count;
var elementsBuilder = ArrayBuilder<EnvDTE.CodeElement>.GetInstance(count);
for (var i = 0; i < count; i++)
{
// We use "i + 1" since CodeModel indices are 1-based
if (ErrorHandler.Succeeded(codeElements.Item(i + 1, out var element)))
{
elementsBuilder.Add(element);
}
}
_elements = elementsBuilder.ToImmutableAndFree();
}
public CodeElementSnapshot(ImmutableArray<EnvDTE.CodeElement> elements)
=> _elements = elements;
public override int Count
{
get { return _elements.Length; }
}
public override EnvDTE.CodeElement this[int index]
{
get
{
if (index < 0 || index >= _elements.Length)
{
throw new <API key>(nameof(index));
}
return _elements[index];
}
}
}
} |
#nullable enable
using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class <API key>
{
internal bool <API key>
{
get
{
var leftType = LeftOperand.Type;
if (leftType?.IsNullableType() != true)
{
return false;
}
var nullableUnderlying = leftType.<API key>();
return nullableUnderlying.Equals(RightOperand.Type);
}
}
}
} |
#!/usr/bin/env bash
# Install command-line tools using Homebrew.
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
brew update
# Upgrade any already-installed formulae.
brew upgrade --all
# Install GNU core utilities (those that come with OS X are outdated).
brew install coreutils
sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum
# Install some other useful utilities like `sponge`.
brew install moreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew install findutils
# Install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names
# Install Bash 4.
# running `chsh`.
brew install bash
brew tap homebrew/versions
brew install bash-completion2
# Install `wget` with IRI support.
brew install wget --with-iri
# Install RingoJS and Narwhal.
# Note that the order in which these are installed is important;
brew install ringojs
brew install narwhal
# Install more recent versions of some OS X tools.
brew install vim --override-system-vi
brew install homebrew/dupes/grep
brew install homebrew/dupes/openssh
brew install homebrew/dupes/screen
brew install homebrew/php/php56 --with-gmp
# Install font tools.
brew tap bramstein/webfonttools
brew install sfnt2woff
brew install sfnt2woff-zopfli
brew install woff2
brew install aircrack-ng
brew install bfg
brew install binutils
brew install binwalk
brew install cifer
brew install dex2jar
brew install dns2tcp
brew install fcrackzip
brew install foremost
brew install hashpump
brew install hydra
brew install john
brew install knock
brew install netpbm
brew install nmap
brew install pngcheck
brew install socat
brew install sqlmap
brew install tcpflow
brew install tcpreplay
brew install tcptrace
brew install ucspi-tcp # `tcpserver` etc.
brew install xpdf
brew install xz
# Install other useful binaries.
brew install ack
brew install dark-mode
#brew install exiv2
brew install git
brew install git-lfs
brew install imagemagick --with-webp
brew install lua
brew install lynx
brew install p7zip
brew install pigz
brew install pv
brew install rename
brew install rhino
brew install speedtest_cli
brew install ssh-copy-id
brew install testssl
brew install tree
brew install webkit2png
brew install zopfli
# Remove outdated versions from the cellar.
brew cleanup |
module.exports = create
/**
* Creates a new, empty vec4
*
* @returns {vec4} a new 4D vector
*/
function create () {
var out = new Float32Array(4)
out[0] = 0
out[1] = 0
out[2] = 0
out[3] = 0
return out
} |
<section class="row" ng-controller="<API key>">
<div class="col-xs-offset-1 col-xs-10 col-md-offset-3 col-md-4">
<form class="signin form-horizontal">
<fieldset>
<div class="form-group text-center">
<img ng-src="{{imageURL}}" alt="{{user.displayName}}" class="img-thumbnail <API key>">
</div>
<div class="text-center form-group" ng-hide="uploader.queue.length">
<span class="btn btn-default btn-file">
Select Image <input type="file" nv-file-select uploader="uploader">
</span>
</div>
<div class="text-center form-group" ng-show="uploader.queue.length">
<button class="btn btn-primary" ng-click="<API key>();">Upload</button>
<button class="btn btn-default" ng-click="cancelUpload();">Cancel</button>
</div>
<div ng-show="success" class="text-center text-success">
<strong>Profile Picture Changed Successfully</strong>
</div>
<div ng-show="error" class="text-center text-danger">
<strong ng-bind="error"></strong>
</div>
</fieldset>
</form>
</div>
</section> |
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class <API key> < Gateway
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v28'
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v28'
TRANSACTIONS = {
sale: '00',
authorization: '01',
verify: '05',
capture: '32',
void: '33',
credit: '34',
store: '05'
}
SUCCESS = 'true'
SENSITIVE_FIELDS = [:cvdcode, :expiry_date, :card_number]
BRANDS = {
:visa => 'Visa',
:master => 'Mastercard',
:american_express => 'American Express',
:jcb => 'JCB',
:discover => 'Discover'
}
DEFAULT_ECI = '07'
self.supported_cardtypes = BRANDS.keys
self.supported_countries = ['CA', 'US']
self.default_currency = 'USD'
self.homepage_url = 'http:
self.display_name = 'FirstData Global Gateway e4 v27'
<API key> = {
'201' => STANDARD_ERROR_CODE[:incorrect_number],
'531' => STANDARD_ERROR_CODE[:invalid_cvc],
'503' => STANDARD_ERROR_CODE[:invalid_cvc],
'811' => STANDARD_ERROR_CODE[:invalid_cvc],
'605' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'522' => STANDARD_ERROR_CODE[:expired_card],
'303' => STANDARD_ERROR_CODE[:card_declined],
'530' => STANDARD_ERROR_CODE[:card_declined],
'401' => STANDARD_ERROR_CODE[:call_issuer],
'402' => STANDARD_ERROR_CODE[:call_issuer],
'501' => STANDARD_ERROR_CODE[:pickup_card],
'22' => STANDARD_ERROR_CODE[:invalid_number],
'25' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'31' => STANDARD_ERROR_CODE[:incorrect_cvc],
'44' => STANDARD_ERROR_CODE[:incorrect_zip],
'42' => STANDARD_ERROR_CODE[:processing_error]
}
def initialize(options = {})
requires!(options, :login, :password, :key_id, :hmac_key)
@options = options
super
end
def authorize(money, <API key>, options = {})
commit(:authorization, build_sale_or_<API key>(money, <API key>, options))
end
def purchase(money, <API key>, options = {})
commit(:sale, build_sale_or_<API key>(money, <API key>, options))
end
def capture(money, authorization, options = {})
commit(:capture, <API key>(money, authorization, options))
end
def void(authorization, options = {})
commit(:void, <API key>(<API key>(authorization), authorization, options))
end
def refund(money, authorization, options = {})
commit(:credit, <API key>(money, authorization, options))
end
def verify(credit_card, options = {})
commit(:verify, build_sale_or_<API key>(0, credit_card, options))
end
# Tokenize a credit card with TransArmor
# The TransArmor token and other card data necessary for subsequent
# transactions is stored in the response's +authorization+ attribute.
# The authorization string may be passed to +authorize+ and +purchase+
# instead of a +ActiveMerchant::Billing::CreditCard+ instance.
# TransArmor support must be explicitly activated on your gateway
# account by FirstData. If your authorization string is empty, contact
# FirstData support for account setup assistance.
def store(credit_card, options = {})
commit(:store, build_store_request(credit_card, options), credit_card)
end
def verify_credentials
response = void('0')
response.message != 'Unauthorized Request. Bad or missing credentials.'
end
def supports_scrubbing?
true
end
def scrub(transcript)
transcript.
gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
gsub(%r((<CVDCode>).+(</CVDCode>)), '\1[FILTERED]\2').
gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
gsub(%r((CARD NUMBER\s+: )#+\d+), '\1[FILTERED]')
end
def <API key>?
true
end
private
def build_request(action, body)
xml = Builder::XmlMarkup.new
xml.instruct!
xml.tag! 'Transaction', xmlns: 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes' do
add_credentials(xml)
<API key>(xml, action)
xml << body
end
xml.target!
end
def build_sale_or_<API key>(money, <API key>, options)
xml = Builder::XmlMarkup.new
add_amount(xml, money, options)
if <API key>.is_a? String
<API key>(xml, <API key>, options)
else
add_credit_card(xml, <API key>, options)
<API key>(xml, <API key>, options)
end
add_address(xml, options)
add_customer_data(xml, options)
add_invoice(xml, options)
add_tax_fields(xml, options)
add_level_3(xml, options)
xml.target!
end
def <API key>(money, identification, options)
xml = Builder::XmlMarkup.new
add_identification(xml, identification)
add_amount(xml, money, options)
add_customer_data(xml, options)
<API key>(xml, options)
xml.target!
end
def build_store_request(credit_card, options)
xml = Builder::XmlMarkup.new
add_credit_card(xml, credit_card, options)
add_address(xml, options)
add_customer_data(xml, options)
xml.target!
end
def add_credentials(xml)
xml.tag! 'ExactID', @options[:login]
xml.tag! 'Password', @options[:password]
end
def <API key>(xml, action)
xml.tag! 'Transaction_Type', TRANSACTIONS[action]
end
def add_identification(xml, identification)
authorization_num, transaction_tag, _ = identification.split(';')
xml.tag! 'Authorization_Num', authorization_num
xml.tag! 'Transaction_Tag', transaction_tag
end
def add_amount(xml, money, options)
currency_code = options[:currency] || default_currency
xml.tag! 'DollarAmount', localized_amount(money, currency_code)
xml.tag! 'Currency', currency_code
end
def add_credit_card(xml, credit_card, options)
if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
xml.tag! 'Track1', credit_card.track_data
xml.tag! 'Ecommerce_Flag', 'R'
else
xml.tag! 'Card_Number', credit_card.number
xml.tag! 'Expiry_Date', expdate(credit_card)
xml.tag! 'CardHoldersName', credit_card.name
xml.tag! 'CardType', card_type(credit_card.brand)
xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
add_credit_card_eci(xml, credit_card, options)
<API key>(xml, credit_card, options)
end
end
def add_credit_card_eci(xml, credit_card, options)
eci = if credit_card.is_a?(Network<API key>) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
# Discover requires any Apple Pay transaction, regardless of in-app
# or web, and regardless of the ECI contained in the PKPaymentToken,
# to have an ECI value explicitly of 04.
'04'
else
(credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
end
xml.tag! 'Ecommerce_Flag', eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
end
def <API key>(xml, credit_card, options)
if credit_card.is_a?(Network<API key>)
add_network_<API key>(xml, credit_card)
else
if credit_card.verification_value?
xml.tag! 'CVD_Presence_Ind', '1'
xml.tag! 'CVDCode', credit_card.verification_value
end
<API key>(xml, options)
end
end
def add_network_<API key>(xml, credit_card)
case card_brand(credit_card).to_sym
when :american_express
cryptogram = Base64.decode64(credit_card.payment_cryptogram)
xml.tag!('XID', Base64.encode64(cryptogram[20...40]))
xml.tag!('CAVV', Base64.encode64(cryptogram[0...20]))
else
xml.tag!('XID', credit_card.transaction_id) if credit_card.transaction_id
xml.tag!('CAVV', credit_card.payment_cryptogram)
end
end
def <API key>(xml, options)
xml.tag! 'CAVV', options[:cavv]
xml.tag! 'XID', options[:xid]
end
def <API key>(xml, store_authorization, options)
params = store_authorization.split(';')
credit_card = CreditCard.new(
:brand => params[1],
:first_name => params[2],
:last_name => params[3],
:month => params[4],
:year => params[5])
xml.tag! 'TransarmorToken', params[0]
xml.tag! 'Expiry_Date', expdate(credit_card)
xml.tag! 'CardHoldersName', credit_card.name
xml.tag! 'CardType', card_type(credit_card.brand)
xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
<API key>(xml, options)
end
def add_customer_data(xml, options)
xml.tag! 'Customer_Ref', options[:customer] if options[:customer]
xml.tag! 'Client_IP', options[:ip] if options[:ip]
xml.tag! 'Client_Email', options[:email] if options[:email]
end
def add_address(xml, options)
if (address = options[:billing_address] || options[:address])
xml.tag! 'Address' do
xml.tag! 'Address1', address[:address1]
xml.tag! 'Address2', address[:address2] if address[:address2]
xml.tag! 'City', address[:city]
xml.tag! 'State', address[:state]
xml.tag! 'Zip', address[:zip]
xml.tag! 'CountryCode', address[:country]
end
xml.tag! 'ZipCode', address[:zip]
end
end
def add_invoice(xml, options)
xml.tag! 'Reference_No', options[:order_id]
xml.tag! 'Reference_3', options[:description] if options[:description]
end
def add_tax_fields(xml, options)
xml.tag! 'Tax1Amount', options[:tax1_amount] if options[:tax1_amount]
xml.tag! 'Tax1Number', options[:tax1_number] if options[:tax1_number]
end
def add_level_3(xml, options)
xml.tag!('Level3') { |x| x << options[:level_3] } if options[:level_3]
end
def <API key>(xml, card, options)
return unless options[:stored_credential]
xml.tag! 'StoredCredentials' do
xml.tag! 'Indicator', <API key>(xml, card, options)
if initiator = options.dig(:stored_credential, :initiator)
xml.tag! initiator == 'merchant' ? 'M' : 'C'
end
if reason_type = options.dig(:stored_credential, :reason_type)
xml.tag! 'Schedule', reason_type == 'unscheduled' ? 'U' : 'S'
end
xml.tag! '<API key>, options[:<API key>] if options[:<API key>]
if <API key> = options[:stored_credential][:<API key>]
xml.tag! 'TransactionId', <API key>
else
xml.tag! 'TransactionId', 'new'
end
xml.tag! 'OriginalAmount', options[:original_amount] if options[:original_amount]
xml.tag! 'ProtectbuyIndicator', options[:<API key>] if options[:<API key>]
end
end
def <API key>(xml, card, options)
if card.brand == 'master' || options.dig(:stored_credential, :initial_transaction) == false
'S'
else
'1'
end
end
def expdate(credit_card)
"#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
end
def card_type(credit_card_brand)
BRANDS[credit_card_brand.to_sym] if credit_card_brand
end
def commit(action, data, credit_card = nil)
url = (test? ? self.test_url : self.live_url)
request = build_request(action, data)
begin
response = parse(ssl_post(url, request, headers('POST', url, request)))
rescue ResponseError => e
response = parse_error(e.response)
end
Response.new(successful?(response), message_from(response), response,
:test => test?,
:authorization => successful?(response) ? <API key>(action, response, credit_card) : '',
:avs_result => {:code => response[:avs]},
:cvv_result => response[:cvv2],
:error_code => standard_error_code(response)
)
end
def headers(method, url, request)
content_type = 'application/xml'
content_digest = Digest::SHA1.hexdigest(request)
sending_time = Time.now.utc.iso8601
payload = [method, content_type, content_digest, sending_time, url.split('.com')[1]].join("\n")
hmac = OpenSSL::HMAC.digest('sha1', @options[:hmac_key], payload)
encoded = Base64.strict_encode64(hmac)
{
'x-gge4-date' => sending_time,
'x-gge4-content-sha1' => content_digest,
'Authorization' => 'GGE4_API ' + @options[:key_id].to_s + ':' + encoded,
'Accepts' => content_type,
'Content-Type' => content_type
}
end
def successful?(response)
response[:<API key>] == SUCCESS
end
def <API key>(action, response, credit_card)
if action == :store
<API key>(response, credit_card)
else
authorization_from(response)
end
end
def authorization_from(response)
if response[:authorization_num] && response[:transaction_tag]
[
response[:authorization_num],
response[:transaction_tag],
(response[:dollar_amount].to_f * 100).round
].join(';')
else
''
end
end
def <API key>(response, credit_card)
if response[:transarmor_token].present?
[
response[:transarmor_token],
credit_card.brand,
credit_card.first_name,
credit_card.last_name,
credit_card.month,
credit_card.year
].map { |value| value.to_s.tr(';', '') }.join(';')
else
raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
end
end
def <API key>(auth)
_, _, amount = auth.split(/;/, 3)
amount.to_i
end
def message_from(response)
if response[:faultcode] && response[:faultstring]
response[:faultstring]
elsif response[:error_number] && response[:error_number] != '0'
response[:error_description]
else
result = (response[:exact_message] || '')
result << " - #{response[:bank_message]}" if response[:bank_message].present?
result
end
end
def parse_error(error)
{
:<API key> => 'false',
:error_number => error.code,
:error_description => error.body,
:<API key> => error.body.gsub(/[^\d]/, '')
}
end
def standard_error_code(response)
<API key>[response[:bank_resp_code] || response[:<API key>]]
end
def parse(xml)
response = {}
xml = REXML::Document.new(xml)
if (root = REXML::XPath.first(xml, '//TransactionResult'))
parse_elements(response, root)
end
SENSITIVE_FIELDS.each { |key| response.delete(key) }
response
end
def parse_elements(response, root)
root.elements.to_a.each do |node|
if node.has_elements?
parse_elements(response, node)
else
response[name_node(root, node)] = (node.text || '').strip
end
end
end
def name_node(root, node)
parent = root.name unless root.name == 'TransactionResult'
"#{parent}#{node.name}".gsub(/EXact/, 'Exact').underscore.to_sym
end
end
end
end |
foo{foo:"ABCD"} |
<?php
namespace <API key>\Entities;
use League\OAuth2\Server\Entities\<API key>;
use League\OAuth2\Server\Entities\Traits\AuthCodeTrait;
use League\OAuth2\Server\Entities\Traits\EntityTrait;
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
class AuthCodeEntity implements <API key>
{
use EntityTrait, TokenEntityTrait, AuthCodeTrait;
} |
// 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,
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
// in all copies or substantial portions of the Software.
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// 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.
if (!process.versions.openssl) {
console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
var assert = require('assert');
var fs = require('fs');
var net = require('net');
var tls = require('tls');
var common = require('../common');
var ended = 0;
var server = tls.createServer({
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
}, function(c) {
// Send close-notify without shutting down TCP socket
if (c.ssl.shutdown() !== 1)
c.ssl.shutdown();
}).listen(common.PORT, function() {
var c = tls.connect(common.PORT, {
rejectUnauthorized: false
}, function() {
// Ensure that we receive 'end' event anyway
c.on('end', function() {
ended++;
c.destroy();
server.close();
});
});
});
process.on('exit', function() {
assert.equal(ended, 1);
}); |
export default /* glsl */`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
vec4 texColor = texture2D( tEquirect, sampleUV );
gl_FragColor = mapTexelToLinear( texColor );
#include <<API key>>
#include <encodings_fragment>
}
`; |
// Use of this source code is governed by a BSD-style
// This file contains tests for Eval.
package types_test
import (
"go/ast"
"go/parser"
"go/token"
"strings"
"testing"
_ "golang.org/x/tools/go/gcimporter"
. "golang.org/x/tools/go/types"
)
func testEval(t *testing.T, pkg *Package, scope *Scope, str string, typ Type, typStr, valStr string) {
gotTv, err := Eval(str, pkg, scope)
if err != nil {
t.Errorf("Eval(%q) failed: %s", str, err)
return
}
if gotTv.Type == nil {
t.Errorf("Eval(%q) got nil type but no error", str)
return
}
// compare types
if typ != nil {
// we have a type, check identity
if !Identical(gotTv.Type, typ) {
t.Errorf("Eval(%q) got type %s, want %s", str, gotTv.Type, typ)
return
}
} else {
// we have a string, compare type string
gotStr := gotTv.Type.String()
if gotStr != typStr {
t.Errorf("Eval(%q) got type %s, want %s", str, gotStr, typStr)
return
}
}
// compare values
gotStr := ""
if gotTv.Value != nil {
gotStr = gotTv.Value.String()
}
if gotStr != valStr {
t.Errorf("Eval(%q) got value %s, want %s", str, gotStr, valStr)
}
}
func TestEvalBasic(t *testing.T) {
for _, typ := range Typ[Bool : String+1] {
testEval(t, nil, nil, typ.Name(), typ, "", "")
}
}
func TestEvalComposite(t *testing.T) {
for _, test := range <API key> {
testEval(t, nil, nil, test.src, nil, test.str, "")
}
}
func TestEvalArith(t *testing.T) {
var tests = []string{
`true`,
`false == false`,
`12345678 + 87654321 == 99999999`,
`10 * 20 == 200`,
`(1<<1000)*2 >> 100 == 2<<900`,
`"foo" + "bar" == "foobar"`,
`"abc" <= "bcd"`,
`len([10]struct{}{}) == 2*5`,
}
for _, test := range tests {
testEval(t, nil, nil, test, Typ[UntypedBool], "", "true")
}
}
func TestEvalContext(t *testing.T) {
src := `
package p
import "fmt"
import m "math"
const c = 3.0
type T []int
func f(a int, s string) float64 {
fmt.Println("calling f")
_ = m.Pi // use package math
const d int = c + 1
var x int
x = a + len(s)
return float64(x)
}
`
fset := token.NewFileSet()
file, err := parser.ParseFile(fset, "p", src, 0)
if err != nil {
t.Fatal(err)
}
pkg, err := Check("p", fset, []*ast.File{file})
if err != nil {
t.Fatal(err)
}
pkgScope := pkg.Scope()
if n := pkgScope.NumChildren(); n != 1 {
t.Fatalf("got %d file scopes, want 1", n)
}
fileScope := pkgScope.Child(0)
if n := fileScope.NumChildren(); n != 1 {
t.Fatalf("got %d functions scopes, want 1", n)
}
funcScope := fileScope.Child(0)
var tests = []string{
`true => true, untyped bool`,
`fmt.Println => , func(a ...interface{}) (n int, err error)`,
`c => 3, untyped float`,
`T => , p.T`,
`a => , int`,
`s => , string`,
`d => 4, int`,
`x => , int`,
`d/c => 1, int`,
`c/2 => 3/2, untyped float`,
`m.Pi < m.E => false, untyped bool`,
}
for _, test := range tests {
str, typ := split(test, ", ")
str, val := split(str, "=>")
testEval(t, pkg, funcScope, str, nil, typ, val)
}
}
// split splits string s at the first occurrence of s.
func split(s, sep string) (string, string) {
i := strings.Index(s, sep)
return strings.TrimSpace(s[:i]), strings.TrimSpace(s[i+len(sep):])
} |
# coding: binary
# Generated by generate-specs
require 'helper'
describe_moneta "<API key>" do
def features
[:create, :expires, :increment]
end
def new_store
Moneta.new(:MongoOfficial, db: '<API key>', logger: {file: File.join(make_tempdir, '<API key>.log')})
end
def load_value(value)
Marshal.load(value)
end
include_context 'setup_store'
<API key> 'concurrent_create'
<API key> '<API key>'
<API key> 'create'
<API key> 'create_expires'
<API key> 'expires'
<API key> 'features'
<API key> 'increment'
<API key> 'marshallable_key'
<API key> 'marshallable_value'
<API key> 'multiprocess'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> '<API key>'
<API key> 'store_large'
<API key> 'transform_value'
end |
<reference types='tether' />
import { CSSModule } from '../index';
export interface TetherContentProps {
className?: string;
cssModule?: CSSModule;
arrow?: string;
disabled?: boolean;
isOpen: boolean;
toggle: () => void;
tether: Tether.ITetherOptions;
tetherRef?: (tether: Tether) => void;
style?: React.CSSProperties;
}
declare const TetherContent: React.StatelessComponent<TetherContentProps>;
export default TetherContent; |
package org.spongepowered.common.world.extent;
import com.flowpowered.math.vector.Vector3i;
import org.spongepowered.api.util.DiscreteTransform3;
import org.spongepowered.api.world.extent.<API key>;
import org.spongepowered.api.world.extent.<API key>;
public class <API key> extends <API key><<API key>> implements <API key> {
public <API key>(<API key> area, DiscreteTransform3 transform) {
super(area, transform);
}
@Override
public <API key> getBlockView(Vector3i newMin, Vector3i newMax) {
return new <API key>(this.volume, this.inverseTransform.transform(newMin), this.inverseTransform.transform(newMax))
.getBlockView(this.transform);
}
@Override
public <API key> getBlockView(DiscreteTransform3 transform) {
return new <API key>(this.volume, this.transform.withTransformation(transform));
}
@Override
public <API key> <API key>() {
return getBlockView(DiscreteTransform3.fromTranslation(this.min.negate()));
}
@Override
public <API key> <API key>() {
return this;
}
} |
var Buffer = require('safe-buffer').Buffer
var checkParameters = require('./precondition')
var defaultEncoding = require('./default-encoding')
var sync = require('./sync')
var toBuffer = require('./to-buffer')
var ZERO_BUF
var subtle = global.crypto && global.crypto.subtle
var toBrowser = {
sha: 'SHA-1',
'sha-1': 'SHA-1',
sha1: 'SHA-1',
sha256: 'SHA-256',
'sha-256': 'SHA-256',
sha384: 'SHA-384',
'sha-384': 'SHA-384',
'sha-512': 'SHA-512',
sha512: 'SHA-512'
}
var checks = []
function checkNative (algo) {
if (global.process && !global.process.browser) {
return Promise.resolve(false)
}
if (!subtle || !subtle.importKey || !subtle.deriveBits) {
return Promise.resolve(false)
}
if (checks[algo] !== undefined) {
return checks[algo]
}
ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
.then(function () {
return true
}).catch(function () {
return false
})
checks[algo] = prom
return prom
}
function browserPbkdf2 (password, salt, iterations, length, algo) {
return subtle.importKey(
'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
).then(function (key) {
return subtle.deriveBits({
name: 'PBKDF2',
salt: salt,
iterations: iterations,
hash: {
name: algo
}
}, key, length << 3)
}).then(function (res) {
return Buffer.from(res)
})
}
function resolvePromise (promise, callback) {
promise.then(function (out) {
process.nextTick(function () {
callback(null, out)
})
}, function (e) {
process.nextTick(function () {
callback(e)
})
})
}
module.exports = function (password, salt, iterations, keylen, digest, callback) {
if (typeof digest === 'function') {
callback = digest
digest = undefined
}
digest = digest || 'sha1'
var algo = toBrowser[digest.toLowerCase()]
if (!algo || typeof global.Promise !== 'function') {
return process.nextTick(function () {
var out
try {
out = sync(password, salt, iterations, keylen, digest)
} catch (e) {
return callback(e)
}
callback(null, out)
})
}
checkParameters(iterations, keylen)
password = toBuffer(password, defaultEncoding, 'Password')
salt = toBuffer(salt, defaultEncoding, 'Salt')
if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
resolvePromise(checkNative(algo).then(function (resp) {
if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
return sync(password, salt, iterations, keylen, digest)
}), callback)
} |
<?php
namespace OSC\OM\Session;
use OSC\OM\Registry;
class MySQL extends \OSC\OM\SessionAbstract implements \<API key>
{
protected $db;
public function __construct()
{
$this->db = Registry::get('Db');
<API key>($this, true);
}
public function exists($session_id)
{
$Qsession = $this->db->prepare('select 1 from :table_sessions where sesskey = :sesskey');
$Qsession->bindValue(':sesskey', $session_id);
$Qsession->execute();
return $Qsession->fetch() !== false;
}
public function open($save_path, $name)
{
return true;
}
public function close()
{
return true;
}
public function read($session_id)
{
$Qsession = $this->db->prepare('select value from :table_sessions where sesskey = :sesskey');
$Qsession->bindValue(':sesskey', $session_id);
$Qsession->execute();
if ($Qsession->fetch() !== false) {
return $Qsession->value('value');
}
return '';
}
public function write($session_id, $session_data)
{
if ($this->exists($session_id)) {
$result = $this->db->save('sessions', [
'expiry' => time(),
'value' => $session_data
], [
'sesskey' => $session_id
]);
} else {
$result = $this->db->save('sessions', [
'sesskey' => $session_id,
'expiry' => time(),
'value' => $session_data
]);
}
return $result !== false;
}
public function destroy($session_id)
{
$result = $this->db->delete('sessions', [
'sesskey' => $session_id
]);
return $result !== false;
}
public function gc($maxlifetime)
{
$Qdel = $this->db->prepare('delete from :table_sessions where expiry < :expiry');
$Qdel->bindValue(':expiry', time() - $maxlifetime);
$Qdel->execute();
return $Qdel->isError() === false;
}
} |
#ifndef lopcodes_h
#define lopcodes_h
#include "llimits.h"
enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
/*
** size and position of opcode arguments.
*/
#define SIZE_C 9
#define SIZE_B 9
#define SIZE_Bx (SIZE_C + SIZE_B)
#define SIZE_A 8
#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A)
#define SIZE_OP 6
#define POS_OP 0
#define POS_A (POS_OP + SIZE_OP)
#define POS_C (POS_A + SIZE_A)
#define POS_B (POS_C + SIZE_C)
#define POS_Bx POS_C
#define POS_Ax POS_A
/*
** limits for opcode arguments.
** we use (signed) int to manipulate most arguments,
** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
*/
#if SIZE_Bx < LUAI_BITSINT-1
#define MAXARG_Bx ((1<<SIZE_Bx)-1)
#define MAXARG_sBx (MAXARG_Bx>>1) /* 'sBx' is signed */
#else
#define MAXARG_Bx MAX_INT
#define MAXARG_sBx MAX_INT
#endif
#if SIZE_Ax < LUAI_BITSINT-1
#define MAXARG_Ax ((1<<SIZE_Ax)-1)
#else
#define MAXARG_Ax MAX_INT
#endif
#define MAXARG_A ((1<<SIZE_A)-1)
#define MAXARG_B ((1<<SIZE_B)-1)
#define MAXARG_C ((1<<SIZE_C)-1)
/* creates a mask with 'n' 1 bits at position 'p' */
#define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p))
/* creates a mask with 'n' 0 bits at position 'p' */
#define MASK0(n,p) (~MASK1(n,p))
/*
** the following macros help to manipulate instructions
*/
#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
#define getarg(i,pos,size) (cast(int, ((i)>>pos) & MASK1(size,0)))
#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
((cast(Instruction, v)<<pos)&MASK1(size,pos))))
#define GETARG_A(i) getarg(i, POS_A, SIZE_A)
#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
#define GETARG_B(i) getarg(i, POS_B, SIZE_B)
#define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
#define GETARG_C(i) getarg(i, POS_C, SIZE_C)
#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
#define GETARG_Bx(i) getarg(i, POS_Bx, SIZE_Bx)
#define SETARG_Bx(i,v) setarg(i, v, POS_Bx, SIZE_Bx)
#define GETARG_Ax(i) getarg(i, POS_Ax, SIZE_Ax)
#define SETARG_Ax(i,v) setarg(i, v, POS_Ax, SIZE_Ax)
#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, b)<<POS_B) \
| (cast(Instruction, c)<<POS_C))
#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, bc)<<POS_Bx))
#define CREATE_Ax(o,a) ((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_Ax))
/*
** Macros to operate RK indices
*/
/* this bit 1 means constant (0 means register) */
#define BITRK (1 << (SIZE_B - 1))
/* test whether value is a constant */
#define ISK(x) ((x) & BITRK)
/* gets the index of the constant */
#define INDEXK(r) ((int)(r) & ~BITRK)
#if !defined(MAXINDEXRK) /* (for debugging only) */
#define MAXINDEXRK (BITRK - 1)
#endif
/* code a constant index as a RK value */
#define RKASK(x) ((x) | BITRK)
/*
** invalid register that fits in 8 bits
*/
#define NO_REG MAXARG_A
/*
** R(x) - register
** Kst(x) - constant (in constant table)
** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
*/
/*
** grep "ORDER OP" if you change these enums
*/
typedef enum {
OP_MOVE,/* A B R(A) := R(B) */
OP_LOADK,/* A Bx R(A) := Kst(Bx) */
OP_LOADKX,/* A R(A) := Kst(extra arg) */
OP_LOADBOOL,
OP_LOADNIL,/* A B R(A), R(A+1), ..., R(A+B) := nil */
OP_GETUPVAL,/* A B R(A) := UpValue[B] */
OP_GETTABUP,
OP_GETTABLE,
OP_SETTABUP,
OP_SETUPVAL,/* A B UpValue[B] := R(A) */
OP_SETTABLE,
OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
OP_SELF,
OP_ADD,
OP_SUB,
OP_MUL,
OP_MOD,
OP_POW,
OP_DIV,
OP_IDIV,
OP_BAND,
OP_BOR,
OP_BXOR,
OP_SHL,
OP_SHR,
OP_UNM,/* A B R(A) := -R(B) */
OP_BNOT,/* A B R(A) := ~R(B) */
OP_NOT,/* A B R(A) := not R(B) */
OP_LEN,/* A B R(A) := length of R(B) */
OP_CONCAT,
OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */
OP_EQ,
OP_LT,
OP_LE,
OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
OP_FORLOOP,/* A sBx R(A)+=R(A+2);
if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */
OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */
OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */
OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
} OpCode;
#define NUM_OPCODES (cast(int, OP_EXTRAARG) + 1)
/*
** masks for instruction properties. The format is:
** bits 0-1: op mode
** bits 2-3: C arg mode
** bits 4-5: B arg mode
** bit 6: instruction set register A
** bit 7: operator is a test (next instruction must be a jump)
*/
enum OpArgMask {
OpArgN, /* argument is not used */
OpArgU, /* argument is used */
OpArgR, /* argument is a register or a jump offset */
OpArgK /* argument is a constant or register/constant */
};
LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
#define testAMode(m) (luaP_opmodes[m] & (1 << 6))
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
/* number of list items to accumulate before a SETLIST instruction */
#define LFIELDS_PER_FLUSH 50
#endif |
// <API key>.h
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// 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.
#import <AFNetworking/AFNetworking.h>
@class OVCURLMatcher;
/**
<API key> subclass that validates and transforms a JSON response into a
`OVCResponse` object.
*/
@interface <API key> : <API key>
/**
Matches URLs in HTTP responses with model classes.
*/
@property (strong, nonatomic, readonly) OVCURLMatcher *URLMatcher;
/**
Matches URLs in HTTP responses with response classes.
*/
// TODO: Annotate nullable
@property (strong, nonatomic, readonly) OVCURLMatcher *<API key>;
/**
The class used to create responses. Must be `OVCResponse` or a subclass.
*/
@property (nonatomic, readonly) Class responseClass;
/**
The model class for server error responses.
*/
@property (nonatomic, readonly) Class errorModelClass;
/**
Creates and returns model serializer.
*/
// TODO: Annotate nullable
+ (instancetype)<API key>:(OVCURLMatcher *)URLMatcher
<API key>:(OVCURLMatcher *)<API key>
responseClass:(Class)responseClass
errorModelClass:(Class)errorModelClass;
@end |
package org.usfirst.frc.team166.robot.commands.Drive;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc.team166.robot.Robot;
public class DriveStraightAuto extends Command {
double distance;
double speed;
public DriveStraightAuto(double desiredDistance, double desiredSpeed) {
requires(Robot.drive);
distance = desiredDistance;
speed = desiredSpeed;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
Robot.drive.resetGyro();
Robot.drive.resetEncoders();
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.drive.driveStraightGyro(speed);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return Robot.drive.hasDrivenDistance(distance);
}
// Called once after isFinished returns true
@Override
protected void end() {
Robot.drive.stopMotors();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
} |
date: 2017-11-07T17:26:46.112Z
version: 4.8.6
category: release
title: Node v4.8.6 (Maintenance)
slug: node-v4-8-6
layout: blog-post.hbs
author: Myles Borins
Notable Changes
* **crypto**:
* update root certificates (Ben Noordhuis) [
* update root certificates (Ben Noordhuis) [
* **deps**:
* add support for more modern versions of INTL (Bruno Pagani) [
* upgrade openssl sources to 1.0.2m (Shigeki Ohtsu) [
* upgrade openssl sources to 1.0.2l (Daniel Bevenius) [
Commits
* [[`e064ae62e4`](https://github.com/nodejs/node/commit/e064ae62e4)] - **build**: fix make test-v8 (Ben Noordhuis) [
* [[`a7f7a87a1b`](https://github.com/nodejs/node/commit/a7f7a87a1b)] - **build**: run test-hash-seed at the end of test-v8 (Michaël Zasso) [
* [[`05e8b1b7d9`](https://github.com/nodejs/node/commit/05e8b1b7d9)] - **build**: codesign tarball binary on macOS (Evan Lucas) [
* [[`e2b6fdf93e`](https://github.com/nodejs/node/commit/e2b6fdf93e)] - **build**: avoid /docs/api and /docs/doc/api upload (Rod Vagg) [
* [[`59d35c0775`](https://github.com/nodejs/node/commit/59d35c0775)] - **build,tools**: do not force codesign prefix (Evan Lucas) [
* [[`210fa72e9e`](https://github.com/nodejs/node/commit/210fa72e9e)] - **crypto**: update root certificates (Ben Noordhuis) [
* [[`752b46a259`](https://github.com/nodejs/node/commit/752b46a259)] - **crypto**: update root certificates (Ben Noordhuis) [
* [[`3640ba4acb`](https://github.com/nodejs/node/commit/3640ba4acb)] - **crypto**: clear err stack after ECDH::BufferToPoint (Ryan Kelly) [
* [[`545235fc4b`](https://github.com/nodejs/node/commit/545235fc4b)] - **deps**: add missing #include "unicode/normlzr.h" (Bruno Pagani) [
* [[`ea09a1c3e6`](https://github.com/nodejs/node/commit/ea09a1c3e6)] - **deps**: update openssl asm and asm_obsolete files (Shigeki Ohtsu) [
* [[`68661a95b5`](https://github.com/nodejs/node/commit/68661a95b5)] - **deps**: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) [nodejs/io.js
* [[`bdcb2525fb`](https://github.com/nodejs/node/commit/bdcb2525fb)] - **deps**: fix asm build error of openssl in x86_win32 (Shigeki Ohtsu) [iojs/io.js
* [[`3f93ffee89`](https://github.com/nodejs/node/commit/3f93ffee89)] - **deps**: fix openssl assembly error on ia32 win32 (Fedor Indutny) [iojs/io.js
* [[`16fbd9da0d`](https://github.com/nodejs/node/commit/16fbd9da0d)] - **deps**: copy all openssl header files to include dir (Shigeki Ohtsu) [
* [[`55e15ec820`](https://github.com/nodejs/node/commit/55e15ec820)] - **deps**: upgrade openssl sources to 1.0.2m (Shigeki Ohtsu) [
* [[`9c3e246ffe`](https://github.com/nodejs/node/commit/9c3e246ffe)] - **deps**: backport 4e18190 from V8 upstream (jshin) [
* [[`43d1ac3a62`](https://github.com/nodejs/node/commit/43d1ac3a62)] - **deps**: backport bff3074 from V8 upstream (Myles Borins) [
* [[`b259fd3bd5`](https://github.com/nodejs/node/commit/b259fd3bd5)] - **deps**: cherry pick d7f813b4 from V8 upstream (akos.palfi) [
* [[`85800c4ba4`](https://github.com/nodejs/node/commit/85800c4ba4)] - **deps**: backport e28183b5 from upstream V8 (karl) [
* [[`06eb181916`](https://github.com/nodejs/node/commit/06eb181916)] - **deps**: update openssl asm and asm_obsolete files (Daniel Bevenius) [
* [[`c0fe1fccc3`](https://github.com/nodejs/node/commit/c0fe1fccc3)] - **deps**: update openssl config files (Daniel Bevenius) [
* [[`523eb60424`](https://github.com/nodejs/node/commit/523eb60424)] - **deps**: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) [nodejs/io.js
* [[`0aacd5a8cd`](https://github.com/nodejs/node/commit/0aacd5a8cd)] - **deps**: fix asm build error of openssl in x86_win32 (Shigeki Ohtsu) [iojs/io.js
* [[`80c48c0720`](https://github.com/nodejs/node/commit/80c48c0720)] - **deps**: fix openssl assembly error on ia32 win32 (Fedor Indutny) [iojs/io.js
* [[`bbd92b4676`](https://github.com/nodejs/node/commit/bbd92b4676)] - **deps**: copy all openssl header files to include dir (Daniel Bevenius) [
* [[`8507f0fb5d`](https://github.com/nodejs/node/commit/8507f0fb5d)] - **deps**: upgrade openssl sources to 1.0.2l (Daniel Bevenius) [
* [[`9bfada8f0c`](https://github.com/nodejs/node/commit/9bfada8f0c)] - **deps**: add example of comparing OpenSSL changes (Daniel Bevenius) [
* [[`71f9cdf241`](https://github.com/nodejs/node/commit/71f9cdf241)] - **deps**: cherry-pick 09db540,686558d from V8 upstream (Jesse Rosenberger) [
* [[`751f1ac08e`](https://github.com/nodejs/node/commit/751f1ac08e)] - ***Revert*** "**deps**: backport e093a04, 09db540 from upstream V8" (Jesse Rosenberger) [
* [[`ed6298c7de`](https://github.com/nodejs/node/commit/ed6298c7de)] - **deps**: cherry-pick 18ea996 from c-ares upstream (Anna Henningsen) [
* [[`639180adfa`](https://github.com/nodejs/node/commit/639180adfa)] - **deps**: update openssl asm and asm_obsolete files (Shigeki Ohtsu) [
* [[`9ba73e1797`](https://github.com/nodejs/node/commit/9ba73e1797)] - **deps**: cherry-pick 4ae5993 from upstream OpenSSL (Shigeki Ohtsu) [
* [[`f8e282e51c`](https://github.com/nodejs/node/commit/f8e282e51c)] - **doc**: fix typo in zlib.md (Luigi Pinca) [
* [[`532a2941cb`](https://github.com/nodejs/node/commit/532a2941cb)] - **doc**: add missing make command to UPGRADING.md (Daniel Bevenius) [
* [[`1db33296cb`](https://github.com/nodejs/node/commit/1db33296cb)] - **doc**: add entry for subprocess.killed property (Rich Trott) [
* [[`0fa09dfd77`](https://github.com/nodejs/node/commit/0fa09dfd77)] - **doc**: change `child` to `subprocess` (Rich Trott) [
* [[`43bbfafaef`](https://github.com/nodejs/node/commit/43bbfafaef)] - **docs**: Fix broken links in crypto.md (Zuzana Svetlikova) [
* [[`1bde7f5cef`](https://github.com/nodejs/node/commit/1bde7f5cef)] - **openssl**: fix keypress requirement in apps on win32 (Shigeki Ohtsu) [iojs/io.js
* [[`e69f47b686`](https://github.com/nodejs/node/commit/e69f47b686)] - **openssl**: fix keypress requirement in apps on win32 (Shigeki Ohtsu) [iojs/io.js
* [[`cb92f93cd5`](https://github.com/nodejs/node/commit/cb92f93cd5)] - **test**: remove internal headers from addons (Gibson Fahnestock) [
* [[`5d9164c315`](https://github.com/nodejs/node/commit/5d9164c315)] - **test**: move <API key> to sequential (Oleksandr Kushchak) [
* [[`07c912e849`](https://github.com/nodejs/node/commit/07c912e849)] - **tools**: update certdata.txt (Ben Noordhuis) [
* [[`c40bffcb88`](https://github.com/nodejs/node/commit/c40bffcb88)] - **tools**: update certdata.txt (Ben Noordhuis) [
* [[`161162713f`](https://github.com/nodejs/node/commit/161162713f)] - **tools**: be explicit about including key-id (Myles Borins) [
* [[`0c820c092b`](https://github.com/nodejs/node/commit/0c820c092b)] - **v8**: fix stack overflow in recursive method (Ben Noordhuis) [
* [[`a1f992975f`](https://github.com/nodejs/node/commit/a1f992975f)] - **zlib**: fix crash when initializing failed (Anna Henningsen) [
* [[`31bf595b94`](https://github.com/nodejs/node/commit/31bf595b94)] - **zlib**: fix node crashing on invalid options (Alexey Orlenko) [
Windows 32-bit Installer: https://nodejs.org/dist/v4.8.6/node-v4.8.6-x86.msi<br>
Windows 64-bit Installer: https://nodejs.org/dist/v4.8.6/node-v4.8.6-x64.msi<br>
Windows 32-bit Binary: https://nodejs.org/dist/v4.8.6/win-x86/node.exe<br>
Windows 64-bit Binary: https://nodejs.org/dist/v4.8.6/win-x64/node.exe<br>
macOS 64-bit Installer: https://nodejs.org/dist/v4.8.6/node-v4.8.6.pkg<br>
macOS 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-darwin-x64.tar.gz<br>
Linux 32-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-x86.tar.xz<br>
Linux 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-x64.tar.xz<br>
Linux PPC LE 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-ppc64le.tar.xz<br>
Linux PPC BE 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-ppc64.tar.xz<br>
SmartOS 32-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-sunos-x86.tar.xz<br>
SmartOS 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-sunos-x64.tar.xz<br>
ARMv6 32-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-armv6l.tar.xz<br>
ARMv7 32-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-armv7l.tar.xz<br>
ARMv8 64-bit Binary: https://nodejs.org/dist/v4.8.6/node-v4.8.6-linux-arm64.tar.xz<br>
Source Code: https://nodejs.org/dist/v4.8.6/node-v4.8.6.tar.gz<br>
Other release files: https://nodejs.org/dist/v4.8.6/<br>
Documentation: https://nodejs.org/docs/v4.8.6/api/
SHASUMS
--BEGIN PGP SIGNED MESSAGE
Hash: SHA256
<SHA256-like> node-v4.8.6-darwin-x64.tar.gz
<SHA256-like> node-v4.8.6-darwin-x64.tar.xz
<SHA256-like> node-v4.8.6-headers.tar.gz
<SHA256-like> node-v4.8.6-headers.tar.xz
<SHA256-like> node-v4.8.6-linux-arm64.tar.gz
<SHA256-like> node-v4.8.6-linux-arm64.tar.xz
<SHA256-like> node-v4.8.6-linux-armv6l.tar.gz
<SHA256-like> node-v4.8.6-linux-armv6l.tar.xz
<SHA256-like> node-v4.8.6-linux-armv7l.tar.gz
<SHA256-like> node-v4.8.6-linux-armv7l.tar.xz
<SHA256-like> node-v4.8.6-linux-ppc64le.tar.gz
<SHA256-like> node-v4.8.6-linux-ppc64le.tar.xz
<SHA256-like> node-v4.8.6-linux-ppc64.tar.gz
<SHA256-like> node-v4.8.6-linux-ppc64.tar.xz
<SHA256-like> node-v4.8.6-linux-x64.tar.gz
<SHA256-like> node-v4.8.6-linux-x64.tar.xz
<SHA256-like> node-v4.8.6-linux-x86.tar.gz
<SHA256-like> node-v4.8.6-linux-x86.tar.xz
<SHA256-like> node-v4.8.6.pkg
<SHA256-like> node-v4.8.6-sunos-x64.tar.gz
<SHA256-like> node-v4.8.6-sunos-x64.tar.xz
<SHA256-like> node-v4.8.6-sunos-x86.tar.gz
<SHA256-like> node-v4.8.6-sunos-x86.tar.xz
<SHA256-like> node-v4.8.6.tar.gz
<SHA256-like> node-v4.8.6.tar.xz
<SHA256-like> node-v4.8.6-win-x64.7z
<SHA256-like> node-v4.8.6-win-x64.zip
<SHA256-like> node-v4.8.6-win-x86.7z
<SHA256-like> node-v4.8.6-win-x86.zip
<SHA256-like> node-v4.8.6-x64.msi
<SHA256-like> node-v4.8.6-x86.msi
<SHA256-like> win-x64/node.exe
<SHA256-like> win-x64/node.lib
<SHA256-like> win-x64/node_pdb.7z
<SHA256-like> win-x64/node_pdb.zip
<SHA256-like> win-x86/node.exe
<SHA256-like> win-x86/node.lib
<SHA256-like> win-x86/node_pdb.7z
<SHA256-like> win-x86/node_pdb.zip
--BEGIN PGP SIGNATURE
iQEzBAEBCAAdFiEEDv/hvO/<API key>
qUY+PQf+K1+<API key>
We/RTpNSJLt34EX0a4W+Y4zSa4+C8yRno/<API key>
I/dLRre+ZV6uXy8WONiAbt+<API key>/z2YR/tsaxA0ZSl+sKdA
x+iurPjh/4KhhB7QayyXPp/<API key>
7GAnZ5YASaDXmKcOv/<API key>/Jc95kI/5Z5nftu+9
<API key>==
=s3mc
--END PGP SIGNATURE |
/**
* @fileOverview The "filebrowser" plugin that adds support for file uploads and
* browsing.
*
* When a file is uploaded or selected inside the file browser, its URL is
* inserted automatically into a field defined in the <code>filebrowser</code>
* attribute. In order to specify a field that should be updated, pass the tab ID and
* the element ID, separated with a colon.<br /><br />
*
* <strong>Example 1: (Browse)</strong>
*
* <pre>
* {
* type : 'button',
* id : 'browse',
* filebrowser : 'tabId:elementId',
* label : editor.lang.common.browseServer
* }
* </pre>
*
* If you set the <code>filebrowser</code> attribute for an element other than
* the <code>fileButton</code>, the <code>Browse</code> action will be triggered.<br /><br />
*
* <strong>Example 2: (Quick Upload)</strong>
*
* <pre>
* {
* type : 'fileButton',
* id : 'uploadButton',
* filebrowser : 'tabId:elementId',
* label : editor.lang.common.uploadSubmit,
* 'for' : [ 'upload', 'upload' ]
* }
* </pre>
*
* If you set the <code>filebrowser</code> attribute for a <code>fileButton</code>
* element, the <code>QuickUpload</code> action will be executed.<br /><br />
*
* The filebrowser plugin also supports more advanced configuration performed through
* a JavaScript object.
*
* The following settings are supported:
*
* <ul>
* <li><code>action</code> – <code>Browse</code> or <code>QuickUpload</code>.</li>
* <li><code>target</code> – the field to update in the <code><em>tabId:elementId</em></code> format.</li>
* <li><code>params</code> – additional arguments to be passed to the server connector (optional).</li>
* <li><code>onSelect</code> – a function to execute when the file is selected/uploaded (optional).</li>
* <li><code>url</code> – the URL to be called (optional).</li>
* </ul>
*
* <strong>Example 3: (Quick Upload)</strong>
*
* <pre>
* {
* type : 'fileButton',
* label : editor.lang.common.uploadSubmit,
* id : 'buttonId',
* filebrowser :
* {
* action : 'QuickUpload', // required
* target : 'tab1:elementId', // required
* params : // optional
* {
* type : 'Files',
* currentFolder : '/folder/'
* },
* onSelect : function( fileUrl, errorMessage ) // optional
* {
* // Do not call the built-in selectFuntion.
* // return false;
* }
* },
* 'for' : [ 'tab1', 'myFile' ]
* }
* </pre>
*
* Suppose you have a file element with an ID of <code>myFile</code>, a text
* field with an ID of <code>elementId</code> and a <code>fileButton</code>.
* If the <code>filebowser.url</code> attribute is not specified explicitly,
* the form action will be set to <code>filebrowser[<em>DialogWindowName</em>]UploadUrl</code>
* or, if not specified, to <code><API key></code>. Additional parameters
* from the <code>params</code> object will be added to the query string. It is
* possible to create your own <code>uploadHandler</code> and cancel the built-in
* <code>updateTargetElement</code> command.<br /><br />
*
* <strong>Example 4: (Browse)</strong>
*
* <pre>
* {
* type : 'button',
* id : 'buttonId',
* label : editor.lang.common.browseServer,
* filebrowser :
* {
* action : 'Browse',
* url : '/ckfinder/ckfinder.html&type=Images',
* target : 'tab1:elementId'
* }
* }
* </pre>
*
* In this example, when the button is pressed, the file browser will be opened in a
* popup window. If you do not specify the <code>filebrowser.url</code> attribute,
* <code>filebrowser[<em>DialogName</em>]BrowseUrl</code> or
* <code><API key></code> will be used. After selecting a file in the file
* browser, an element with an ID of <code>elementId</code> will be updated. Just
* like in the third example, a custom <code>onSelect</code> function may be defined.
*/
(function() {
// Adds (additional) arguments to given url.
// @param {String}
// url The url.
// @param {Object}
// params Additional parameters.
function addQueryString( url, params ) {
var queryString = [];
if ( !params )
return url;
else {
for ( var i in params )
queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
}
return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
}
// Make a string's first character uppercase.
// @param {String}
// str String.
function ucFirst( str ) {
str += '';
var f = str.charAt( 0 ).toUpperCase();
return f + str.substr( 1 );
}
// The onlick function assigned to the 'Browse Server' button. Opens the
// file browser and updates target field when file is selected.
// @param {CKEDITOR.event}
// evt The event object.
function browseServer( evt ) {
var dialog = this.getDialog();
var editor = dialog.getParentEditor();
editor._.filebrowserSe = this;
var width = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ] || editor.config.<API key> || '80%';
var height = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ] || editor.config.<API key> || '70%';
var params = this.filebrowser.params || {};
params.CKEditor = editor.name;
params.CKEditorFuncNum = editor._.filebrowserFn;
if ( !params.langCode )
params.langCode = editor.langCode;
var url = addQueryString( this.filebrowser.url, params );
// TODO: V4: Remove backward compatibility (#8163).
editor.popup( url, width, height, editor.config.<API key> || editor.config.<API key> );
}
// The onlick function assigned to the 'Upload' button. Makes the final
// decision whether form is really submitted and updates target field when
// file is uploaded.
// @param {CKEDITOR.event}
// evt The event object.
function uploadFile( evt ) {
var dialog = this.getDialog();
var editor = dialog.getParentEditor();
editor._.filebrowserSe = this;
// If user didn't select the file, stop the upload.
if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value )
return false;
if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() )
return false;
return true;
}
// Setups the file element.
// @param {CKEDITOR.ui.dialog.file}
// fileInput The file element used during file upload.
// @param {Object}
// filebrowser Object containing filebrowser settings assigned to
// the fileButton associated with this file element.
function setupFileElement( editor, fileInput, filebrowser ) {
var params = filebrowser.params || {};
params.CKEditor = editor.name;
params.CKEditorFuncNum = editor._.filebrowserFn;
if ( !params.langCode )
params.langCode = editor.langCode;
fileInput.action = addQueryString( filebrowser.url, params );
fileInput.filebrowser = filebrowser;
}
// Traverse through the content definition and attach filebrowser to
// elements with 'filebrowser' attribute.
// @param String
// dialogName Dialog name.
// @param {CKEDITOR.dialog.definitionObject}
// definition Dialog definition.
// @param {Array}
// elements Array of {@link CKEDITOR.dialog.definition.content}
// objects.
function attachFileBrowser( editor, dialogName, definition, elements ) {
var element, fileInput;
for ( var i in elements ) {
element = elements[ i ];
if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' )
attachFileBrowser( editor, dialogName, definition, element.children );
if ( !element.filebrowser )
continue;
if ( typeof element.filebrowser == 'string' ) {
var fb = {
action: ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse',
target: element.filebrowser
};
element.filebrowser = fb;
}
if ( element.filebrowser.action == 'Browse' ) {
var url = element.filebrowser.url;
if ( url === undefined ) {
url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ];
if ( url === undefined )
url = editor.config.<API key>;
}
if ( url ) {
element.onClick = browseServer;
element.filebrowser.url = url;
element.hidden = false;
}
} else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] ) {
url = element.filebrowser.url;
if ( url === undefined ) {
url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ];
if ( url === undefined )
url = editor.config.<API key>;
}
if ( url ) {
var onClick = element.onClick;
element.onClick = function( evt ) {
// "element" here means the definition object, so we need to find the correct
// button to scope the event call
var sender = evt.sender;
if ( onClick && onClick.call( sender, evt ) === false )
return false;
return uploadFile.call( sender, evt );
};
element.filebrowser.url = url;
element.hidden = false;
setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser );
}
}
}
}
// Updates the target element with the url of uploaded/selected file.
// @param {String}
// url The url of a file.
function updateTargetElement( url, sourceElement ) {
var dialog = sourceElement.getDialog();
var targetElement = sourceElement.filebrowser.target || null;
// If there is a reference to targetElement, update it.
if ( targetElement ) {
var target = targetElement.split( ':' );
var element = dialog.getContentElement( target[ 0 ], target[ 1 ] );
if ( element ) {
element.setValue( url );
dialog.selectPage( target[ 0 ] );
}
}
}
// Returns true if filebrowser is configured in one of the elements.
// @param {CKEDITOR.dialog.definitionObject}
// definition Dialog definition.
// @param String
// tabId The tab id where element(s) can be found.
// @param String
// elementId The element id (or ids, separated with a semicolon) to check.
function isConfigured( definition, tabId, elementId ) {
if ( elementId.indexOf( ";" ) !== -1 ) {
var ids = elementId.split( ";" );
for ( var i = 0; i < ids.length; i++ ) {
if ( isConfigured( definition, tabId, ids[ i ] ) )
return true;
}
return false;
}
var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser;
return ( elementFileBrowser && elementFileBrowser.url );
}
function setUrl( fileUrl, data ) {
var dialog = this._.filebrowserSe.getDialog(),
targetInput = this._.filebrowserSe[ 'for' ],
onSelect = this._.filebrowserSe.filebrowser.onSelect;
if ( targetInput )
dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset();
if ( typeof data == 'function' && data.call( this._.filebrowserSe ) === false )
return;
if ( onSelect && onSelect.call( this._.filebrowserSe, fileUrl, data ) === false )
return;
// The "data" argument may be used to pass the error message to the editor.
if ( typeof data == 'string' && data )
alert( data );
if ( fileUrl )
updateTargetElement( fileUrl, this._.filebrowserSe );
}
CKEDITOR.plugins.add( 'filebrowser', {
requires: 'popup',
init: function( editor, pluginPath ) {
editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor );
editor.on( 'destroy', function() {
CKEDITOR.tools.removeFunction( this._.filebrowserFn );
});
}
});
CKEDITOR.on( 'dialogDefinition', function( evt ) {
var definition = evt.data.definition,
element;
// Associate filebrowser to elements with 'filebrowser' attribute.
for ( var i in definition.contents ) {
if ( ( element = definition.contents[ i ] ) ) {
attachFileBrowser( evt.editor, evt.data.name, definition, element.elements );
if ( element.hidden && element.filebrowser ) {
element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser );
}
}
}
});
})();
/**
* The location of an external file browser that should be launched when the **Browse Server**
* button is pressed in the **Image** dialog window.
*
* If not set, CKEditor will use {@link CKEDITOR.config#<API key>}.
*
* config.<API key> = '/browser/browse.php?type=Images';
*
* @since 3.0
* @cfg {String} [<API key>='' (empty string = disabled)]
* @member CKEDITOR.config
*/
/**
* The location of an external file browser that should be launched when the **Browse Server**
* button is pressed in the **Flash** dialog window.
*
* If not set, CKEditor will use {@link CKEDITOR.config#<API key>}.
*
* config.<API key> = '/browser/browse.php?type=Flash';
*
* @since 3.0
* @cfg {String} [<API key>='' (empty string = disabled)]
* @member CKEDITOR.config
*/
/**
* The location of the script that handles file uploads in the **Image** dialog window.
*
* If not set, CKEditor will use {@link CKEDITOR.config#<API key>}.
*
* config.<API key> = '/uploader/upload.php?type=Images';
*
* @since 3.0
* @cfg {String} [<API key>='' (empty string = disabled)]
* @member CKEDITOR.config
*/
/**
* The location of the script that handles file uploads in the **Flash** dialog window.
*
* If not set, CKEditor will use {@link CKEDITOR.config#<API key>}.
*
* config.<API key> = '/uploader/upload.php?type=Flash';
*
* @since 3.0
* @cfg {String} <API key>='' (empty string = disabled)]
* @member CKEDITOR.config
*/
/**
* The location of an external file browser that should be launched when the **Browse Server**
* button is pressed in the **Link** tab of the **Image** dialog window.
*
* If not set, CKEditor will use {@link CKEDITOR.config#<API key>}.
*
* config.<API key> = '/browser/browse.php';
*
* @since 3.2
* @cfg {String} [<API key>='' (empty string = disabled)]
* @member CKEDITOR.config
*/
/**
* The features to use in the file browser popup window.
*
* config.<API key> = 'resizable=yes,scrollbars=no';
*
* @since 3.4.1
* @cfg {String} [<API key>='location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes']
* @member CKEDITOR.config
*/
/**
* The width of the file browser popup window. It can be a number denoting a value in
* pixels or a percent string.
*
* config.<API key> = 750;
*
* config.<API key> = '50%';
*
* @cfg {Number/String} [<API key>='80%']
* @member CKEDITOR.config
*/
/**
* The height of the file browser popup window. It can be a number denoting a value in
* pixels or a percent string.
*
* config.<API key> = 580;
*
* config.<API key> = '50%';
*
* @cfg {Number/String} [<API key>='70%']
* @member CKEDITOR.config
*/ |
package ij.gui;
import ij.IJ;
import java.awt.*;
import java.awt.event.*;
/** A modal dialog box with a one line message and
"Don't Save", "Cancel" and "Save" buttons. */
public class SaveChangesDialog extends Dialog implements ActionListener, KeyListener {
private Button dontSave, cancel, save;
private boolean cancelPressed, savePressed;
public SaveChangesDialog(Frame parent, String fileName) {
super(parent, "Save?", true);
setLayout(new BorderLayout());
Panel panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
Component message;
if (fileName.startsWith("Save "))
message = new Label(fileName);
else {
if (fileName.length()>22)
message = new MultiLineLabel("Save changes to\n" + "\"" + fileName + "\"?");
else
message = new Label("Save changes to \"" + fileName + "\"?");
}
message.setFont(new Font("Dialog", Font.BOLD, 12));
panel.add(message);
add("Center", panel);
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.CENTER, 8, 8));
save = new Button(" Save ");
save.addActionListener(this);
save.addKeyListener(this);
cancel = new Button(" Cancel ");
cancel.addActionListener(this);
cancel.addKeyListener(this);
dontSave = new Button("Don't Save");
dontSave.addActionListener(this);
dontSave.addKeyListener(this);
if (ij.IJ.isMacintosh()) {
panel.add(dontSave);
panel.add(cancel);
panel.add(save);
} else {
panel.add(save);
panel.add(dontSave);
panel.add(cancel);
}
add("South", panel);
if (ij.IJ.isMacintosh())
setResizable(false);
pack();
GUI.center(this);
show();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource()==cancel)
cancelPressed = true;
else if (e.getSource()==save)
savePressed = true;
closeDialog();
}
/** Returns true if the user dismissed dialog by pressing "Cancel". */
public boolean cancelPressed() {
if (cancelPressed)
ij.Macro.abort();
return cancelPressed;
}
/** Returns true if the user dismissed dialog by pressing "Save". */
public boolean savePressed() {
return savePressed;
}
void closeDialog() {
//setVisible(false);
dispose();
}
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
IJ.setKeyDown(keyCode);
if (keyCode==KeyEvent.VK_ENTER)
closeDialog();
else if (keyCode==KeyEvent.VK_ESCAPE) {
cancelPressed = true;
closeDialog();
IJ.resetEscape();
}
}
public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent e) {}
} |
layout: post
date: 2007-03-19
time: "09:00:00"
authors: ["Greg Wilson"]
title: "Sign Error: Five Papers Retracted"
category: ["Opinion"]
<p>Via <a href="http:
<blockquote><p>Their mistake has consequences beyond the damage to the unfortunate young investigator and his team. For five years, other labs have been interpreting their biophysical and biochemical data in terms of the wrong structures. A number of scientists have been unable to publish their results because they seemed to contradict the published X-ray structures. I personally know of at least one investigator whose grant application was turned down for funding because his biochemical data did not agree with the structures. One could argue that an entire sub-field has been held back for years...</p></blockquote>
<p>If I was a twenty-something working toward my PhD, I'd be thinking very hard about how I was going to validate the programs I was writing—the odds are growing steadily that journal editors and granting agencies are going to start demanding some sort of due diligence, sooner rather than later.</p> |
var <API key> = {
'order_promotion[name]': {
required: "Please, enter your name",
maxlength: "Please, enter less than 64 symbols",
minlength: jQuery.validator.format("Enter your name, more than 3 symbols")
},
'order_promotion[email]': {
required: "Please, enter your e-mail",
maxlength: "Please, enter less than 72 symbols",
email: "Your e-mail should be in form name@domain.com"
},
'order_promotion[message]': {
required: "Please, enter your message",
maxlength: "Please, enter no more than 5000 symbols",
minlength: "Please, enter more than 30 symbols"
}
}; |
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Markup.Xaml;
using Avalonia.VisualTree;
using ControlCatalog.ViewModels;
namespace ControlCatalog.Pages
{
public class ItemsRepeaterPage : UserControl
{
private readonly <API key> _viewModel;
private ItemsRepeater _repeater;
private ScrollViewer _scroller;
private Button _scrollToLast;
private Button _scrollToRandom;
private Random _random = new Random(0);
public ItemsRepeaterPage()
{
this.InitializeComponent();
_repeater = this.FindControl<ItemsRepeater>("repeater");
_scroller = this.FindControl<ScrollViewer>("scroller");
_scrollToLast = this.FindControl<Button>("scrollToLast");
_scrollToRandom = this.FindControl<Button>("scrollToRandom");
_repeater.PointerPressed += RepeaterClick;
_repeater.KeyDown += RepeaterOnKeyDown;
_scrollToLast.Click += scrollToLast_Click;
_scrollToRandom.Click += <API key>;
DataContext = _viewModel = new <API key>();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public void OnSelectTemplateKey(object sender, <API key> e)
{
var item = (<API key>.Item)e.DataContext;
e.TemplateKey = (item.Index % 2 == 0) ? "even" : "odd";
}
private void LayoutChanged(object sender, <API key> e)
{
if (_repeater == null)
{
return;
}
var comboBox = (ComboBox)sender;
switch (comboBox.SelectedIndex)
{
case 0:
_scroller.<API key> = ScrollBarVisibility.Auto;
_scroller.<API key> = ScrollBarVisibility.Auto;
_repeater.Layout = new StackLayout { Orientation = Orientation.Vertical };
break;
case 1:
_scroller.<API key> = ScrollBarVisibility.Auto;
_scroller.<API key> = ScrollBarVisibility.Auto;
_repeater.Layout = new StackLayout { Orientation = Orientation.Horizontal };
break;
case 2:
_scroller.<API key> = ScrollBarVisibility.Auto;
_scroller.<API key> = ScrollBarVisibility.Disabled;
_repeater.Layout = new UniformGridLayout
{
Orientation = Orientation.Vertical,
MinItemWidth = 200,
MinItemHeight = 200,
};
break;
case 3:
_scroller.<API key> = ScrollBarVisibility.Disabled;
_scroller.<API key> = ScrollBarVisibility.Auto;
_repeater.Layout = new UniformGridLayout
{
Orientation = Orientation.Horizontal,
MinItemWidth = 200,
MinItemHeight = 200,
};
break;
case 4:
_scroller.<API key> = ScrollBarVisibility.Auto;
_scroller.<API key> = ScrollBarVisibility.Disabled;
_repeater.Layout = new WrapLayout
{
Orientation = Orientation.Vertical,
HorizontalSpacing = 20,
VerticalSpacing = 20
};
break;
case 5:
_scroller.<API key> = ScrollBarVisibility.Disabled;
_scroller.<API key> = ScrollBarVisibility.Auto;
_repeater.Layout = new WrapLayout
{
Orientation = Orientation.Horizontal,
HorizontalSpacing = 20,
VerticalSpacing = 20
};
break;
}
}
private void ScrollTo(int index)
{
System.Diagnostics.Debug.WriteLine("Scroll to " + index);
var layoutManager = ((Window)this.GetVisualRoot()).LayoutManager;
var element = _repeater.GetOrCreateElement(index);
layoutManager.ExecuteLayoutPass();
element.BringIntoView();
}
private void RepeaterClick(object sender, <API key> e)
{
var item = (e.Source as TextBlock)?.DataContext as <API key>.Item;
_viewModel.SelectedItem = item;
}
private void RepeaterOnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F5)
{
_viewModel.ResetItems();
}
}
private void scrollToLast_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
ScrollTo(_viewModel.Items.Count - 1);
}
private void <API key>(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
ScrollTo(_random.Next(_viewModel.Items.Count - 1));
}
}
} |
[Drupal Console](https://drupalconsole.com/) is a modern CLI for interacting with Drupal and scaffolding a site. It works only with Drupal 8+, and is built on top of the Symfony Console component.
Drupal VM will automatically install Drupal Console if you install Drupal 8 or later in your VM (this is based on the value of the `<API key>` variable inside `config.yml`.
To use Drupal Console with a Drupal 8 site (in this case, using the default configuration that ships with Drupal VM):
1. Log into the VM with `vagrant ssh`.
2. Change directory to the Drupal site's document root: `cd /var/www/drupalvm/drupal`.
3. Use Drupal console (e.g. `drupal cache:rebuild all`).
You should see an output like:
vagrant@drupalvm:/var/www/drupalvm/drupal$ drupal cache:rebuild all
[+] Rebuilding cache(s), wait a moment please.
[+] Done clearing cache(s).
The command was executed successfully! |
define(
//begin v1.x content
{
"<API key>": "{1} {0}",
"<API key>+0": "dette kvt.",
"<API key>+1": "næste kvt.",
"field-tue-relative+-1": "sidste tirsdag",
"field-year": "år",
"dateFormatItem-yw": "'uge' w 'i' y",
"<API key>": "om eftermiddagen",
"dateFormatItem-Hm": "HH.mm",
"field-wed-relative+0": "på onsdag",
"field-wed-relative+1": "næste onsdag",
"dateFormatItem-ms": "mm.ss",
"timeFormat-short": "HH.mm",
"field-minute": "minut",
"<API key>+-1": "sidste md.",
"<API key>+0": "på ti.",
"<API key>+1": "næste ti.",
"<API key>+-1": "i går",
"<API key>+0": "på tor.",
"<API key>": "{1} {0}",
"field-day-relative+0": "i dag",
"<API key>+-2": "i forgårs",
"<API key>+1": "næste tor.",
"field-day-relative+1": "i morgen",
"<API key>+0": "denne uge",
"field-day-relative+2": "i overmorgen",
"<API key>+1": "næste uge",
"<API key>+-1": "sidste on.",
"field-year-narrow": "år",
"<API key>+0": "i år",
"field-tue-relative+0": "på tirsdag",
"<API key>+1": "næste år",
"field-tue-relative+1": "næste tirsdag",
"<API key>": "a",
"field-second-short": "sek.",
"<API key>": "morgen",
"<API key>": "formiddag",
"dateFormatItem-MMMd": "d. MMM",
"<API key>": "om morgenen",
"<API key>": "om formiddagen",
"<API key>": "AM",
"<API key>+0": "denne måned",
"field-week-relative+0": "denne uge",
"timeFormat-medium": "HH.mm.ss",
"<API key>+1": "næste måned",
"field-week-relative+1": "næste uge",
"<API key>+0": "på sø.",
"<API key>+0": "på man.",
"<API key>+1": "næste sø.",
"<API key>+1": "næste man.",
"<API key>+0": "nu",
"<API key>": "{0} ({2}: {1})",
"<API key>": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"eraNames": [
"f.Kr.",
"e.Kr."
],
"<API key>": "PM",
"<API key>": "E d. MMM y G",
"field-month-short": "md.",
"field-day": "dag",
"<API key>": "nat",
"field-year-relative+-1": "sidste år",
"<API key>": "AM",
"<API key>+-1": "sidste lør.",
"<API key>": "om eftermiddagen",
"<API key>": "om eftermiddagen",
"field-hour-relative+0": "i den kommende time",
"field-wed-relative+-1": "sidste onsdag",
"<API key>": "{1} {0}",
"<API key>": [
"S",
"M",
"T",
"O",
"T",
"F",
"L"
],
"<API key>+-1": "sidste lø.",
"field-second": "sekund",
"<API key>": "PM",
"dateFormatItem-Ehms": "E h.mm.ss a",
"dateFormat-long": "d. MMMM y",
"<API key>": "d. MMM y G",
"<API key>+0": "denne time",
"<API key>": "midnat",
"field-quarter": "kvartal",
"field-week-short": "uge",
"<API key>": "midnat",
"<API key>+0": "i dag",
"<API key>": "E d. MMM y",
"<API key>+1": "i morgen",
"<API key>+2": "i overmorgen",
"<API key>": [
"1. kvartal",
"2. kvartal",
"3. kvartal",
"4. kvartal"
],
"days-format-narrow": [
"S",
"M",
"T",
"O",
"T",
"F",
"L"
],
"<API key>": "om aftenen",
"<API key>": "{0} {1}",
"<API key>+0": "på tir.",
"<API key>+1": "næste tir.",
"<API key>+-1": "sidste md.",
"field-mon-relative+-1": "sidste mandag",
"<API key>": "MMM y G",
"field-month": "måned",
"<API key>": "nat",
"field-day-narrow": "dag",
"<API key>": "eftermiddag",
"dateFormatItem-MMM": "MMM",
"field-minute-short": "min.",
"field-dayperiod": "AM/PM",
"<API key>+0": "på lør.",
"<API key>+1": "næste lør.",
"<API key>": "p",
"dateFormat-medium": "d. MMM y",
"eraAbbr": [
"f.Kr.",
"e.Kr."
],
"<API key>": [
"1. kvt.",
"2. kvt.",
"3. kvt.",
"4. kvt."
],
"<API key>": "PM",
"field-second-narrow": "s",
"<API key>": "nat",
"field-mon-relative+0": "på mandag",
"field-year-short": "år",
"<API key>+-1": "i går",
"field-mon-relative+1": "næste mandag",
"<API key>+-2": "i forgårs",
"<API key>": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"<API key>": "om morgenen",
"<API key>": "om formiddagen",
"<API key>+-1": "sidste kvartal",
"<API key>": "AM",
"<API key>+-1": "sidste uge",
"days-format-short": [
"sø",
"ma",
"ti",
"on",
"to",
"fr",
"lø"
],
"<API key>": [
"1",
"2",
"3",
"4"
],
"<API key>": "PM",
"field-sat-relative+-1": "sidste lørdag",
"<API key>": "{0} ({2}: {1})",
"dateTimeFormat-long": "{1} 'kl'. {0}",
"dateFormatItem-Md": "d/M",
"field-hour": "time",
"<API key>+0": "denne minut",
"<API key>": "QQQQ y",
"months-format-wide": [
"januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"
],
"<API key>": "om natten",
"dateFormat-full": "EEEE 'den' d. MMMM y",
"<API key>+-1": "sidste måned",
"dateFormatItem-Hms": "HH.mm.ss",
"field-quarter-short": "kvt.",
"<API key>+0": "på lø.",
"dateFormatItem-Hmv": "HH.mm v",
"field-fri-relative+0": "på fredag",
"<API key>+1": "næste lø.",
"field-fri-relative+1": "næste fredag",
"<API key>+0": "denne md.",
"<API key>+1": "næste md.",
"<API key>+0": "på søn.",
"<API key>+1": "næste søn.",
"<API key>": "{0} ({2}: {1})",
"field-week-relative+-1": "sidste uge",
"<API key>+-1": "sidste kvt.",
"dateFormatItem-Ehm": "E h.mm a",
"<API key>+0": "denne minut",
"months-format-abbr": [
"jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."
],
"<API key>": "midnat",
"timeFormat-long": "HH.mm.ss z",
"<API key>+0": "dette kvartal",
"<API key>+0": "i det kommende minut",
"<API key>+1": "næste kvartal",
"<API key>+-1": "sidste ons.",
"dateFormatItem-yMMM": "MMM y",
"dateFormat-short": "dd/MM/y",
"<API key>": "om natten",
"<API key>": "'uge' W 'i' MMM",
"<API key>+-1": "sidste år",
"<API key>+-1": "sidste tor.",
"<API key>": [
"søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"
],
"<API key>+-1": "sidste ma.",
"<API key>": "{1} {0}",
"<API key>": "d. MMMM",
"<API key>+-1": "sidste to.",
"dateFormatItem-E": "ccc",
"dateFormatItem-H": "HH",
"<API key>+-1": "sidste ti.",
"<API key>": "om aftenen",
"<API key>": "PM",
"dateFormatItem-M": "M",
"<API key>": [
"januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"
],
"<API key>+0": "på ons.",
"<API key>+1": "næste ons.",
"dateFormatItem-Hmsv": "HH.mm.ss v",
"field-sun-relative+-1": "sidste søndag",
"<API key>": "E d. MMMM",
"<API key>": [
"søn",
"man",
"tir",
"ons",
"tor",
"fre",
"lør"
],
"dateTimeFormat-full": "{1} 'kl'. {0}",
"dateFormatItem-hm": "h.mm a",
"dateFormatItem-d": "d.",
"field-weekday": "ugedag",
"<API key>": "aften",
"<API key>+0": "i dag",
"<API key>+0": "dette kvt.",
"<API key>+1": "i morgen",
"field-sat-relative+0": "på lørdag",
"dateFormatItem-h": "h a",
"<API key>+1": "næste kvt.",
"<API key>+2": "i overmorgen",
"field-sat-relative+1": "næste lørdag",
"<API key>+0": "denne uge",
"<API key>": [
"jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."
],
"dateFormatItem-hmsv": "h.mm.ss a v",
"<API key>+1": "næste uge",
"<API key>": "om morgenen",
"<API key>": "aften",
"dateFormatItem-yMM": "MM/y",
"<API key>": "om formiddagen",
"<API key>+0": "denne md.",
"timeFormat-full": "HH.mm.ss zzzz",
"<API key>+1": "næste md.",
"dateFormatItem-MEd": "E d/M",
"dateFormatItem-y": "y",
"<API key>+0": "på to.",
"<API key>+-1": "sidste sø.",
"<API key>+-1": "sidste man.",
"<API key>+1": "næste to.",
"field-thu-relative+0": "på torsdag",
"<API key>": "eftermiddag",
"field-thu-relative+1": "næste torsdag",
"dateFormatItem-hms": "h.mm.ss a",
"<API key>": "{0} ({2}: {1})",
"<API key>+-1": "sidste fre.",
"dateFormatItem-hmv": "h.mm a v",
"<API key>": "{0} ({2}: {1})",
"field-thu-relative+-1": "sidste torsdag",
"dateFormatItem-yMd": "d/M/y",
"<API key>": [
"1",
"2",
"3",
"4"
],
"field-week": "uge",
"<API key>": [
"1. kvartal",
"2. kvartal",
"3. kvartal",
"4. kvartal"
],
"dateFormatItem-Ed": "E 'den' d.",
"<API key>+0": "på on.",
"<API key>+1": "næste on.",
"<API key>": "morgen",
"<API key>": "formiddag",
"<API key>+0": "i år",
"<API key>+-1": "sidste kvt.",
"<API key>+1": "næste år",
"<API key>+0": "på fre.",
"<API key>+1": "næste fre.",
"<API key>": "{0} {1}",
"<API key>": [
"sø",
"ma",
"ti",
"on",
"to",
"fr",
"lø"
],
"<API key>+-1": "sidste uge",
"<API key>": "morgen",
"<API key>": "formiddag",
"<API key>+0": "denne time",
"<API key>": "midnat",
"field-hour-short": "t.",
"<API key>": [
"1. kvt.",
"2. kvt.",
"3. kvt.",
"4. kvt."
],
"field-month-narrow": "md.",
"field-hour-narrow": "t",
"<API key>+-1": "sidste fr.",
"field-year-relative+0": "i år",
"field-year-relative+1": "næste år",
"field-fri-relative+-1": "sidste fredag",
"eraNarrow": [
"fKr",
"fvt",
"eKr",
"vt"
],
"<API key>+-1": "sidste tir.",
"field-minute-narrow": "min",
"<API key>": "eftermiddag",
"dateFormatItem-yQQQ": "QQQ y",
"days-format-wide": [
"søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"
],
"<API key>": "{0} ({2}: {1})",
"<API key>+0": "på ma.",
"dateFormatItem-EHm": "E HH.mm",
"<API key>+1": "næste ma.",
"<API key>": "midnat",
"dateFormatItem-yM": "M/y",
"<API key>+-1": "sidste år",
"field-zone": "tidszone",
"<API key>": "MMMM y",
"<API key>": "E d. MMM",
"dateFormatItem-EHms": "E HH.mm.ss",
"dateFormatItem-yMEd": "E d/M/y",
"<API key>": "midnat",
"<API key>": "kvt.",
"<API key>": "AM",
"field-day-relative+-1": "i går",
"<API key>+-1": "sidste søn.",
"field-day-relative+-2": "i forgårs",
"<API key>": "om natten",
"days-format-abbr": [
"søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."
],
"dateFormatItem-MMdd": "dd/MM",
"field-sun-relative+0": "på søndag",
"field-sun-relative+1": "næste søndag",
"<API key>": "d. MMM y",
"<API key>": "{0} ({2}: {1})",
"dateFormatItem-Gy": "y G",
"field-era": "æra",
"field-week-narrow": "uge",
"field-day-short": "dag",
"<API key>": "aften",
"<API key>+0": "på fr.",
"<API key>": "om aftenen",
"<API key>+1": "næste fr.",
"<API key>": "AM"
}
//end v1.x content
); |
define(
//begin v1.x content
{
"<API key>+0": "ora",
"<API key>+-1": "trimestre scorso",
"field-weekday": "giorno della settimana",
"<API key>+0": "questo lu",
"<API key>+1": "lu prossimo",
"field-wed-relative+0": "questo mercoledì",
"field-wed-relative+1": "mercoledì prossimo",
"field-week-short": "sett.",
"field-tue-relative+-1": "martedì scorso",
"field-year-short": "anno",
"<API key>+-1": "gi scorso",
"field-hour-relative+0": "quest’ora",
"dateFormat-long": "dd MMMM y G",
"<API key>": "trim.",
"field-fri-relative+-1": "venerdì scorso",
"field-hour-short": "h.",
"field-wed-relative+-1": "mercoledì scorso",
"dateFormat-full": "EEEE d MMMM y G",
"<API key>+-1": "lun. scorso",
"field-thu-relative+-1": "giovedì scorso",
"field-era": "era",
"<API key>+0": "questo sa",
"<API key>+1": "sa prossimo",
"field-year": "anno",
"field-hour": "ora",
"field-sat-relative+0": "questo sabato",
"field-sat-relative+1": "sabato prossimo",
"<API key>+-1": "sab. scorso",
"field-minute-narrow": "m",
"field-day-relative+0": "oggi",
"field-day-relative+1": "domani",
"field-thu-relative+0": "questo giovedì",
"<API key>+-1": "lu scorso",
"field-day-relative+2": "dopodomani",
"<API key>+0": "questo me",
"field-thu-relative+1": "giovedì prossimo",
"<API key>+1": "me prossimo",
"<API key>+0": "questo lun.",
"<API key>+1": "lun. prossimo",
"<API key>+-1": "mer. scorso",
"<API key>+-1": "ve scorso",
"field-hour-narrow": "h",
"<API key>+0": "questo mar.",
"field-year-narrow": "anno",
"<API key>+1": "mar. prossimo",
"field-minute-short": "min.",
"field-day-narrow": "g",
"<API key>+0": "questo mer.",
"<API key>+1": "mer. prossimo",
"field-sun-relative+0": "questa domenica",
"field-sun-relative+1": "domenica prossima",
"field-minute": "minuto",
"field-month-short": "mese",
"field-dayperiod": "AM/PM",
"field-day-relative+-1": "ieri",
"field-day-relative+-2": "l’altro ieri",
"<API key>+0": "questo minuto",
"field-week-narrow": "sett.",
"<API key>+-1": "me scorso",
"field-day-short": "g",
"<API key>+0": "questo trimestre",
"<API key>+1": "trimestre prossimo",
"field-fri-relative+0": "questo venerdì",
"field-fri-relative+1": "venerdì prossimo",
"field-day": "giorno",
"field-second-narrow": "s",
"field-zone": "fuso orario",
"field-year-relative+-1": "anno scorso",
"<API key>+-1": "mese scorso",
"<API key>+0": "questo gio.",
"<API key>+1": "gio. prossimo",
"<API key>+0": "questo trim.",
"<API key>+1": "trim. prossimo",
"field-quarter": "trimestre",
"field-month": "mese",
"field-tue-relative+0": "questo martedì",
"<API key>+0": "questo trim.",
"field-tue-relative+1": "martedì prossimo",
"<API key>+1": "trim. prossimo",
"<API key>+0": "questo ve",
"<API key>+1": "ve prossimo",
"<API key>+-1": "ven. scorso",
"<API key>+-1": "do scorsa",
"<API key>+-1": "trim. scorso",
"<API key>+0": "questa do",
"<API key>+0": "questo gi",
"<API key>+1": "do prossima",
"<API key>+1": "gi prossimo",
"<API key>+0": "questo ma",
"field-mon-relative+0": "questo lunedì",
"<API key>+1": "ma prossimo",
"field-mon-relative+1": "lunedì prossimo",
"dateFormat-short": "dd/MM/yy GGGGG",
"<API key>+-1": "ma scorso",
"field-second-short": "sec.",
"field-second": "secondo",
"<API key>+0": "questo ven.",
"field-sat-relative+-1": "sabato scorso",
"<API key>+1": "ven. prossimo",
"field-sun-relative+-1": "domenica scorsa",
"<API key>+0": "questo mese",
"<API key>+-1": "trim. scorso",
"<API key>+1": "mese prossimo",
"field-week": "settimana",
"<API key>+0": "questo sab.",
"dateFormat-medium": "dd MMM y G",
"<API key>+1": "sab. prossimo",
"field-year-relative+0": "quest’anno",
"field-week-relative+-1": "settimana scorsa",
"field-year-relative+1": "anno prossimo",
"field-quarter-short": "trim.",
"<API key>+-1": "dom. scorsa",
"<API key>+-1": "gio. scorso",
"<API key>+-1": "mar. scorso",
"field-mon-relative+-1": "lunedì scorso",
"<API key>+-1": "sa scorso",
"field-month-narrow": "mese",
"field-week-relative+0": "questa settimana",
"<API key>+0": "questa dom.",
"field-week-relative+1": "settimana prossima",
"<API key>+1": "dom. prossima"
}
//end v1.x content
); |
package org.eclipse.wst.jsdt.internal.compiler.ast;
import org.eclipse.wst.jsdt.internal.compiler.ASTVisitor;
import org.eclipse.wst.jsdt.internal.compiler.impl.*;
import org.eclipse.wst.jsdt.internal.compiler.codegen.*;
import org.eclipse.wst.jsdt.internal.compiler.flow.*;
import org.eclipse.wst.jsdt.internal.compiler.lookup.*;
//dedicated treatment for the ||
public class OR_OR_Expression extends BinaryExpression {
int rightInitStateIndex = -1;
int <API key> = -1;
public OR_OR_Expression(Expression left, Expression right, int operator) {
super(left, right, operator);
}
public FlowInfo analyseCode(
BlockScope currentScope,
FlowContext flowContext,
FlowInfo flowInfo) {
Constant cst = this.left.<API key>();
boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
boolean <API key> = cst != NotAConstant && cst.booleanValue() == false;
if (<API key>) {
// FALSE || anything
// need to be careful of scenario:
// (x || y) || !z, if passing the left info to the right, it would be swapped by the !
FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
<API key> =
currentScope.methodScope().<API key>(mergedInfo);
return mergedInfo;
}
FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
// need to be careful of scenario:
// (x || y) || !z, if passing the left info to the right, it would be swapped by the !
FlowInfo rightInfo = leftInfo.initsWhenFalse().unconditionalInits().copy();
rightInitStateIndex =
currentScope.methodScope().<API key>(rightInfo);
int previousMode = rightInfo.reachMode();
if (isLeftOptimizedTrue){
rightInfo.setReachMode(FlowInfo.UNREACHABLE);
}
rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
FlowInfo falseMergedInfo = rightInfo.initsWhenFalse().copy();
rightInfo.setReachMode(previousMode); // reset after falseMergedInfo got extracted
FlowInfo mergedInfo = FlowInfo.conditional(
// merging two true initInfos for such a negative case: if ((t && (b = t)) || f) r = b; // b may not have been initialized
leftInfo.initsWhenTrue().copy().unconditionalInits().mergedWith(
rightInfo.initsWhenTrue().copy().unconditionalInits()),
falseMergedInfo);
<API key> =
currentScope.methodScope().<API key>(mergedInfo);
return mergedInfo;
}
/**
* Code generation for a binary operation
*/
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
int pc = codeStream.position;
if (constant != Constant.NotAConstant) {
// inlined value
if (valueRequired)
codeStream.generateConstant(constant, implicitConversion);
codeStream.recordPositionsFrom(pc, this.sourceStart);
return;
}
Constant cst = right.constant;
if (cst != NotAConstant) {
// <expr> || true --> true
if (cst.booleanValue() == true) {
this.left.generateCode(currentScope, codeStream, false);
if (valueRequired) codeStream.iconst_1();
} else {
// <expr>|| false --> <expr>
this.left.generateCode(currentScope, codeStream, valueRequired);
}
if (<API key> != -1) {
codeStream.<API key>(currentScope, <API key>);
}
codeStream.<API key>(implicitConversion);
codeStream.<API key>(codeStream.position);
codeStream.recordPositionsFrom(pc, this.sourceStart);
return;
}
Label trueLabel = new Label(codeStream), endLabel;
cst = left.<API key>();
boolean leftIsConst = cst != NotAConstant;
boolean leftIsTrue = leftIsConst && cst.booleanValue() == true;
cst = right.<API key>();
boolean rightIsConst = cst != NotAConstant;
boolean rightIsTrue = rightIsConst && cst.booleanValue() == true;
generateOperands : {
if (leftIsConst) {
left.generateCode(currentScope, codeStream, false);
if (leftIsTrue) {
break generateOperands; // no need to generate right operand
}
} else {
left.<API key>(currentScope, codeStream, trueLabel, null, true);
// need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1
}
if (rightInitStateIndex != -1) {
codeStream.<API key>(currentScope, rightInitStateIndex);
}
if (rightIsConst) {
right.generateCode(currentScope, codeStream, false);
} else {
right.<API key>(currentScope, codeStream, trueLabel, null, valueRequired);
}
}
if (<API key> != -1) {
codeStream.<API key>(currentScope, <API key>);
}
/*
* improving code gen for such a case: boolean b = i < 0 || true since
* the label has never been used, we have the inlined value on the
* stack.
*/
if (valueRequired) {
if (leftIsConst && leftIsTrue) {
codeStream.iconst_1();
codeStream.<API key>(codeStream.position);
} else {
if (rightIsConst && rightIsTrue) {
codeStream.iconst_1();
codeStream.<API key>(codeStream.position);
} else {
codeStream.iconst_0();
}
if (trueLabel.<API key>()) {
if ((bits & ValueForReturnMASK) != 0) {
codeStream.ireturn();
trueLabel.place();
codeStream.iconst_1();
} else {
codeStream.goto_(endLabel = new Label(codeStream));
codeStream.decrStackSize(1);
trueLabel.place();
codeStream.iconst_1();
endLabel.place();
}
} else {
trueLabel.place();
}
}
codeStream.<API key>(implicitConversion);
codeStream.<API key>(codeStream.position);
} else {
trueLabel.place();
}
}
/**
* Boolean operator code generation Optimized operations are: ||
*/
public void <API key>(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
if (constant != Constant.NotAConstant) {
super.<API key>(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
return;
}
// <expr> || false --> <expr>
Constant cst = right.constant;
if (cst != NotAConstant && cst.booleanValue() == false) {
int pc = codeStream.position;
this.left.<API key>(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
if (<API key> != -1) {
codeStream.<API key>(currentScope, <API key>);
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
return;
}
cst = left.<API key>();
boolean leftIsConst = cst != NotAConstant;
boolean leftIsTrue = leftIsConst && cst.booleanValue() == true;
cst = right.<API key>();
boolean rightIsConst = cst != NotAConstant;
boolean rightIsTrue = rightIsConst && cst.booleanValue() == true;
// default case
generateOperands : {
if (falseLabel == null) {
if (trueLabel != null) {
// implicit falling through the FALSE case
left.<API key>(currentScope, codeStream, trueLabel, null, !leftIsConst);
// need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1
if (leftIsConst && leftIsTrue) {
codeStream.goto_(trueLabel);
codeStream.<API key>(codeStream.position);
break generateOperands; // no need to generate right operand
}
if (rightInitStateIndex != -1) {
codeStream
.<API key>(currentScope, rightInitStateIndex);
}
right.<API key>(currentScope, codeStream, trueLabel, null, valueRequired && !rightIsConst);
if (valueRequired && rightIsConst && rightIsTrue) {
codeStream.goto_(trueLabel);
codeStream.<API key>(codeStream.position);
}
}
} else {
// implicit falling through the TRUE case
if (trueLabel == null) {
Label internalTrueLabel = new Label(codeStream);
left.<API key>(currentScope, codeStream, internalTrueLabel, null, !leftIsConst);
// need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1
if (leftIsConst && leftIsTrue) {
internalTrueLabel.place();
break generateOperands; // no need to generate right operand
}
if (rightInitStateIndex != -1) {
codeStream
.<API key>(currentScope, rightInitStateIndex);
}
right.<API key>(currentScope, codeStream, null, falseLabel, valueRequired && !rightIsConst);
if (valueRequired && rightIsConst) {
if (!rightIsTrue) {
codeStream.goto_(falseLabel);
codeStream.<API key>(codeStream.position);
}
}
internalTrueLabel.place();
} else {
// no implicit fall through TRUE/FALSE --> should never occur
}
}
}
if (<API key> != -1) {
codeStream.<API key>(currentScope, <API key>);
}
}
public boolean <API key>() {
return false;
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
left.traverse(visitor, scope);
right.traverse(visitor, scope);
}
visitor.endVisit(this, scope);
}
} |
#!/bin/bash
[ $# -lt 3 ] && { echo "Usage: $0 <<API key>> <Author> <GitHub Username>"; exit 1; }
openHABVersion=2.5.0-SNAPSHOT
camelcaseId=$1
id=`echo $camelcaseId | tr '[:upper:]' '[:lower:]'`
author=$2
githubUser=$3
mvn -s archetype-settings.xml archetype:generate -N \
-DarchetypeGroupId=org.openhab.core.tools.archetypes \
-<API key>=org.openhab.core.tools.archetypes.binding \
-DarchetypeVersion=$openHABVersion \
-DgroupId=org.openhab.binding \
-DartifactId=org.openhab.binding.$id \
-Dpackage=org.openhab.binding.$id \
-Dversion=$openHABVersion \
-DbindingId=$id \
-DbindingIdCamelCase=$camelcaseId \
-DvendorName=openHAB \
-Dnamespace=org.openhab \
-Dauthor="$author" \
-DgithubUser="$githubUser"
directory="org.openhab.binding.$id/"
cp ../src/etc/NOTICE "$directory" |
package org.eclipse.jdt.internal.core.search.indexing;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.internal.core.search.processing.IJob;
public abstract class IndexRequest implements IJob {
protected boolean isCancelled = false;
protected IPath containerPath;
protected IndexManager manager;
public IndexRequest(IPath containerPath, IndexManager manager) {
this.containerPath = containerPath;
this.manager = manager;
}
public boolean belongsTo(String <API key>) {
// used to remove pending jobs because the project was deleted... not to delete index files
// can be found either by project name or JAR path name
return <API key>.equals(this.containerPath.segment(0))
|| <API key>.equals(this.containerPath.toString());
}
public void cancel() {
this.manager.jobWasCancelled(this.containerPath);
this.isCancelled = true;
}
public void ensureReadyToRun() {
// tag the index as inconsistent
this.manager.aboutToUpdateIndex(this.containerPath, updatedIndexState());
}
public String getJobFamily() {
return this.containerPath.toString();
}
protected Integer updatedIndexState() {
return IndexManager.UPDATING_STATE;
}
} |
package org.openhab.binding.yamahareceiver.internal.hardware;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.<API key>;
import org.openhab.binding.yamahareceiver.internal.<API key>.Zone;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* Yamaha Receiver Proxy used to control a yamaha receiver with HTTP/XML
*
* @author Eric Thill
* @author Ben Jones
* @since 1.6.0
*/
public class YamahaReceiverProxy {
public static final int VOLUME_MIN = -80;
public static final int VOLUME_MAX = 16;
private final <API key> dbf = <API key>.newInstance();
private final String host;
public YamahaReceiverProxy(String host) {
this.host = host;
}
public String getHost() {
return host;
}
public void setPower(Zone zone, boolean on) throws IOException {
if (on) {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Power_Control><Power>On</Power></Power_Control></" + zone + "></YAMAHA_AV>");
} else {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Power_Control><Power>Standby</Power></Power_Control></" + zone + "></YAMAHA_AV>");
}
}
public void setVolume(Zone zone, float volume) throws IOException {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Volume><Lvl><Val>" + (int) (volume * 10) + "</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></"
+ zone + "></YAMAHA_AV>");
}
public void setMute(Zone zone, boolean mute) throws IOException {
if (mute) {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Volume><Mute>On</Mute></Volume></" + zone + "></YAMAHA_AV>");
} else {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Volume><Mute>Off</Mute></Volume></" + zone + "></YAMAHA_AV>");
}
}
public void setInput(Zone zone, String name) throws IOException {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Input><Input_Sel>" + name + "</Input_Sel></Input></" + zone + "></YAMAHA_AV>");
}
public void setSurroundProgram(Zone zone, String name) throws IOException {
postAndGetResponse("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><" + zone
+ "><Surround><Program_Sel><Current><Sound_Program>" + name
+ "</Sound_Program></Current></Program_Sel></Surround></" + zone + "></YAMAHA_AV>");
}
public void setNetRadio(int lineNo) throws IOException {
/* Jump to specified line in preset list */
postAndGetResponse(
"<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><NET_RADIO><Play_Control><Preset><Preset_Sel>"
+ lineNo + "</Preset_Sel></Preset></Play_Control></NET_RADIO></YAMAHA_AV>");
}
public YamahaReceiverState getState(Zone zone) throws IOException {
Document doc = <API key>("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"GET\"><" + zone
+ "><Basic_Status>GetParam</Basic_Status></" + zone + "></YAMAHA_AV>");
Node basicStatus = getNode(doc.getFirstChild(), "" + zone + "/Basic_Status");
Node powerNode = getNode(basicStatus, "Power_Control/Power");
boolean power = powerNode != null ? "On".equalsIgnoreCase(powerNode.getTextContent()) : false;
Node inputNode = getNode(basicStatus, "Input/Input_Sel");
String input = inputNode != null ? inputNode.getTextContent() : null;
Node soundProgramNode = getNode(basicStatus, "Surround/Program_Sel/Current/Sound_Program");
String soundProgram = soundProgramNode != null ? soundProgramNode.getTextContent() : null;
Node volumeNode = getNode(basicStatus, "Volume/Lvl/Val");
float volume = volumeNode != null ? Float.parseFloat(volumeNode.getTextContent()) * .1f : VOLUME_MIN;
Node muteNode = getNode(basicStatus, "Volume/Mute");
boolean mute = muteNode != null ? "On".equalsIgnoreCase(muteNode.getTextContent()) : false;
return new YamahaReceiverState(power, input, soundProgram, volume, mute);
}
public List<String> getInputsList(Zone zone) throws IOException {
List<String> names = new ArrayList<String>();
Document doc = <API key>("<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"GET\"><" + zone
+ "><Input><Input_Sel_Item>GetParam</Input_Sel_Item></Input></" + zone + "></YAMAHA_AV>");
Node inputSelItem = getNode(doc.getFirstChild(), zone + "/Input/Input_Sel_Item");
NodeList items = inputSelItem.getChildNodes();
for (int i = 0; i < items.getLength(); i++) {
Element item = (Element) items.item(i);
String name = item.<API key>("Param").item(0).getTextContent();
boolean writable = item.<API key>("RW").item(0).getTextContent().contains("W");
if (writable) {
names.add(name);
}
}
return names;
}
private static Node getNode(Node root, String nodePath) {
String[] nodePathArr = nodePath.split("/");
return getNode(root, nodePathArr, 0);
}
private static Node getNode(Node parent, String[] nodePath, int offset) {
if (parent == null) {
return null;
}
if (offset < nodePath.length - 1) {
return getNode(((Element) parent).<API key>(nodePath[offset]).item(0), nodePath, offset + 1);
} else {
return ((Element) parent).<API key>(nodePath[offset]).item(0);
}
}
private Document <API key>(String message) throws IOException {
String response = postAndGetResponse(message);
String xml = response.toString();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
return db.parse(new InputSource(new StringReader(xml)));
} catch (Exception e) {
throw new IOException("Could not handle response", e);
}
}
private String postAndGetResponse(String message) throws IOException {
HttpURLConnection connection = null;
try {
URL url = new URL("http://" + host + "/YamahaRemoteControl/ctrl");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Length", "" + Integer.toString(message.length()));
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
// Send request
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(message);
wr.flush();
wr.close();
// Read response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while ((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
return response.toString();
} catch (Exception e) {
throw new IOException("Could not handle http post", e);
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
} |
package org.openhab.binding.ddwrt;
import org.openhab.core.binding.BindingProvider;
import org.openhab.core.items.Item;
/**
* This interface is implemented by classes that can map openHAB items to
* DD-WRT binding types.
*
* Implementing classes should register themselves as a service in order to be
* taken into account.
*
* @author Kai Kreuzer
* @author Markus Eckhardt
* @since 1.9.0
*/
public interface <API key> extends BindingProvider {
/** binds wlan state to an item */
static final public String TYPE_ROUTER_TYPE = "routertype";
/** binds wlan state to an item */
static final public String TYPE_WLAN_24 = "wlan24";
/** binds wlan state to an item */
static final public String TYPE_WLAN_50 = "wlan50";
/** binds guest wlan state to an item */
static final public String TYPE_WLAN_GUEST = "wlanguest";
static final public String[] TYPES = { TYPE_ROUTER_TYPE, TYPE_WLAN_24, TYPE_WLAN_50, TYPE_WLAN_GUEST };
/**
* Returns the Type of the Item identified by {@code itemName}
*
* @param itemName
* the name of the item to find the type for
* @return the type of the Item identified by {@code itemName}
*/
Class<? extends Item> getItemType(String itemName);
/**
* Returns the binding type for an item name
*
* @param itemName
* the name of the item
* @return the items binding type
*/
String getType(String itemName);
/**
* Provides an array of all item names of this provider for a given binding
* type
*
* @param bindingType
* the binding type of the items
* @return an array of all item names of this provider for the given binding
* type
*/
String[] getItemNamesForType(String bindingType);
} |
<?php
return array(
'Cezpdf' => 'lib/ezpdf/classes/class.ezpdf.php',
'Cpdf' => 'lib/ezpdf/classes/class.pdf.php',
'eZ1337Translator' => 'lib/ezi18n/classes/ez1337translator.php',
'eZAlphabetOperator' => 'kernel/common/ezalphabetoperator.php',
'<API key>' => 'kernel/classes/<API key>/ezapprove/<API key>.php',
'eZApproveType' => 'kernel/classes/workflowtypes/event/ezapprove/ezapprovetype.php',
'eZAudit' => 'kernel/classes/ezaudit.php',
'eZAuthor' => 'kernel/classes/datatypes/ezauthor/ezauthor.php',
'eZAuthorType' => 'kernel/classes/datatypes/ezauthor/ezauthortype.php',
'eZAutoLinkOperator' => 'kernel/common/ezautolinkoperator.php',
'eZAutoloadGenerator' => 'kernel/private/classes/ezautoloadgenerator.php',
'eZBCMath' => 'lib/ezmath/classes/mathhandlers/ezbcmath.php',
'eZBZIP2Handler' => 'lib/ezfile/classes/<API key>.php',
'eZBasket' => 'kernel/classes/ezbasket.php',
'eZBinaryFile' => 'kernel/classes/datatypes/ezbinaryfile/ezbinaryfile.php',
'eZBinaryFileHandler' => 'kernel/classes/ezbinaryfilehandler.php',
'eZBinaryFileType' => 'kernel/classes/datatypes/ezbinaryfile/ezbinaryfiletype.php',
'eZBooleanType' => 'kernel/classes/datatypes/ezboolean/ezbooleantype.php',
'eZBorkTranslator' => 'lib/ezi18n/classes/ezborktranslator.php',
'eZCLI' => 'lib/ezutils/classes/ezcli.php',
'eZCache' => 'kernel/classes/ezcache.php',
'eZCharTransform' => 'lib/ezi18n/classes/ezchartransform.php',
'eZCharsetInfo' => 'lib/ezi18n/classes/ezcharsetinfo.php',
'<API key>' => 'kernel/class/<API key>.php',
'eZClassFunctions' => 'kernel/class/ezclassfunctions.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/interfaces/<API key>.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/interfaces/<API key>.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/<API key>.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/<API key>.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/interfaces/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/private/classes/exceptions/cluster/noconnection.php',
'<API key>' => 'kernel/private/classes/exceptions/cluster/nodatabase.php',
'eZCodeMapper' => 'lib/ezi18n/classes/ezcodemapper.php',
'eZCodePage' => 'lib/ezi18n/classes/ezcodepage.php',
'eZCodePageCodec' => 'lib/ezi18n/classes/ezcodepagecodec.php',
'eZCodePageMapper' => 'lib/ezi18n/classes/ezcodepagemapper.php',
'eZCodeTemplate' => 'kernel/classes/ezcodetemplate.php',
'<API key>' => 'kernel/classes/notification/event/ezcollaboration/ezcollaborationtype.php',
'<API key>' => 'kernel/collaboration/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZCollaborationItem' => 'kernel/classes/ezcollaborationitem.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/notification/handler/<API key>/<API key>.php',
'<API key>' => 'kernel/classes/notification/handler/<API key>/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZContentBrowse' => 'kernel/classes/ezcontentbrowse.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZContentCache' => 'kernel/classes/ezcontentcache.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZContentClass' => 'kernel/classes/ezcontentclass.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZContentClassGroup' => 'kernel/classes/ezcontentclassgroup.php',
'eZContentClassName' => 'kernel/classes/ezcontentclassname.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/packagecreators/ezcontentclass/<API key>.php',
'<API key>' => 'kernel/classes/packagehandlers/ezcontentclass/<API key>.php',
'<API key>' => 'kernel/content/<API key>.php',
'eZContentFunctions' => 'kernel/classes/ezcontentfunctions.php',
'eZContentLanguage' => 'kernel/classes/ezcontentlanguage.php',
'eZContentObject' => 'kernel/classes/ezcontentobject.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/packagecreators/ezcontentobject/<API key>.php',
'<API key>' => 'kernel/classes/packagehandlers/ezcontentobject/<API key>.php',
'<API key>' => 'kernel/classes/packageinstallers/ezcontentobject/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/content/<API key>.php',
'<API key>' => 'kernel/common/<API key>.php',
'eZContentUpload' => 'kernel/classes/ezcontentupload.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZCountryType' => 'kernel/classes/datatypes/ezcountry/ezcountrytype.php',
'eZCurrency' => 'lib/ezlocale/classes/ezcurrency.php',
'eZCurrencyConverter' => 'kernel/shop/classes/ezcurrencyconverter.php',
'eZCurrencyData' => 'kernel/shop/classes/ezcurrencydata.php',
'eZCurrentTimeType' => 'kernel/classes/notification/event/ezcurrenttime/ezcurrenttimetype.php',
'eZDB' => 'lib/ezdb/classes/ezdb.php',
'eZDBException' => 'kernel/private/classes/exceptions/database/exception.php',
'eZDBFileHandler' => 'kernel/classes/clusterfilehandlers/ezdbfilehandler.php',
'<API key>' => 'kernel/classes/clusterfilehandlers/dbbackends/mysql.php',
'<API key>' => 'kernel/classes/clusterfilehandlers/dbbackends/mysqli.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZDBInterface' => 'lib/ezdb/classes/ezdbinterface.php',
'<API key>' => 'kernel/private/classes/exceptions/database/noconnection.php',
'eZDBPackageHandler' => 'kernel/classes/packagehandlers/ezdb/ezdbpackagehandler.php',
'eZDBSchemaInterface' => 'lib/ezdbschema/classes/ezdbschemainterface.php',
'eZDBTool' => 'lib/ezdb/classes/ezdbtool.php',
'eZDFSFileHandler' => 'kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/dfsbackends/dfs.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/dfsbackends/mysql.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/dfsbackends/mysqli.php',
'<API key>' => 'kernel/private/classes/exceptions/cluster/<API key>.php',
'<API key>' => 'kernel/private/classes/exceptions/cluster/<API key>.php',
'<API key>' => 'kernel/private/classes/exceptions/cluster/table_not_found.php',
'<API key>' => 'kernel/private/classes/clusterfilehandlers/dfsbackends/mysqlbackenderror.php',
'eZDataType' => 'kernel/classes/ezdatatype.php',
'eZDate' => 'lib/ezlocale/classes/ezdate.php',
'<API key>' => 'kernel/common/<API key>.php',
'eZDateTime' => 'lib/ezlocale/classes/ezdatetime.php',
'eZDateTimeType' => 'kernel/classes/datatypes/ezdatetime/ezdatetimetype.php',
'eZDateTimeValidator' => 'lib/ezutils/classes/ezdatetimevalidator.php',
'eZDateType' => 'kernel/classes/datatypes/ezdate/ezdatetype.php',
'eZDateUtils' => 'lib/ezlocale/classes/ezdateutils.php',
'eZDbSchema' => 'lib/ezdbschema/classes/ezdbschema.php',
'eZDbSchemaChecker' => 'lib/ezdbschema/classes/ezdbschemachecker.php',
'eZDebug' => 'lib/ezutils/classes/ezdebug.php',
'eZDebugSetting' => 'lib/ezutils/classes/ezdebugsetting.php',
'<API key>' => 'kernel/classes/basketinfohandlers/<API key>.php',
'<API key>' => 'kernel/classes/<API key>/<API key>.php',
'<API key>' => 'kernel/classes/shopaccounthandlers/<API key>.php',
'eZDefaultVATHandler' => 'kernel/classes/vathandlers/ezdefaultvathandler.php',
'eZDiff' => 'lib/ezdiff/classes/ezdiff.php',
'<API key>' => 'lib/ezdiff/classes/<API key>.php',
'<API key>' => 'lib/ezdiff/classes/<API key>.php',
'eZDiffContent' => 'lib/ezdiff/classes/ezdiffcontent.php',
'eZDiffEngine' => 'lib/ezdiff/classes/ezdiffengine.php',
'eZDiffMatrix' => 'lib/ezdiff/classes/ezdiffmatrix.php',
'eZDiffTextEngine' => 'lib/ezdiff/classes/ezdifftextengine.php',
'eZDiffXMLTextEngine' => 'lib/ezdiff/classes/ezdiffxmltextengine.php',
'eZDir' => 'lib/ezfile/classes/ezdir.php',
'eZDiscount' => 'kernel/classes/ezdiscount.php',
'eZDiscountRule' => 'kernel/classes/ezdiscountrule.php',
'eZDiscountSubRule' => 'kernel/classes/ezdiscountsubrule.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZECBHandler' => 'kernel/shop/classes/<API key>/ezecb/ezecbhandler.php',
'eZEXIFImageAnalyzer' => 'lib/ezimage/classes/ezexifimageanalyzer.php',
'eZEmailType' => 'kernel/classes/datatypes/ezemail/ezemailtype.php',
'eZEnum' => 'kernel/classes/datatypes/ezenum/ezenum.php',
'eZEnumObjectValue' => 'kernel/classes/datatypes/ezenum/ezenumobjectvalue.php',
'eZEnumType' => 'kernel/classes/datatypes/ezenum/ezenumtype.php',
'eZEnumValue' => 'kernel/classes/datatypes/ezenum/ezenumvalue.php',
'eZError' => 'kernel/classes/ezerror.php',
'<API key>' => 'kernel/shop/classes/<API key>/<API key>.php',
'eZExecution' => 'lib/ezutils/classes/ezexecution.php',
'eZExpiryHandler' => 'lib/ezutils/classes/ezexpiryhandler.php',
'eZExtension' => 'lib/ezutils/classes/ezextension.php',
'<API key>' => 'kernel/classes/packagecreators/ezextension/<API key>.php',
'<API key>' => 'kernel/classes/packagehandlers/ezextension/<API key>.php',
'eZFS2FileHandler' => 'kernel/private/classes/clusterfilehandlers/ezfs2filehandler.php',
'eZFSFileHandler' => 'kernel/classes/clusterfilehandlers/ezfsfilehandler.php',
'eZFile' => 'lib/ezfile/classes/ezfile.php',
'eZFileDirectHandler' => 'kernel/classes/binaryhandlers/ezfiledirect/ezfiledirecthandler.php',
'eZFileHandler' => 'lib/ezfile/classes/ezfilehandler.php',
'<API key>' => 'kernel/classes/packagehandlers/ezfile/<API key>.php',
'<API key>' => 'kernel/classes/binaryhandlers/ezfilepassthrough/<API key>.php',
'eZFileTransport' => 'lib/ezutils/classes/ezfiletransport.php',
'<API key>' => 'kernel/classes/workflowtypes/event/<API key>/<API key>.php',
'eZFloatType' => 'kernel/classes/datatypes/ezfloat/ezfloattype.php',
'eZFloatValidator' => 'lib/ezutils/classes/ezfloatvalidator.php',
'eZForgotPassword' => 'kernel/classes/datatypes/ezuser/ezforgotpassword.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'eZFunctionHandler' => 'lib/ezutils/classes/ezfunctionhandler.php',
'eZGIFImageAnalyzer' => 'lib/ezimage/classes/ezgifimageanalyzer.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'<API key>' => 'kernel/classes/notification/handler/ezgeneraldigest/<API key>.php',
'<API key>' => 'kernel/classes/notification/handler/ezgeneraldigest/<API key>.php',
'eZHTTPFile' => 'lib/ezutils/classes/ezhttpfile.php',
'eZHTTPHeader' => 'kernel/classes/ezhttpheader.php',
'eZHTTPPersistence' => 'lib/ezutils/classes/ezhttppersistence.php',
'eZHTTPTool' => 'lib/ezutils/classes/ezhttptool.php',
'eZINI' => 'lib/ezutils/classes/ezini.php',
'<API key>' => 'kernel/classes/packagehandlers/eziniaddon/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/ezisbn/<API key>.php',
'eZISBN13' => 'kernel/classes/datatypes/ezisbn/ezisbn13.php',
'eZISBNGroup' => 'kernel/classes/datatypes/ezisbn/ezisbngroup.php',
'eZISBNGroupRange' => 'kernel/classes/datatypes/ezisbn/ezisbngrouprange.php',
'<API key>' => 'kernel/classes/datatypes/ezisbn/<API key>.php',
'eZISBNType' => 'kernel/classes/datatypes/ezisbn/ezisbntype.php',
'eZIdentifierType' => 'kernel/classes/datatypes/ezidentifier/ezidentifiertype.php',
'eZImageAliasHandler' => 'kernel/classes/datatypes/ezimage/ezimagealiashandler.php',
'eZImageAnalyzer' => 'lib/ezimage/classes/ezimageanalyzer.php',
'eZImageFactory' => 'lib/ezimage/classes/ezimagefactory.php',
'eZImageFile' => 'kernel/classes/datatypes/ezimage/ezimagefile.php',
'eZImageFont' => 'lib/ezimage/classes/ezimagefont.php',
'eZImageGDFactory' => 'lib/ezimage/classes/ezimagegdfactory.php',
'eZImageGDHandler' => 'lib/ezimage/classes/ezimagegdhandler.php',
'eZImageHandler' => 'lib/ezimage/classes/ezimagehandler.php',
'eZImageInterface' => 'lib/ezimage/classes/ezimageinterface.php',
'eZImageLayer' => 'lib/ezimage/classes/ezimagelayer.php',
'eZImageManager' => 'lib/ezimage/classes/ezimagemanager.php',
'eZImageObject' => 'lib/ezimage/classes/ezimageobject.php',
'eZImageShellFactory' => 'lib/ezimage/classes/ezimageshellfactory.php',
'eZImageShellHandler' => 'lib/ezimage/classes/ezimageshellhandler.php',
'eZImageTextLayer' => 'lib/ezimage/classes/ezimagetextlayer.php',
'eZImageType' => 'kernel/classes/datatypes/ezimage/ezimagetype.php',
'<API key>' => 'kernel/infocollector/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZIniSettingType' => 'kernel/classes/datatypes/ezinisetting/ezinisettingtype.php',
'eZInputValidator' => 'lib/ezutils/classes/ezinputvalidator.php',
'<API key>' => 'kernel/classes/packagehandlers/ezinstallscript/<API key>.php',
'<API key>' => 'kernel/classes/packageinstallers/ezinstallscript/<API key>.php',
'eZIntegerType' => 'kernel/classes/datatypes/ezinteger/ezintegertype.php',
'eZIntegerValidator' => 'lib/ezutils/classes/ezintegervalidator.php',
'eZKernelOperator' => 'kernel/common/ezkerneloperator.php',
'eZKeyword' => 'kernel/classes/datatypes/ezkeyword/ezkeyword.php',
'eZKeywordType' => 'kernel/classes/datatypes/ezkeyword/ezkeywordtype.php',
'eZLDAPUser' => 'kernel/classes/datatypes/ezuser/ezldapuser.php',
'<API key>' => 'kernel/layout/<API key>.php',
'eZLintSchema' => 'lib/ezdbschema/classes/ezlintschema.php',
'eZLocale' => 'lib/ezlocale/classes/ezlocale.php',
'eZLog' => 'lib/ezfile/classes/ezlog.php',
'eZMBStringMapper' => 'lib/ezi18n/classes/ezmbstringmapper.php',
'eZMD5' => 'lib/ezfile/classes/ezmd5.php',
'eZMail' => 'lib/ezutils/classes/ezmail.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'eZMailTransport' => 'lib/ezutils/classes/ezmailtransport.php',
'eZMath' => 'lib/ezutils/classes/ezmath.php',
'eZMatrix' => 'kernel/classes/datatypes/ezmatrix/ezmatrix.php',
'eZMatrixDefinition' => 'kernel/classes/datatypes/ezmatrix/ezmatrixdefinition.php',
'eZMatrixType' => 'kernel/classes/datatypes/ezmatrix/ezmatrixtype.php',
'eZMedia' => 'kernel/classes/datatypes/ezmedia/ezmedia.php',
'eZMediaType' => 'kernel/classes/datatypes/ezmedia/ezmediatype.php',
'eZMimeType' => 'lib/ezutils/classes/ezmimetype.php',
'eZModule' => 'lib/ezutils/classes/ezmodule.php',
'<API key>' => 'lib/ezutils/classes/<API key>.php',
'<API key>' => 'lib/ezutils/classes/<API key>.php',
'eZModuleOperator' => 'kernel/common/ezmoduleoperator.php',
'<API key>' => 'kernel/common/<API key>.php',
'eZMultiOption' => 'kernel/classes/datatypes/ezmultioption/ezmultioption.php',
'eZMultiOption2' => 'kernel/classes/datatypes/ezmultioption2/ezmultioption2.php',
'eZMultiOption2Type' => 'kernel/classes/datatypes/ezmultioption2/ezmultioption2type.php',
'eZMultiOptionType' => 'kernel/classes/datatypes/ezmultioption/ezmultioptiontype.php',
'eZMultiPrice' => 'kernel/classes/datatypes/ezmultiprice/ezmultiprice.php',
'eZMultiPriceData' => 'kernel/shop/classes/ezmultipricedata.php',
'eZMultiPriceType' => 'kernel/classes/datatypes/ezmultiprice/ezmultipricetype.php',
'eZMultiplexerType' => 'kernel/classes/workflowtypes/event/ezmultiplexer/ezmultiplexertype.php',
'eZMutex' => 'lib/ezutils/classes/ezmutex.php',
'eZMySQLBackendError' => 'kernel/classes/clusterfilehandlers/dbbackends/mysqlbackenderror.php',
'eZMySQLCharset' => 'lib/ezdb/classes/ezmysqlcharset.php',
'eZMySQLDB' => 'lib/ezdb/classes/ezmysqldb.php',
'eZMySQLiDB' => 'lib/ezdb/classes/ezmysqlidb.php',
'eZMysqlSchema' => 'lib/ezdbschema/classes/ezmysqlschema.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZNavigationPart' => 'kernel/classes/eznavigationpart.php',
'<API key>' => 'lib/ezfile/classes/<API key>.php',
'eZNodeAssignment' => 'kernel/classes/eznodeassignment.php',
'eZNodeviewfunctions' => 'kernel/classes/eznodeviewfunctions.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'eZNotificationEvent' => 'kernel/classes/notification/eznotificationevent.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'<API key>' => 'kernel/notification/<API key>.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'<API key>' => 'kernel/classes/notification/<API key>.php',
'eZNullDB' => 'lib/ezdb/classes/eznulldb.php',
'eZObjectForwarder' => 'kernel/common/ezobjectforwarder.php',
'<API key>' => 'kernel/classes/datatypes/<API key>/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/ezobjectrelation/<API key>.php',
'eZOperationHandler' => 'lib/ezutils/classes/ezoperationhandler.php',
'eZOperationMemento' => 'lib/ezutils/classes/ezoperationmemento.php',
'eZOption' => 'kernel/classes/datatypes/ezoption/ezoption.php',
'eZOptionType' => 'kernel/classes/datatypes/ezoption/ezoptiontype.php',
'eZOrder' => 'kernel/classes/ezorder.php',
'eZOrderItem' => 'kernel/classes/ezorderitem.php',
'eZOrderStatus' => 'kernel/classes/ezorderstatus.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZOverride' => 'kernel/common/ezoverride.php',
'eZPDF' => 'lib/ezpdf/classes/ezpdf.php',
'eZPDFExport' => 'kernel/classes/ezpdfexport.php',
'eZPDFParser' => 'kernel/classes/datatypes/ezbinaryfile/plugins/ezpdfparser.php',
'eZPDFTable' => 'lib/ezpdf/classes/class.ezpdftable.php',
'eZPDFXMLOutput' => 'kernel/classes/datatypes/ezxmltext/handlers/output/ezpdfxmloutput.php',
'eZPHPCreator' => 'lib/ezutils/classes/ezphpcreator.php',
'eZPHPMath' => 'lib/ezmath/classes/mathhandlers/ezphpmath.php',
'eZPackage' => 'kernel/classes/ezpackage.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/package/<API key>.php',
'eZPackageHandler' => 'kernel/classes/ezpackagehandler.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZPackageOperator' => 'kernel/common/ezpackageoperator.php',
'eZPackageType' => 'kernel/classes/datatypes/ezpackage/ezpackagetype.php',
'eZPathElement' => 'kernel/classes/ezpathelement.php',
'<API key>' => 'kernel/shop/classes/<API key>.php',
'eZPaymentGateway' => 'kernel/shop/classes/ezpaymentgateway.php',
'<API key>' => 'kernel/classes/workflowtypes/event/ezpaymentgateway/<API key>.php',
'eZPaymentLogger' => 'kernel/classes/workflowtypes/event/ezpaymentgateway/ezpaymentlogger.php',
'eZPaymentObject' => 'kernel/shop/classes/ezpaymentobject.php',
'eZPendingActions' => 'kernel/classes/ezpendingactions.php',
'eZPersistentObject' => 'kernel/classes/ezpersistentobject.php',
'eZPgsqlSchema' => 'lib/ezdbschema/classes/ezpgsqlschema.php',
'eZPlainTextParser' => 'kernel/classes/datatypes/ezbinaryfile/plugins/ezplaintextparser.php',
'eZPlainXMLOutput' => 'kernel/classes/datatypes/ezxmltext/handlers/output/ezplainxmloutput.php',
'eZPolicy' => 'kernel/classes/ezpolicy.php',
'eZPolicyLimitation' => 'kernel/classes/ezpolicylimitation.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZPostgreSQLDB' => 'lib/ezdb/classes/ezpostgresqldb.php',
'eZPreferences' => 'kernel/classes/ezpreferences.php',
'eZPrice' => 'kernel/classes/datatypes/ezprice/ezprice.php',
'eZPriceType' => 'kernel/classes/datatypes/ezprice/ezpricetype.php',
'eZProcess' => 'lib/ezutils/classes/ezprocess.php',
'eZProductCategory' => 'kernel/classes/ezproductcategory.php',
'<API key>' => 'kernel/classes/datatypes/ezproductcategory/<API key>.php',
'eZProductCollection' => 'kernel/classes/ezproductcollection.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZPublishSDK' => 'lib/version.php',
'eZPublishType' => 'kernel/classes/notification/event/ezpublish/ezpublishtype.php',
'eZRSSEditFunction' => 'kernel/rss/edit_functions.php',
'eZRSSExport' => 'kernel/classes/ezrssexport.php',
'eZRSSExportItem' => 'kernel/classes/ezrssexportitem.php',
'<API key>' => 'kernel/rss/<API key>.php',
'eZRSSImport' => 'kernel/classes/ezrssimport.php',
'eZRandomTranslator' => 'lib/ezi18n/classes/ezrandomtranslator.php',
'eZRangeOption' => 'kernel/classes/datatypes/ezrangeoption/ezrangeoption.php',
'eZRangeOptionType' => 'kernel/classes/datatypes/ezrangeoption/ezrangeoptiontype.php',
'eZRedirectGateway' => 'kernel/shop/classes/ezredirectgateway.php',
'eZRedirectManager' => 'kernel/classes/ezredirectmanager.php',
'eZRegExpValidator' => 'lib/ezutils/classes/ezregexpvalidator.php',
'eZRemoteIdUtility' => 'lib/ezutils/classes/ezremoteidutility.php',
'eZRole' => 'kernel/classes/ezrole.php',
'<API key>' => 'kernel/role/<API key>.php',
'eZRunCronjobs' => 'kernel/classes/ezruncronjobs.php',
'eZSMTPTransport' => 'lib/ezutils/classes/ezsmtptransport.php',
'eZSOAPBody' => 'lib/ezsoap/classes/ezsoapbody.php',
'eZSOAPClient' => 'lib/ezsoap/classes/ezsoapclient.php',
'eZSOAPCodec' => 'lib/ezsoap/classes/ezsoapcodec.php',
'eZSOAPEnvelope' => 'lib/ezsoap/classes/ezsoapenvelope.php',
'eZSOAPFault' => 'lib/ezsoap/classes/ezsoapfault.php',
'eZSOAPHeader' => 'lib/ezsoap/classes/ezsoapheader.php',
'eZSOAPParameter' => 'lib/ezsoap/classes/ezsoapparameter.php',
'eZSOAPRequest' => 'lib/ezsoap/classes/ezsoaprequest.php',
'eZSOAPResponse' => 'lib/ezsoap/classes/ezsoapresponse.php',
'eZSOAPServer' => 'lib/ezsoap/classes/ezsoapserver.php',
'eZSSLZone' => 'kernel/classes/ezsslzone.php',
'eZScript' => 'kernel/classes/ezscript.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'eZScriptTrashPurge' => 'kernel/private/classes/ezscripttrashpurge.php',
'eZSearch' => 'kernel/classes/ezsearch.php',
'eZSearchEngine' => 'kernel/search/plugins/ezsearchengine/ezsearchengine.php',
'<API key>' => 'kernel/search/<API key>.php',
'eZSearchLog' => 'kernel/classes/ezsearchlog.php',
'eZSection' => 'kernel/classes/ezsection.php',
'<API key>' => 'kernel/section/<API key>.php',
'eZSelectionType' => 'kernel/classes/datatypes/ezselection/ezselectiontype.php',
'eZSendmailTransport' => 'lib/ezutils/classes/ezsendmailtransport.php',
'<API key>' => 'kernel/classes/<API key>.php',
'eZSession' => 'lib/ezsession/classes/ezsession.php',
'<API key>' => 'kernel/setup/<API key>.php',
'eZSetupSummary' => 'kernel/setup/ezsetup_summary.php',
'eZShippingManager' => 'kernel/classes/ezshippingmanager.php',
'<API key>' => 'kernel/classes/<API key>.php',
'<API key>' => 'kernel/shop/<API key>.php',
'eZShopFunctions' => 'kernel/shop/classes/ezshopfunctions.php',
'<API key>' => 'kernel/shop/<API key>.php',
'eZShuffleTranslator' => 'lib/ezi18n/classes/ezshuffletranslator.php',
'eZSimplePrice' => 'kernel/shop/classes/ezsimpleprice.php',
'<API key>' => 'kernel/classes/workflowtypes/event/ezsimpleshipping/<API key>.php',
'<API key>' => 'kernel/classes/shopaccounthandlers/<API key>.php',
'<API key>' => 'kernel/common/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/ezxmltext/handlers/input/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/ezxmltext/handlers/input/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/ezxmltext/handlers/input/<API key>.php',
'eZSiteAccess' => 'kernel/classes/ezsiteaccess.php',
'eZSiteData' => 'kernel/classes/ezsitedata.php',
'eZSiteInstaller' => 'kernel/classes/ezsiteinstaller.php',
'eZStaticCache' => 'kernel/classes/ezstaticcache.php',
'eZStepCreateSites' => 'kernel/setup/steps/ezstep_create_sites.php',
'eZStepData' => 'kernel/setup/steps/ezstep_data.php',
'<API key>' => 'kernel/setup/steps/<API key>.php',
'eZStepDatabaseInit' => 'kernel/setup/steps/<API key>.php',
'eZStepEmailSettings' => 'kernel/setup/steps/<API key>.php',
'eZStepFinal' => 'kernel/setup/steps/ezstep_final.php',
'eZStepInstaller' => 'kernel/setup/steps/ezstep_installer.php',
'<API key>' => 'kernel/setup/steps/<API key>.php',
'<API key>' => 'kernel/setup/steps/<API key>.php',
'eZStepRegistration' => 'kernel/setup/steps/ezstep_registration.php',
'eZStepSecurity' => 'kernel/setup/steps/ezstep_security.php',
'eZStepSiteAccess' => 'kernel/setup/steps/ezstep_site_access.php',
'eZStepSiteAdmin' => 'kernel/setup/steps/ezstep_site_admin.php',
'eZStepSiteDetails' => 'kernel/setup/steps/ezstep_site_details.php',
'eZStepSitePackages' => 'kernel/setup/steps/<API key>.php',
'eZStepSiteTemplates' => 'kernel/setup/steps/<API key>.php',
'eZStepSiteTypes' => 'kernel/setup/steps/ezstep_site_types.php',
'eZStepSystemCheck' => 'kernel/setup/steps/ezstep_system_check.php',
'<API key>' => 'kernel/setup/steps/<API key>.php',
'eZStepWelcome' => 'kernel/setup/steps/ezstep_welcome.php',
'eZStringType' => 'kernel/classes/datatypes/ezstring/ezstringtype.php',
'eZStringUtils' => 'lib/ezutils/classes/ezstringutils.php',
'<API key>' => 'kernel/classes/packagecreators/ezstyle/<API key>.php',
'eZSubTreeHandler' => 'kernel/classes/notification/handler/ezsubtree/ezsubtreehandler.php',
'eZSubtreeCache' => 'kernel/classes/ezsubtreecache.php',
'<API key>' => 'kernel/classes/notification/handler/ezsubtree/<API key>.php',
'<API key>' => 'kernel/classes/datatypes/<API key>/<API key>.php',
'eZSys' => 'lib/ezutils/classes/ezsys.php',
'eZSysInfo' => 'lib/ezutils/classes/ezsysinfo.php',
'eZTOCOperator' => 'kernel/common/eztocoperator.php',
'eZTSTranslator' => 'lib/ezi18n/classes/eztstranslator.php',
'eZTemplate' => 'lib/eztemplate/classes/eztemplate.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateCompiler' => 'lib/eztemplate/classes/eztemplatecompiler.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'kernel/common/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateLoop' => 'lib/eztemplate/classes/eztemplateloop.php',
'<API key>' => 'lib/eztemplate/classes/eztemplateloop.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateNodeTool' => 'lib/eztemplate/classes/eztemplatenodetool.php',
'eZTemplateOperator' => 'lib/eztemplate/classes/eztemplateoperator.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateOptimizer' => 'lib/eztemplate/classes/eztemplateoptimizer.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateParser' => 'lib/eztemplate/classes/eztemplateparser.php',
'eZTemplateRoot' => 'lib/eztemplate/classes/eztemplateroot.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'eZTemplateTreeCache' => 'lib/eztemplate/classes/eztemplatetreecache.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'lib/eztemplate/classes/<API key>.php',
'<API key>' => 'kernel/common/<API key>.php',
'eZTextCodec' => 'lib/ezi18n/classes/eztextcodec.php',
'eZTextDiff' => 'lib/ezdiff/classes/eztextdiff.php',
'eZTextFileUser' => 'kernel/classes/datatypes/ezuser/eztextfileuser.php',
'eZTextInputParser' => 'kernel/classes/eztextinputparser.php',
'eZTextTool' => 'lib/ezutils/classes/eztexttool.php',
'eZTextType' => 'kernel/classes/datatypes/eztext/eztexttype.php',
'eZTime' => 'lib/ezlocale/classes/eztime.php',
'eZTimeType' => 'kernel/classes/datatypes/eztime/eztimetype.php',
'eZTipafriendCounter' => 'kernel/classes/eztipafriendcounter.php',
'eZTipafriendRequest' => 'kernel/classes/eztipafriendrequest.php',
'eZTopMenuOperator' => 'kernel/common/eztopmenuoperator.php',
'eZTranslationCache' => 'lib/ezi18n/classes/eztranslationcache.php',
'eZTranslatorGroup' => 'lib/ezi18n/classes/eztranslatorgroup.php',
'eZTranslatorHandler' => 'lib/ezi18n/classes/eztranslatorhandler.php',
'eZTranslatorManager' => 'lib/ezi18n/classes/eztranslatormanager.php',
'eZTreeMenuOperator' => 'kernel/common/eztreemenuoperator.php',
'eZTrigger' => 'kernel/classes/eztrigger.php',
'eZURI' => 'lib/ezutils/classes/ezuri.php',
'eZURL' => 'kernel/classes/datatypes/ezurl/ezurl.php',
'eZURLAliasFilter' => 'kernel/classes/ezurlaliasfilter.php',
'<API key>' => 'kernel/private/classes/urlaliasfilters/<API key>.php',
'eZURLAliasML' => 'kernel/classes/ezurlaliasml.php',
'eZURLAliasQuery' => 'kernel/classes/ezurlaliasquery.php',
'<API key>' => 'kernel/url/<API key>.php',
'eZURLObjectLink' => 'kernel/classes/datatypes/ezurl/ezurlobjectlink.php',
'eZURLOperator' => 'kernel/common/ezurloperator.php',
'eZURLType' => 'kernel/classes/datatypes/ezurl/ezurltype.php',
'eZURLWildcard' => 'kernel/classes/ezurlwildcard.php',
'eZUTF8Codec' => 'lib/ezi18n/classes/ezutf8codec.php',
'eZUser' => 'kernel/classes/datatypes/ezuser/ezuser.php',
'eZUserAccountKey' => 'kernel/classes/datatypes/ezuser/ezuseraccountkey.php',
'eZUserDiscountRule' => 'kernel/classes/ezuserdiscountrule.php',
'<API key>' => 'kernel/user/<API key>.php',
'eZUserLoginHandler' => 'kernel/classes/datatypes/ezuser/ezuserloginhandler.php',
'<API key>' => 'kernel/user/<API key>.php',
'eZUserSetting' => 'kernel/classes/datatypes/ezuser/ezusersetting.php',
'<API key>' => 'kernel/classes/shopaccounthandlers/<API key>.php',
'eZUserType' => 'kernel/classes/datatypes/ezuser/ezusertype.php',
'eZVATManager' => 'kernel/classes/ezvatmanager.php',
'eZVatRule' => 'kernel/classes/ezvatrule.php',
'eZVatType' => 'kernel/classes/ezvattype.php',
'eZViewCounter' => 'kernel/classes/ezviewcounter.php',
'eZWaitUntilDate' => 'kernel/classes/workflowtypes/event/ezwaituntildate/ezwaituntildate.php',
'eZWaitUntilDateType' => 'kernel/classes/workflowtypes/event/ezwaituntildate/ezwaituntildatetype.php',
'<API key>' => 'kernel/classes/workflowtypes/event/ezwaituntildate/<API key>.php',
'<API key>' => 'kernel/private/classes/webdav/<API key>.php',
'<API key>' => 'kernel/private/classes/webdav/<API key>.php',
'<API key>' => 'kernel/classes/webdav/<API key>.php',
'eZWebDAVFileServer' => 'lib/ezwebdav/classes/ezwebdavfileserver.php',
'eZWebDAVServer' => 'lib/ezwebdav/classes/ezwebdavserver.php',
'eZWishList' => 'kernel/classes/ezwishlist.php',
'eZWizardBase' => 'lib/ezutils/classes/ezwizardbase.php',
'<API key>' => 'lib/ezutils/classes/<API key>.php',
'eZWordParser' => 'kernel/classes/datatypes/ezbinaryfile/plugins/ezwordparser.php',
'<API key>' => 'kernel/common/<API key>.php',
'eZWorkflow' => 'kernel/classes/ezworkflow.php',
'eZWorkflowEvent' => 'kernel/classes/ezworkflowevent.php',
'eZWorkflowEventType' => 'kernel/classes/ezworkfloweventtype.php',
'<API key>' => 'kernel/workflow/<API key>.php',
'eZWorkflowFunctions' => 'kernel/workflow/ezworkflowfunctions.php',
'eZWorkflowGroup' => 'kernel/classes/ezworkflowgroup.php',
'eZWorkflowGroupLink' => 'kernel/classes/ezworkflowgrouplink.php',
'eZWorkflowGroupType' => 'kernel/classes/ezworkflowgrouptype.php',
'eZWorkflowProcess' => 'kernel/classes/ezworkflowprocess.php',
'eZWorkflowType' => 'kernel/classes/ezworkflowtype.php',
'eZXHTMLXMLOutput' => 'kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php',
'eZXMLInputHandler' => 'kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php',
'eZXMLInputParser' => 'kernel/classes/datatypes/ezxmltext/ezxmlinputparser.php',
'eZXMLOutputHandler' => 'kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php',
'eZXMLSchema' => 'kernel/classes/datatypes/ezxmltext/ezxmlschema.php',
'eZXMLText' => 'kernel/classes/datatypes/ezxmltext/ezxmltext.php',
'eZXMLTextDiff' => 'lib/ezdiff/classes/ezxmltextdiff.php',
'eZXMLTextType' => 'kernel/classes/datatypes/ezxmltext/ezxmltexttype.php',
'eZi18nOperator' => 'kernel/common/ezi18noperator.php',
'ezpAccessDenied' => 'kernel/private/classes/exceptions/kernel/accessdenied.php',
'<API key>' => 'kernel/private/classes/<API key>/cli.php',
'<API key>' => 'kernel/private/classes/<API key>/log.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/structs/<API key>.php',
'<API key>' => 'kernel/private/options/<API key>.php',
'ezpAutoloadOutput' => 'kernel/private/interfaces/ezpautoloadoutput.php',
'<API key>' => 'kernel/private/rest/classes/cache/exceptions/cluster.php',
'<API key>' => 'kernel/private/rest/classes/cache/options/storage_cluster.php',
'ezpClusterGateway' => 'kernel/clustering/gateway.php',
'ezpContent' => 'kernel/private/api/content/content.php',
'<API key>' => 'kernel/private/api/content/exceptions/access_denied.php',
'<API key>' => 'kernel/private/api/content/criteria/class.php',
'ezpContentCriteria' => 'kernel/private/api/content/criteria.php',
'<API key>' => 'kernel/private/api/interfaces/content_criteria.php',
'<API key>' => 'kernel/private/api/content/criteria_set.php',
'<API key>' => 'kernel/private/api/content/criteria/depth.php',
'ezpContentException' => 'kernel/private/api/content/exceptions/content_exception.php',
'ezpContentField' => 'kernel/private/api/content/field.php',
'<API key>' => 'kernel/private/api/content/criteria/field.php',
'<API key>' => 'kernel/private/api/content/exceptions/<API key>.php',
'ezpContentFieldSet' => 'kernel/private/api/content/field_set.php',
'<API key>' => 'kernel/private/api/content/criteria/limit.php',
'ezpContentList' => 'kernel/private/api/content/list.php',
'ezpContentLocation' => 'kernel/private/api/content/location.php',
'<API key>' => 'kernel/private/api/content/criteria/location.php',
'<API key>' => 'kernel/private/api/content/location_set.php',
'<API key>' => 'kernel/private/api/content/exceptions/content_not_found.php',
'<API key>' => 'kernel/content/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/private/api/content/repository.php',
'<API key>' => 'kernel/private/api/content/criteria/sorting.php',
'<API key>' => 'kernel/private/rest/classes/renderers/<API key>.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/clustering/dbmysql.php',
'<API key>' => 'kernel/clustering/dbmysqli.php',
'<API key>' => 'kernel/clustering/dfsmysqli.php',
'ezpEvent' => 'kernel/private/classes/ezpevent.php',
'ezpExtension' => 'kernel/private/classes/ezpextension.php',
'ezpExtensionOptions' => 'kernel/private/options/ezpextensionoptions.php',
'<API key>' => 'kernel/private/rest/classes/http_response_codes.php',
'ezpI18n' => 'kernel/common/ezpi18n.php',
'ezpKernel' => 'kernel/private/classes/ezpkernel.php',
'ezpKernelHandler' => 'kernel/private/interfaces/ezpkernelhandler.php',
'ezpKernelResult' => 'kernel/private/classes/ezpkernelresult.php',
'ezpKernelTreeMenu' => 'kernel/private/classes/ezpkerneltreemenu.php',
'ezpKernelWeb' => 'kernel/private/classes/ezpkernelweb.php',
'ezpLanguageNotFound' => 'kernel/private/classes/exceptions/kernel/languagenotfound.php',
'ezpLanguageSwitcher' => 'kernel/private/classes/ezplanguageswitcher.php',
'<API key>' => 'kernel/private/interfaces/<API key>.php',
'<API key>' => 'kernel/private/modules/switchlanguage/<API key>.php',
'<API key>' => 'kernel/private/eztemplate/<API key>.php',
'ezpLocation' => 'kernel/private/api/location.php',
'ezpMail' => 'kernel/private/classes/ezpmail.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'ezpModuleDisabled' => 'kernel/private/classes/exceptions/kernel/moduledisabled.php',
'ezpModuleNotFound' => 'kernel/private/classes/exceptions/kernel/modulenotfound.php',
'<API key>' => 'kernel/private/classes/exceptions/kernel/moduleviewdisabled.php',
'<API key>' => 'kernel/private/classes/exceptions/kernel/moduleviewnotfound.php',
'ezpMultivariateTest' => 'kernel/private/classes/ezpmultivariatetest.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'<API key>' => 'kernel/private/rest/classes/dispatcher.php',
'ezpMvcConfiguration' => 'kernel/private/rest/classes/mvc_configuration.php',
'ezpMvcRailsRoute' => 'kernel/private/rest/classes/routes/rails.php',
'ezpMvcRegexpRoute' => 'kernel/private/rest/classes/routes/regexp.php',
'<API key>' => 'kernel/private/rest/classes/auth/<API key>.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/bad_request.php',
'ezpOauthErrorType' => 'kernel/private/rest/classes/outh_error_type.php',
'ezpOauthException' => 'kernel/private/rest/classes/exceptions/oauth.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/expired_token.php',
'ezpOauthFilter' => 'kernel/private/rest/classes/oauth/oauth_filter.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/insufficient_scope.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/invalid_request.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/invalid_token.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/missing_auth_info.php',
'ezpOauthRequired' => 'kernel/private/rest/classes/status/oauth_required.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/auth.php',
'ezpO<API key> => 'kernel/private/rest/classes/o<API key>.php',
'ezpO<API key> => 'kernel/private/rest/classes/exceptions/o<API key>.php',
'ezpOauthUtility' => 'kernel/private/rest/classes/oauth/utility.php',
'<API key>' => 'kernel/private/rest/classes/auth/auth_configuration.php',
'<API key>' => 'kernel/private/rest/classes/controllers/auth.php',
'ezpRestAuthProvider' => 'kernel/private/rest/classes/auth/auth_provider.php',
'ezpRest<API key> => 'kernel/private/rest/classes/exceptions/<API key>.php',
'ezpRestAuthcode' => 'kernel/private/rest/classes/models/ezprest_authcode.php',
'<API key>' => 'kernel/private/rest/classes/auth/styles/abstract_auth_style.php',
'ezpRest<API key> => 'kernel/private/rest/classes/auth/auth_style.php',
'<API key>' => 'kernel/private/oauth/classes/<API key>.php',
'<API key>' => 'kernel/private/rest/classes/auth/styles/basic_auth.php',
'<API key>' => 'kernel/private/rest/classes/cache/apc.php',
'<API key>' => 'kernel/private/rest/classes/cache/cluster.php',
'<API key>' => 'kernel/private/rest/classes/cache/object.php',
'<API key>' => 'kernel/private/rest/classes/cache/storage.php',
'ezpRestClient' => 'kernel/private/oauth/classes/restclient.php',
'<API key>' => 'kernel/private/rest/classes/content_renderer.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/content_renderer.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/<API key>.php',
'ezpRestDbConfig' => 'kernel/private/rest/classes/lazy.php',
'ezpRestDebug' => 'kernel/private/rest/classes/debug/debug.php',
'<API key>' => 'kernel/private/rest/classes/debug/formatters/php_formatter.php',
'<API key>' => 'kernel/private/rest/classes/<API key>.php',
'<API key>' => 'kernel/private/rest/classes/controllers/error.php',
'ezpRestException' => 'kernel/private/rest/classes/exceptions/rest_exception.php',
'<API key>' => 'kernel/private/rest/classes/views/feed_decorator.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/<API key>.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/filter_not_found.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/https_required.php',
'<API key>' => 'kernel/private/rest/classes/request/http_parser.php',
'ezpRestHttpResponse' => 'kernel/private/rest/classes/status/http_response.php',
'<API key>' => 'kernel/private/rest/classes/<API key>.php',
'<API key>' => 'kernel/private/rest/classes/auth/ini_route_security.php',
'ezpRestJsonView' => 'kernel/private/rest/classes/views/json.php',
'ezpRestModel' => 'kernel/private/rest/classes/models/rest_model.php',
'<API key>' => 'kernel/private/rest/classes/controllers/rest_controller.php',
'ezpRestMvcResult' => 'kernel/private/rest/classes/response/result.php',
'ezpRestNoAuthStyle' => 'kernel/private/rest/classes/auth/styles/no_auth.php',
'ezpRestO<API key> => 'kernel/private/rest/classes/auth/styles/oauth.php',
'<API key>' => 'kernel/private/rest/classes/status/oauth_error.php',
'<API key>' => 'kernel/private/rest/classes/controllers/oauth_token.php',
'ezpRestPoConfig' => 'kernel/private/rest/classes/lazy.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/prerouting_filter.php',
'<API key>' => 'kernel/private/rest/classes/prefix_filter.php',
'ezpRestProvider' => 'kernel/private/rest/classes/rest_provider.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/rest_provider.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/<API key>.php',
'ezpRestRequest' => 'kernel/private/rest/classes/request/rest_request.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/request_filter.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/response_filter.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/result_filter.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/route_filter.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/<API key>.php',
'ezpRestRouter' => 'kernel/private/rest/classes/router.php',
'<API key>' => 'kernel/private/rest/classes/cache/clear_routes.php',
'<API key>' => 'kernel/private/rest/classes/status/response.php',
'ezpRestToken' => 'kernel/private/rest/classes/models/ezprest_token.php',
'ezpRestTokenManager' => 'kernel/private/oauth/classes/tokenmanager.php',
'<API key>' => 'kernel/private/rest/classes/routes/versioned_route.php',
'<API key>' => 'kernel/private/rest/classes/interfaces/view_controller.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/<API key>.php',
'ezpSearchEngine' => 'kernel/private/interfaces/ezpsearchengine.php',
'ezpSessionHandler' => 'lib/ezsession/classes/ezpsessionhandler.php',
'ezpSessionHandlerDB' => 'lib/ezsession/classes/ezpsessionhandlerdb.php',
'<API key>' => 'lib/ezsession/classes/<API key>.php',
'<API key>' => 'lib/ezsession/classes/<API key>.php',
'ezpStaticCache' => 'kernel/private/interfaces/ezpstaticcache.php',
'ezpTopologicalSort' => 'kernel/private/classes/ezptopologicalsort.php',
'<API key>' => 'kernel/private/classes/<API key>.php',
'ezpUpdatedContent' => 'kernel/private/rest/classes/sync/updates.php',
'<API key>' => 'kernel/private/rest/classes/exceptions/user_not_found.php',
);
?> |
<div class="userpro userpro-<?php echo $i; ?> userpro-<?php echo $layout; ?>" <?php <API key>( $args ); ?>>
<a href="#" class="userpro-close-popup"><?php _e('Close','userpro'); ?></a>
<div class="userpro-head">
<div class="userpro-left"><?php echo $args["{$template}_heading"]; ?></div>
<?php if ($args["{$template}_side"]) { ?>
<div class="userpro-right"><a href="#" data-template="<?php echo $args["{$template}_side_action"]; ?>"><?php echo $args["{$template}_side"]; ?></a></div>
<?php } ?>
<div class="userpro-clear"></div>
</div>
<div class="userpro-body">
<?php do_action('<API key>'); ?>
<form action="" method="post" data-action="<?php echo $template; ?>">
<?php // Hook into fields $args, $user_id
if (!isset($user_id)) $user_id = 0;
$hook_args = array_merge($args, array('user_id' => $user_id, 'unique_id' => $i));
do_action('<API key>', $hook_args);
?>
<!-- fields -->
<div class='userpro-field' data-key='secretkey'>
<div class='userpro-label <?php if ($args['field_icons'] == 1) { echo 'iconed'; } ?>'><label for='secretkey-<?php echo $i; ?>'><?php _e('Your Secret Key','userpro'); ?></label></div>
<div class='userpro-input'>
<input type='text' name='secretkey-<?php echo $i; ?>' id='secretkey-<?php echo $i; ?>' data-required="1" data-ajaxcheck="validatesecretkey" />
<div class='userpro-help'><?php _e('You need a secret key to change your account password. Do not have one? Click <a href="#" data-template="reset">here</a> to obtain a new key.','userpro'); ?></div>
<div class='userpro-clear'></div>
</div>
</div><div class='userpro-clear'></div>
<?php foreach( userpro_get_fields( array('user_pass','user_pass_confirm','passwordstrength') ) as $key => $array ) { ?>
<?php if ($array) echo userpro_edit_field( $key, $array, $i, $args ) ?>
<?php } ?>
<?php $key = 'antispam'; $array = $userpro->fields[$key];
if (isset($array) && is_array($array)) echo userpro_edit_field( $key, $array, $i, $args ); ?>
<?php // Hook into fields $args, $user_id
if (!isset($user_id)) $user_id = 0;
$hook_args = array_merge($args, array('user_id' => $user_id, 'unique_id' => $i));
do_action('<API key>', $hook_args);
?>
<?php // Hook into fields $args, $user_id
if (!isset($user_id)) $user_id = 0;
$hook_args = array_merge($args, array('user_id' => $user_id, 'unique_id' => $i));
do_action('<API key>', $hook_args);
?>
<?php if ($args["{$template}_button_primary"] || $args["{$template}_button_secondary"] ) { ?>
<div class="userpro-field userpro-submit userpro-column">
<?php if ($args["{$template}_button_primary"]) { ?>
<input type="submit" value="<?php echo $args["{$template}_button_primary"]; ?>" class="userpro-button" />
<?php } ?>
<?php if ($args["{$template}_button_secondary"]) { ?>
<input type="button" value="<?php echo $args["{$template}_button_secondary"]; ?>" class="userpro-button secondary" data-template="<?php echo $args["{$template}_button_action"]; ?>" />
<?php } ?>
<img src="<?php echo $userpro->skin_url(); ?>loading.gif" alt="" class="userpro-loading" />
<div class="userpro-clear"></div>
</div>
<?php } ?>
</form>
</div>
</div> |
<?php
namespace Laminas\Feed\PubSubHubbub\Model;
use DateInterval;
use DateTime;
use Laminas\Feed\PubSubHubbub;
class Subscription extends AbstractModel implements <API key>
{
/**
* Common DateTime object to assist with unit testing
*
* @var DateTime
*/
protected $now;
/**
* Save subscription to RDMBS
*
* @return bool
* @throws PubSubHubbub\Exception\<API key>
*/
public function setSubscription(array $data)
{
if (! isset($data['id'])) {
throw new PubSubHubbub\Exception\<API key>(
'ID must be set before attempting a save'
);
}
$result = $this->db->select(['id' => $data['id']]);
if ($result && (0 < count($result))) {
$data['created_time'] = $result->current()->created_time;
$now = $this->getNow();
if (array_key_exists('lease_seconds', $data)
&& $data['lease_seconds']
) {
$data['expiration_time'] = $now->add(new DateInterval('PT' . $data['lease_seconds'] . 'S'))
->format('Y-m-d H:i:s');
}
$this->db->update(
$data,
['id' => $data['id']]
);
return false;
}
$this->db->insert($data);
return true;
}
/**
* Get subscription by ID/key
*
* @param string $key
* @return array
* @throws PubSubHubbub\Exception\<API key>
*/
public function getSubscription($key)
{
if (empty($key) || ! is_string($key)) {
throw new PubSubHubbub\Exception\<API key>(
'Invalid parameter "key" of "' . $key . '" must be a non-empty string'
);
}
$result = $this->db->select(['id' => $key]);
if ($result && count($result)) {
return $result->current()->getArrayCopy();
}
return false;
}
/**
* Determine if a subscription matching the key exists
*
* @param string $key
* @return bool
* @throws PubSubHubbub\Exception\<API key>
*/
public function hasSubscription($key)
{
if (empty($key) || ! is_string($key)) {
throw new PubSubHubbub\Exception\<API key>(
'Invalid parameter "key" of "' . $key . '" must be a non-empty string'
);
}
$result = $this->db->select(['id' => $key]);
if ($result && count($result)) {
return true;
}
return false;
}
/**
* Delete a subscription
*
* @param string $key
* @return bool
*/
public function deleteSubscription($key)
{
$result = $this->db->select(['id' => $key]);
if ($result && count($result)) {
$this->db->delete(
['id' => $key]
);
return true;
}
return false;
}
/**
* Get a new DateTime or the one injected for testing
*
* @return DateTime
*/
public function getNow()
{
if (null === $this->now) {
return new DateTime();
}
return $this->now;
}
/**
* Set a DateTime instance for assisting with unit testing
*
* @return $this
*/
public function setNow(DateTime $now)
{
$this->now = $now;
return $this;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.