answer stringlengths 15 1.25M |
|---|
package clustertemplate
import (
"context"
"fmt"
"strings"
v3 "github.com/rancher/rancher/pkg/generated/norman/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/namespace"
"github.com/rancher/rancher/pkg/types/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
)
const (
RevisionController = "<API key>"
<API key> = "io.cattle.field/clusterTemplateId"
)
type RevController struct {
clusterTemplates v3.<API key>
<API key> v3.<API key>
<API key> v3.<API key>
<API key> v3.<API key>
}
func newRevController(ctx context.Context, mgmt *config.ManagementContext) *RevController {
n := &RevController{
clusterTemplates: mgmt.Management.ClusterTemplates(namespace.GlobalNamespace),
<API key>: mgmt.Management.ClusterTemplates(namespace.GlobalNamespace).Controller().Lister(),
<API key>: mgmt.Management.<API key>(namespace.GlobalNamespace),
<API key>: mgmt.Management.<API key>(namespace.GlobalNamespace).Controller().Lister(),
}
return n
}
func Register(ctx context.Context, management *config.ManagementContext) {
n := newRevController(ctx, management)
if n != nil {
management.Management.<API key>("").AddHandler(ctx, RevisionController, n.sync)
}
<API key>(ctx, management)
}
//sync is called periodically and on real updates
func (n *RevController) sync(key string, obj *v3.<API key>) (runtime.Object, error) {
if obj == nil || obj.DeletionTimestamp != nil {
return nil, nil
}
if obj.Spec.ClusterTemplateName == "" {
return nil, nil
}
//load the template
split := strings.SplitN(obj.Spec.ClusterTemplateName, ":", 2)
if len(split) != 2 {
return nil, fmt.Errorf("error in splitting clusterTemplate name %v", obj.Spec.ClusterTemplateName)
}
templateName := split[1]
template, err := n.<API key>.Get(namespace.GlobalNamespace, templateName)
if err != nil {
return nil, err
}
if template.Spec.DefaultRevisionName != "" {
return nil, nil
}
//if default is not set, set the revision to this revision if only one found
set := labels.Set(map[string]string{<API key>: templateName})
revisionList, err := n.<API key>.List(namespace.GlobalNamespace, set.AsSelector())
if err != nil {
return nil, err
}
revisionCount := len(revisionList)
if revisionCount == 0 {
//check from etcd
revlist, err := n.<API key>.List(metav1.ListOptions{LabelSelector: set.AsSelector().String()})
if err != nil {
return nil, err
}
if len(revlist.Items) != 0 {
revisionCount = len(revlist.Items)
}
}
if revisionCount == 1 {
templateCopy := template.DeepCopy()
templateCopy.Spec.DefaultRevisionName = namespace.GlobalNamespace + ":" + obj.Name
_, err := n.clusterTemplates.Update(templateCopy)
if err != nil {
return nil, err
}
}
return nil, nil
} |
require 'spec_helper'
describe AdoptionMailer do
describe 'interest_email' do
let(:cookbook) { create(:cookbook) }
let(:user) { create(:user) }
subject do
AdoptionMailer.interest_email(cookbook, user)
end
context 'in the to address' do
it 'includes the current owner\'s email' do
expect(subject.to).to include(cookbook.owner.email)
end
end
context 'in the subject' do
it 'includes the correct name' do
expect(subject.subject).to include(cookbook.name)
end
it 'includes the type of cookbook or tool' do
expect(subject.subject).to include(cookbook.class.name.downcase)
end
end
context 'in the body' do
it 'includes the adopting user email' do
expect(subject.text_part.to_s).to include(user.email)
expect(subject.html_part.to_s).to include(user.email)
end
it 'includes the username of the adopting user' do
# Making the username different from the email
allow(user).to receive(:username).and_return('someone')
expect(subject.text_part.to_s).to include(user.username)
expect(subject.html_part.to_s).to include(user.username)
end
it 'includes the type of cookbook or tool' do
expect(subject.text_part.to_s).to include(cookbook.class.name.downcase)
expect(subject.html_part.to_s).to include(cookbook.class.name.downcase)
end
it 'includes the name of the cookbook' do
expect(subject.text_part.to_s).to include(cookbook.name)
expect(subject.html_part.to_s).to include(cookbook.name)
end
context 'including a link to the cookbook page' do
it 'includes the supermarket url' do
expect(subject.text_part.to_s).to include(root_url)
expect(subject.html_part.to_s).to include(root_url)
end
it 'includes a link to the cookbook page' do
expect(subject.text_part.to_s).to include(cookbook_path(cookbook))
expect(subject.html_part.to_s).to include(cookbook_path(cookbook))
end
end
end
end
end |
<?php
namespace frontend\controllers;
use Yii;
//use yii\base\<API key>;
//use yii\web\<API key>;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\adver\Adver;
//use common\models\gallery\Gallery;
/**
* Adver controller
*/
class AdverController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'except' => ['index', 'error'],
'rules' => [
[
'allow' => true,
//'actions' => ['register', 'adver-list', 'delete', 'update', 'gallery'],
'roles' => ['@'],
],
[
'allow' => true,
'actions' => ['download-attachment', 'index', 'search-cluster', 'search-marker', 'info-window', 'view', 'qr-code', 'error'],
'roles' => ['?'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
'attachment-delete' => ['post'],
'gallery-delete' => ['post'],
],
],
/*[
'class' => 'yii\filters\HttpCache',
'only' => ['index'],
'lastModified' => function ($action, $params) {
$q = new \yii\db\Query();
return $q->from('adver')->max('updated_at');
},
],*/
[
'class' => 'yii\filters\HttpCache',
'only' => ['view'],
'etagSeed' => function ($action, $params) {
$model = $this->findModel((int)Yii::$app->request->get('id'));
return serialize([
$model->id,
$model->updated_at,
]);
},
],
];
}
/**
* @inheritdoc
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'index' => [
'class' => 'frontend\controllers\adver\Index',
],
'register' => [
'class' => 'frontend\controllers\adver\Register',
],
'update' => [
'class' => 'frontend\controllers\adver\Update',
],
'delete' => [
'class' => 'frontend\controllers\adver\Delete',
],
'adver-list' => [
'class' => 'frontend\controllers\adver\AdverList',
],
'gallery-add' => [
'class' => 'frontend\controllers\adver\GalleryAdd',
],
'gallery-delete' => [
'class' => 'frontend\controllers\adver\GalleryDelete',
],
'attachment-add' => [
'class' => 'frontend\controllers\adver\AttachmentAdd',
],
'attachment-delete' => [
'class' => 'frontend\controllers\adver\AttachmentDelete',
],
'download-attachment' => [
'class' => 'common\controllers\adver\DownloadAttachment',
],
'search-cluster' => [
'class' => 'frontend\controllers\adver\SearchCluster',
],
'search-marker' => [
'class' => 'frontend\controllers\adver\SearchMarker',
],
'info-window' => [
'class' => 'frontend\controllers\adver\InfoWindow',
],
'view' => [
'class' => 'frontend\controllers\adver\View',
],
];
}
/*
public function actionIndex()
{
return $this->render('index');
}*/
public function findModel($id)
{
if (($model = Adver::findOne($id)) !== null) {
return $model;
} else {
throw new \yii\web\<API key>(Yii::t('app', 'The requested page does not exist.'));
}
}
} |
id: expr.match
title: match & imatch
layout: docs
category: Expression Terms
permalink: docs/expr/match.html
The `match` expression performs an `fnmatch(3)` match against the basename of
the file, evaluating true if the match is successful.
["match", "*.txt"]
You may optionally provide a third argument to change the scope of the match
from the basename to the wholename of the file.
["match", "*.txt", "basename"] |
// Python Tools for Visual Studio
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Language.<API key>;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.PythonTools.Repl {
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Black";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Colors.Black;
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkRed";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x7f, 0, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkGreen";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0x7f, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkYellow";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x7f, 0x7f, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkBlue";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0x00, 0x7f);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkMagenta";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x7f, 0x00, 0x7f);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkCyan";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0x7f, 0x7f);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Gray";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0xC0, 0xC0, 0xC0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - DarkGray";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x7f, 0x7f, 0x7f);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Red";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0xff, 0, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Green";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0xff, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Yellow";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0xff, 0xff, 0);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
[Order(After = Priority.Default, Before = Priority.High)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Blue";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0x00, 0xff);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Magenta";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0xff, 0x00, 0xff);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - Cyan";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0x00, 0xff, 0xff);
}
}
[Export(typeof(<API key>))]
[ClassificationType(<API key> = Name)]
[Name(Name)]
[UserVisible(true)]
internal class <API key> : <API key> {
public const string Name = "Interactive - White";
[Export]
[Name(Name)]
[BaseDefinition(<API key>.NaturalLanguage)]
internal static <API key> Definition = null; // Set via MEF
public <API key>() {
DisplayName = Name;
ForegroundColor = Color.FromRgb(0xff, 0xff, 0xff);
}
}
} |
#include <ode/config.h>
#include <ode/memory.h>
#include <ode/error.h>
#include "array.h"
static inline int roundUpToPowerOfTwo (int x)
{
int i = 1;
while (i < x) i <<= 1;
return i;
}
void dArrayBase::_freeAll (int sizeofT)
{
if (_data) {
if (_data == this+1) return; // if constructLocalArray() was called
dFree (_data,_anum * sizeofT);
}
}
void dArrayBase::_setSize (int newsize, int sizeofT)
{
if (newsize < 0) return;
if (newsize > _anum) {
if (_data == this+1) {
// this is a no-no, because constructLocalArray() was called
dDebug (0,"setSize() out of space in LOCAL array");
}
int newanum = roundUpToPowerOfTwo (newsize);
if (_data) _data = dRealloc (_data, _anum*sizeofT, newanum*sizeofT);
else _data = dAlloc (newanum*sizeofT);
_anum = newanum;
}
_size = newsize;
}
void * dArrayBase::operator new (size_t size)
{
return dAlloc (size);
}
void dArrayBase::operator delete (void *ptr, size_t size)
{
dFree (ptr,size);
}
void dArrayBase::constructLocalArray (int __anum)
{
_size = 0;
_anum = __anum;
_data = this+1;
} |
Copyright (c) 2009 Microsoft Corporation
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Microsoft nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest({
id: "15.2.3.6-4-37",
path: "TestCases/chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-37.js",
description: "Object.defineProperty - 'O' is a Number object that uses Object's [[GetOwnProperty]] method to access the 'name' property (8.12.9 step 1)",
test: function testcase() {
var obj = new Number(-2);
Object.defineProperty(obj, "foo", {
value: 12,
configurable: false
});
try {
Object.defineProperty(obj, "foo", {
value: 11,
configurable: true
});
return false;
} catch (e) {
return e instanceof TypeError && obj.foo === 12;
}
},
precondition: function prereq() {
return fnExists(Object.defineProperty);
}
}); |
<?php
final class <API key>
extends <API key> {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$response = $this->loadProject();
if ($response) {
return $response;
}
$viewer = $request->getUser();
$project = $this->getProject();
$id = $project->getID();
$picture = $project->getProfileImageURI();
$header = id(new PHUIHeaderView())
->setHeader(pht('Project History'))
->setUser($viewer)
->setPolicyObject($project)
->setImage($picture);
if ($project->getStatus() == <API key>::STATUS_ACTIVE) {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
} else {
$header->setStatus('fa-ban', 'red', pht('Archived'));
}
$curtain = $this->buildCurtain($project);
$properties = $this-><API key>($project);
$timeline = $this-><API key>(
$project,
new <API key>());
$timeline->setShouldTerminate(true);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::ITEM_MANAGE);
$crumbs = $this-><API key>();
$crumbs->addTextCrumb(pht('Manage'));
$crumbs->setBorder(true);
$manage = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->addPropertySection(pht('Details'), $properties)
->setMainColumn(
array(
$timeline,
));
return $this->newPage()
->setNavigation($nav)
->setCrumbs($crumbs)
->setTitle(
array(
$project->getDisplayName(),
pht('Manage'),
))
->appendChild(
array(
$manage,
));
}
private function buildCurtain(PhabricatorProject $project) {
$viewer = $this->getViewer();
$id = $project->getID();
$can_edit = <API key>::hasCapability(
$viewer,
$project,
<API key>::CAN_EDIT);
$curtain = $this->newCurtainView($project);
$curtain->addAction(
id(new <API key>())
->setName(pht('Edit Details'))
->setIcon('fa-pencil')
->setHref($this->getApplicationURI("edit/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
$curtain->addAction(
id(new <API key>())
->setName(pht('Edit Menu'))
->setIcon('fa-th-list')
->setHref($this->getApplicationURI("{$id}/item/configure/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
$curtain->addAction(
id(new <API key>())
->setName(pht('Edit Picture'))
->setIcon('fa-picture-o')
->setHref($this->getApplicationURI("picture/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
if ($project->isArchived()) {
$curtain->addAction(
id(new <API key>())
->setName(pht('Activate Project'))
->setIcon('fa-check')
->setHref($this->getApplicationURI("archive/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(true));
} else {
$curtain->addAction(
id(new <API key>())
->setName(pht('Archive Project'))
->setIcon('fa-ban')
->setHref($this->getApplicationURI("archive/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(true));
}
return $curtain;
}
private function <API key>(
PhabricatorProject $project) {
$viewer = $this->getViewer();
$view = id(new <API key>())
->setUser($viewer);
$view->addProperty(
pht('Looks Like'),
$viewer->renderHandle($project->getPHID())->setAsTag(true));
$field_list = <API key>::getObjectFields(
$project,
<API key>::ROLE_VIEW);
$field_list-><API key>($project, $viewer, $view);
return $view;
}
} |
#if V8_TARGET_ARCH_IA32
#include "src/<API key>.h"
#include "src/frames.h"
namespace v8 {
namespace internal {
const Register <API key>::ContextRegister() { return esi; }
void <API key>::<API key>(
<API key>* data, int <API key>) {
constexpr Register <API key>[] = {eax, ecx, edx, edi};
STATIC_ASSERT(arraysize(<API key>) == <API key>);
CHECK_LE(static_cast<size_t>(<API key>),
arraysize(<API key>));
data-><API key>(<API key>,
<API key>);
}
void <API key>::<API key>(
<API key>* data) {
static const Register <API key>[] = {ecx, edx, esi, edi,
kReturnRegister0};
data-><API key>(<API key>,
arraysize(<API key>));
CHECK_LE(static_cast<size_t>(kParameterCount),
arraysize(<API key>));
data-><API key>(kParameterCount, <API key>);
}
const Register <API key>::ScopeInfoRegister() {
return edi;
}
const Register <API key>::SlotsRegister() { return eax; }
const Register LoadDescriptor::ReceiverRegister() { return edx; }
const Register LoadDescriptor::NameRegister() { return ecx; }
const Register LoadDescriptor::SlotRegister() { return eax; }
const Register <API key>::VectorRegister() { return no_reg; }
const Register StoreDescriptor::ReceiverRegister() { return edx; }
const Register StoreDescriptor::NameRegister() { return ecx; }
const Register StoreDescriptor::ValueRegister() { return no_reg; }
const Register StoreDescriptor::SlotRegister() { return no_reg; }
const Register <API key>::VectorRegister() { return no_reg; }
const Register <API key>::SlotRegister() { return no_reg; }
const Register <API key>::VectorRegister() { return no_reg; }
const Register <API key>::MapRegister() { return edi; }
const Register ApiGetterDescriptor::HolderRegister() { return ecx; }
const Register ApiGetterDescriptor::CallbackRegister() { return eax; }
const Register <API key>::ObjectRegister() { return eax; }
const Register <API key>::KeyRegister() { return ecx; }
// static
const Register <API key>::ArgumentRegister() { return eax; }
void TypeofDescriptor::<API key>(
<API key>* data) {
Register registers[] = {ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments
// edi : the target to call
Register registers[] = {edi, eax};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments (on the stack, not including receiver)
// edi : the target to call
// ecx : arguments list length (untagged)
// On the stack : arguments list (FixedArray)
Register registers[] = {edi, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments
// ecx : start index (to support rest parameters)
// edi : the target to call
Register registers[] = {edi, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// edx : function template info
// ecx : number of arguments (on the stack, not including receiver)
Register registers[] = {edx, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments (on the stack, not including receiver)
// edi : the target to call
// ecx : the object to spread
Register registers[] = {edi, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// edi : the target to call
// edx : the arguments list
Register registers[] = {edi, edx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments (on the stack, not including receiver)
// edi : the target to call
// edx : the new target
// ecx : arguments list length (untagged)
// On the stack : arguments list (FixedArray)
Register registers[] = {edi, edx, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments
// edx : the new target
// ecx : start index (to support rest parameters)
// edi : the target to call
Register registers[] = {edi, edx, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments (on the stack, not including receiver)
// edi : the target to call
// edx : the new target
// ecx : the object to spread
Register registers[] = {edi, edx, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// edi : the target to call
// edx : the new target
// ecx : the arguments list
Register registers[] = {edi, edx, ecx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// eax : number of arguments
// edx : the new target
// edi : the target to call
// ecx : allocation site or undefined
// TODO(jgruber): Remove the unused allocation site parameter.
Register registers[] = {edi, edx, eax, ecx};
data-><API key>(arraysize(registers), registers);
}
void AbortDescriptor::<API key>(
<API key>* data) {
Register registers[] = {edx};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
// register state
data-><API key>(0, nullptr);
}
void CompareDescriptor::<API key>(
<API key>* data) {
Register registers[] = {edx, eax};
data-><API key>(arraysize(registers), registers);
}
void BinaryOpDescriptor::<API key>(
<API key>* data) {
Register registers[] = {edx, eax};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
edi, // JSFunction
edx, // the new target
eax, // actual number of arguments
ecx, // expected number of arguments
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
edx, // kApiFunctionAddress
ecx, // kArgc
eax, // kCallData
edi, // kHolder
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
<API key>, <API key>,
<API key>, <API key>};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
eax, // argument count (not including receiver)
ecx, // address of first argument
edi // the target callable to be call
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
eax, // argument count (not including receiver)
ecx, // address of first argument
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
eax, // the value to pass to the generator
edx // the JSGeneratorObject to resume
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
Register registers[] = {
eax, // loaded new FP
};
data-><API key>(arraysize(registers), registers);
}
void <API key>::<API key>(
<API key>* data) {
data-><API key>(0, nullptr);
}
} // namespace internal
} // namespace v8
#endif // V8_TARGET_ARCH_IA32 |
body {
}
input[type=text] {
padding: 3px;
border-radius: 5px;
border: 1px solid #bbb;
}
.error {
color: #a00;
}
textarea {
padding: 3px;
border-radius: 5px;
border: 1px solid #bbb;
}
div#album_list {
padding: 50px;
}
.album {
width: 300px;
float: left;
margin-right: 10px;
}
div.album div.title {
float: right;
} |
var egret;
(function (egret) {
/**
* @class egret.RendererContext
* @classdesc
* RenderContext
*
* @extends egret.HashObject
* @private
*/
var RendererContext = (function (_super) {
__extends(RendererContext, _super);
/**
* @method egret.RendererContext#constructor
*/
function RendererContext() {
_super.call(this);
/**
*
* @member egret.RendererContext#renderCost
*/
this.renderCost = 0;
/**
* 1
* @member egret.RendererContext#<API key>
*/
this.<API key> = 1;
this.profiler = egret.Profiler.getInstance();
if (!RendererContext.blendModesForGL) {
RendererContext.initBlendMode();
}
}
var __egretProto__ = RendererContext.prototype;
Object.defineProperty(__egretProto__, "<API key>", {
get: function () {
return this.<API key>;
},
set: function (value) {
this.<API key>(value);
},
enumerable: true,
configurable: true
});
__egretProto__.<API key> = function (value) {
this.<API key> = value;
};
/**
* @method egret.RendererContext#clearScreen
* @private
*/
__egretProto__.clearScreen = function () {
};
/**
* Context
* @method egret.RendererContext#clearRect
* @param x {number}
* @param y {number}
* @param w {number}
* @param h {numbe}
*/
__egretProto__.clearRect = function (x, y, w, h) {
};
/**
*
* @method egret.RendererContext#drawImage
* @param texture {Texture}
* @param sourceX {any}
* @param sourceY {any}
* @param sourceWidth {any}
* @param sourceHeight {any}
* @param destX {any}
* @param destY {any}
* @param destWidth {any}
* @param destHeigh {any}
*/
__egretProto__.drawImage = function (texture, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight, repeat) {
if (repeat === void 0) { repeat = "no-repeat"; }
this.profiler.onDrawImage();
};
/**
* 9
* @method egret.RendererContext#drawImageScale9
* @param texture {Texture}
* @param sourceX {any}
* @param sourceY {any}
* @param sourceWidth {any}
* @param sourceHeight {any}
* @param destX {any}
* @param destY {any}
* @param destWidth {any}
* @param destHeigh {any}
*/
__egretProto__.drawImageScale9 = function (texture, sourceX, sourceY, sourceWidth, sourceHeight, offX, offY, destWidth, destHeight, rect) {
return false;
};
__egretProto__._addOneDraw = function () {
this.profiler.onDrawImage();
};
/**
* Context
* @method egret.RendererContext#setTransform
* @param matrix {egret.Matri}
*/
__egretProto__.setTransform = function (matrix) {
};
/**
* alpha
* @method egret.RendererContext#setAlpha
* @param value {number}
* @param blendMode {egret.BlendMod}
*/
__egretProto__.setAlpha = function (value, blendMode) {
};
/**
*
* @method egret.RendererContext#setupFont
* @param textField {TextField}
*/
__egretProto__.setupFont = function (textField, style) {
if (style === void 0) { style = null; }
};
/**
*
* @method egret.RendererContext#measureText
* @param text {string}
* @returns {number}
* @stable B setupFont
*/
__egretProto__.measureText = function (text) {
return 0;
};
/**
*
* @method egret.RendererContext#drawText
* @param textField {egret.TextField}
* @param text {string}
* @param x {number}
* @param y {number}
* @param maxWidth {numbe}
*/
__egretProto__.drawText = function (textField, text, x, y, maxWidth, style) {
if (style === void 0) { style = null; }
this.profiler.onDrawImage();
};
__egretProto__.strokeRect = function (x, y, w, h, color) {
};
__egretProto__.pushMask = function (mask) {
};
__egretProto__.popMask = function () {
};
__egretProto__.onRenderStart = function () {
};
__egretProto__.onRenderFinish = function () {
};
__egretProto__.<API key> = function (<API key>) {
};
__egretProto__.setGlobalFilter = function (filterData) {
};
__egretProto__.drawCursor = function (x1, y1, x2, y2) {
};
RendererContext.<API key> = function (canvas) {
return null;
};
RendererContext.deleteTexture = function (texture) {
var context = egret.MainContext.instance.rendererContext;
var gl = context["gl"];
var bitmapData = texture._bitmapData;
if (bitmapData) {
var webGLTexture = bitmapData.webGLTexture;
if (webGLTexture && gl) {
for (var key in webGLTexture) {
var glTexture = webGLTexture[key];
gl.deleteTexture(glTexture);
}
}
bitmapData.webGLTexture = null;
}
};
RendererContext.initBlendMode = function () {
RendererContext.blendModesForGL = {};
RendererContext.blendModesForGL[egret.BlendMode.NORMAL] = [1, 771];
RendererContext.blendModesForGL[egret.BlendMode.ADD] = [770, 1];
RendererContext.blendModesForGL[egret.BlendMode.ERASE] = [0, 771];
RendererContext.blendModesForGL[egret.BlendMode.ERASE_REVERSE] = [0, 770];
};
/**
* gl blendModecanvas
* @method egret.RendererContext#<API key>
* @param key {string}
* @param src {number}
* @param dst {number}
* @param override {boolean}
*/
RendererContext.<API key> = function (key, src, dst, override) {
if (RendererContext.blendModesForGL[key] && !override) {
egret.Logger.warningWithErrorId(1005, key);
}
else {
RendererContext.blendModesForGL[key] = [src, dst];
}
};
/**
*
* Canvas
*/
RendererContext.<API key> = true;
RendererContext.blendModesForGL = null;
return RendererContext;
})(egret.HashObject);
egret.RendererContext = RendererContext;
RendererContext.prototype.__class__ = "egret.RendererContext";
})(egret || (egret = {})); |
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>chigraph: Member List</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</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>
<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="chigraphDoxygenIcon.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">chigraph
 <span id="projectnumber">master</span>
</div>
<div id="projectbrief">Systems programming language written for beginners in LLVM</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('<API key>.html','');});
</script>
<div id="doc-content">
<!-- 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 class="header">
<div class="headertitle">
<div class="title">chi::NamedDataType Member List</div> </div>
</div><!--header
<div class="contents">
<p>This is the complete list of members for <a class="el" href="<API key>.html">chi::NamedDataType</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">name</a></td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">NamedDataType</a>(std::string n={}, DataType ty={})</td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">operator!=</a>(const NamedDataType &lhs, const NamedDataType &rhs)</td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">operator==</a>(const NamedDataType &lhs, const NamedDataType &rhs)</td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">type</a></td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">valid</a>() const</td><td class="entry"><a class="el" href="<API key>.html">chi::NamedDataType</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Sat Sep 16 2017 17:41:35 for chigraph by
<a href="http:
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html> |
App.<API key> = Ember.ObjectController.extend({
needs: ["experiment",'permanent'],
templateName: function(){
if(this.get('model.experimentCategory')=="MS"){
return '<API key>';
}
else{
return 'subtypeTemplates/exactChemo';
}
}.property('ExperimentCategory'),
experimentDuration: function(){
return this.get('controllers.experiment.experimentDuration');
},
}); |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_17) on Wed Jun 17 16:17:58 BST 2009 -->
<TITLE>
<API key> (Apache JMeter API)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.jmeter.samplers.<API key> class">
<LINK REL="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle() {
parent.document.title = "<API key> (Apache JMeter API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<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=3 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="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>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="class in org.apache.jmeter.samplers"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="class in org.apache.jmeter.samplers"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.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 | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A
HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <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.jmeter.samplers</FONT>
<BR>
Class <API key></H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html"
title="class in org.apache.jmeter.testelement">org.apache.jmeter.testelement.AbstractTestElement</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.jmeter.samplers.<API key></B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B>
<DD><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Cloneable.html"
title="class or interface in java.lang">Cloneable</A>, <A
HREF="../../../../org/apache/jmeter/engine/util/NoThreadClone.html"
title="interface in org.apache.jmeter.engine.util">NoThreadClone</A>, <A
HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html"
title="class or interface in java.io">Serializable</A>, <A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html"
title="interface in org.apache.jmeter.testelement">TestElement</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B><API key></B>
<DT>extends <A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html"
title="class in org.apache.jmeter.testelement">AbstractTestElement</A>
<DT>implements <A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html"
title="class or interface in java.io">Serializable</A>, <A
HREF="../../../../org/apache/jmeter/engine/util/NoThreadClone.html"
title="interface in org.apache.jmeter.engine.util">NoThreadClone</A>
</DL>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Revision: 674365 $</DD>
<DT><B>See Also:</B>
<DD><A HREF="../../../../serialized-form.html#org.apache.jmeter.samplers.<API key>">Serialized
Form</A>
</DL>
<HR>
<P>
<A NAME="field_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
</TABLE>
<A NAME="<API key>.apache.jmeter.testelement.TestElement"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TD><B>Fields inherited from interface org.apache.jmeter.testelement.<A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html"
title="interface in org.apache.jmeter.testelement">TestElement</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/jmeter/testelement/TestElement.html#COMMENTS">COMMENTS</A>, <A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html#ENABLED">ENABLED</A>, <A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html#GUI_CLASS">GUI_CLASS</A>, <A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html#NAME">NAME</A>, <A
HREF="../../../../org/apache/jmeter/testelement/TestElement.html#TEST_CLASS">TEST_CLASS</A></CODE></TD>
</TR>
</TABLE>
<A NAME="constructor_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A
HREF="../../../../org/apache/jmeter/samplers/<API key>.html#<API key>()"><API key></A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A
HREF="../../../../org/apache/jmeter/samplers/<API key>.html#<API key>(org.apache.jmeter.samplers.<API key>)"><API key></A></B>(<A
HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="interface in org.apache.jmeter.samplers"><API key></A> l)</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">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></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/jmeter/samplers/<API key>.html#sampleOccurred(org.apache.jmeter.samplers.SampleEvent)">sampleOccurred</A></B>(<A
HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</CODE>
<BR>
A sample has started and stopped.
</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/jmeter/samplers/<API key>.html#sampleStarted(org.apache.jmeter.samplers.SampleEvent)">sampleStarted</A></B>(<A
HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</CODE>
<BR>
A sample has started.
</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/jmeter/samplers/<API key>.html#sampleStopped(org.apache.jmeter.samplers.SampleEvent)">sampleStopped</A></B>(<A
HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</CODE>
<BR>
A sample has stopped.
</TD>
</TR>
</TABLE>
<A NAME="<API key>.apache.jmeter.testelement.AbstractTestElement"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TD><B>Methods inherited from class org.apache.jmeter.testelement.<A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html"
title="class in org.apache.jmeter.testelement">AbstractTestElement</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#addProperty(org.apache.jmeter.testelement.property.JMeterProperty)">addProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#addTestElement(org.apache.jmeter.testelement.TestElement)">addTestElement</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#canRemove()">canRemove</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#clear()">clear</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#clearTemporary(org.apache.jmeter.testelement.property.JMeterProperty)">clearTemporary</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#clone()">clone</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#emptyTemporary()">emptyTemporary</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#equals(java.lang.Object)">equals</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getComment()">getComment</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getName()">getName</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getProperty(java.lang.String)">getProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#<API key>(java.lang.String)"><API key></A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#<API key>(java.lang.String, boolean)"><API key></A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsDouble(java.lang.String)">getPropertyAsDouble</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsFloat(java.lang.String)">getPropertyAsFloat</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsInt(java.lang.String)">getPropertyAsInt</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsInt(java.lang.String, int)">getPropertyAsInt</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsLong(java.lang.String)">getPropertyAsLong</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsString(java.lang.String)">getPropertyAsString</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getPropertyAsString(java.lang.String, java.lang.String)">getPropertyAsString</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getThreadContext()">getThreadContext</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#getThreadName()">getThreadName</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#hashCode()">hashCode</A>, <A
HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#isEnabled()">isEnabled</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#isRunningVersion()">isRunningVersion</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#isTemporary(org.apache.jmeter.testelement.property.JMeterProperty)">isTemporary</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#logProperties()">logProperties</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#mergeIn(org.apache.jmeter.testelement.TestElement)">mergeIn</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#propertyIterator()">propertyIterator</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#<API key>()"><API key></A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#removeProperty(java.lang.String)">removeProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setComment(java.lang.String)">setComment</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setName(java.lang.String)">setName</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(org.apache.jmeter.testelement.property.JMeterProperty)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, boolean)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, boolean, boolean)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, int)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, int, int)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, java.lang.String)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setProperty(java.lang.String, java.lang.String, java.lang.String)">setProperty</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setRunningVersion(boolean)">setRunningVersion</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setTemporary(org.apache.jmeter.testelement.property.JMeterProperty)">setTemporary</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setThreadContext(org.apache.jmeter.threads.JMeterContext)">setThreadContext</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#setThreadName(java.lang.String)">setThreadName</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#traverse(org.apache.jmeter.testelement.<API key>)">traverse</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#traverseCollection(org.apache.jmeter.testelement.property.CollectionProperty, org.apache.jmeter.testelement.<API key>)">traverseCollection</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#traverseMap(org.apache.jmeter.testelement.property.MapProperty, org.apache.jmeter.testelement.<API key>)">traverseMap</A>,
<A HREF="../../../../org/apache/jmeter/testelement/AbstractTestElement.html#traverseProperty(org.apache.jmeter.testelement.<API key>, org.apache.jmeter.testelement.property.JMeterProperty)">traverseProperty</A></CODE>
</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>">
<TD><B>Methods inherited from class java.lang.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html"
title="class or interface in java.lang">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#finalize()"
title="class or interface in java.lang">finalize</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#getClass()"
title="class or interface in java.lang">getClass</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notify()"
title="class or interface in java.lang">notify</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notifyAll()"
title="class or interface in java.lang">notifyAll</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#toString()"
title="class or interface in java.lang">toString</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait()"
title="class or interface in java.lang">wait</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long)"
title="class or interface in java.lang">wait</A>, <A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long, int)"
title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<A NAME="constructor_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="<API key>(org.apache.jmeter.samplers.<API key>)"></A>
<H3>
<API key></H3>
<PRE>
public <B><API key></B>(<A HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="interface in org.apache.jmeter.samplers"><API key></A> l)</PRE>
<DL>
</DL>
<HR>
<A NAME="<API key>()"></A>
<H3>
<API key></H3>
<PRE>
public <B><API key></B>()</PRE>
<DL>
</DL>
<A NAME="method_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="sampleOccurred(org.apache.jmeter.samplers.SampleEvent)"></A>
<H3>
sampleOccurred</H3>
<PRE>
public void <B>sampleOccurred</B>(<A HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE></B>
</DD>
<DD>A sample has started and stopped.
<P>
<DD>
<DL>
<DT><B>Specified by:</B>
<DD><CODE><A
HREF="../../../../org/apache/jmeter/samplers/SampleListener.html#sampleOccurred(org.apache.jmeter.samplers.SampleEvent)">sampleOccurred</A></CODE>
in interface <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE>
</DL>
</DD>
<DD>
<DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="sampleStarted(org.apache.jmeter.samplers.SampleEvent)"></A>
<H3>
sampleStarted</H3>
<PRE>
public void <B>sampleStarted</B>(<A HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE></B>
</DD>
<DD>A sample has started.
<P>
<DD>
<DL>
<DT><B>Specified by:</B>
<DD><CODE><A
HREF="../../../../org/apache/jmeter/samplers/SampleListener.html#sampleStarted(org.apache.jmeter.samplers.SampleEvent)">sampleStarted</A></CODE>
in interface <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE>
</DL>
</DD>
<DD>
<DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="sampleStopped(org.apache.jmeter.samplers.SampleEvent)"></A>
<H3>
sampleStopped</H3>
<PRE>
public void <B>sampleStopped</B>(<A HREF="../../../../org/apache/jmeter/samplers/SampleEvent.html"
title="class in org.apache.jmeter.samplers">SampleEvent</A> e)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE></B>
</DD>
<DD>A sample has stopped.
<P>
<DD>
<DL>
<DT><B>Specified by:</B>
<DD><CODE><A
HREF="../../../../org/apache/jmeter/samplers/SampleListener.html#sampleStopped(org.apache.jmeter.samplers.SampleEvent)">sampleStopped</A></CODE>
in interface <CODE><A HREF="../../../../org/apache/jmeter/samplers/SampleListener.html"
title="interface in org.apache.jmeter.samplers">SampleListener</A></CODE>
</DL>
</DD>
<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=3 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="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>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="class in org.apache.jmeter.samplers"><B>PREV CLASS</B></A>
<A HREF="../../../../org/apache/jmeter/samplers/<API key>.html"
title="class in org.apache.jmeter.samplers"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.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 | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A
HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A
HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML> |
<!DOCTYPE html>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html>
<head>
<meta charset="utf-8">
<title>A Very Simple Page With Links</title>
</head>
<body>
<a id="this-tab" href="simple.html">Open simple in this tab</a>
<a id="background-tab" target="_blank" href="simple.html">Open simple in a background tab</a>
</body>
</html> |
var inTry = false;
var inFinally = false;
function* g() {
try {
try {
inTry = true;
yield;
$ERROR('This code is unreachable (within nested `try` block)');
} catch (e) {
throw e;
}
$ERROR('This code is unreachable (following nested `try` statement)');
} finally {
inFinally = true;
}
$ERROR('This code is unreachable (following outer `try` statement)');
}
var iter = g();
var exception = new Error();
var result;
iter.next();
assert.sameValue(inTry, true, 'Nested `try` code patch executed');
assert.sameValue(inFinally, false, '`finally` code path not executed');
result = iter.return(45);
assert.sameValue(result.value, 45, 'Result `value` following `return`');
assert.sameValue(result.done, true, 'Result `done` flag following `return`');
assert.sameValue(inFinally, true, '`finally` code path executed');
result = iter.next();
assert.sameValue(
result.value, undefined, 'Result `value` is undefined when complete'
);
assert.sameValue(
result.done, true, 'Result `done` flag is `true` when complete'
); |
package org.joeffice.desktop.ui;
import java.text.<API key>;
import java.text.AttributedString;
/**
* Interface to style a component.
*
* @see <API key>
* @author Anthony Goubard - Japplis
*/
public interface Styleable {
/**
* Overrides the font attributes with the given attributes.
*/
void setFontAttributes(AttributedString attributes);
/**
* Gets the font attributes that are on the selection.
* If in the selection an attribute has different values (e.g. font size), the attribute is not returned.
* @return
*/
AttributedString <API key>();
} |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/compute/v1/compute.proto
namespace Google\Cloud\Compute\V1;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A request message for TargetHttpsProxies.Patch. See the method description for details.
*
* Generated from protobuf message <code>google.cloud.compute.v1.<API key></code>
*/
class <API key> extends \Google\Protobuf\Internal\Message
{
/**
* Project ID for this request.
*
* Generated from protobuf field <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.<API key>) = "project"];</code>
*/
private $project = '';
/**
* An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( <API key>). end_interface: <API key>
*
* Generated from protobuf field <code>optional string request_id = 37109963;</code>
*/
private $request_id = null;
/**
* Name of the TargetHttpsProxy resource to patch.
*
* Generated from protobuf field <code>string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private $target_https_proxy = '';
/**
* The body resource for this request
*
* Generated from protobuf field <code>.google.cloud.compute.v1.TargetHttpsProxy <API key> = 433657473 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private $<API key> = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $project
* Project ID for this request.
* @type string $request_id
* An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( <API key>). end_interface: <API key>
* @type string $target_https_proxy
* Name of the TargetHttpsProxy resource to patch.
* @type \Google\Cloud\Compute\V1\TargetHttpsProxy $<API key>
* The body resource for this request
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
parent::__construct($data);
}
/**
* Project ID for this request.
*
* Generated from protobuf field <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.<API key>) = "project"];</code>
* @return string
*/
public function getProject()
{
return $this->project;
}
/**
* Project ID for this request.
*
* Generated from protobuf field <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.<API key>) = "project"];</code>
* @param string $var
* @return $this
*/
public function setProject($var)
{
GPBUtil::checkString($var, True);
$this->project = $var;
return $this;
}
/**
* An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( <API key>). end_interface: <API key>
*
* Generated from protobuf field <code>optional string request_id = 37109963;</code>
* @return string
*/
public function getRequestId()
{
return isset($this->request_id) ? $this->request_id : '';
}
public function hasRequestId()
{
return isset($this->request_id);
}
public function clearRequestId()
{
unset($this->request_id);
}
/**
* An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( <API key>). end_interface: <API key>
*
* Generated from protobuf field <code>optional string request_id = 37109963;</code>
* @param string $var
* @return $this
*/
public function setRequestId($var)
{
GPBUtil::checkString($var, True);
$this->request_id = $var;
return $this;
}
/**
* Name of the TargetHttpsProxy resource to patch.
*
* Generated from protobuf field <code>string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED];</code>
* @return string
*/
public function getTargetHttpsProxy()
{
return $this->target_https_proxy;
}
/**
* Name of the TargetHttpsProxy resource to patch.
*
* Generated from protobuf field <code>string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED];</code>
* @param string $var
* @return $this
*/
public function setTargetHttpsProxy($var)
{
GPBUtil::checkString($var, True);
$this->target_https_proxy = $var;
return $this;
}
/**
* The body resource for this request
*
* Generated from protobuf field <code>.google.cloud.compute.v1.TargetHttpsProxy <API key> = 433657473 [(.google.api.field_behavior) = REQUIRED];</code>
* @return \Google\Cloud\Compute\V1\TargetHttpsProxy|null
*/
public function <API key>()
{
return $this-><API key>;
}
public function <API key>()
{
return isset($this-><API key>);
}
public function <API key>()
{
unset($this-><API key>);
}
/**
* The body resource for this request
*
* Generated from protobuf field <code>.google.cloud.compute.v1.TargetHttpsProxy <API key> = 433657473 [(.google.api.field_behavior) = REQUIRED];</code>
* @param \Google\Cloud\Compute\V1\TargetHttpsProxy $var
* @return $this
*/
public function <API key>($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\TargetHttpsProxy::class);
$this-><API key> = $var;
return $this;
}
} |
import ast
import label
import repository
import os
class IncludeDef:
"""
Represents build file include definition like
include_defs("//include/path").
"""
def __init__(self, ast_call: ast.Call) -> None:
self.ast_call = ast_call
def get_location(self) -> str:
"""
Returns an include definition location.
For include_defs("//include/path") it is "//include/path".
"""
return self.ast_call.args[0].s
def get_label(self) -> label.Label:
"""Returns a label identifying a build extension file."""
return label.from_string(self.get_location())
def get_include_path(self, repo: repository.Repository):
"""Returns a path to a file from which symbols should be imported."""
l = self.get_label()
return os.path.join(repo.get_cell_path(l.cell), l.package)
def from_ast_call(ast_call: ast.Call) -> IncludeDef:
"""
IncludeDef factory method that creates instances from ast Call description.
"""
return IncludeDef(ast_call) |
// <auto-generated/>
#nullable disable
namespace Azure.Management.Compute.Models
{
<summary> The reason for restriction. </summary>
public enum <API key>
{
<summary> QuotaId. </summary>
QuotaId,
<summary> <API key>. </summary>
<API key>
}
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Open Jail. The Jailer Project Web Site.</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Open Jail <small><small style="font-style: italic;">The Jailer
Project Web Site</small></small>
<hr style="width: 100%; height: 1px;"></h1>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top">
<table border="1" bordercolor="#dddddd" cellpadding="14"
cellspacing="0" width="140">
<tbody>
<tr>
<td width="106">
<p><a href="index.html">Introduction</a><br>
Tutorial
<table>
<tbody>
<tr>
<td> </td>
<td><a href="JailerGuiTutorial.html">GUI</a><a
href="JailerTutorial.html"><br>
CLI</a><a href="files.html"><br>
</a> </td>
</tr>
</tbody>
</table>
<a>Documentation</a>
<table>
<tbody>
<tr>
<td> </td>
<td><a href="terms.html">Terms</a> <a
href="architecture.html"><br>
Architecture</a><br>
<a href="design.html">Design</a><br>
<a href="files.html">File Formats</a> </td>
</tr>
</tbody>
</table>
<a href="domainmodel.html">Addendum</a><br>
<a
href="http://sourceforge.net/project/showfiles.php?group_id=197260">Download</a><br>
<a href="http://sourceforge.net/projects/jailer/">Homepage</a><br>
</p>
<a href="http://sourceforge.net/projects/jailer/"><img
src="http://sflogo.sourceforge.net/sflogo.php?group_id=197260&type=1"
alt="SourceForge.net Logo" style="border: 0px solid ;"></a> </td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="0%"> </td>
<td valign="top" width="100%">
<h2>Tutorial <small>(using Command Line Interface)</small><br>
</h2>
<h3>Prerequisites</h3>
<ul>
<li>Java JRE 1.5 or above (<a
href="http://java.sun.com/javase/downloads/index.jsp"><img alt=""
src="arrow.gif" style="border: 0px solid ; width: 13px; height: 13px;"
hspace="4">download</a>)</li>
<li>R-DBMS with JDBC-driver<br>
</li>
<li>jailer_1.0.zip</li>
</ul>
<h3><br>
</h3>
<h3>Step 1. Setup Jailer</h3>
Unpack jailer.zip:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$unzip jailer_0.9.6.zip<br>
$cd jailer<br style="font-family: monospace;">
</span> <span style="font-family: monospace;">$ll</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 136 2007-06-01 10:12 jailer.sh</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">-rw-r--r-- 1
wisser users 1175 2007-06-01 10:10 build.xml</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 136 2007-06-01 10:10 config</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 344 2007-06-01 10:10 datamodel</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 184 2007-06-01 10:10 example</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 160 2007-06-01 10:10 extractionmodel</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 272 2007-06-01 10:11 lib</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 3
wisser users 112 2007-06-01 10:10 restrictionmodel</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 4
wisser users 160 2007-06-01 10:10 script</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">drwxr-xr-x 4
wisser users 96 2007-06-01 10:10 src</span><br>
</td>
</tr>
</tbody>
</table>
<br>
Register the JDBC-Driver. Edit the file <span
style="font-family: monospace;">jailer.sh</span> and put the
JDBC-Driver into the class-path:<br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">jailer.sh</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;">JDBCLIB=<span
style="font-style: italic; color: rgb(51, 51, 255);">path to the
JDBC-Driver-jar</span></span><br style="font-family: monospace;">
<span style="font-family: monospace;">LIB=lib</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=.:out:out/jailer.jar</span><br
style="font-family: monospace;">
<br style="font-family: monospace;">
<span style="font-family: monospace;"># JDBC-driver</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$JDBCLIB/</span><span
style="font-family: monospace;"><span
style="font-style: italic; color: rgb(51, 51, 255);">JDBC-Driver-jar</span></span><br
style="font-family: monospace;">
<span style="font-family: monospace;"></span><br
style="font-family: monospace;">
<span style="font-family: monospace;"># configuration files
in the config directory</span><br style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:config</span><br
style="font-family: monospace;">
<br style="font-family: monospace;">
<span style="font-family: monospace;"># the libraries</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/junit.jar</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/commons-logging.jar</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/log4j.jar</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/args4j.jar</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/spring.jar</span><br
style="font-family: monospace;">
<span style="font-family: monospace;">CP=$CP:$LIB/jailer.jar</span><br
style="font-family: monospace;">
<br style="font-family: monospace;">
<span style="font-family: monospace;">java -cp $CP
net.sf.jailer.Jailer $@</span><br>
</td>
</tr>
</tbody>
</table>
<br>
<h3>Step 2. Setup the Database</h3>
Create a new schema and execute <a href="scott-tiger.sql.html"><img
alt="" src="arrow.gif"
style="border: 0px solid ; width: 13px; height: 13px;" hspace="4"><big><span
style="font-family: monospace;">script/scott-tiger.sql</span></big></a>.
Make sure that the script runs successfully.<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$db2 connect to wisser </span><span
style="font-family: monospace;">user scott </span><span
style="font-family: monospace;">using tiger<span
style="font-family: mon;"><span style="font-style: italic;"></span></span></span><span
style="font-family: monospace;"><span
style="font-style: italic; color: rgb(51, 51, 255);"></span></span><br>
<span style="font-family: monospace;">$db2 -tvf
script/scott-tiger.sql<br>
</span><span style="font-family: monospace;"></span></td>
</tr>
</tbody>
</table>
<br>
<h3>Step 3. Building the data model</h3>
Jailer needs to know all the tables and all associations between them,
so
we must tell him. Tables are defined in <big><span
style="font-family: monospace;">datamodel/table.csv</span><small>,</small></big><small>
</small>associations in <big><span
style="font-family: monospace;">datamodel/association.csv</span>.</big><br>
<br>
Fortunately most of the model definitions can be generated
automatically by analyzing the relational database.<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh build-model
com.ibm.db2.jcc.DB2Driver jdbc:db2://localhost:50001/wisser scott tiger<br>
Jailer 0.9.5<br>
<br>
Building data model.<br>
See 'export.log' for more information.<br>
<br>
$ cat export.log<br>
2007-06-01 15:51:30,308 [main] INFO - find tables with
net.sf.jailer.modelbuilder.<API key>@16fe0f4<br>
2007-06-01 15:51:32,115 [main] INFO - file
'datamodel/model-builder-table.csv' written<br>
2007-06-01 15:51:32,175 [main] INFO - find associations
with
net.sf.jailer.modelbuilder.<API key>@16fe0f4<br>
2007-06-01 15:51:32,298 [main] INFO - find associations
with DEPARTMENT<br>
2007-06-01 15:51:32,323 [main] INFO - find associations
with SALARYGRADE<br>
2007-06-01 15:51:32,328 [main] INFO - find associations
with EMPLOYEE<br>
2007-06-01 15:51:32,369 [main] INFO - file
'datamodel/<API key>.csv' written<br>
</span><span style="font-family: monospace;"><span
style="font-style: italic; color: rgb(51, 51, 255);"></span></span></td>
</tr>
</tbody>
</table>
<br>
<br>
<table>
<tbody>
<tr>
<td> Jailer finds the following tables
and associations: </td>
<td style="vertical-align: top;"><small><a
href="JailerTutorial.html#footnote">2</a></small></td>
</tr>
</tbody>
</table>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">datamodel/model-builder-table.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># Name;
upsert; primary key; ; author<br>
DEPARTMENT; N; DEPTNO INTEGER; ;IBM
DB2 JDBC Driver;<br>
EMPLOYEE; N; EMPNO
INTEGER; ;IBM DB2 JDBC Driver;<br>
SALARYGRADE; N; GRADE INTEGER;LOSAL
INTEGER;HISAL INTEGER; ;IBM DB2 JDBC Driver;<br>
</span><span style="font-family: monospace;"></span></td>
</tr>
</tbody>
</table>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">datamodel/<API key>.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># Table A; Table
B; first-insert; cardinality (opt); join-condition; name (opt);
author<br>
DEPARTMENT; EMPLOYEE; A; 1:n; A.DEPTNO=B.DEPTNO; ; IBM DB2
JDBC Driver;<br>
EMPLOYEE; EMPLOYEE; A; 1:n; A.EMPNO=B.BOSS;
; IBM DB2 JDBC Driver;<br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
Copy the definitions into the files <big><span
style="font-family: monospace;">datamodel/table.csv</span></big> and <big><span
style="font-family: monospace;">datamodel/association.csv</span>.</big><br>
One association is still missing: depending on his salary an employee
is classified into a salary grade. <br>
Add this definition manually.<br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">datamodel/association.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># Table A; Table
B; first-insert; cardinality (opt); join-condition; name (opt);
author<br>
DEPARTMENT; EMPLOYEE; A; 1:n; A.DEPTNO=B.DEPTNO; ; IBM DB2
JDBC Driver;<br>
EMPLOYEE; EMPLOYEE; A; 1:n; A.EMPNO=B.BOSS;
; IBM DB2 JDBC Driver;<br>
<span style="color: rgb(153, 0, 0);">EMPLOYEE;
SALARYGRADE; ; n:1; A.SALARY BETWEEN B.LOSAL AND B.HISAL; ; Wisser</span><br>
</span></td>
</tr>
</tbody>
</table>
<br>
Note that Jailer now knows more about the data model than the DBMS.<br>
<br>
<table>
<tbody>
<tr>
<td>
<h3>Step 4. Examine the data model</h3>
</td>
<td style="vertical-align: top;"><small><a href="#footnote">1</a></small></td>
</tr>
</tbody>
</table>
Let's see what Jailer knows now about the model.<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh print-datamodel<br>
DEPARTMENT (DEPTNO INTEGER NOT NULL)<br>
<br>
has dependent:<br>
EMPLOYEE
1:n on A.DEPTNO=B.DEPTNO<br>
<br>
EMPLOYEE (EMPNO INTEGER NOT NULL)<br>
<br>
depends on:<br>
DEPARTMENT
n:1 on B.DEPTNO=A.DEPTNO<br>
EMPLOYEE
n:1 on B.EMPNO=A.BOSS<br>
<br>
has dependent:<br>
EMPLOYEE
1:n on A.EMPNO=B.BOSS<br>
<br>
is associated with:<br>
SALARYGRADE
n:1 on A.SALARY BETWEEN B.LOSAL AND B.HISAL<br>
<br>
SALARYGRADE (GRADE INTEGER NOT NULL, LOSAL INTEGER NOT NULL, HISAL
INTEGER NOT NULL)<br>
<br>
is associated with:<br>
EMPLOYEE
1:n on B.SALARY BETWEEN A.LOSAL AND A.HISAL<br>
<br>
<br>
tables in dependent-cycle: EMPLOYEE<br>
<br>
excluding following tables from component-analysis: { }<br>
<br>
1 components:<br>
{ DEPARTMENT, EMPLOYEE, SALARYGRADE }<br>
</span></td>
</tr>
</tbody>
</table>
<br>
Note that each association is listed twice. While associations are
undirected, restrictions on them are directed. We will see later for
what restrictions are good for and how to define them.<br>
<br>
<h3>Step 5. Prepare the DB for exports</h3>
Jailer uses some tables for collecting entities inside the data base.
The structure of these tables depends on the data-model, so we have to
create the tables after building the data-model files. (You can easily
re-create the tables after any model-changes)<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh create-ddl > <a
href="jailer-ddl.sql.html"><img alt="" src="arrow.gif"
style="border: 0px solid ; width: 13px; height: 13px;" hspace="4">jailer-ddl.sql</a><br>
$ db2 -tvf jailer-ddl.sql<br>
</span></td>
</tr>
</tbody>
</table>
<h3><br>
Step 6. Export evil Scott (unrestricted)</h3>
Now export the employee named Scott. To do that we need an <span
style="font-style: italic;">extraction-model</span>. Create a file
named <big><span style="font-family: monospace;">extractionmodel/scott.csv</span></big>.<br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">extractionmodel/scott.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># the employee named 'SCOTT' and all
associated entities<br>
<br>
# subject;
condition;
limit; restrictions<br>
EMPLOYEE;
NAME='SCOTT';
;<br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
This extraction model describes a set of entities containing (the)
employee(s)
named 'SCOTT', entities associated with these employees, entities
associated with these entities and so forth.<br>
<br>
Export this set:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh export -e scott.sql
extractionmodel/scott.csv com.ibm.db2.jcc.DB2Driver
jdbc:db2://localhost:50001/wisser scott tiger<br>
Jailer 0.9.5<br>
<br>
exporting 'extractionmodel/scott.csv' to 'scott.sql'<br>
See 'export.log' for more information.<br>
writing file 'scott.sql'...<br>
file 'scott.sql' written.<br>
<br>
$ cat export.log<br>
2007-06-04 13:27:25,123 [main] INFO - exporting EMPLOYEE
Where NAME='SCOTT'<br>
<br>
2007-06-04 13:27:25,249 [main] INFO - export
statistic:
22<br>
2007-06-04 13:27:25,299 [main] INFO -
DEPARTMENT
3<br>
2007-06-04 13:27:25,299 [main] INFO -
EMPLOYEE
14<br>
2007-06-04 13:27:25,299 [main] INFO -
SALARYGRADE
5<br>
<br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
A file <a href="scott.sql.html"><img alt="" src="arrow.gif"
style="border: 0px solid ; width: 13px; height: 13px;" hspace="4"><big><span
style="font-family: monospace;">scott.sql</span></big></a> is created
containing <big><span style="font-family: monospace;">Insert</span></big>-statements
for Scott, for his evil boss, for the president and for scott's
department and salary-grade.<br>
<br>
But why are there also statements for all other employees? (Bad luck
for innocent James!)<br>
<br>
Let Jailer explain why:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh export -e scott.sql <span
style="color: rgb(204, 0, 0);">-explain </span>extractionmodel/scott.csv
com.ibm.db2.jcc.DB2Driver jdbc:db2://localhost:50001/wisser scott tiger
> /dev/null<br>
$ cat explain.log<br>
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7698) --1--> DEPARTMENT(30).<br>
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7698) --2--> EMPLOYEE(7521).<br>
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7698) --2--> EMPLOYEE(7844) --3--> SALARYGRADE(3, 1401,
2000).<br>
EMPLOYEE(7788) --4--> EMPLOYEE(7566) --4--> EMPLOYEE(7839)
--1--> DEPARTMENT(10).<br>
EMPLOYEE(7788) --4--> EMPLOYEE(7566) --4--> EMPLOYEE(7839)
--3--> SALARYGRADE(5, 3001, 9999).<br>
EMPLOYEE(7788) --1--> DEPARTMENT(20) --5--> EMPLOYEE(7369).<br>
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7698) --2--> EMPLOYEE(7654).<br>
<span style="color: rgb(204, 0, 0);">EMPLOYEE(7788)
--2--> EMPLOYEE(7876) --3--> SALARYGRADE(1, 700, 1200) --6-->
EMPLOYEE(7900).</span><br style="color: rgb(204, 0, 0);">
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7782) --2--> EMPLOYEE(7934) --3--> SALARYGRADE(2, 1201,
1400).<br>
EMPLOYEE(7788) --3--> SALARYGRADE(4, 2001, 3000) --6-->
EMPLOYEE(7698) --2--> EMPLOYEE(7499).<br>
EMPLOYEE(7788) --1--> DEPARTMENT(20) --5--> EMPLOYEE(7902).<br>
<br>
# 1
EMPLOYEE
->
DEPARTMENT
n:1 on B.DEPTNO=A.DEPTNO<br>
# 2
EMPLOYEE
->
EMPLOYEE(SUBORDINATES)
1:n on A.EMPNO=B.BOSS<br>
# 3
EMPLOYEE
->
SALARYGRADE
n:1 on A.SALARY BETWEEN B.LOSAL AND B.HISAL<br>
# 4
EMPLOYEE
-> EMPLOYEE(<API key>) n:1 on B.EMPNO=A.BOSS<br>
# 5
DEPARTMENT
->
EMPLOYEE
1:n on A.DEPTNO=B.DEPTNO<br>
# 6
SALARYGRADE
->
EMPLOYEE
1:n on B.SALARY BETWEEN A.LOSAL AND A.HISAL<br>
</span></td>
</tr>
</tbody>
</table>
<br>
Adams is Scotts subordinate and James and Adams are both
classified in the same salary-grade.<br>
<br>
<h3>Step 7. Export evil Scott (restricted)</h3>
If we export an employee we must export his boss and department too!
Otherwise the set of exported entities would not be consistent (due to
the foreign key constraints). No constraint prevents us from excluding
the salary-grade from export, but we should'nt do that becauses the
resulting set would
also be inconsistent.<br>
<br>
To exclude subordinates, 'same department'-members and 'same
salary-grade'-employees, we must restrict some associations. To do so,
define a <span style="font-style: italic;">restriction-model:</span><br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">restrictionmodel/no-subordinates.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># from A (or association name); to
B; <API key><br>
SUBORDINATE;
; ignore<br>
DEPARTMENT;
EMPLOYEE; ignore<br>
SALARYGRADE;
EMPLOYEE; ignore<br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
The <span style="font-style: italic;"><API key></span> is
an extension of the associations join-condition (expressed in
SQL-syntax) for one direction of an association. <br>
"ignore" stands for an unsatisfiable condition.<br>
<br>
Note that the association between DEPARTMENT and EMPLOYEE is restricted
in that direction by designating the source and destination table. It's
obviously not possible to restrict reflexive associations the same way,
so we have to give the <span style="font-style: italic;">'subordinate
of</span>'-association a name.<br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">datamodel/association.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># Table A; Table
B; first-insert; cardinality (opt); join-condition; name (opt);
author<br>
DEPARTMENT; EMPLOYEE; A; 1:n; A.DEPTNO=B.DEPTNO; ; IBM DB2
JDBC Driver;<br>
EMPLOYEE; EMPLOYEE; A; 1:n; A.EMPNO=B.BOSS; </span><span
style="font-family: monospace; color: rgb(255, 0, 0);">SUBORDINATE</span><span
style="font-family: monospace;">; IBM DB2 JDBC Driver;<br>
<span style="color: rgb(0, 0, 0);">EMPLOYEE;
SALARYGRADE; ; n:1; A.SALARY BETWEEN B.LOSAL AND B.HISAL; ; Wisser</span><br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
You can examine the restrictions the same way you examined the data
model:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh print-datamodel <span
style="color: rgb(204, 0, 0);">restrictionmodel/no-subordinates.csv</span><br>
restricted by: [restrictionmodel/no-subordinates.csv]<br>
DEPARTMENT (DEPTNO INTEGER NOT NULL)<br>
<br>
ignored:<br>
EMPLOYEE
1:n on A.DEPTNO=B.DEPTNO<br>
<br>
EMPLOYEE (EMPNO INTEGER NOT NULL)<br>
<br>
depends on:<br>
DEPARTMENT
n:1 on B.DEPTNO=A.DEPTNO<br>
EMPLOYEE(inverse-SUBORDINATE) n:1 on
B.EMPNO=A.BOSS<br>
<br>
is associated with:<br>
SALARYGRADE
n:1 on A.SALARY BETWEEN B.LOSAL AND B.HISAL<br>
<br>
<span style="color: rgb(255, 0, 0);">ignored:</span><br
style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">
EMPLOYEE(SUBORDINATE)
1:n on A.EMPNO=B.BOSS</span><br>
<br>
SALARYGRADE (GRADE INTEGER NOT NULL, LOSAL INTEGER NOT NULL, HISAL
INTEGER NOT NULL)<br>
<br>
ignored:<br>
EMPLOYEE
1:n on B.SALARY BETWEEN A.LOSAL AND A.HISAL<br>
<br>
<br>
tables in dependent-cycle: EMPLOYEE<br>
<br>
excluding following tables from component-analysis: { DEPARTMENT,
SALARYGRADE }<br>
<br>
1 components: <br>
{ EMPLOYEE }<br>
</span></td>
</tr>
</tbody>
</table>
<br>
<br>
A restriction-model is part of the extraction-model. Create a new
extraction-model:<br>
<br>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">extractionmodel/<API key>.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># the employee named 'SCOTT' and all
associated entities<br>
<br>
# subject;
condition;
limit; restrictions<br>
EMPLOYEE;
NAME='SCOTT';
; </span><span
style="font-family: monospace; color: rgb(255, 0, 0);">no-subordinates.csv</span></td>
</tr>
</tbody>
</table>
<br>
<br>
and look what Jailer extracts now:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh export -e scott.sql <span
style="color: rgb(204, 0, 0);">extractionmodel/<API key>.csv</span>
com.ibm.db2.jcc.DB2Driver jdbc:db2://localhost:50001/wisser xbcsetup
1234 > /dev/null<br>
$ cat scott.sql<br>
</span><span style="font-family: monospace;">-- generated
by Jailer at Mon Jun 04 15:08:15 CEST 2007 from wisser@u19<br>
-- extraction model: EMPLOYEE where NAME='SCOTT'
(extractionmodel/<API key>.csv)<br>
-- database URL:
jdbc:db2://localhost:50001/wisser<br>
-- database user: scott<br>
-- exported entities: 7<br>
--
DEPARTMENT
2<br>
--
EMPLOYEE
3<br>
--
SALARYGRADE
2<br>
<br>
<br>
<br>
Insert into SALARYGRADE(GRADE, LOSAL, HISAL) <br>
values (4, 2001, 3000), <br>
(5, 3001, 9999);<br>
Insert into DEPARTMENT(DEPTNO, NAME, LOCATION) <br>
values (20, 'RESEARCH', 'DALLAS'), <br>
(10, 'ACCOUNTING',
'NEW YORK');<br>
Insert into EMPLOYEE(EMPNO, NAME, JOB, BOSS, HIREDATE, SALARY, COMM,
DEPTNO) <br>
values (7839, 'KING', 'PRESIDENT', null, '1981-11-17', 5000.00,
null, 10);<br>
Insert into EMPLOYEE(EMPNO, NAME, JOB, BOSS, HIREDATE, SALARY, COMM,
DEPTNO) <br>
values (7566, 'JONES', 'MANAGER', 7839, '1981-04-02', 2975.00,
null, 20);<br>
Insert into EMPLOYEE(EMPNO, NAME, JOB, BOSS, HIREDATE, SALARY, COMM,
DEPTNO) <br>
values (7788, 'SCOTT', 'ANALYST', 7566, '1982-12-09', 3000.00,
null, 20);<br>
</span></td>
</tr>
</tbody>
</table>
<br>
Freedom for the innocent!<br>
<br>
<h3>Step 8. Delete Scott (unsuccessful)</h3>
It is also possible to create DML-scripts for deletion of exported
entities:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh export -e scott.sql <span
style="color: rgb(204, 0, 0);">-d delete-scott.sql</span>
extractionmodel/<API key>.csv
com.ibm.db2.jcc.DB2Driver jdbc:db2://localhost:50001/wisser scott tiger
> /dev/null<br>
$ cat delete-scott.sql<br>
-- generated by Jailer at Tue Jun 05 10:20:40 CEST 2007 from wisser@u19<br>
-- extraction model: EMPLOYEE where NAME='SCOTT'
(extractionmodel/<API key>.csv)<br>
-- database URL:
jdbc:db2://localhost:50001/wisser<br>
-- database user: scott<br>
-- exported entities: 7<br>
--
DEPARTMENT
2<br>
--
EMPLOYEE
3<br>
--
SALARYGRADE
2<br>
-- Tabu-tables: { }<br>
-- entities to delete: 0<br>
<br>
</span><span style="font-family: monospace;"></span></td>
</tr>
</tbody>
</table>
<br>
Jailer has exported 7 entities but didn't delete anything! That's
because deleting Scott but not Scotts subordinate (who is not in the
set defined by the extraction-model!) would violate the integrity of
the data base.<br>
<br>
<h3>Step 9. Delete Scott</h3>
<p>In order to delete Scott, me must delete his subordinate too.
To do so, relax the restriction on the <span
style="font-style: italic;">SUBORDINATE</span>-association:</p>
<table
style="background-color: rgb(51, 102, 255); text-align: left;"
border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td
style="height: 24px; background-color: rgb(202, 225, 235); vertical-align: top;"><big><span
style="font-family: monospace;"><span style="font-weight: bold;">restrictionmodel/no-subordinates.csv</span>
</span><span style="font-family: monospace;"></span></big><br>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(202, 225, 235); vertical-align: top;"><span
style="font-family: monospace;"># from A (or association name); to
B; <API key><br>
SUBORDINATE;
; <span
style="color: rgb(204, 0, 0);">A.NAME='SCOTT'</span><br>
DEPARTMENT;
EMPLOYEE; ignore<br>
SALARYGRADE;
EMPLOYEE; ignore<br>
</span></td>
</tr>
</tbody>
</table>
<br>
and repeat the exportation:<br>
<br>
<table style="width: 100%; text-align: left;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="background-color: rgb(230, 255, 230); vertical-align: top;"><span
style="font-family: monospace;">$ sh jailer.sh export -e <a
href="scott.sql.2.html"><img alt="" src="arrow.gif"
style="border: 0px solid ; width: 13px; height: 13px;" hspace="4">scott.sql</a>
<span style="color: rgb(0, 0, 0);">-d delete-scott.sql</span>
extractionmodel/<API key>.csv
com.ibm.db2.jcc.DB2Driver jdbc:db2://localhost:50001/wisser scott tiger
> /dev/null<br>
$ cat delete-scott.sql<br>
-- generated by Jailer at Tue Jun 05 10:50:03 CEST 2007 from wisser@u19<br>
-- extraction model: EMPLOYEE where NAME='SCOTT'
(extractionmodel/<API key>.csv)<br>
-- database URL:
jdbc:db2://localhost:50001/wisser<br>
-- database user: scott<br>
-- exported entities: 9<br>
--
DEPARTMENT
2<br>
--
EMPLOYEE
4<br>
--
SALARYGRADE
3<br>
-- Tabu-tables: { }<br>
-- entities to delete: 2<br>
--
EMPLOYEE
2 (-2)<br>
<br>
<br>
<br>
Delete from EMPLOYEE Where EMPNO in (7876);<br>
Delete from EMPLOYEE Where EMPNO in (7788);<br>
</span></td>
</tr>
</tbody>
</table>
<br>
The file <big><span style="font-family: monospace;">delete-scott.sql</span></big>
contains <big><span style="font-family: monospace;">Delete</span></big>-statements
for Scott and Adams.<br>
Note that <big><span style="font-family: monospace;">scott.sql</span></big>
now contains <big><span style="font-family: monospace;">Insert</span></big>-statements
for Adams and his salary-grade too.<br>
<br>
</td>
</tr>
</tbody>
</table>
<br>
<hr style="width: 100%; height: 1px;">
<a name="footnote"></a>1) Since 0.9.3 it is also possible to render the
data model as HTML. Click<a href="render/index.html"><img alt=""
src="arrow.gif" style="border: 0px solid ; width: 13px; height: 13px;"
hspace="4">here</a> to see how the
tutorial's model would look like in HTML.<br>
2) Since 2.0 all associations in <big><span
style="font-family: monospace;">datamodel/<API key>.csv
</span></big>have names.<big><span style="font-family: monospace;"></span></big><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html> |
#pragma once
#include <aws/elasticache/ElastiCache_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/elasticache/model/ResponseMetadata.h>
#include <aws/elasticache/model/<API key>.h>
#include <aws/elasticache/model/<API key>.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class <API key>;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace ElastiCache
{
namespace Model
{
class AWS_ELASTICACHE_API <API key>
{
public:
<API key>();
<API key>(const Aws::<API key><Aws::Utils::Xml::XmlDocument>& result);
<API key>& operator=(const Aws::<API key><Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>Update actions that have been processed successfully</p>
*/
inline const Aws::Vector<<API key>>& <API key>() const{ return <API key>; }
/**
* <p>Update actions that have been processed successfully</p>
*/
inline void <API key>(const Aws::Vector<<API key>>& value) { <API key> = value; }
/**
* <p>Update actions that have been processed successfully</p>
*/
inline void <API key>(Aws::Vector<<API key>>&& value) { <API key> = std::move(value); }
/**
* <p>Update actions that have been processed successfully</p>
*/
inline <API key>& <API key>(const Aws::Vector<<API key>>& value) { <API key>(value); return *this;}
/**
* <p>Update actions that have been processed successfully</p>
*/
inline <API key>& <API key>(Aws::Vector<<API key>>&& value) { <API key>(std::move(value)); return *this;}
/**
* <p>Update actions that have been processed successfully</p>
*/
inline <API key>& <API key>(const <API key>& value) { <API key>.push_back(value); return *this; }
/**
* <p>Update actions that have been processed successfully</p>
*/
inline <API key>& <API key>(<API key>&& value) { <API key>.push_back(std::move(value)); return *this; }
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline const Aws::Vector<<API key>>& <API key>() const{ return <API key>; }
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline void <API key>(const Aws::Vector<<API key>>& value) { <API key> = value; }
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline void <API key>(Aws::Vector<<API key>>&& value) { <API key> = std::move(value); }
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline <API key>& <API key>(const Aws::Vector<<API key>>& value) { <API key>(value); return *this;}
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline <API key>& <API key>(Aws::Vector<<API key>>&& value) { <API key>(std::move(value)); return *this;}
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline <API key>& <API key>(const <API key>& value) { <API key>.push_back(value); return *this; }
/**
* <p>Update actions that haven't been processed successfully</p>
*/
inline <API key>& <API key>(<API key>&& value) { <API key>.push_back(std::move(value)); return *this; }
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline <API key>& <API key>(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline <API key>& <API key>(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
Aws::Vector<<API key>> <API key>;
Aws::Vector<<API key>> <API key>;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace ElastiCache
} // namespace Aws |
<?php namespace DMA\Friends\Tests;
use League\FactoryMuffin\Facade as FactoryMuffin;
use DMA\Friends\Tests\MuffinCase;
use DMA\Friends\Models\Activity;
class ActivityModelTest extends MuffinCase
{
public function <API key>()
{
$activity = FactoryMuffin::create('DMA\Friends\Models\Activity');
$this->assertInstanceOf('DMA\Friends\Models\Activity', $activity);
}
public function <API key>()
{
$activity = FactoryMuffin::create('DMA\Friends\Models\Activity');
$category = FactoryMuffin::create('DMA\Friends\Models\Category');
$this->assertInstanceOf('DMA\Friends\Models\Category', $category);
$activity->categories()->save($category);
}
public function <API key>()
{
$activity = FactoryMuffin::create('DMA\Friends\Models\Activity');
$timeRestrictionData = [
'start_time' => '11:00AM',
'end_time' => '12:00PM',
'days' => [
1 => true,
2 => false,
3 => true,
4 => false,
5 => true,
6 => false,
],
];
$activity-><API key> = $timeRestrictionData;
$activity->save();
// Load a new reference to the model
$newActivity = Activity::find($activity->id);
// Compare <API key> to ensure that attributes are serialized/unserialized properly
$this->assertEquals($newActivity-><API key>, $timeRestrictionData);
}
} |
// file at the top-level directory of this distribution and at
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:fail
fn f() {
fail!();
}
fn main() {
f();
let _a = @0;
} |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/translate/v3/translation_service.proto
namespace Google\Cloud\Translate\V3;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Configures which glossary should be used for a specific target language,
* and defines options for applying that glossary.
*
* Generated from protobuf message <code>google.cloud.translation.v3.<API key></code>
*/
class <API key> extends \Google\Protobuf\Internal\Message
{
/**
* Required. The `glossary` to be applied for this translation.
* The format depends on glossary:
* - User provided custom glossary:
* `projects/{<API key>}/locations/{location-id}/glossaries/{glossary-id}`
*
* Generated from protobuf field <code>string glossary = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private $glossary = '';
/**
* Optional. Indicates match is case-insensitive.
* Default value is false if missing.
*
* Generated from protobuf field <code>bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
private $ignore_case = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $glossary
* Required. The `glossary` to be applied for this translation.
* The format depends on glossary:
* - User provided custom glossary:
* `projects/{<API key>}/locations/{location-id}/glossaries/{glossary-id}`
* @type bool $ignore_case
* Optional. Indicates match is case-insensitive.
* Default value is false if missing.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce();
parent::__construct($data);
}
/**
* Required. The `glossary` to be applied for this translation.
* The format depends on glossary:
* - User provided custom glossary:
* `projects/{<API key>}/locations/{location-id}/glossaries/{glossary-id}`
*
* Generated from protobuf field <code>string glossary = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return string
*/
public function getGlossary()
{
return $this->glossary;
}
/**
* Required. The `glossary` to be applied for this translation.
* The format depends on glossary:
* - User provided custom glossary:
* `projects/{<API key>}/locations/{location-id}/glossaries/{glossary-id}`
*
* Generated from protobuf field <code>string glossary = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @param string $var
* @return $this
*/
public function setGlossary($var)
{
GPBUtil::checkString($var, True);
$this->glossary = $var;
return $this;
}
/**
* Optional. Indicates match is case-insensitive.
* Default value is false if missing.
*
* Generated from protobuf field <code>bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return bool
*/
public function getIgnoreCase()
{
return $this->ignore_case;
}
/**
* Optional. Indicates match is case-insensitive.
* Default value is false if missing.
*
* Generated from protobuf field <code>bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param bool $var
* @return $this
*/
public function setIgnoreCase($var)
{
GPBUtil::checkBool($var);
$this->ignore_case = $var;
return $this;
}
} |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/api/monitoring.proto
namespace Google\Api;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Monitoring configuration of the service.
* The example below shows how to configure monitored resources and metrics
* for monitoring. In the example, a monitored resource and two metrics are
* defined. The `library.googleapis.com/book/returned_count` metric is sent
* to both producer and consumer projects, whereas the
* `library.googleapis.com/book/overdue_count` metric is only sent to the
* consumer project.
* monitored_resources:
* - type: library.googleapis.com/branch
* labels:
* - key: /city
* description: The city where the library branch is located in.
* - key: /name
* description: The name of the branch.
* metrics:
* - name: library.googleapis.com/book/returned_count
* metric_kind: DELTA
* value_type: INT64
* labels:
* - key: /customer_id
* - name: library.googleapis.com/book/overdue_count
* metric_kind: GAUGE
* value_type: INT64
* labels:
* - key: /customer_id
* monitoring:
* <API key>:
* - monitored_resource: library.googleapis.com/branch
* metrics:
* - library.googleapis.com/book/returned_count
* <API key>:
* - monitored_resource: library.googleapis.com/branch
* metrics:
* - library.googleapis.com/book/returned_count
* - library.googleapis.com/book/overdue_count
*
* Generated from protobuf message <code>google.api.Monitoring</code>
*/
class Monitoring extends \Google\Protobuf\Internal\Message
{
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one producer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 1;</code>
*/
private $<API key>;
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 2;</code>
*/
private $<API key>;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Api\Monitoring\<API key>[]|\Google\Protobuf\Internal\RepeatedField $<API key>
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one producer destination.
* @type \Google\Api\Monitoring\<API key>[]|\Google\Protobuf\Internal\RepeatedField $<API key>
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one consumer destination.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Api\Monitoring::initOnce();
parent::__construct($data);
}
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one producer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 1;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* Monitoring configurations for sending metrics to the producer project.
* There can be multiple producer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one producer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 1;</code>
* @param \Google\Api\Monitoring\<API key>[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function <API key>($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\<API key>::class);
$this-><API key> = $arr;
return $this;
}
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 2;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* Monitoring configurations for sending metrics to the consumer project.
* There can be multiple consumer destinations, each one must have a
* different monitored resource type. A metric can be used in at most
* one consumer destination.
*
* Generated from protobuf field <code>repeated .google.api.Monitoring.<API key> <API key> = 2;</code>
* @param \Google\Api\Monitoring\<API key>[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function <API key>($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\<API key>::class);
$this-><API key> = $arr;
return $this;
}
} |
package <API key>;
public class <API key>
extends java.lang.Object
implements
mono.android.IGCUserPeer,
android.view.View.OnTouchListener
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onTouch:(Landroid/view/View;Landroid/view/MotionEvent;)Z:<API key>:Android.Views.View/<API key>, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"";
mono.android.Runtime.register ("Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer+ButtonTouchListener, Xamarin.Forms.Platform.Android", <API key>.class, __md_methods);
}
public <API key> ()
{
super ();
if (getClass () == <API key>.class)
mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer+ButtonTouchListener, Xamarin.Forms.Platform.Android", "", this, new java.lang.Object[] { });
}
public boolean onTouch (android.view.View p0, android.view.MotionEvent p1)
{
return n_onTouch (p0, p1);
}
private native boolean n_onTouch (android.view.View p0, android.view.MotionEvent p1);
private java.util.ArrayList refList;
public void <API key> (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void <API key> ()
{
if (refList != null)
refList.clear ();
}
} |
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;
using Microsoft.CodeAnalysis.VisualBasic.Testing;
namespace NFluent.Analyzer.Test
{
public static partial class <API key><TAnalyzer>
where TAnalyzer : DiagnosticAnalyzer, new()
{
<inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic()"/>
public static DiagnosticResult Diagnostic()
=> <API key><TAnalyzer, MSTestVerifier>.Diagnostic();
<inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic(string)"/>
public static DiagnosticResult Diagnostic(string diagnosticId)
=> <API key><TAnalyzer, MSTestVerifier>.Diagnostic(diagnosticId);
<inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic(<API key>)"/>
public static DiagnosticResult Diagnostic(<API key> descriptor)
=> <API key><TAnalyzer, MSTestVerifier>.Diagnostic(descriptor);
<inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.VerifyAnalyzerAsync(string, DiagnosticResult[])"/>
public static async Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected)
{
var test = new Test
{
TestCode = source,
};
test.ExpectedDiagnostics.AddRange(expected);
await test.RunAsync(CancellationToken.None);
}
}
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>bson_free()</title>
<link rel="stylesheet" type="text/css" href="C.css">
<script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="jquery.syntax.js"></script><script type="text/javascript" src="yelp.js"></script>
</head>
<body><div class="page" role="main">
<div class="header"><div class="trails" role="navigation"><div class="trail">
<a class="trail" href="index.html" title="Libbson">Libbson</a> › <a class="trail" href="index.html
<div class="body">
<div class="hgroup"><h1 class="title"><span class="title">bson_free()</span></h1></div>
<div class="region">
<div class="contents"></div>
<div id="synopsis" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Synopsis</span></h2></div>
<div class="region"><div class="contents"><div class="synopsis"><div class="inner"><div class="region"><div class="contents"><div class="code"><pre class="contents syntax brush-clang">void
bson_free (void *mem);</pre></div></div></div></div></div></div></div>
</div></div>
<div id="parameters" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Parameters</span></h2></div>
<div class="region"><div class="contents"><div class="table"><div class="inner"><div class="region"><table class="table"><tr>
<td><p class="p"><span class="code">mem</span></p></td>
<td><p class="p">A memory region.</p></td>
</tr></table></div></div></div></div></div>
</div></div>
<div id="description" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Description</span></h2></div>
<div class="region"><div class="contents"><p class="p">This function shall free the memory supplied by <span class="code">mem</span>. This should be used by functions that require you free the result with <span class="code">bson_free()</span>.</p></div></div>
</div></div>
<div class="sect sect-links" role="navigation">
<div class="hgroup"></div>
<div class="contents"><div class="links guidelinks"><div class="inner">
<div class="title"><h2><span class="title">More Information</span></h2></div>
<div class="region"><ul><li class="links "><a href="memory.html" title="Memory Management">Memory Management</a></li></ul></div>
</div></div></div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="footer"></div>
</div></body>
</html> |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0) on Sat Aug 25 00:26:56 EDT 2007 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
Priority (Apache Log4j 1.2.15 API)
</TITLE>
<META NAME="date" CONTENT="2007-08-25">
<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="Priority (Apache Log4j 1.2.15 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="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Priority.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/log4j/PatternLayout.html" title="class in org.apache.log4j"><B>PREV CLASS</B></A>
<A HREF="../../../org/apache/log4j/<API key>.html" title="class in org.apache.log4j"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/apache/log4j/Priority.html" target="_top"><B>FRAMES</B></A>
<A HREF="Priority.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.log4j</FONT>
<BR>
Class Priority</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.apache.log4j.Priority</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../org/apache/log4j/Level.html" title="class in org.apache.log4j">Level</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>Priority</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<font color="#AA4444">Refrain from using this class directly, use
the <A HREF="../../../org/apache/log4j/Level.html" title="class in org.apache.log4j"><CODE>Level</CODE></A> class instead</font>.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Ceki Gülcü</DD>
</DL>
<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>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#ALL_INT">ALL_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#DEBUG">DEBUG</A></B></CODE>
<BR>
<B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#DEBUG"><CODE>Level.DEBUG</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#DEBUG_INT">DEBUG_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#ERROR">ERROR</A></B></CODE>
<BR>
<B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#ERROR"><CODE>Level.ERROR</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#ERROR_INT">ERROR_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#FATAL">FATAL</A></B></CODE>
<BR>
<B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#FATAL"><CODE>Level.FATAL</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#FATAL_INT">FATAL_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#INFO">INFO</A></B></CODE>
<BR>
<B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#INFO"><CODE>Level.INFO</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#INFO_INT">INFO_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#OFF_INT">OFF_INT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#WARN">WARN</A></B></CODE>
<BR>
<B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#WARN"><CODE>Level.WARN</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#WARN_INT">WARN_INT</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 ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#Priority()">Priority</A></B>()</CODE>
<BR>
Default constructor for deserialization.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#Priority(int, java.lang.String, int)">Priority</A></B>(int level,
java.lang.String levelStr,
int syslogEquivalent)</CODE>
<BR>
Instantiate a level object.</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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object o)</CODE>
<BR>
Two priorities are equal if their level fields are equal.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#<API key>()"><API key></A></B>()</CODE>
<BR>
<B>Deprecated.</B> <I>This method will be removed with no replacement.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#getSyslogEquivalent()">getSyslogEquivalent</A></B>()</CODE>
<BR>
Return the syslog equivalent of this priority as an integer.</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/log4j/Priority.html#isGreaterOrEqual(org.apache.log4j.Priority)">isGreaterOrEqual</A></B>(<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> r)</CODE>
<BR>
Returns <code>true</code> if this level has a higher or equal
level than the level passed as argument, <code>false</code>
otherwise.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toInt()">toInt</A></B>()</CODE>
<BR>
Returns the integer representation of this level.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toPriority(int)">toPriority</A></B>(int val)</CODE>
<BR>
<B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(int)"><CODE>Level.toLevel(int)</CODE></A> method instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toPriority(int, org.apache.log4j.Priority)">toPriority</A></B>(int val,
<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> defaultPriority)</CODE>
<BR>
<B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(int, org.apache.log4j.Level)"><CODE>Level.toLevel(int, Level)</CODE></A> method instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toPriority(java.lang.String)">toPriority</A></B>(java.lang.String sArg)</CODE>
<BR>
<B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(java.lang.String)"><CODE>Level.toLevel(String)</CODE></A> method instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toPriority(java.lang.String, org.apache.log4j.Priority)">toPriority</A></B>(java.lang.String sArg,
<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> defaultPriority)</CODE>
<BR>
<B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(java.lang.String, org.apache.log4j.Level)"><CODE>Level.toLevel(String, Level)</CODE></A> method instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/apache/log4j/Priority.html#toString()">toString</A></B>()</CODE>
<BR>
Returns the string representation of this priority.</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, finalize, getClass, hashCode, notify, notifyAll, 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="OFF_INT"></A><H3>
OFF_INT</H3>
<PRE>
public static final int <B>OFF_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.OFF_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="FATAL_INT"></A><H3>
FATAL_INT</H3>
<PRE>
public static final int <B>FATAL_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.FATAL_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="ERROR_INT"></A><H3>
ERROR_INT</H3>
<PRE>
public static final int <B>ERROR_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.ERROR_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="WARN_INT"></A><H3>
WARN_INT</H3>
<PRE>
public static final int <B>WARN_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.WARN_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="INFO_INT"></A><H3>
INFO_INT</H3>
<PRE>
public static final int <B>INFO_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.INFO_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="DEBUG_INT"></A><H3>
DEBUG_INT</H3>
<PRE>
public static final int <B>DEBUG_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.DEBUG_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="ALL_INT"></A><H3>
ALL_INT</H3>
<PRE>
public static final int <B>ALL_INT</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.apache.log4j.Priority.ALL_INT">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="FATAL"></A><H3>
FATAL</H3>
<PRE>
public static final <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>FATAL</B></PRE>
<DL>
<DD><B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#FATAL"><CODE>Level.FATAL</CODE></A> instead.</I><DL>
</DL>
</DL>
<HR>
<A NAME="ERROR"></A><H3>
ERROR</H3>
<PRE>
public static final <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>ERROR</B></PRE>
<DL>
<DD><B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#ERROR"><CODE>Level.ERROR</CODE></A> instead.</I><DL>
</DL>
</DL>
<HR>
<A NAME="WARN"></A><H3>
WARN</H3>
<PRE>
public static final <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>WARN</B></PRE>
<DL>
<DD><B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#WARN"><CODE>Level.WARN</CODE></A> instead.</I><DL>
</DL>
</DL>
<HR>
<A NAME="INFO"></A><H3>
INFO</H3>
<PRE>
public static final <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>INFO</B></PRE>
<DL>
<DD><B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#INFO"><CODE>Level.INFO</CODE></A> instead.</I><DL>
</DL>
</DL>
<HR>
<A NAME="DEBUG"></A><H3>
DEBUG</H3>
<PRE>
public static final <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>DEBUG</B></PRE>
<DL>
<DD><B>Deprecated.</B> <I>Use <A HREF="../../../org/apache/log4j/Level.html#DEBUG"><CODE>Level.DEBUG</CODE></A> instead.</I><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="Priority()"></A><H3>
Priority</H3>
<PRE>
protected <B>Priority</B>()</PRE>
<DL>
<DD>Default constructor for deserialization.
<P>
</DL>
<HR>
<A NAME="Priority(int, java.lang.String, int)"></A><H3>
Priority</H3>
<PRE>
protected <B>Priority</B>(int level,
java.lang.String levelStr,
int syslogEquivalent)</PRE>
<DL>
<DD>Instantiate a level object.
<P>
</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="equals(java.lang.Object)"></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(java.lang.Object o)</PRE>
<DL>
<DD>Two priorities are equal if their level fields are equal.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>equals</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getSyslogEquivalent()"></A><H3>
getSyslogEquivalent</H3>
<PRE>
public final int <B>getSyslogEquivalent</B>()</PRE>
<DL>
<DD>Return the syslog equivalent of this priority as an integer.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isGreaterOrEqual(org.apache.log4j.Priority)"></A><H3>
isGreaterOrEqual</H3>
<PRE>
public boolean <B>isGreaterOrEqual</B>(<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> r)</PRE>
<DL>
<DD>Returns <code>true</code> if this level has a higher or equal
level than the level passed as argument, <code>false</code>
otherwise.
<p>You should think twice before overriding the default
implementation of <code>isGreaterOrEqual</code> method.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="<API key>()"></A><H3>
<API key></H3>
<PRE>
public static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A>[] <B><API key></B>()</PRE>
<DL>
<DD><B>Deprecated.</B> <I>This method will be removed with no replacement.</I>
<P>
<DD>Return all possible priorities as an array of Level objects in
descending order.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toString()"></A><H3>
toString</H3>
<PRE>
public final java.lang.String <B>toString</B>()</PRE>
<DL>
<DD>Returns the string representation of this priority.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toInt()"></A><H3>
toInt</H3>
<PRE>
public final int <B>toInt</B>()</PRE>
<DL>
<DD>Returns the integer representation of this level.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toPriority(java.lang.String)"></A><H3>
toPriority</H3>
<PRE>
public static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>toPriority</B>(java.lang.String sArg)</PRE>
<DL>
<DD><B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(java.lang.String)"><CODE>Level.toLevel(String)</CODE></A> method instead.</I>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toPriority(int)"></A><H3>
toPriority</H3>
<PRE>
public static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>toPriority</B>(int val)</PRE>
<DL>
<DD><B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(int)"><CODE>Level.toLevel(int)</CODE></A> method instead.</I>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toPriority(int, org.apache.log4j.Priority)"></A><H3>
toPriority</H3>
<PRE>
public static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>toPriority</B>(int val,
<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> defaultPriority)</PRE>
<DL>
<DD><B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(int, org.apache.log4j.Level)"><CODE>Level.toLevel(int, Level)</CODE></A> method instead.</I>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toPriority(java.lang.String, org.apache.log4j.Priority)"></A><H3>
toPriority</H3>
<PRE>
public static <A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> <B>toPriority</B>(java.lang.String sArg,
<A HREF="../../../org/apache/log4j/Priority.html" title="class in org.apache.log4j">Priority</A> defaultPriority)</PRE>
<DL>
<DD><B>Deprecated.</B> <I>Please use the <A HREF="../../../org/apache/log4j/Level.html#toLevel(java.lang.String, org.apache.log4j.Level)"><CODE>Level.toLevel(String, Level)</CODE></A> method instead.</I>
<P>
<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/Priority.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/log4j/PatternLayout.html" title="class in org.apache.log4j"><B>PREV CLASS</B></A>
<A HREF="../../../org/apache/log4j/<API key>.html" title="class in org.apache.log4j"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/apache/log4j/Priority.html" target="_top"><B>FRAMES</B></A>
<A HREF="Priority.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>
Copyright © 1999-2007 <a href="http:
</BODY>
</HTML> |
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;
import org.junit.jupiter.api.extension.ExtendWith;
class ValueSourcesTest {
@ParameterizedTest
@ValueSource(ints = {1})
void testWithIntValues(int i) { }
@ParameterizedTest
@ValueSource(longs = {1L})
void testWithLongValues(long l) { }
@ParameterizedTest
@ValueSource(doubles = {0.5})
void <API key>(double d) { }
@ParameterizedTest
@ValueSource(strings = {""})
void <API key>(String s) { }
@ParameterizedTest
@ValueSource(booleans = {<warning descr="No implicit conversion found to convert object of type 'boolean' to 'int'">false</warning>})
void <API key>(int argument) { }
@ParameterizedTest
<warning descr="Exactly one type of input must be provided">@ValueSource(ints = {1},
strings = "str")</warning>
void <API key>(int i) { }
@ParameterizedTest
<warning descr="No value source is defined">@ValueSource()</warning>
void testWithNoValues(int i) { }
@ParameterizedTest
<warning descr="Multiple parameters are not supported by this source">@ValueSource(ints = 1)</warning>
void <API key>(int i, int j) { }
@ParameterizedTest
@ValueSource(ints = {1})
<warning descr="Suspicious combination '@Test' and '@ParameterizedTest'">@org.junit.jupiter.api.Test</warning>
void <API key>(int i) { }
@ValueSource(ints = {1})
<warning descr="Suspicious combination '@Test' and parameterized source">@org.junit.jupiter.api.Test</warning>
void <API key>(int i) { }
}
@ExtendWith( String.class ) //fake extension
@interface RunnerExtension { }
@RunnerExtension
abstract class AbstractValueSource {}
class <API key> extends AbstractValueSource {
@ParameterizedTest
@ValueSource(ints = {1})
void testWithIntValues(int i, String fromExtension) { }
}
class <API key> {
<warning descr="No sources are provided, the suite would be empty">@ParameterizedTest</warning>
void <API key>(int i) { }
@ParameterizedTest
@EnumSource(<warning descr="No implicit conversion found to convert object of type 'E' to 'int'">E.class</warning>)
void testWithEnumSource(int i) { }
@ParameterizedTest
@EnumSource(E.class)
void <API key>(E e) { }
enum E {
A, B;
}
@ParameterizedTest
@CsvSource({"foo, 1"})
void testWithCsvSource(String first, int second) {}
}
@org.junit.jupiter.params.provider.ArgumentsSource()
@interface CustomSource { }
class <API key> {
@ParameterizedTest
@CustomSource
void jsonSourceTest(String param) { }
}
class ArgSources {
@ParameterizedTest
@org.junit.jupiter.params.provider.ArgumentsSources({@org.junit.jupiter.params.provider.ArgumentsSource})
void args(String param) { }
<warning descr="No sources are provided, the suite would be empty">@ParameterizedTest</warning>
@org.junit.jupiter.params.provider.ArgumentsSources({})
void emptyArgs(String param) { }
} |
var timespan = require('./lib/timespan');
var jws = require('jws');
var includes = require('lodash.includes');
var isBoolean = require('lodash.isboolean');
var isInteger = require('lodash.isinteger');
var isNumber = require('lodash.isnumber');
var isPlainObject = require('lodash.isplainobject');
var isString = require('lodash.isstring');
var once = require('lodash.once');
var sign_options_schema = {
expiresIn: { isValid: function(value) { return isInteger(value) || isString(value); }, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
notBefore: { isValid: function(value) { return isInteger(value) || isString(value); }, message: '"notBefore" should be a number of seconds or string representing a timespan' },
audience: { isValid: function(value) { return isString(value) || Array.isArray(value); }, message: '"audience" must be a string or array' },
algorithm: { isValid: includes.bind(null, ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none']), message: '"algorithm" must be a valid string enum value' },
header: { isValid: isPlainObject, message: '"header" must be an object' },
encoding: { isValid: isString, message: '"encoding" must be a string' },
issuer: { isValid: isString, message: '"issuer" must be a string' },
subject: { isValid: isString, message: '"subject" must be a string' },
jwtid: { isValid: isString, message: '"jwtid" must be a string' },
noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
keyid: { isValid: isString, message: '"keyid" must be a string' },
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' }
};
var <API key> = {
iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
};
function validate(schema, allowUnknown, object, parameterName) {
if (!isPlainObject(object)) {
throw new Error('Expected "' + parameterName + '" to be a plain object.');
}
Object.keys(object)
.forEach(function(key) {
var validator = schema[key];
if (!validator) {
if (!allowUnknown) {
throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
}
return;
}
if (!validator.isValid(object[key])) {
throw new Error(validator.message);
}
});
}
function validateOptions(options) {
return validate(sign_options_schema, false, options, 'options');
}
function validatePayload(payload) {
return validate(<API key>, true, payload, 'payload');
}
var options_to_payload = {
'audience': 'aud',
'issuer': 'iss',
'subject': 'sub',
'jwtid': 'jti'
};
var options_for_objects = [
'expiresIn',
'notBefore',
'noTimestamp',
'audience',
'issuer',
'subject',
'jwtid',
];
module.exports = function (payload, secretOrPrivateKey, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
} else {
options = options || {};
}
var isObjectPayload = typeof payload === 'object' &&
!Buffer.isBuffer(payload);
var header = Object.assign({
alg: options.algorithm || 'HS256',
typ: isObjectPayload ? 'JWT' : undefined,
kid: options.keyid
}, options.header);
function failure(err) {
if (callback) {
return callback(err);
}
throw err;
}
if (!secretOrPrivateKey && options.algorithm !== 'none') {
return failure(new Error('secretOrPrivateKey must have a value'));
}
if (typeof payload === 'undefined') {
return failure(new Error('payload is required'));
} else if (isObjectPayload) {
try {
validatePayload(payload);
}
catch (error) {
return failure(error);
}
if (!options.mutatePayload) {
payload = Object.assign({},payload);
}
} else {
var invalid_options = options_for_objects.filter(function (opt) {
return typeof options[opt] !== 'undefined';
});
if (invalid_options.length > 0) {
return failure(new Error('invalid ' + invalid_options.join(',') + ' option for ' + (typeof payload ) + ' payload'));
}
}
if (typeof payload.exp !== 'undefined' && typeof options.expiresIn !== 'undefined') {
return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
}
if (typeof payload.nbf !== 'undefined' && typeof options.notBefore !== 'undefined') {
return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
}
try {
validateOptions(options);
}
catch (error) {
return failure(error);
}
var timestamp = payload.iat || Math.floor(Date.now() / 1000);
if (!options.noTimestamp) {
payload.iat = timestamp;
} else {
delete payload.iat;
}
if (typeof options.notBefore !== 'undefined') {
payload.nbf = timespan(options.notBefore, timestamp);
if (typeof payload.nbf === 'undefined') {
return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
}
}
if (typeof options.expiresIn !== 'undefined' && typeof payload === 'object') {
payload.exp = timespan(options.expiresIn, timestamp);
if (typeof payload.exp === 'undefined') {
return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
}
}
Object.keys(options_to_payload).forEach(function (key) {
var claim = options_to_payload[key];
if (typeof options[key] !== 'undefined') {
if (typeof payload[claim] !== 'undefined') {
return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
}
payload[claim] = options[key];
}
});
var encoding = options.encoding || 'utf8';
if (typeof callback === 'function') {
callback = callback && once(callback);
jws.createSign({
header: header,
privateKey: secretOrPrivateKey,
payload: payload,
encoding: encoding
}).once('error', callback)
.once('done', function (signature) {
callback(null, signature);
});
} else {
return jws.sign({header: header, payload: payload, <API key>, encoding: encoding});
}
}; |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<meta name="<API key>" content="<API key>" />
<title>How to Use Kibana 4 for Log Analysis</title>
<meta name="author" content="Speaker 50" >
<link rel="alternate" type="application/rss+xml" title="devopsdays RSS Feed" href="http:
<script type="text/javascript" src="https:
<script type="text/javascript">
google.load('jquery', '1.3.2');
</script>
<!---This is a combined jAmpersand, jqwindont , jPullquote -->
<script type="text/javascript" src="/js/devops.js"></script>
<!--- Blueprint CSS Framework Screen + Fancytype-Screen + jedi.css -->
<link rel="stylesheet" href="/css/devops.min.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
<!--[if IE]>
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]
<!
Customize the labels on the map
*References*
- http://code.google.com/apis/maps/documentation/javascript/maptypes.html#StyledMaps
- http://<API key>.googlecode.com/svn/tags/markerwithlabel/1.1/examples/basic.html
<link href="/css/googlemaps.css" rel="stylesheet">
</head>
<body onload="initialize()">
<div class="container ">
<div class="span-24 last" id="header">
<div class="span-16 first">
<img src="/images/devopsdays-banner.png" title="devopsdays banner" width="801" height="115" alt="devopdays banner" ><br>
</div>
<div class="span-8 last">
</div>
</div>
<div class="span-24 last">
<div id="headermenu">
<table >
<tr>
<td>
<a href="/"><img alt="home" title="home" src="/images/home.png"></a>
<a href="/">Home</a>
</td>
<td>
<a href="/contact/"><img alt="contact" title="contact" src="/images/contact.png"></a>
<a href="/contact/">Contact</a>
</td>
<td>
<a href="/events/"><img alt="events" title="events" src="/images/events.png"></a>
<a href="/events/">Events</a>
</td>
<td>
<a href="/presentations/"><img alt="presentations" title="presentations" src="/images/presentations.png"></a>
<a href="/presentations/">Presentations</a>
</td>
<td>
<a href="/blog/"><img alt="blog" title="blog" src="/images/blog.png"></a>
<a href="/blog/">Blog</a>
</td>
</tr>
</table>
</div>
</div>
<div class="span-24 last" id="header">
<div class="span-15 first">
<h1>How to Use Kibana 4 for Log Analysis </h1>
</div>
<div class="span-8 last">
<div>
<a href="/feed"><img width="32px" height="32px" alt="rss" title="rss feed" src="/images/feed.png"></a>
<a href="http:
<a href="http://groups.google.com/group/devopsdays"><img width="32px" height="32px" alt="mail" title="mailinglist" src="/images/email.png"></a>
<a href="http:
<a href="http:
</div>
</div>
</div>
<div class="span-15 ">
<div class="span-15 last ">
<p><strong>Abstract:</strong></p>
<p>In this session, we will explore the value of Kibana 4 for log analysis and will give a real live, hands-on tutorial on how to set up Kibana 4 and get the most out of Apache log files. We will examine three use cases: IT operations, business intelligence, and security and compliance. This is a hands-on session which will require participants to bring their own laptops, and we will provide the rest.
<strong>Speaker:</strong>
Speaker 50</p>
</div>
<div class="span-15 first last">
<script type="text/javascript">
// var disqus_developer = 1;
</script>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'devopsdays';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.<API key>('head')[0] || document.<API key>('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<hr>
</div>
</div>
<div class="span-8 last">
<div class="span-8 last">
<div style="height:340px">
<a class="twitter-timeline" data-chrome="noheader nofooter" data-tweet-limit=2 data-dnt="true" href="https://twitter.com/devopsdaysmsp/lists/devopsdays" data-widget-id="720829916510466048">Tweets from devopsdays events</a>
<script>!function(d,s,id){var js,fjs=d.<API key>(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
</div>
</div>
<div class="span-17 ">
<div style=" padding-top:18px;" class="span-7 last">
<h1>Past </h1>
</div>
<div class="span-17 ">
<div style="height:700px;" id="quicklinks">
<table>
<tr>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2009</strong><br/>
<a href="/events/2009-ghent/">Ghent 2009</a>
</div>
<br>
<div style="margin:1px;">
<strong>2010</strong><br/>
<a href="/events/2010-sydney/">Sydney 2010</a><br>
<a href="/events/2010-us/">Mountain View 2010</a><br>
<a href="/events/2010-europe/">Hamburg 2010</a><br>
<a href="/events/2010-brazil/">Sao Paulo 2010</a><br>
</div>
</div>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2011</strong><br/>
<a href="/events/2011-boston/">Boston 2011</a><br>
<a href="/events/2011-mountainview/">Mountain View 2011</a><br>
<a href="/events/2011-melbourne/">Melbourne 2011</a><br>
<a href="/events/2011-bangalore/">Bangalore 2011</a><br>
<a href="/events/2011-goteborg/">Göteborg 2011</a><br>
<a href="/events/2011-manila/">Manila 2011</a><br>
</div>
<br>
<div style="margin:1px;">
<strong>2012</strong><br/>
<a href="/events/2012-austin/">Austin 2012</a><br>
<a href="/events/2012-tokyo/">Tokyo 2012</a><br>
<a href="/events/2012-india/">Delhi 2012</a><br>
<a href="/events/2012-mountainview/">Mountain View 2012</a><br>
<a href="/events/2012-italy/">Rome 2012</a><br>
<a href="/events/2012-newyork/">New York 2012</a><br>
</div>
</div>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2013</strong><br/>
<a href="/events/2013-newzealand/">New Zealand 2013</a><br>
<a href="/events/2013-london-spring/">London 2013</a><br>
<a href="/events/2013-paris/">Paris 2013</a><br>
<a href="/events/2013-austin/">Austin 2013</a><br>
<a href="/events/2013-berlin/">Berlin 2013</a><br>
<a href="/events/2013-amsterdam/">Amsterdam 2013</a><br>
<a href="/events/2013-mountainview/">Silicon Valley 2013</a><br>
<a href="/events/2013-downunder">Downunder 2013</a><br>
<a href="/events/2013-india/">Bangalore 2013</a><br/>
<a href="/events/2013-london/">London Autumn 2013</a><br/>
<a href="/events/2013-barcelona/">Barcelona 2013</a><br/>
<a href="/events/2013-vancouver/">Vancouver 2013</a><br/>
<a href="/events/2013-portland/">Portland 2013</a><br/>
<a href="/events/2013-newyork/">New York 2013</a><br/>
<a href="/events/2013-atlanta/">Atlanta 2013</a><br/>
<a href="/events/2013-telaviv/">Tel Aviv 2013</a><br/>
<a href="/events/2013-tokyo/">Tokyo 2013</a><br/>
</div>
</div>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2014</strong><br/>
<a href="/events/2014-nairobi/">Nairobi 2014</a><br/>
<a href="/events/2014-ljubljana/">Ljubljana 2014</a><br/>
<a href="/events/2014-austin/">Austin 2014</a><br/>
<a href="/events/2014-pittsburgh/">Pittsburgh 2014</a><br/>
<a href="/events/2014-amsterdam/">Amsterdam 2014</a><br/>
<a href="/events/2014-siliconvalley/">Silicon Valley 2014</a><br/>
<a href="/events/2014-minneapolis/">Minneapolis 2014</a><br/>
<a href="/events/2014-brisbane/">Brisbane 2014</a><br/>
<a href="/events/2014-boston/">Boston 2014</a><br/>
<a href="/events/2014-toronto/">Toronto 2014</a><br/>
<a href="/events/2014-newyork/">New York 2014</a><br/>
<a href="/events/2014-warsaw/">Warsaw 2014</a><br/>
<a href="/events/2014-chicago/">Chicago 2014</a><br/>
<a href="/events/2014-berlin/">Berlin 2014</a><br/>
<a href="/events/2014-belgium/">Belgium 2014</a><br/>
<a href="/events/2014-helsinki/">Helsinki 2014</a><br/>
<a href="/events/2014-vancouver/">Vancouver 2014</a><br/>
<a href="/events/2014-telaviv/">Tel Aviv 2014</a><br/>
<a href="/events/2014-bangalore/">Bangalore 2014</a><br/>
</div>
</div>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2015</strong><br/>
<a href="/events/2015-ljubljana/">Ljubljana 2015</a><br/>
<a href="/events/2015-paris">Paris 2015</a><br/>
<a href="/events/2015-denver/">Denver 2015</a><br/>
<a href="/events/2015-newyork/">New York 2015</a><br/>
<a href="/events/2015-austin">Austin 2015</a><br/>
<a href="/events/2015-toronto">Toronto 2015</a><br/>
<a href="/events/2015-washington-dc/">Washington, DC 2015</a><br/>
<a href="/events/2015-amsterdam">Amsterdam 2015</a><br/>
<a href="/events/2015-minneapolis/">Minneapolis 2015</a><br/>
<a href="/events/2015-melbourne/">Melbourne 2015</a><br/>
<a href="/events/2015-pittsburgh/">Pittsburgh 2015</a><br/>
<a href="/events/2015-chicago/">Chicago 2015</a><br/>
<a href="/events/2015-bangalore/">Bangalore 2015</a><br/>
<a href="/events/2015-boston/">Boston 2015</a><br/>
<a href="/events/2015-telaviv/">Tel Aviv 2015</a><br/>
<a href="/events/2015-singapore/">Singapore 2015</a><br/>
<a href="/events/2015-berlin/">Berlin 2015</a><br/>
<a href="/events/2015-charlotte">Charlotte 2015</a><br/>
<a href="/events/2015-siliconvalley">Silicon Valley 2015</a><br/>
<a href="/events/2015-detroit">Detroit 2015</a><br/>
<a href="/events/2015-ohio/">Ohio 2015</a><br/>
<a href="/events/2015-warsaw/">Warsaw 2015</a><br/>
</div>
</div>
<div style="display:table-cell; vertical-align:top">
<div style="margin:1px;">
<strong>2016</strong><br/>
<a href="/events/<API key>/">Los Angeles (1 day)</a>
<a href="/events/2016-vancouver/">Vancouver</a><br/>
<a href="/events/2016-london/">London</a><br/>
<a href="/events/2016-denver/">Denver</a><br/>
<a href="/events/2016-atlanta/">Atlanta</a><br/>
</div>
</div>
</tr>
</table>
</div>
</div>
</div>
<div class="span-6 last ">
<div style=" padding-top:18px;" class="span-5 last">
<h1>Future </h1>
</div>
<div class="span-6 last">
<div style="height:700px;" id="quicklinks">
<table>
<tr>
<td>
<strong>2016</strong><br/>
<a href="/events/2016-austin/">Austin - May 2 & 3</a><br/>
<a href="/events/2016-kiel/">Kiel - May 12 & 13</a><br/>
<a href="/events/2016-seattle/">Seattle - May 12 & 13</a><br/>
<a href="/events/2016-toronto/">Toronto - May 26 & 27</a><br/>
<a href="/events/2016-istanbul/">Istanbul - Jun 3 & 4</a><br/>
<a href="/events/2016-washington-dc/">Washington, DC - Jun 8 & 9</a><br/>
<a href="/events/2016-saltlakecity/">Salt Lake City - Jun 14 & 15</a><br/>
<a href="/events/2016-siliconvalley/">Silicon Valley - June 24 & 25</a><br/>
<a href="/events/2016-amsterdam/">Amsterdam - Jun 29, 30 & Jul 1</a><br/>
<a href="/events/2016-minneapolis/">Minneapolis - Jul 20 & 21</a><br/>
<a href="/events/2016-portland/">Portland - Aug 9 & 10</a><br/>
<a href="/events/2016-boston/">Boston - Aug 25 & 26</a><br/>
<a href="/events/2016-chicago/">Chicago - Aug 30 & 31</a><br/>
<a href="/events/2016-oslo/">Oslo - Sep 5 & 6</a><br/>
<a href="/events/2016-dallas/">Dallas - Sep 15 & 16</a><br/>
<a href="/events/2016-newyork/">New York - Sep 23 & 24</a><br/>
<a href="/events/2016-boise/">Boise - Oct 7 & 8</a><br/>
<a href="/events/2016-singapore/">Singapore - Oct 8 & 9</a><br/>
<a href="/events/2016-detroit/">Detroit - Oct 12 & 13</a><br/>
<a href="/events/2016-kansascity/">Kansas City - Oct 20 & 21</a><br/>
<a href="/events/2016-philadelphia/">Philadelphia - Oct 26 & 27</a><br/>
<br/>
<strong>2016, Dates TBD</strong><br/>
<a href="/events/2016-ghent/">Ghent</a><br/>
<a href="/events/2016-raleigh/">Raleigh</a><br/>
<a href="/events/2016-newzealand/">New Zealand</a><br/>
<a href="/events/2016-ohio/">Ohio</a><br/>
<a href="/events/2016-nashville/">Nashville</a><br/>
<a href="/events/2016-madison/">Madison</a><br/>
<a href="/events/2016-capetown/">Cape Town</a><br/>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9713393-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https:
var s = document.<API key>('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html> |
package docs.services;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.lightbend.lagom.javadsl.immutable.ImmutableStyle;
import org.immutables.value.Value;
@Value.Immutable
@ImmutableStyle
@JsonSerialize(as = Item.class)
@JsonDeserialize(as = Item.class)
public interface AbstractItem {
@Value.Parameter
String id();
@Value.Parameter
long orderId();
} |
$<API key> = 'Stop';
$packageName = 'thunderbird'
$uninstalled = $false
[array]$key = <API key> -SoftwareName 'Mozilla Thunderbird*'
if ($key.Count -eq 1) {
$key | ForEach-Object {
$packageArgs = @{
packageName = $packageName
fileType = 'exe'
silentArgs = '-ms'
validExitCodes= @(0)
file = "$($_.UninstallString.Trim('"'))"
}
<API key> @packageArgs
Write-Warning "Auto Uninstaller may detect Mozilla Maintenance Service."
Write-Warning "This should not be uninstalled if any other Mozilla product is installed."
}
} elseif ($key.Count -eq 0) {
Write-Warning "$packageName has already been uninstalled by other means."
} elseif ($key.Count -gt 1) {
Write-Warning "$($key.Count) matches found!"
Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
Write-Warning "Please alert package maintainer the following keys were matched:"
$key | ForEach-Object {Write-Warning "- $($_.DisplayName)"}
} |
package org.apereo.cas.config;
import org.apereo.cas.CipherExecutor;
import org.apereo.cas.configuration.<API key>;
import org.apereo.cas.couchdb.core.<API key>;
import org.apereo.cas.couchdb.trusted.Multifactor<API key>;
import org.apereo.cas.trusted.authentication.api.Multifactor<API key>;
import org.apereo.cas.trusted.authentication.storage.CouchDbMultifactor<API key>;
import lombok.val;
import org.ektorp.impl.ObjectMapperFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.<API key>;
import org.springframework.boot.context.properties.<API key>;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* This is {@link CouchDbMultifactor<API key>}.
*
* @author Timur Duehr
* @since 6.0.0
*/
@Configuration("couchDbMultifactor<API key>)
@<API key>(<API key>.class)
public class CouchDbMultifactor<API key> {
@Autowired
private <API key> casProperties;
@Autowired
@Qualifier("<API key>")
private ObjectProvider<CipherExecutor> <API key>;
@Autowired
@Qualifier("<API key>")
private ObjectProvider<ObjectMapperFactory> objectMapperFactory;
@<API key>(name = "<API key>")
@Bean
@RefreshScope
public <API key> <API key>() {
return new <API key>(casProperties.getAuthn().getMfa().getTrusted().getCouchDb(), objectMapperFactory.getIfAvailable());
}
@<API key>(name = "<API key>")
@Bean
@RefreshScope
public Multifactor<API key> <API key>(
@Qualifier("<API key>") final <API key> <API key>) {
return new Multifactor<API key>(<API key>.getCouchDbConnector(),
casProperties.getAuthn().getMfa().getTrusted().getCouchDb().isCreateIfNotExists());
}
@<API key>(name = "<API key>")
@Bean
@RefreshScope
public Multifactor<API key> mfaTrustEngine(
@Qualifier("<API key>") final Multifactor<API key> <API key>) {
val c = new CouchDbMultifactor<API key>(<API key>);
c.setCipherExecutor(<API key>.getIfAvailable());
return c;
}
} |
(function($) {
// jQuery plugin definition
$.fn.YafModalDialog = function(settings) {
settings = $.extend({ Dialog: "#MessageBox", ImagePath: "images/", Type: "information" }, settings);
// traverse all nodes
this.each(function() {
$($(this)).click(function() {
$.fn.YafModalDialog.Show(settings);
});
});
// allow jQuery chaining
return this;
};
// jQuery plugin definition
$.fn.YafModalDialog.Close = function(settings) {
settings = $.extend({ Dialog: "#MessageBox", ImagePath: "images/", Type: "information" }, settings);
var DialogId = settings.Dialog;
DialogId = DialogId.replace("
var MainDialogId = DialogId + 'Box';
CloseDialog();
function CloseDialog() {
$(settings.Dialog).hide();
$('#' + MainDialogId + '_overlay').fadeOut();
$(document).unbind('keydown.' + DialogId);
$('#' + MainDialogId + '_overlay').remove();
var cnt = $("#" + MainDialogId + " .DialogContent").contents();
$("#" + MainDialogId).replaceWith(cnt);
$(settings.Dialog + '#ModalDialog' + ' #' + DialogId + 'Close').remove();
$(settings.Dialog + '#ModalDialog_overlay').remove();
return false;
}
;
// allow jQuery chaining
return this;
};
$.fn.YafModalDialog.Show = function(settings) {
settings = $.extend({ Dialog: "#MessageBox", ImagePath: "images/", Type: "information" }, settings);
var icon = $(settings.Dialog).find(".DialogIcon").eq(0).attr('src');
var iconsPath = settings.ImagePath;
iconsPath = iconsPath.replace("images/", "icons/");
if (settings.Type == 'error') {
icon = iconsPath + 'ErrorBig.png'; // over write the message to error message
} else if (settings.Type == 'information') {
icon = iconsPath + 'InfoBig.png'; // over write the message to information message
} else if (settings.Type == 'warning') {
icon = iconsPath + 'WarningBig.png'; // over write the message to warning message
}
$(settings.Dialog).find(".DialogIcon").eq(0).attr('src', icon);
if ($('#LoginBox').is(':visible')) {
$.fn.YafModalDialog.Close({ Dialog: '#LoginBox' });
}
//var top = getPageScroll()[1] + (getPageHeight() / 100);
var top = '25%';
var left = $(window).width() / 2 - 205;
var cookieScroll = readCookie('ScrollPosition');
if (cookieScroll != null) {
eraseCookie('ScrollPosition');
top = 0;
top = (parseInt(cookieScroll) + 100) + 'px';
}
var DialogId = settings.Dialog;
DialogId = DialogId.replace("
var MainDialogId = DialogId + 'Box';
$(settings.Dialog).wrapInner("<div id=\"" + MainDialogId + "\" class=\"ModalDialog\" style=\"top: " + top + "; display: block; left: " + left + "px; \"><div class=\"yafpopup\"><div class=\"DialogContent\">");
$('#' + MainDialogId + ' .popup').after("<a href=\"javascript:void(0);\" class=\"close\" id=\"" + DialogId + "Close\"><img src=\"" + settings.ImagePath + "closelabel.png\" title=\"close\" class=\"close_image\"></a>");
$(settings.Dialog).after("<div id=\"" + MainDialogId + "_overlay\" class=\"ModalDialog_hide <API key>\" style=\"display: none; opacity: 0.2; \"></div>");
$(settings.Dialog).fadeIn('normal');
// IE FIX
$('#' + MainDialogId + '_overlay').css('filter', 'alpha(opacity=20)');
$('#' + MainDialogId + '_overlay').fadeIn('normal');
$(document).bind('keydown.' + DialogId, function(e) {
if (e.keyCode == 27) {
$.fn.YafModalDialog.Close(settings);
}
return true;
});
$('#' + DialogId + 'Close').click(function() {
$.fn.YafModalDialog.Close(settings);
});
};
})(jQuery);
function createCookie(name, value) {
var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
} |
'use strict';
var Base = require('./../base');
module.exports = Base.extend({
url: '/camunda/app/tasklist/default/
header: function () {
return element(by.css('[cam-widget-header]'));
},
accountDropdown: function () {
return this.header().element(by.css('.account.dropdown'));
},
<API key>: function () {
return this.accountDropdown().element(by.css('.dropdown-toggle'));
}
}); |
CKEDITOR.plugins.setLang( 'forms', 'ka', {
button: {
title: 'ღილაკის პარამეტრები',
text: 'ტექსტი',
type: 'ტიპი',
typeBtn: 'ღილაკი',
typeSbm: 'გაგზავნა',
typeRst: 'გასუფთავება'
},
checkboxAndRadio: {
checkboxTitle: 'მონიშვნის ღილაკის (Checkbox) პარამეტრები',
radioTitle: 'ასარჩევი ღილაკის (Radio) პარამეტრები',
value: 'ტექსტი',
selected: 'არჩეული'
},
form: {
title: 'ფორმის პარამეტრები',
menu: 'ფორმის პარამეტრები',
action: 'ქმედება',
method: 'მეთოდი',
encoding: 'კოდირება'
},
hidden: {
title: 'მალული ველის პარამეტრები',
name: 'სახელი',
value: 'მნიშვნელობა'
},
select: {
title: 'არჩევის ველის პარამეტრები',
selectInfo: 'ინფორმაცია',
opAvail: 'შესაძლებელი ვარიანტები',
value: 'მნიშვნელობა',
size: 'ზომა',
lines: 'ხაზები',
chkMulti: 'მრავლობითი არჩევანის საშუალება',
opText: 'ტექსტი',
opValue: 'მნიშვნელობა',
btnAdd: 'დამატება',
btnModify: 'შეცვლა',
btnUp: 'ზემოთ',
btnDown: 'ქვემოთ',
btnSetValue: 'ამორჩეულ მნიშვნელოვნად დაყენება',
btnDelete: 'წაშლა'
},
textarea: {
title: 'ტექსტური არის პარამეტრები',
cols: 'სვეტები',
rows: 'სტრიქონები'
},
textfield: {
title: 'ტექსტური ველის პარამეტრები',
name: 'სახელი',
value: 'მნიშვნელობა',
charWidth: 'სიმბოლოს ზომა',
maxChars: 'ასოების მაქსიმალური ოდენობა',
type: 'ტიპი',
typeText: 'ტექსტი',
typePass: 'პაროლი',
typeEmail: 'Email', // MISSING
typeSearch: 'Search', // MISSING
typeTel: 'Telephone Number', // MISSING
typeUrl: 'URL'
}
}); |
// Code generated by reactGen. DO NOT EDIT.
package react
// ImgProps are the props for a <Img> component
type ImgProps struct {
ClassName string
<API key> *DangerousInnerHTML
ID string
Key string
OnChange
OnClick
Role string
Src string
Style *CSS
}
func (i *ImgProps) assign(v *_ImgProps) {
v.ClassName = i.ClassName
v.<API key> = i.<API key>
if i.ID != "" {
v.ID = i.ID
}
if i.Key != "" {
v.Key = i.Key
}
if i.OnChange != nil {
v.o.Set("onChange", i.OnChange.OnChange)
}
if i.OnClick != nil {
v.o.Set("onClick", i.OnClick.OnClick)
}
v.Role = i.Role
v.Src = i.Src
// TODO: until we have a resolution on
v.Style = i.Style.hack()
} |
/* @internal */
namespace ts.formatting {
const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard);
const jsxScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.JSX);
export interface FormattingScanner {
advance(): void;
isOnToken(): boolean;
isOnEOF(): boolean;
readTokenInfo(n: Node): TokenInfo;
readEOFTokenRange(): TextRangeWithKind;
<API key>(): TextRangeWithKind[] | undefined;
<API key>(): boolean;
skipToEndOf(node: Node): void;
skipToStartOf(node: Node): void;
}
const enum ScanAction {
Scan,
<API key>,
RescanSlashToken,
RescanTemplateToken,
RescanJsxIdentifier,
RescanJsxText,
<API key>,
}
export function <API key><T>(text: string, languageVariant: LanguageVariant, startPos: number, endPos: number, cb: (scanner: FormattingScanner) => T): T {
const scanner = languageVariant === LanguageVariant.JSX ? jsxScanner : standardScanner;
scanner.setText(text);
scanner.setTextPos(startPos);
let wasNewLine = true;
let leadingTrivia: <API key>[] | undefined;
let trailingTrivia: <API key>[] | undefined;
let savedPos: number;
let lastScanAction: ScanAction | undefined;
let lastTokenInfo: TokenInfo | undefined;
const res = cb({
advance,
readTokenInfo,
readEOFTokenRange,
isOnToken,
isOnEOF,
<API key>: () => leadingTrivia,
<API key>: () => wasNewLine,
skipToEndOf,
skipToStartOf,
});
lastTokenInfo = undefined;
scanner.setText(undefined);
return res;
function advance(): void {
lastTokenInfo = undefined;
const isStarted = scanner.getStartPos() !== startPos;
if (isStarted) {
wasNewLine = !!trailingTrivia && last(trailingTrivia).kind === SyntaxKind.NewLineTrivia;
}
else {
scanner.scan();
}
leadingTrivia = undefined;
trailingTrivia = undefined;
let pos = scanner.getStartPos();
// Read leading trivia and token
while (pos < endPos) {
const t = scanner.getToken();
if (!isTrivia(t)) {
break;
}
// consume leading trivia
scanner.scan();
const item: <API key> = {
pos,
end: scanner.getStartPos(),
kind: t
};
pos = scanner.getStartPos();
leadingTrivia = append(leadingTrivia, item);
}
savedPos = scanner.getStartPos();
}
function <API key>(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.<API key>:
case SyntaxKind.<API key>:
case SyntaxKind.<API key>:
case SyntaxKind.<API key>:
case SyntaxKind.<API key>:
return true;
}
return false;
}
function <API key>(node: Node): boolean {
if (node.parent) {
switch (node.parent.kind) {
case SyntaxKind.JsxAttribute:
case SyntaxKind.JsxOpeningElement:
case SyntaxKind.JsxClosingElement:
case SyntaxKind.<API key>:
// May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier.
return isKeyword(node.kind) || node.kind === SyntaxKind.Identifier;
}
}
return false;
}
function shouldRescanJsxText(node: Node): boolean {
return isJsxText(node);
}
function <API key>(container: Node): boolean {
return container.kind === SyntaxKind.<API key>;
}
function <API key>(container: Node): boolean {
return container.kind === SyntaxKind.TemplateMiddle ||
container.kind === SyntaxKind.TemplateTail;
}
function <API key>(node: Node): boolean {
return node.parent && isJsxAttribute(node.parent) && node.parent.initializer === node;
}
function <API key>(t: SyntaxKind): boolean {
return t === SyntaxKind.SlashToken || t === SyntaxKind.SlashEqualsToken;
}
function readTokenInfo(n: Node): TokenInfo {
Debug.assert(isOnToken());
// normally scanner returns the smallest available token
// check the kind of context node to determine if scanner should have more greedy behavior and consume more text.
const expectedScanAction = <API key>(n) ? ScanAction.<API key> :
<API key>(n) ? ScanAction.RescanSlashToken :
<API key>(n) ? ScanAction.RescanTemplateToken :
<API key>(n) ? ScanAction.RescanJsxIdentifier :
shouldRescanJsxText(n) ? ScanAction.RescanJsxText :
<API key>(n) ? ScanAction.<API key> :
ScanAction.Scan;
if (lastTokenInfo && expectedScanAction === lastScanAction) {
// readTokenInfo was called before with the same expected scan action.
// No need to re-scan text, return existing 'lastTokenInfo'
// it is ok to call fixTokenKind here since it does not affect
// what portion of text is consumed. In contrast rescanning can change it,
// i.e. for '>=' when originally scanner eats just one character
// and rescanning forces it to consume more.
return fixTokenKind(lastTokenInfo, n);
}
if (scanner.getStartPos() !== savedPos) {
Debug.assert(lastTokenInfo !== undefined);
// readTokenInfo was called before but scan action differs - rescan text
scanner.setTextPos(savedPos);
scanner.scan();
}
let currentToken = getNextToken(n, expectedScanAction);
const <API key>(
scanner.getStartPos(),
scanner.getTextPos(),
currentToken,
);
// consume trailing trivia
if (trailingTrivia) {
trailingTrivia = undefined;
}
while (scanner.getStartPos() < endPos) {
currentToken = scanner.scan();
if (!isTrivia(currentToken)) {
break;
}
const trivia = <API key>(
scanner.getStartPos(),
scanner.getTextPos(),
currentToken,
);
if (!trailingTrivia) {
trailingTrivia = [];
}
trailingTrivia.push(trivia);
if (currentToken === SyntaxKind.NewLineTrivia) {
// move past new line
scanner.scan();
break;
}
}
lastTokenInfo = { leadingTrivia, trailingTrivia, token };
return fixTokenKind(lastTokenInfo, n);
}
function getNextToken(n: Node, expectedScanAction: ScanAction): SyntaxKind {
const token = scanner.getToken();
lastScanAction = ScanAction.Scan;
switch (expectedScanAction) {
case ScanAction.<API key>:
if (token === SyntaxKind.GreaterThanToken) {
lastScanAction = ScanAction.<API key>;
const newToken = scanner.reScanGreaterToken();
Debug.assert(n.kind === newToken);
return newToken;
}
break;
case ScanAction.RescanSlashToken:
if (<API key>(token)) {
lastScanAction = ScanAction.RescanSlashToken;
const newToken = scanner.reScanSlashToken();
Debug.assert(n.kind === newToken);
return newToken;
}
break;
case ScanAction.RescanTemplateToken:
if (token === SyntaxKind.CloseBraceToken) {
lastScanAction = ScanAction.RescanTemplateToken;
return scanner.reScanTemplateToken(/* isTaggedTemplate */ false);
}
break;
case ScanAction.RescanJsxIdentifier:
lastScanAction = ScanAction.RescanJsxIdentifier;
return scanner.scanJsxIdentifier();
case ScanAction.RescanJsxText:
lastScanAction = ScanAction.RescanJsxText;
return scanner.reScanJsxToken(/* <API key> */ false);
case ScanAction.<API key>:
lastScanAction = ScanAction.<API key>;
return scanner.<API key>();
case ScanAction.Scan:
break;
default:
Debug.assertNever(expectedScanAction);
}
return token;
}
function readEOFTokenRange(): TextRangeWithKind<SyntaxKind.EndOfFileToken> {
Debug.assert(isOnEOF());
return <API key>(scanner.getStartPos(), scanner.getTextPos(), SyntaxKind.EndOfFileToken);
}
function isOnToken(): boolean {
const current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
const startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos();
return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current);
}
function isOnEOF(): boolean {
const current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
return current === SyntaxKind.EndOfFileToken;
}
// when containing node in the tree is token
// but its kind differs from the kind that was returned by the scanner,
// then kind needs to be fixed. This might happen in cases
// when parser interprets token differently, i.e keyword treated as identifier
function fixTokenKind(tokenInfo: TokenInfo, container: Node): TokenInfo {
if (isToken(container) && tokenInfo.token.kind !== container.kind) {
tokenInfo.token.kind = container.kind;
}
return tokenInfo;
}
function skipToEndOf(node: Node): void {
scanner.setTextPos(node.end);
savedPos = scanner.getStartPos();
lastScanAction = undefined;
lastTokenInfo = undefined;
wasNewLine = false;
leadingTrivia = undefined;
trailingTrivia = undefined;
}
function skipToStartOf(node: Node): void {
scanner.setTextPos(node.pos);
savedPos = scanner.getStartPos();
lastScanAction = undefined;
lastTokenInfo = undefined;
wasNewLine = false;
leadingTrivia = undefined;
trailingTrivia = undefined;
}
}
} |
CKEDITOR.plugins.setLang( 'a11yhelp', 'en-gb', {
title: 'Accessibility Instructions', // MISSING
contents: 'Help Contents. To close this dialog press ESC.', // MISSING
legend: [
{
name: 'General', // MISSING
items: [
{
name: 'Editor Toolbar', // MISSING
legend: 'Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button.' // MISSING
},
{
name: 'Editor Dialog', // MISSING
legend: 'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING
},
{
name: 'Editor Context Menu', // MISSING
legend: 'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING
},
{
name: 'Editor List Box', // MISSING
legend: 'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING
},
{
name: 'Editor Element Path Bar', // MISSING
legend: 'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING
}
]
},
{
name: 'Commands', // MISSING
items: [
{
name: ' Undo command', // MISSING
legend: 'Press ${undo}' // MISSING
},
{
name: ' Redo command', // MISSING
legend: 'Press ${redo}' // MISSING
},
{
name: ' Bold command', // MISSING
legend: 'Press ${bold}' // MISSING
},
{
name: ' Italic command', // MISSING
legend: 'Press ${italic}' // MISSING
},
{
name: ' Underline command', // MISSING
legend: 'Press ${underline}' // MISSING
},
{
name: ' Link command', // MISSING
legend: 'Press ${link}' // MISSING
},
{
name: ' Toolbar Collapse command', // MISSING
legend: 'Press ${toolbarCollapse}' // MISSING
},
{
name: ' Access previous focus space command', // MISSING
legend: 'Press ${accessPreviousSpace} to access the closest unreachable focus space before the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.' // MISSING
},
{
name: ' Access next focus space command', // MISSING
legend: 'Press ${accessNextSpace} to access the closest unreachable focus space after the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.' // MISSING
},
{
name: ' Accessibility Help', // MISSING
legend: 'Press ${a11yHelp}' // MISSING
}
]
}
],
backspace: 'Backspace',
tab: 'Tab',
enter: 'Enter',
shift: 'Shift',
ctrl: 'Ctrl',
alt: 'Alt',
pause: 'Pause',
capslock: 'Caps Lock',
escape: 'Escape',
pageUp: 'Page Up',
pageDown: 'Page Down',
end: 'End',
home: 'Home',
leftArrow: 'Left Arrow',
upArrow: 'Up Arrow',
rightArrow: 'Right Arrow',
downArrow: 'Down Arrow',
insert: 'Insert',
'delete': 'Delete',
leftWindowKey: 'Left Windows key',
rightWindowKey: 'Right Windows key',
selectKey: 'Select key',
numpad0: 'Numpad 0',
numpad1: 'Numpad 1',
numpad2: 'Numpad 2',
numpad3: 'Numpad 3',
numpad4: 'Numpad 4',
numpad5: 'Numpad 5',
numpad6: 'Numpad 6',
numpad7: 'Numpad 7',
numpad8: 'Numpad 8',
numpad9: 'Numpad 9',
multiply: 'Multiply',
add: 'Add',
subtract: 'Subtract',
decimalPoint: 'Decimal Point',
divide: 'Divide',
f1: 'F1',
f2: 'F2',
f3: 'F3',
f4: 'F4',
f5: 'F5',
f6: 'F6',
f7: 'F7',
f8: 'F8',
f9: 'F9',
f10: 'F10',
f11: 'F11',
f12: 'F12',
numLock: 'Num Lock',
scrollLock: 'Scroll Lock',
semiColon: 'Semicolon',
equalSign: 'Equal Sign',
comma: 'Comma',
dash: 'Dash',
period: 'Period',
forwardSlash: 'Forward Slash',
graveAccent: 'Grave Accent',
openBracket: 'Open Bracket',
backSlash: 'Backslash',
closeBracket: 'Close Bracket',
singleQuote: 'Single Quote'
} ); |
#include <aws/mediaconvert/model/<API key>.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/<API key>.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MediaConvert
{
namespace Model
{
namespace <API key>
{
static const int DISABLED_HASH = HashingUtils::HashString("DISABLED");
static const int ENABLED_HASH = HashingUtils::HashString("ENABLED");
<API key> <API key>(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == DISABLED_HASH)
{
return <API key>::DISABLED;
}
else if (hashCode == ENABLED_HASH)
{
return <API key>::ENABLED;
}
<API key>* overflowContainer = Aws::<API key>();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<<API key>>(hashCode);
}
return <API key>::NOT_SET;
}
Aws::String <API key>(<API key> enumValue)
{
switch(enumValue)
{
case <API key>::DISABLED:
return "DISABLED";
case <API key>::ENABLED:
return "ENABLED";
default:
<API key>* overflowContainer = Aws::<API key>();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace <API key>
} // namespace Model
} // namespace MediaConvert
} // namespace Aws |
using System.Collections.Generic;
namespace Utilities.DataStructures
{
public class NodePriorityHeap<T> : IOpenSet<T> where T : class
{
PriorityHeap<NodeRecord<T>> OpenHeap { get; set; }
public NodePriorityHeap()
{
this.OpenHeap = new PriorityHeap<NodeRecord<T>>();
}
public void Initialize()
{
this.OpenHeap.Clear();
}
public void Replace(NodeRecord<T> nodeToBeReplaced, NodeRecord<T> nodeToReplace)
{
this.OpenHeap.Remove(nodeToBeReplaced);
this.OpenHeap.Enqueue(nodeToReplace);
}
public NodeRecord<T> GetBestAndRemove()
{
return this.OpenHeap.Dequeue();
}
public NodeRecord<T> PeekBest()
{
return this.OpenHeap.Peek();
}
public void AddToOpen(NodeRecord<T> nodeRecord)
{
this.OpenHeap.Enqueue(nodeRecord);
}
public void RemoveFromOpen(NodeRecord<T> nodeRecord)
{
this.OpenHeap.Remove(nodeRecord);
}
public NodeRecord<T> SearchInOpen(NodeRecord<T> nodeRecord)
{
return this.OpenHeap.SearchForEqual(nodeRecord);
}
public ICollection<NodeRecord<T>> All()
{
return this.OpenHeap;
}
public int CountOpen()
{
return this.OpenHeap.Count;
}
}
} |
import React from 'react';
import { chain, cloneDeep, compact, debounce, uniq, map } from 'lodash';
import { $rootScope } from 'ngimport';
import { Subscription } from 'rxjs';
import { Application } from 'core/application';
import { CloudProviderLabel, CloudProviderLogo } from 'core/cloudProvider';
import { FilterCollapse, ISortFilter, <API key> } from 'core/filterModel';
import { FilterSection } from 'core/cluster/filter/FilterSection';
import { LoadBalancerState } from 'core/state';
const <API key> = [
{ filterField: 'providerType', on: 'loadBalancer', localField: 'type' },
{ filterField: 'account', on: 'loadBalancer', localField: 'account' },
{ filterField: 'region', on: 'loadBalancer', localField: 'region' },
{ filterField: 'availabilityZone', on: 'instance', localField: 'zone' },
];
function poolBuilder(loadBalancers: any[]) {
const pool = chain(loadBalancers)
.map(lb => {
const poolUnitTemplate = chain(<API key>)
.filter({ on: 'loadBalancer' })
.reduce((acc, coordinate) => {
acc[coordinate.filterField] = lb[coordinate.localField];
return acc;
}, {} as any)
.value();
const poolUnits = chain(['instances', 'detachedInstances'])
.map(instanceStatus => lb[instanceStatus])
.flatten<any>()
.map(instance => {
const poolUnit = cloneDeep(poolUnitTemplate);
if (!instance) {
return poolUnit;
}
return chain(<API key>)
.filter({ on: 'instance' })
.reduce((acc, coordinate) => {
acc[coordinate.filterField] = instance[coordinate.localField];
return acc;
}, poolUnit)
.value();
})
.value();
if (!poolUnits.length) {
poolUnits.push(poolUnitTemplate);
}
return poolUnits;
})
.flatten()
.value();
return pool;
}
export interface <API key> {
app: Application;
}
export interface <API key> {
sortFilter: ISortFilter;
tags: any[];
<API key>: string[];
<API key>: string[];
accountHeadings: string[];
regionHeadings: string[];
stackHeadings: string[];
detailHeadings: string[];
}
export class LoadBalancerFilters extends React.Component<<API key>, <API key>> {
private <API key>: () => void;
private <API key>: Subscription;
private <API key>: () => void;
private <API key>: () => void;
constructor(props: <API key>) {
super(props);
this.state = {
sortFilter: LoadBalancerState.filterModel.asFilterModel.sortFilter,
tags: LoadBalancerState.filterModel.asFilterModel.tags,
<API key>: [],
<API key>: [],
accountHeadings: [],
regionHeadings: [],
stackHeadings: [],
detailHeadings: [],
};
this.<API key> = debounce(this.<API key>, 300);
}
public componentDidMount(): void {
const { app } = this.props;
this.<API key> = LoadBalancerState.filterService.groupsUpdatedStream.subscribe(() => {
this.setState({ tags: LoadBalancerState.filterModel.asFilterModel.tags });
});
if (app.loadBalancers && app.loadBalancers.loaded) {
this.<API key>();
}
this.<API key> = app.loadBalancers.onRefresh(null, () => this.<API key>());
this.<API key> = $rootScope.$on('$<API key>', () => {
LoadBalancerState.filterModel.asFilterModel.activate();
LoadBalancerState.filterService.<API key>(app);
});
}
public <API key>(): void {
this.<API key>.unsubscribe();
this.<API key>();
this.<API key>();
}
public <API key> = (applyParamsToUrl = true): void => {
const { app } = this.props;
if (applyParamsToUrl) {
LoadBalancerState.filterModel.asFilterModel.applyParamsToUrl();
}
LoadBalancerState.filterService.<API key>(app);
const { availabilityZone, region, account } = <API key>({
sortFilter: LoadBalancerState.filterModel.asFilterModel.sortFilter,
dependencyOrder: ['providerType', 'account', 'region', 'availabilityZone'],
pool: poolBuilder(app.loadBalancers.data),
});
this.setState({
accountHeadings: account,
regionHeadings: region,
<API key>: availabilityZone,
stackHeadings: ['(none)'].concat(this.<API key>('stack')),
detailHeadings: ['(none)'].concat(this.<API key>('detail')),
<API key>: this.<API key>('type'),
});
};
private <API key> = (option: string): string[] => {
return compact(uniq(map(this.props.app.loadBalancers.data, option) as string[])).sort();
};
private clearFilters = (): void => {
LoadBalancerState.filterService.clearFilters();
LoadBalancerState.filterModel.asFilterModel.applyParamsToUrl();
LoadBalancerState.filterService.<API key>(this.props.app);
};
private handleStatusChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const target = event.target;
const value = target.type === 'checkbox' ? target.checked : target.value;
const name = target.name;
this.state.sortFilter.status[name] = Boolean(value);
this.<API key>();
};
private handleSearchBlur = (event: React.ChangeEvent<HTMLInputElement>) => {
const target = event.target;
this.state.sortFilter.filter = target.value;
this.<API key>();
};
private handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const target = event.target;
this.state.sortFilter.filter = target.value;
this.setState({ sortFilter: this.state.sortFilter });
this.<API key>();
};
public render() {
const loadBalancersLoaded = this.props.app.loadBalancers.loaded;
const {
accountHeadings,
<API key>,
regionHeadings,
stackHeadings,
detailHeadings,
<API key>,
sortFilter,
tags,
} = this.state;
return (
<div>
<FilterCollapse />
<div className="heading">
<span
className="btn btn-default btn-xs"
style={{ visibility: tags.length > 0 ? 'inherit' : 'hidden' }}
onClick={this.clearFilters}
>
Clear All
</span>
<FilterSection heading="Search" expanded={true} helpKey="loadBalancer.search">
<form className="form-horizontal" role="form">
<div className="form-group nav-search">
<input
type="search"
className="form-control input-sm"
value={sortFilter.filter}
onBlur={this.handleSearchBlur}
onChange={this.handleSearchChange}
style={{ width: '85%', display: 'inline-block' }}
/>
</div>
</form>
</FilterSection>
</div>
{loadBalancersLoaded && (
<div className="content">
{<API key>.length > 1 && (
<FilterSection heading="Provider" expanded={true}>
{<API key>.map(heading => (
<FilterCheckbox
heading={heading}
isCloudProvider={true}
key={heading}
sortFilterType={sortFilter.providerType}
onChange={this.<API key>}
/>
))}
</FilterSection>
)}
<FilterSection heading="Account" expanded={true}>
{accountHeadings.map(heading => (
<FilterCheckbox
heading={heading}
key={heading}
sortFilterType={sortFilter.account}
onChange={this.<API key>}
/>
))}
</FilterSection>
<FilterSection heading="Region" expanded={true}>
{regionHeadings.map(heading => (
<FilterCheckbox
heading={heading}
key={heading}
sortFilterType={sortFilter.region}
onChange={this.<API key>}
/>
))}
</FilterSection>
<FilterSection heading="Stack" expanded={true}>
{stackHeadings.map(heading => (
<FilterCheckbox
heading={heading}
key={heading}
sortFilterType={sortFilter.stack}
onChange={this.<API key>}
/>
))}
</FilterSection>
<FilterSection heading="Detail" expanded={true}>
{detailHeadings.map(heading => (
<FilterCheckbox
heading={heading}
key={heading}
sortFilterType={sortFilter.detail}
onChange={this.<API key>}
/>
))}
</FilterSection>
<FilterSection heading="Instance Status" expanded={true}>
<div className="form">
<div className="checkbox">
<label>
<input
type="checkbox"
checked={Boolean(sortFilter.status && sortFilter.status.Up)}
onChange={this.handleStatusChange}
name="Up"
/>
Healthy
</label>
</div>
<div className="checkbox">
<label>
<input
type="checkbox"
checked={Boolean(sortFilter.status && sortFilter.status.Down)}
onChange={this.handleStatusChange}
name="Down"
/>
Unhealthy
</label>
</div>
<div className="checkbox">
<label>
<input
type="checkbox"
checked={Boolean(sortFilter.status && sortFilter.status.OutOfService)}
onChange={this.handleStatusChange}
name="OutOfService"
/>
Out of Service
</label>
</div>
</div>
</FilterSection>
<FilterSection heading="Availability Zones" expanded={true}>
{<API key>.map(heading => (
<FilterCheckbox
heading={heading}
key={heading}
sortFilterType={sortFilter.availabilityZone}
onChange={this.<API key>}
/>
))}
</FilterSection>
</div>
)}
</div>
);
}
}
const FilterCheckbox = (props: {
heading: string;
sortFilterType: { [key: string]: boolean };
onChange: () => void;
isCloudProvider?: boolean;
}): JSX.Element => {
const { heading, isCloudProvider, onChange, sortFilterType } = props;
const changeHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
const target = event.target;
const value = target.type === 'checkbox' ? target.checked : target.value;
sortFilterType[heading] = Boolean(value);
onChange();
};
return (
<div className="checkbox">
<label>
<input type="checkbox" checked={Boolean(sortFilterType[heading])} onChange={changeHandler} />
{!isCloudProvider ? (
heading
) : (
<>
<CloudProviderLogo provider="heading" height="'14px'" width="'14px'" />
<CloudProviderLabel provider={heading} />
</>
)}
</label>
</div>
);
}; |
package aQute.bnd.plugin.eclipse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import aQute.bnd.annotation.plugin.BndPlugin;
import aQute.bnd.build.Project;
import aQute.bnd.build.Workspace;
import aQute.bnd.service.lifecycle.LifeCyclePlugin;
import aQute.lib.io.IO;
/**
* This plugin creates a build.xml file in the project when a project gets
* created. You can either store a template under cnf/ant/project.xml or a
* default is taken.
*/
@BndPlugin(name = "eclipse")
public class EclipsePlugin extends LifeCyclePlugin {
@Override
public void created(Project p) throws IOException {
Workspace workspace = p.getWorkspace();
copy("project", ".project", p);
copy("classpath", ".classpath", p);
}
private void copy(String source, String dest, Project p) throws IOException {
File d = p.getFile(dest);
if (d.isFile()) {
return;
}
File f = p.getWorkspace().getFile("eclipse/" + source + ".tmpl");
InputStream in;
if (f.isFile()) {
in = new FileInputStream(f);
} else {
in = EclipsePlugin.class.getResourceAsStream(source);
if (in == null) {
p.error("Cannot find Eclipse default for %s", source);
return;
}
}
String s = IO.collect(in);
String process = p.getReplacer().process(s);
d.getParentFile().mkdirs();
IO.store(process, d);
}
@Override
public String toString() {
return "EclipsePlugin";
}
@Override
public void init(Workspace ws) throws Exception {
Project p = new Project(ws, ws.getFile("cnf"));
created(p);
for (Project pp : ws.getAllProjects()) {
created(pp);
}
}
} |
package com.pushtorefresh.storio3.contentresolver.operations.internal;
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import com.pushtorefresh.storio3.Optional;
import com.pushtorefresh.storio3.contentresolver.Changes;
import com.pushtorefresh.storio3.contentresolver.<API key>;
import com.pushtorefresh.storio3.contentresolver.queries.Query;
import com.pushtorefresh.storio3.operations.<API key>;
import com.pushtorefresh.storio3.operations.<API key>;
import com.pushtorefresh.storio3.operations.PreparedOperation;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import com.pushtorefresh.storio3.operations.internal.<API key>;
import io.reactivex.<API key>;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import static com.pushtorefresh.storio3.internal.Environment.<API key>;
public class RxJavaUtils {
private RxJavaUtils() {
throw new <API key>("No instances please.");
}
@CheckResult
@NonNull
public static <Result, WrappedResult, Data> Flowable<Result> createFlowable(
@NonNull <API key> <API key>,
@NonNull PreparedOperation<Result, WrappedResult, Data> operation,
@NonNull <API key> <API key>
) {
<API key>("asRxFlowable()");
final Flowable<Result> flowable = Flowable.create(
new <API key><Result, WrappedResult, Data>(operation), <API key>
);
return subscribeOn(
<API key>,
flowable
);
}
@CheckResult
@NonNull
public static <Result, WrappedResult> Flowable<Result> createGetFlowable(
@NonNull <API key> <API key>,
@NonNull PreparedOperation<Result, WrappedResult, Query> operation,
@NonNull Query query,
@NonNull <API key> <API key>
) {
<API key>("asRxFlowable()");
final Flowable<Result> flowable = <API key>
.observeChangesOfUri(query.uri(), <API key>) // each change triggers executeAsBlocking
.map(new <API key><Changes, Result, WrappedResult, Query>(operation))
.startWith(Flowable.create(new <API key><Result, WrappedResult, Query>(operation), <API key>)); // start stream with first query result
return subscribeOn(
<API key>,
flowable
);
}
@CheckResult
@NonNull
public static <Result> Flowable<Optional<Result>> <API key>(
@NonNull <API key> <API key>,
@NonNull PreparedOperation<Result, Optional<Result>, Query> operation,
@NonNull Query query,
@NonNull <API key> <API key>
) {
<API key>("asRxFlowable()");
final Flowable<Optional<Result>> flowable = <API key>
.observeChangesOfUri(query.uri(), <API key>) // each change triggers executeAsBlocking
.map(new <API key><Changes, Result, Query>(operation))
.startWith(Flowable.create(new <API key><Result, Query>(operation), <API key>)); // start stream with first query result
return subscribeOn(
<API key>,
flowable
);
}
@CheckResult
@NonNull
public static <Result, WrappedResult, Data> Single<Result> createSingle(
@NonNull <API key> <API key>,
@NonNull PreparedOperation<Result, WrappedResult, Data> operation
) {
<API key>("asRxSingle()");
final Single<Result> single = Single.create(new <API key><Result, WrappedResult, Data>(operation));
return subscribeOn(
<API key>,
single
);
}
@CheckResult
@NonNull
public static <Result, Data> Single<Optional<Result>> <API key>(
@NonNull <API key> <API key>,
@NonNull PreparedOperation<Result, Optional<Result>, Data> operation
) {
<API key>("asRxSingle()");
final Single<Optional<Result>> single = Single.create(new <API key><Result, Data>(operation));
return subscribeOn(
<API key>,
single
);
}
@CheckResult
@NonNull
public static <Result, Data> Completable createCompletable(
@NonNull <API key> <API key>,
@NonNull <API key><Result, Data> operation
) {
<API key>("asRxCompletable()");
final Completable completable = Completable.create(new <API key>(operation));
return subscribeOn(
<API key>,
completable
);
}
@CheckResult
@NonNull
public static <Result, WrappedResult, Data> Maybe<Result> createMaybe(
@NonNull <API key> <API key>,
@NonNull <API key><Result, WrappedResult, Data> operation
) {
<API key>("asRxMaybe()");
final Maybe<Result> maybe =
Maybe.create(new <API key><Result, WrappedResult, Data>(operation));
return subscribeOn(<API key>, maybe);
}
@CheckResult
@NonNull
public static <T> Flowable<T> subscribeOn(
@NonNull <API key> <API key>,
@NonNull Flowable<T> flowable
) {
final Scheduler scheduler = <API key>.defaultRxScheduler();
return scheduler != null ? flowable.subscribeOn(scheduler) : flowable;
}
@CheckResult
@NonNull
public static <T> Single<T> subscribeOn(
@NonNull <API key> <API key>,
@NonNull Single<T> single
) {
final Scheduler scheduler = <API key>.defaultRxScheduler();
return scheduler != null ? single.subscribeOn(scheduler) : single;
}
@CheckResult
@NonNull
public static Completable subscribeOn(
@NonNull <API key> <API key>,
@NonNull Completable completable
) {
final Scheduler scheduler = <API key>.defaultRxScheduler();
return scheduler != null ? completable.subscribeOn(scheduler) : completable;
}
@CheckResult
@NonNull
public static <T> Maybe<T> subscribeOn(
@NonNull <API key> <API key>,
@NonNull Maybe<T> maybe
) {
final Scheduler scheduler = <API key>.defaultRxScheduler();
return scheduler != null ? maybe.subscribeOn(scheduler) : maybe;
}
} |
// nglib-mesh.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "Mesh.h"
#include "TopoDS.hxx"
#include "TopoDS_Face.hxx"
#include "TopoDS_Shape.hxx"
#include "GProp_GProps.hxx"
#include "BRepGProp.hxx"
// param mesh: input Mesh
void printStatistics(Mesh& mesh){
// print some statistics
cout << "statistics:" << endl;
cout << "total area:" << mesh.getSurfaceArea() << endl;
cout << "total volume:" << mesh.getVolume() << endl;
cout << "points count: " << mesh.point.size() << endl;
cout << "edges count:" << mesh.getEdgeCount() << endl;
cout << "triangle count:" << count_if(mesh.surface.begin(),mesh.surface.end(),
[](const vector<int>& v){return v.size()==3;}) << endl;
cout << "quad count:" << count_if(mesh.surface.begin(),mesh.surface.end(),
[](const vector<int>& v){return v.size()==4;}) << endl;
cout << "surface (elements) count: " << mesh.surface.size() << endl;
cout << "is closed surface: " << mesh.isClosed() << endl;
MeshStats out;
mesh.stats(&out);
cout << out.tostring() << endl;
}
// this function is a meshing demo of step format and statistics print
// param: argument to config
void <API key>(map<string,string>& config) {
nglib::Ng_Init();
nglib::Ng_Mesh * occ_mesh;
nglib::<API key> mp=nglib::<API key>();
auto geo = nglib::Ng_OCC_Load_STEP(config["infile"].c_str());
occ_mesh = nglib::Ng_NewMesh();
//mp.quad_dominated = 1;
mp.maxh = atof(config["maxh"].c_str());
mp.minh = atof(config["minh"].c_str());
mp.fineness = atof(config["fineness"].c_str());
mp.grading = atof(config["grading"].c_str());
nglib::<API key>(geo,occ_mesh,&mp);
cout<<"start edgemesh"<<endl;
nglib::<API key>(geo,occ_mesh,&mp);
cout<<"edgemesh ok!!!"<<endl;
cout<<"start surfacemesh"<<endl;
nglib::<API key>(geo,occ_mesh, &mp);
cout<<"surfacemesh ok!!!"<<endl;
Mesh m;
m.feedNgMesh(occ_mesh);
nglib::Ng_DeleteMesh(occ_mesh);
m.saveAsSTL(config["outfile"]+".stl");
m.saveAsVTK(config["outfile"]+".vtk");
m.saveAsVTP(config["outfile"]+".vtp");
m.saveAsGDF(config["outfile"]+".gdf");
// statistics
printStatistics(m);
cout << "after call to .forceTriToQuad()" << endl;
m.forceTriToQuad();
m.saveAsSTL(config["outfile"]+"-quad.stl");
m.saveAsVTK(config["outfile"]+"-quad.vtk");
m.saveAsVTP(config["outfile"]+"-quad.vtp");
m.saveAsGDF(config["outfile"]+"-quad.gdf");
m.saveAsDAT(config["outfile"]+"-quad.dat");
// statistics
printStatistics(m);
cout<<"print statistics OK!!!"<<endl;
}
// this function is a meshing demo of igs format and statistics print
// param: argument to config
void <API key>(map<string,string>& config) {
nglib::Ng_Init();
nglib::Ng_Mesh * occ_mesh;
nglib::<API key> mp=nglib::<API key>();
auto geo = nglib::Ng_OCC_Load_IGES(config["infile"].c_str());
occ_mesh = nglib::Ng_NewMesh();
//mp.quad_dominated = 1;
mp.maxh = atof(config["maxh"].c_str());
mp.minh = atof(config["minh"].c_str());
mp.fineness = atof(config["fineness"].c_str());
mp.grading = atof(config["grading"].c_str());
nglib::<API key>(geo,occ_mesh,&mp);
cout<<"start edgemesh"<<endl;
nglib::<API key>(geo,occ_mesh,&mp);
cout<<"edgemesh ok!!!"<<endl;
cout<<"start surfacemesh"<<endl;
nglib::<API key>(geo,occ_mesh, &mp);
cout<<"surfacemesh ok!!!"<<endl;
Mesh m;
m.feedNgMesh(occ_mesh);
nglib::Ng_DeleteMesh(occ_mesh);
m.saveAsSTL(config["outfile"]+".stl");
m.saveAsVTK(config["outfile"]+".vtk");
m.saveAsVTP(config["outfile"]+".vtp");
m.saveAsGDF(config["outfile"]+".gdf");
// statistics
printStatistics(m);
cout << "after call to .forceTriToQuad()" << endl;
m.forceTriToQuad();
m.saveAsSTL(config["outfile"]+"-quad.stl");
m.saveAsVTK(config["outfile"]+"-quad.vtk");
m.saveAsVTP(config["outfile"]+"-quad.vtp");
m.saveAsGDF(config["outfile"]+"-quad.gdf");
m.saveAsDAT(config["outfile"]+"-quad.dat");
// statistics
printStatistics(m);
cout<<"print statistics OK!!!"<<endl;
}
// this function is a meshing demo of stl format and statistics print
// param: argument to config
void <API key>(map<string,string>& config){
// meshing demo and statistics
// this also include forceTriToQuad()
nglib::Ng_Init();
auto geo = nglib::Ng_STL_LoadGeometry(config["infile"].c_str());
nglib::Ng_Mesh* mesh = nglib::Ng_NewMesh();
nglib::<API key> mp = nglib::<API key>();
//mp.quad_dominated = 1;
mp.maxh = atof(config["maxh"].c_str());
mp.minh = atof(config["minh"].c_str());
mp.fineness = atof(config["fineness"].c_str());
mp.grading = atof(config["grading"].c_str());
nglib::<API key>(geo);
nglib::Ng_STL_MakeEdges(geo,mesh,&mp);
cout << "Start Surface Meshing...." << endl;
nglib::Ng_Result result = nglib::<API key>(geo,mesh,&mp);
if(result != nglib::NG_OK){
cout << "Error in Surface Meshing....Aborting!!" << endl;
}
Mesh m;
m.feedNgMesh(mesh);
nglib::Ng_DeleteMesh(mesh);
m.saveAsSTL(config["outfile"]+".stl");
m.saveAsVTK(config["outfile"]+".vtk");
m.saveAsVTP(config["outfile"]+".vtp");
// statistics
printStatistics(m);
cout << "after call to .forceTriToQuad()" << endl;
m.forceTriToQuad();
m.saveAsSTL(config["outfile"]+"-quad.stl");
m.saveAsVTK(config["outfile"]+"-quad.vtk");
m.saveAsVTP(config["outfile"]+"-quad.vtp");
m.saveAsGDF(config["outfile"]+"-quad.gdf");
m.saveAsDAT(config["outfile"]+"-quad.dat");
// statistics
printStatistics(m);
cout<<"print statistics OK!!!"<<endl;
Mesh original;
original.loadSTLFile(config["infile"]);
cout << "original volume: " << original.getVolume() << endl;
double oriVolume = original.getVolume();
if(config["usetolerance"].compare("1") == 0){
double tolerance = 0.01*atof(config["tolerance"].c_str());
for(int i=0;i<10;i++){
double cVolume = m.getVolume();
if(abs((oriVolume-cVolume)/oriVolume) > tolerance){
mp.minh /= 2;
mp.maxh /= 2;
auto geo = nglib::Ng_STL_LoadGeometry(config["infile"].c_str());
nglib::Ng_Mesh* mesh = nglib::Ng_NewMesh();
nglib::<API key>(geo);
nglib::Ng_STL_MakeEdges(geo,mesh,&mp);
nglib::Ng_Result result = nglib::<API key>(geo,mesh,&mp);
if(!result){
cout << "minh:" << mp.minh << ", maxh:" << mp.maxh <<
"result OK." << endl;
}
m.feedNgMesh(mesh);
nglib::Ng_DeleteMesh(mesh);
m.forceTriToQuad();
}else{
printStatistics(m);
cout << "tolerance:" << abs((oriVolume-cVolume)/oriVolume) << endl;
cout << "ori volume:" << oriVolume << endl;
break;
}
}
}
nglib::Ng_Exit();
}
// trimming utilities
// trim from start
static inline std::string <rim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}
// trim from both ends
// method declaration was modified from:
// static inline std::string &trim(std::string &s)
// static inline std::string &trim(std::string &s)
// because the original signature with non-const references cannot be used with r-values
// and caused compile error in mac
static inline std::string trim(std::string s) {
return ltrim(rtrim(s));
}
// load configuration, assume config well written
void loadConfig(const string& fn, map<string,string>& config){
ifstream fin(fn);
string line;
while(getline(fin,line)){
line = trim(line);
if(line.length()>0 && line[0] != '
int index = (int) line.find(':');
if(index>0){
string name = line.substr(0,index);
string value = trim(line.substr(index+1));
config[name] = value;
}
}
}
string infile = config["infile"];
string infiletype = trim(infile.substr(infile.find('.')+1));
config["infiletype"] = infiletype;
fin.close();
}
//checks if a string is number or not
//returns true if string is a number otherwise false.
bool isNumber( string myString )
{
std::istringstream iss(myString);
float f;
iss >>f; // noskipws considers leading whitespace invalid
// Check the entire string was consumed and if either failbit or badbit is set
return iss.eof() && !iss.fail();
}
//This function checks whether given file exists or not
// return True if file exists otherwise False;
bool checkFileExists(string const &fileName){
ifstream fileStream(fileName.c_str());
if(fileStream.good()){
fileStream.close();
return true;
}
else{
fileStream.close();
return false;
}
}
//This function checks all the parameters of configuration file.
// If there are invalid parameters, it overwrites them with default values and report errors.
// if input file does not exist or filetype is wrong - returns false
bool handleConfigParams(map<string,string> &config) {
if(!checkFileExists(config["infile"])){
cout<<"Config parameter: infile "<<config["infile"]<<" does not exist"<<endl;
//config["infile"]="FlapSingle.stl"; //set the value to the default value
return false;
}
if(config["infiletype"] != "stl" && config["infiletype"] != "step" && config["infiletype"] != "igs")
{
cout<<"config parameter :infiletype is not one of stl, step, igs"<<endl;
//config["infiletype"] = "stl";
return false;
}
if(!isNumber(config["maxh"]))
{
if(config["maxh"].empty())
cout<<"config parameter :maxh is empty"<<endl;
else
cout<<"config parameter :maxh "<<config["maxh"]<<" is not a valid number "<<endl;
config["maxh"]="2.0";
}
if(!isNumber(config["minh"]))
{
if(config["minh"].empty())
cout<<"config parameter :minh is empty"<<endl;
else
cout<<"config parameter :minh "<<config["minh"]<<" is not a valid number "<<endl;
config["minh"]="0.5";
}
if(!isNumber(config["fineness"]))
{
if(config["fineness"].empty())
cout<<"config parameter :fineness is empty"<<endl;
else
cout<<"config parameter :fineness "<<config["fineness"]<<" is not a valid number "<<endl;
config["fineness"]="0.5";
}
if(!isNumber(config["grading"]))
{
if(config["grading"].empty())
cout<<"config parameter :grading is empty"<<endl;
else
cout<<"config parameter :grading "<<config["grading"]<<" is not a valid number "<<endl;
config["grading"]="0.5";
}
if(!isNumber(config["usetolerance"]))
{
if(config["usetolerance"].empty())
cout<<"config parameter :usetolerance is empty"<<endl;
else
cout<<"config parameter :usetolerance "<<config["usetolerance"]<<" is not a valid number "<<endl;
config["usetolerance"]="0";
}
if(!isNumber(config["tolerance"]))
{
if(config["tolerance"].empty())
cout<<"config parameter :tolerance is empty"<<endl;
else
cout<<"config parameter :tolerance "<<config["tolerance"]<<" is not a valid number "<<endl;
config["tolerance"]="1";
}
return true;
}
int main(int argc, char* argv[])
{
map<string,string> config;
config["infiletype"] = "stl";
config["infile"] = "FlapSingle.stl";
config["outfile"] = "flap-meshed";
config["maxh"] = "2.0";
config["minh"] = "0.5";
config["fineness"] = "0.5";
config["grading"] = "0.5";
config["usetolerance"] = "0";
config["tolerance"] = "1";
if (checkFileExists("config.txt")) {
loadConfig("config.txt",config);
} else {
cout << "unable to find config.txt, using default values" << endl;
}
if (!handleConfigParams(config))
return 1;
if(config["infiletype"] == "stl")
<API key>(config);
else if(config["infiletype"] == "step" )
<API key>(config);
else if(config["infiletype"] == "igs")
<API key>(config);
return 0;
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_17) on Wed Jun 17 16:17:28 BST 2009 -->
<TITLE>
org.apache.jmeter.examples.sampler.gui Class Hierarchy (Apache JMeter API)
</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle() {
parent.document.title = "org.apache.jmeter.examples.sampler.gui Class Hierarchy (Apache JMeter API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<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=3 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>Tree</B></FONT>
</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>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/jmeter/examples/sampler/package-tree.html"><B>PREV</B></A>
<A
HREF="../../../../../../org/apache/jmeter/examples/testbeans/example1/package-tree.html"><B>NEXT</B></A></FONT>
</TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.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>
Hierarchy For Package org.apache.jmeter.examples.sampler.gui
</H2>
</CENTER>
<DL>
<DT><B>Package Hierarchies:</B>
<DD><A HREF="../../../../../../overview-tree.html">All Packages</A>
</DL>
<HR>
<H2>
Class Hierarchy
</H2>
<UL>
<LI TYPE="circle">class java.lang.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html"
title="class or interface in java.lang"><B>Object</B></A>
<UL>
<LI TYPE="circle">class java.awt.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Component.html"
title="class or interface in java.awt"><B>Component</B></A> (implements
java.awt.image.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/ImageObserver.html"
title="class or interface in java.awt.image">ImageObserver</A>, java.awt.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/MenuContainer.html"
title="class or interface in java.awt">MenuContainer</A>, java.io.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html"
title="class or interface in java.io">Serializable</A>)
<UL>
<LI TYPE="circle">class java.awt.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Container.html"
title="class or interface in java.awt"><B>Container</B></A>
<UL>
<LI TYPE="circle">class javax.swing.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComponent.html"
title="class or interface in javax.swing"><B>JComponent</B></A> (implements java.io.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html"
title="class or interface in java.io">Serializable</A>)
<UL>
<LI TYPE="circle">class javax.swing.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JPanel.html"
title="class or interface in javax.swing"><B>JPanel</B></A> (implements
javax.accessibility.<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/javax/accessibility/Accessible.html"
title="class or interface in javax.accessibility">Accessible</A>)
<UL>
<LI TYPE="circle">class org.apache.jmeter.gui.<A
HREF="../../../../../../org/apache/jmeter/gui/<API key>.html"
title="class in org.apache.jmeter.gui"><B><API key></B></A>
(implements org.apache.jmeter.gui.<A
HREF="../../../../../../org/apache/jmeter/gui/JMeterGUIComponent.html"
title="interface in org.apache.jmeter.gui">JMeterGUIComponent</A>,
org.apache.jmeter.visualizers.<A
HREF="../../../../../../org/apache/jmeter/visualizers/Printable.html"
title="interface in org.apache.jmeter.visualizers">Printable</A>)
<UL>
<LI TYPE="circle">class org.apache.jmeter.samplers.gui.<A
HREF="../../../../../../org/apache/jmeter/samplers/gui/AbstractSamplerGui.html"
title="class in org.apache.jmeter.samplers.gui"><B>AbstractSamplerGui</B></A>
<UL>
<LI TYPE="circle">class
org.apache.jmeter.examples.sampler.gui.<A
HREF="../../../../../../org/apache/jmeter/examples/sampler/gui/ExampleSamplerGui.html"
title="class in org.apache.jmeter.examples.sampler.gui"><B>ExampleSamplerGui</B></A>
</UL>
</UL>
</UL>
</UL>
</UL>
</UL>
</UL>
</UL>
<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=3 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>Tree</B></FONT>
</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>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/jmeter/examples/sampler/package-tree.html"><B>PREV</B></A>
<A
HREF="../../../../../../org/apache/jmeter/examples/testbeans/example1/package-tree.html"><B>NEXT</B></A></FONT>
</TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.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> |
#include "drv_sdio.h"
#ifdef RT_USING_SDIO
#ifdef BSP_USING_SDIO
//#define DRV_DEBUG
#define LOG_TAG "drv.sdio"
#include <drv_log.h>
static struct rt_mmcsd_host *host;
#define RTHW_SDIO_LOCK(_sdio) rt_mutex_take(&_sdio->mutex, RT_WAITING_FOREVER)
#define RTHW_SDIO_UNLOCK(_sdio) rt_mutex_release(&_sdio->mutex);
struct rthw_sdio
{
struct rt_mmcsd_host *host;
struct swm_sdio_des sdio_des;
struct rt_event event;
struct rt_mutex mutex;
struct sdio_pkg *pkg;
};
ALIGN(SDIO_ALIGN_LEN)
static rt_uint8_t cache_buf[SDIO_BUFF_SIZE];
/**
* @brief This function wait sdio completed.
* @param sdio rthw_sdio
* @retval None
*/
static void <API key>(struct rthw_sdio *sdio)
{
rt_uint32_t status;
struct rt_mmcsd_cmd *cmd = sdio->pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
SDIO_TypeDef *hw_sdio = sdio->sdio_des.hw_sdio;
if (rt_event_recv(&sdio->event, 0xffffffff, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
<API key>(1000), &status) != RT_EOK)
{
LOG_E("wait completed timeout");
cmd->err = -RT_ETIMEOUT;
return;
}
if (sdio->pkg == RT_NULL)
{
return;
}
if (resp_type(cmd) == RESP_NONE)
{
;
}
else if (resp_type(cmd) == RESP_R2)
{
cmd->resp[0] = (hw_sdio->RESP[3] << 8) + ((hw_sdio->RESP[2] >> 24) & 0xFF);
cmd->resp[1] = (hw_sdio->RESP[2] << 8) + ((hw_sdio->RESP[1] >> 24) & 0xFF);
cmd->resp[2] = (hw_sdio->RESP[1] << 8) + ((hw_sdio->RESP[0] >> 24) & 0xFF);
cmd->resp[3] = (hw_sdio->RESP[0] << 8) + 0x00;
}
else
{
cmd->resp[0] = hw_sdio->RESP[0];
}
if (status & SDIO_IF_ERROR_Msk)
{
if ((status & <API key>) && (resp_type(cmd) & (RESP_R3 | RESP_R4)))
{
cmd->err = RT_EOK;
}
else
{
cmd->err = -RT_ERROR;
}
if (status & <API key>)
{
cmd->err = -RT_ETIMEOUT;
}
if (status & <API key>)
{
data->err = -RT_ERROR;
}
if (status & <API key>)
{
data->err = -RT_ETIMEOUT;
}
if (cmd->err == RT_EOK)
{
LOG_D("sta:0x%08X [%08X %08X %08X %08X]", status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
}
else
{
LOG_D("err:0x%08x, %s cmd:%d arg:0x%08x rw:%c len:%d blksize:%d",
status,
status == 0 ? "NULL" : "",
cmd->cmd_code,
cmd->arg,
data ? (data->flags & DATA_DIR_WRITE ? 'w' : 'r') : '-',
data ? data->blks * data->blksize : 0,
data ? data->blksize : 0);
}
}
else
{
cmd->err = RT_EOK;
LOG_D("sta:0x%08X [%08X %08X %08X %08X]", status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
}
}
/**
* @brief This function transfer data by dma.
* @param sdio rthw_sdio
* @param pkg sdio package
* @retval None
*/
static void rthw_sdio_transfer(struct rthw_sdio *sdio, struct sdio_pkg *pkg)
{
struct rt_mmcsd_data *data;
int size;
void *buff;
if ((RT_NULL == pkg) || (RT_NULL == sdio))
{
LOG_E("rthw_sdio_transfer invalid args");
return;
}
data = pkg->cmd->data;
if (RT_NULL == data)
{
LOG_E("rthw_sdio_transfer invalid args");
return;
}
buff = pkg->buff;
if (RT_NULL == buff)
{
LOG_E("rthw_sdio_transfer invalid args");
return;
}
size = data->blks * data->blksize;
if (data->flags & DATA_DIR_WRITE)
{
sdio->sdio_des.txconfig(pkg, (rt_uint32_t *)buff, size);
}
else if (data->flags & DATA_DIR_READ)
{
sdio->sdio_des.rxconfig(pkg, (rt_uint32_t *)buff, size);
}
}
/**
* @brief This function send command.
* @param sdio rthw_sdio
* @param pkg sdio package
* @retval None
*/
static void <API key>(struct rthw_sdio *sdio, struct sdio_pkg *pkg)
{
struct rt_mmcsd_cmd *cmd = pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
SDIO_TypeDef *hw_sdio = sdio->sdio_des.hw_sdio;
rt_uint32_t reg_cmd;
/* save pkg */
sdio->pkg = pkg;
LOG_D("CMD:%d ARG:0x%08x RES:%s%s%s%s%s%s%s%s%s rw:%c len:%d blksize:%d",
cmd->cmd_code,
cmd->arg,
resp_type(cmd) == RESP_NONE ? "NONE" : "",
resp_type(cmd) == RESP_R1 ? "R1" : "",
resp_type(cmd) == RESP_R1B ? "R1B" : "",
resp_type(cmd) == RESP_R2 ? "R2" : "",
resp_type(cmd) == RESP_R3 ? "R3" : "",
resp_type(cmd) == RESP_R4 ? "R4" : "",
resp_type(cmd) == RESP_R5 ? "R5" : "",
resp_type(cmd) == RESP_R6 ? "R6" : "",
resp_type(cmd) == RESP_R7 ? "R7" : "",
data ? (data->flags & DATA_DIR_WRITE ? 'w' : 'r') : '-',
data ? data->blks * data->blksize : 0,
data ? data->blksize : 0);
/* config cmd reg */
reg_cmd = (cmd->cmd_code << <API key>) |
(0 << <API key>) |
(0 << <API key>) |
(0 << <API key>) |
(0 << SDIO_CMD_DMAEN_Pos);
if (resp_type(cmd) == RESP_NONE)
reg_cmd |= SD_RESP_NO << <API key>;
else if (resp_type(cmd) == RESP_R2)
reg_cmd |= SD_RESP_128b << <API key>;
else
reg_cmd |= SD_RESP_32b << <API key>;
/* config data reg */
if (data != RT_NULL)
{
rt_uint32_t dir = 0;
dir = (data->flags & DATA_DIR_READ) ? 1 : 0;
hw_sdio->BLK = (data->blks << SDIO_BLK_COUNT_Pos) | (data->blksize << SDIO_BLK_SIZE_Pos);
reg_cmd |= (1 << <API key>) |
(dir << <API key>) |
((data->blks > 1) << <API key>) |
((data->blks > 1) << <API key>) |
(0 << <API key>);
}
else
{
reg_cmd |= (0 << <API key>);
}
if (cmd->cmd_code != SD_IO_SEND_OP_COND)
{
/* send cmd */
hw_sdio->ARG = cmd->arg;
hw_sdio->CMD = reg_cmd;
}
/* transfer config */
if (data != RT_NULL)
{
rthw_sdio_transfer(sdio, pkg);
}
/* wait completed */
<API key>(sdio);
/* clear pkg */
sdio->pkg = RT_NULL;
}
/**
* @brief This function send sdio request.
* @param sdio rthw_sdio
* @param req request
* @retval None
*/
static void rthw_sdio_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req)
{
struct sdio_pkg pkg;
struct rthw_sdio *sdio = host->private_data;
struct rt_mmcsd_data *data;
RTHW_SDIO_LOCK(sdio);
if (req->cmd != RT_NULL)
{
rt_memset(&pkg, 0, sizeof(pkg));
data = req->cmd->data;
pkg.cmd = req->cmd;
if (data != RT_NULL)
{
rt_uint32_t size = data->blks * data->blksize;
RT_ASSERT(size <= SDIO_BUFF_SIZE);
pkg.buff = data->buf;
if ((rt_uint32_t)data->buf & (SDIO_ALIGN_LEN - 1))
{
pkg.buff = cache_buf;
if (data->flags & DATA_DIR_WRITE)
{
rt_memcpy(cache_buf, data->buf, size);
}
}
}
<API key>(sdio, &pkg);
if ((data != RT_NULL) && (data->flags & DATA_DIR_READ) && ((rt_uint32_t)data->buf & (SDIO_ALIGN_LEN - 1)))
{
rt_memcpy(data->buf, cache_buf, data->blksize * data->blks);
}
}
if (req->stop != RT_NULL)
{
rt_memset(&pkg, 0, sizeof(pkg));
pkg.cmd = req->stop;
<API key>(sdio, &pkg);
}
RTHW_SDIO_UNLOCK(sdio);
mmcsd_req_complete(sdio->host);
}
/**
* @brief This function config sdio.
* @param host rt_mmcsd_host
* @param io_cfg rt_mmcsd_io_cfg
* @retval None
*/
static void rthw_sdio_iocfg(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io_cfg)
{
rt_uint32_t clkcr, div, clk_src;
rt_uint32_t clk = io_cfg->clock;
struct rthw_sdio *sdio = host->private_data;
SDIO_TypeDef *hw_sdio = sdio->sdio_des.hw_sdio;
clk_src = sdio->sdio_des.clk_get(sdio->sdio_des.hw_sdio);
if (clk_src < 400 * 1000)
{
LOG_E("The clock rate is too low! rata:%d", clk_src);
return;
}
if (clk > host->freq_max)
clk = host->freq_max;
if (clk > clk_src)
{
LOG_W("Setting rate is greater than clock source rate.");
clk = clk_src;
}
LOG_D("clk:%d width:%s%s%s power:%s%s%s",
clk,
io_cfg->bus_width == MMCSD_BUS_WIDTH_8 ? "8" : "",
io_cfg->bus_width == MMCSD_BUS_WIDTH_4 ? "4" : "",
io_cfg->bus_width == MMCSD_BUS_WIDTH_1 ? "1" : "",
io_cfg->power_mode == MMCSD_POWER_OFF ? "OFF" : "",
io_cfg->power_mode == MMCSD_POWER_UP ? "UP" : "",
io_cfg->power_mode == MMCSD_POWER_ON ? "ON" : "");
RTHW_SDIO_LOCK(sdio);
hw_sdio->CR1 = (1 << SDIO_CR1_CDSRC_Pos) | (7 << SDIO_CR1_VOLT_Pos);
if (io_cfg->bus_width == MMCSD_BUS_WIDTH_8)
{
hw_sdio->CR1 |= (1 << SDIO_CR1_8BIT_Pos);
}
else
{
hw_sdio->CR1 &= ~SDIO_CR1_8BIT_Msk;
if (io_cfg->bus_width == MMCSD_BUS_WIDTH_4)
{
hw_sdio->CR1 |= (1 << SDIO_CR1_4BIT_Pos);
}
else
{
hw_sdio->CR1 &= ~SDIO_CR1_4BIT_Msk;
}
}
switch (io_cfg->power_mode)
{
case MMCSD_POWER_OFF:
hw_sdio->CR1 &= ~SDIO_CR1_PWRON_Msk;
break;
case MMCSD_POWER_UP:
case MMCSD_POWER_ON:
hw_sdio->CR1 |= (1 << SDIO_CR1_PWRON_Pos);
break;
default:
LOG_W("unknown power_mode %d", io_cfg->power_mode);
break;
}
div = clk_src / clk;
if ((clk == 0) || (div == 0))
{
clkcr = 0;
}
else
{
if (div > 128)
clkcr = 0x80;
else if (div > 64)
clkcr = 0x40;
else if (div > 32)
clkcr = 0x20;
else if (div > 16)
clkcr = 0x10;
else if (div > 8)
clkcr = 0x08;
else if (div > 4)
clkcr = 0x04;
else if (div > 2)
clkcr = 0x02;
else if (div > 1)
clkcr = 0x01;
else
clkcr = 0x00;
}
SDIO->CR2 = (1 << SDIO_CR2_CLKEN_Pos) |
(1 << <API key>) |
(clkcr << <API key>) |
(0xC << <API key>); // 2**25 SDIO_CLK
while ((SDIO->CR2 & SDIO_CR2_CLKRDY_Msk) == 0)
;
RTHW_SDIO_UNLOCK(sdio);
}
/**
* @brief This function delect sdcard.
* @param host rt_mmcsd_host
* @retval 0x01
*/
static rt_int32_t rthw_sdio_delect(struct rt_mmcsd_host *host)
{
LOG_D("try to detect device");
return 0x01;
}
/**
* @brief This function update sdio interrupt.
* @param host rt_mmcsd_host
* @param enable
* @retval None
*/
void <API key>(struct rt_mmcsd_host *host, rt_int32_t enable)
{
struct rthw_sdio *sdio = host->private_data;
SDIO_TypeDef *hw_sdio = sdio->sdio_des.hw_sdio;
if (enable)
{
LOG_D("enable sdio irq");
hw_sdio->IFE = 0xFFFFFFFF;
hw_sdio->IE = 0xFFFF000F;
}
else
{
LOG_D("disable sdio irq");
hw_sdio->IFE &= ~0xFFFFFFFF;
hw_sdio->IE &= ~0xFFFFFFFF;
}
}
static const struct rt_mmcsd_host_ops swm_sdio_ops =
{
rthw_sdio_request,
rthw_sdio_iocfg,
rthw_sdio_delect,
<API key>,
};
struct rt_mmcsd_host *sdio_host_create(struct swm_sdio_des *sdio_des)
{
struct rt_mmcsd_host *host;
struct rthw_sdio *sdio = RT_NULL;
if ((sdio_des == RT_NULL) || (sdio_des->txconfig == RT_NULL) || (sdio_des->rxconfig == RT_NULL))
{
LOG_E("L:%d F:%s %s %s %s",
(sdio_des == RT_NULL ? "sdio_des is NULL" : ""),
(sdio_des ? (sdio_des->txconfig ? "txconfig is NULL" : "") : ""),
(sdio_des ? (sdio_des->rxconfig ? "rxconfig is NULL" : "") : ""));
return RT_NULL;
}
sdio = rt_malloc(sizeof(struct rthw_sdio));
if (sdio == RT_NULL)
{
LOG_E("L:%d F:%s malloc rthw_sdio fail");
return RT_NULL;
}
rt_memset(sdio, 0, sizeof(struct rthw_sdio));
host = mmcsd_alloc_host();
if (host == RT_NULL)
{
LOG_E("L:%d F:%s mmcsd alloc host fail");
rt_free(sdio);
return RT_NULL;
}
rt_memcpy(&sdio->sdio_des, sdio_des, sizeof(struct swm_sdio_des));
rt_event_init(&sdio->event, "sdio", RT_IPC_FLAG_FIFO);
rt_mutex_init(&sdio->mutex, "sdio", RT_IPC_FLAG_PRIO);
/* set host defautl attributes */
host->ops = &swm_sdio_ops;
host->freq_min = 400 * 1000;
host->freq_max = SDIO_MAX_FREQ;
host->valid_ocr = 0X00FFFF80; /* The voltage range supported is 1.65v-3.6v */
#ifndef SDIO_USING_1_BIT
host->flags = MMCSD_BUSWIDTH_4 | MMCSD_MUTBLKWRITE | MMCSD_SUP_SDIO_IRQ;
#else
host->flags = MMCSD_MUTBLKWRITE | MMCSD_SUP_SDIO_IRQ;
#endif
host->max_seg_size = SDIO_BUFF_SIZE;
host->max_dma_segs = 1;
host->max_blk_size = 512;
host->max_blk_count = 512;
/* link up host and sdio */
sdio->host = host;
host->private_data = sdio;
<API key>(host, 1);
/* ready to change */
mmcsd_change(host);
return host;
}
static rt_uint32_t swm_sdio_clock_get(SDIO_TypeDef *hw_sdio)
{
uint32_t prediv = ((SYS->CLKDIV & SYS_CLKDIV_SDIO_Msk) >> SYS_CLKDIV_SDIO_Pos);
return (SystemCoreClock / (1 << prediv));
}
static rt_err_t swm_sdio_rxconfig(struct sdio_pkg *pkg, rt_uint32_t *buff, int size)
{
struct rt_mmcsd_cmd *cmd = pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
for (uint32_t i = 0; i < data->blks; i++)
{
while ((SDIO->IF & <API key>) == 0)
__NOP();
SDIO->IF = <API key>;
for (uint32_t j = 0; j < data->blksize / 4; j++)
buff[j] = SDIO->DATA;
}
return RT_EOK;
}
static rt_err_t swm_sdio_txconfig(struct sdio_pkg *pkg, rt_uint32_t *buff, int size)
{
struct rt_mmcsd_cmd *cmd = pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
for (uint32_t i = 0; i < data->blks; i++)
{
while ((SDIO->IF & <API key>) == 0)
__NOP();
SDIO->IF = <API key>;
for (uint32_t j = 0; j < data->blksize / 4; j++)
SDIO->DATA = buff[j];
}
return RT_EOK;
}
/**
* @brief This function interrupt process function.
* @param host rt_mmcsd_host
* @retval None
*/
void <API key>(struct rt_mmcsd_host *host)
{
int complete = 0;
struct rthw_sdio *sdio = host->private_data;
SDIO_TypeDef *hw_sdio = sdio->sdio_des.hw_sdio;
rt_uint32_t intstatus = hw_sdio->IF;
if (intstatus & SDIO_IF_ERROR_Msk)
{
hw_sdio->IF = 0xFFFFFFFF;
complete = 1;
}
else
{
if (intstatus & SDIO_IF_CMDDONE_Msk)
{
hw_sdio->IF = SDIO_IF_CMDDONE_Msk;
if (sdio->pkg != RT_NULL)
{
if (!sdio->pkg->cmd->data)
{
complete = 1;
}
}
}
if (intstatus & SDIO_IF_TRXDONE_Msk)
{
hw_sdio->IF = SDIO_IF_TRXDONE_Msk;
complete = 1;
}
}
if (complete)
{
rt_event_send(&sdio->event, intstatus);
}
}
void SDIO_Handler(void)
{
/* enter interrupt */
rt_interrupt_enter();
/* Process All SDIO Interrupt Sources */
<API key>(host);
/* leave interrupt */
rt_interrupt_leave();
}
int rt_hw_sdio_init(void)
{
struct swm_sdio_des sdio_des;
#if 1
PORT_Init(PORTB, PIN1, PORTB_PIN1_SD_CLK, 0);
PORT_Init(PORTB, PIN2, PORTB_PIN2_SD_CMD, 1);
PORT_Init(PORTB, PIN3, PORTB_PIN3_SD_D0, 1);
PORT_Init(PORTB, PIN4, PORTB_PIN4_SD_D1, 1);
PORT_Init(PORTB, PIN5, PORTB_PIN5_SD_D2, 1);
PORT_Init(PORTB, PIN6, PORTB_PIN6_SD_D3, 1);
#else
PORT_Init(PORTP, PIN11, PORTP_PIN11_SD_CLK, 0);
PORT_Init(PORTP, PIN10, PORTP_PIN10_SD_CMD, 1);
PORT_Init(PORTP, PIN9, PORTP_PIN9_SD_D0, 1);
PORT_Init(PORTP, PIN8, PORTP_PIN8_SD_D1, 1);
PORT_Init(PORTP, PIN7, PORTP_PIN7_SD_D2, 1);
PORT_Init(PORTP, PIN6, PORTP_PIN6_SD_D3, 1);
#endif
NVIC_EnableIRQ(SDIO_IRQn);
SYS->CLKDIV &= ~SYS_CLKDIV_SDIO_Msk;
if (SystemCoreClock > 80000000) //SDIO52MHz
SYS->CLKDIV |= (2 << SYS_CLKDIV_SDIO_Pos); //SDCLK = SYSCLK / 4
else
SYS->CLKDIV |= (1 << SYS_CLKDIV_SDIO_Pos); //SDCLK = SYSCLK / 2
SYS->CLKEN |= (0x01 << SYS_CLKEN_SDIO_Pos);
SDIO->CR2 = (1 << SDIO_CR2_RSTALL_Pos);
NVIC_EnableIRQ(SDIO_IRQn);
sdio_des.clk_get = swm_sdio_clock_get;
sdio_des.hw_sdio = SDIO;
sdio_des.rxconfig = swm_sdio_rxconfig;
sdio_des.txconfig = swm_sdio_txconfig;
host = sdio_host_create(&sdio_des);
if (host == RT_NULL)
{
LOG_E("host create fail");
return -1;
}
return 0;
}
INIT_DEVICE_EXPORT(rt_hw_sdio_init);
#endif /* BSP_USING_SDIO */
#endif /* RT_USING_SDIO */ |
#!/usr/bin/env ruby
require 'tk'
begin
# try to use Img extension
require 'tkextlib/tkimg'
rescue Exception
# cannot use Img extention --> ignore
end
# scrolled_canvas
class TkScrolledCanvas < TkCanvas
include TkComposite
def <API key>(keys={})
@h_scr = TkScrollbar.new(@frame)
@v_scr = TkScrollbar.new(@frame)
@canvas = TkCanvas.new(@frame)
@path = @canvas.path
@canvas.xscrollbar(@h_scr)
@canvas.yscrollbar(@v_scr)
TkGrid.rowconfigure(@frame, 0, :weight=>1, :minsize=>0)
TkGrid.columnconfigure(@frame, 0, :weight=>1, :minsize=>0)
@canvas.grid(:row=>0, :column=>0, :sticky=>'news')
@h_scr.grid(:row=>1, :column=>0, :sticky=>'ew')
@v_scr.grid(:row=>0, :column=>1, :sticky=>'ns')
delegate('DEFAULT', @canvas)
delegate('background', @canvas, @h_scr, @v_scr)
delegate('activebackground', @h_scr, @v_scr)
delegate('troughcolor', @h_scr, @v_scr)
delegate('repeatdelay', @h_scr, @v_scr)
delegate('repeatinterval', @h_scr, @v_scr)
delegate('borderwidth', @frame)
delegate('relief', @frame)
delegate_alias('canvasborderwidth', 'borderwidth', @canvas)
delegate_alias('canvasrelief', 'relief', @canvas)
delegate_alias('<API key>', 'borderwidth', @h_scr, @v_scr)
delegate_alias('scrollbarrelief', 'relief', @h_scr, @v_scr)
configure(keys) unless keys.empty?
end
end
class PhotoCanvas < TkScrolledCanvas
USAGE = <<EOT
WHAT IS
You can write comments on the loaded image, and save it as a Postscipt
file (original image file is not modified). Each comment is drawn as a
set of an indicator circle, an arrow, and a memo text. See the following
how to write comments.
This can save the list of memo texts to another file. It may useful to
search the saved Postscript file by the comments on them.
This may not support multibyte characters (multibyte texts are broken on
a Postscript file). It depends on features of canvas widgets of Tcl/Tk
libraries linked your Ruby/Tk. If you use Tcl/Tk8.0-jp (Japanized Tcl/Tk),
you can (possibly) get a Japanese Postscript file.
BINDINGS
* Button-1 : draw comments by following steps
1st - Set center of a indicator circle.
2nd - Set head position of an arrow.
3rd - Set tail position of an arrow, and show an entry box.
Input a memo text and hit 'Enter' key to entry the comment.
* Button-2-drag : scroll the canvas
* Button-3 : when drawing, cancel current drawing
* Double-Button-3 : delete the clicked comment (text, arrow, and circle)
EOT
def initialize(*args)
super(*args)
self.highlightthickness = 0
self.selectborderwidth = 0
@photo = TkPhotoImage.new
@img = TkcImage.new(self, 0, 0, :image=>@photo)
width = self.width
height = self.height
@scr_region = [-width, -height, width, height]
self.scrollregion(@scr_region)
self.xview_moveto(0.25)
self.yview_moveto(0.25)
@col = 'red'
@font = 'Helvetica -12'
@memo_id_num = -1
@memo_id_head = 'memo_'
@memo_id_tag = nil
@overlap_d = 2
@state = TkVariable.new
@border = 2
@selectborder = 1
@delta = @border + @selectborder
@entry = TkEntry.new(self, :relief=>:ridge, :borderwidth=>@border,
:selectborderwidth=>@selectborder,
:highlightthickness=>0)
@entry.bind('Return'){@state.value = 0}
@mode = old_mode = 0
_state0()
bind('2', :x, :y){|x,y| scan_mark(x,y)}
bind('B2-Motion', :x, :y){|x,y| scan_dragto(x,y)}
bind('3'){
next if (old_mode = @mode) == 0
@items.each{|item| item.delete }
_state0()
}
bind('Double-3', :widget, :x, :y){|w, x, y|
next if old_mode != 0
x = w.canvasx(x)
y = w.canvasy(y)
tag = nil
w.find_overlapping(x - @overlap_d, y - @overlap_d,
x + @overlap_d, y + @overlap_d).find{|item|
! (item.tags.find{|name|
if name =~ /^(#{@memo_id_head}\d+)$/
tag = $1
end
}.empty?)
}
w.delete(tag) if tag
}
end
private
def _state0() # init
@mode = 0
@memo_id_num += 1
@memo_id_tag = @memo_id_head + @memo_id_num.to_s
@target = nil
@items = []
@mark = [0, 0]
bind_remove('Motion')
bind('ButtonRelease-1', proc{|x,y| _state1(x,y)}, '%x', '%y')
end
def _state1(x,y) # set center
@mode = 1
@target = TkcOval.new(self,
[canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)],
:outline=>@col, :width=>3, :tags=>[@memo_id_tag])
@items << @target
@mark = [x,y]
bind('Motion', proc{|x,y| _state2(x,y)}, '%x', '%y')
bind('ButtonRelease-1', proc{|x,y| _state3(x,y)}, '%x', '%y')
end
def _state2(x,y) # create circle
@mode = 2
r = Integer(Math.sqrt((x-@mark[0])**2 + (y-@mark[1])**2))
@target.coords([canvasx(@mark[0] - r), canvasy(@mark[1] - r)],
[canvasx(@mark[0] + r), canvasy(@mark[1] + r)])
end
def _state3(x,y) # set line start
@mode = 3
@target = TkcLine.new(self,
[canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)],
:arrow=>:first, :arrowshape=>[10, 14, 5],
:fill=>@col, :tags=>[@memo_id_tag])
@items << @target
@mark = [x, y]
bind('Motion', proc{|x,y| _state4(x,y)}, '%x', '%y')
bind('ButtonRelease-1', proc{|x,y| _state5(x,y)}, '%x', '%y')
end
def _state4(x,y) # create line
@mode = 4
@target.coords([canvasx(@mark[0]), canvasy(@mark[1])],
[canvasx(x), canvasy(y)])
end
def _state5(x,y) # set text
@mode = 5
if x - @mark[0] >= 0
justify = 'left'
dx = - @delta
if y - @mark[1] >= 0
anchor = 'nw'
dy = - @delta
else
anchor = 'sw'
dy = @delta
end
else
justify = 'right'
dx = @delta
if y - @mark[1] >= 0
anchor = 'ne'
dy = - @delta
else
anchor = 'se'
dy = @delta
end
end
bind_remove('Motion')
@entry.value = ''
@entry.configure(:justify=>justify, :font=>@font, :foreground=>@col)
ewin = TkcWindow.new(self, [canvasx(x)+dx, canvasy(y)+dy],
:window=>@entry, :state=>:normal, :anchor=>anchor,
:tags=>[@memo_id_tag])
@entry.focus
@entry.grab
@state.wait
@entry.grab_release
ewin.delete
@target = TkcText.new(self, [canvasx(x), canvasy(y)],
:anchor=>anchor, :justify=>justify,
:fill=>@col, :font=>@font, :text=>@entry.value,
:tags=>[@memo_id_tag])
_state0()
end
public
def load_photo(filename)
@photo.configure(:file=>filename)
end
def modified?
! ((find_withtag('all') - [@img]).empty?)
end
def fig_erase
(find_withtag('all') - [@img]).each{|item| item.delete}
end
def reset_region
width = @photo.width
height = @photo.height
if width > @scr_region[2]
@scr_region[0] = -width
@scr_region[2] = width
end
if height > @scr_region[3]
@scr_region[1] = -height
@scr_region[3] = height
end
self.scrollregion(@scr_region)
self.xview_moveto(0.25)
self.yview_moveto(0.25)
end
def get_texts
ret = []
find_withtag('all').each{|item|
if item.kind_of?(TkcText)
ret << item[:text]
end
}
ret
end
end
# define methods for menu
def open_file(canvas, fname)
if canvas.modified?
ret = Tk.messageBox(:icon=>'warning',:type=>'okcancel',:default=>'cancel',
:message=>'Canvas may be modified. Realy erase? ')
return if ret == 'cancel'
end
filetypes = [
['GIF Files', '.gif'],
['GIF Files', [], 'GIFF'],
['PPM Files', '.ppm'],
['PGM Files', '.pgm']
]
begin
if Tk::Img::package_version != ''
filetypes << ['JPEG Files', ['.jpg', '.jpeg']]
filetypes << ['PNG Files', '.png']
filetypes << ['PostScript Files', '.ps']
filetypes << ['PDF Files', '.pdf']
filetypes << ['Windows Bitmap Files', '.bmp']
filetypes << ['Windows Icon Files', '.ico']
filetypes << ['PCX Files', '.pcx']
filetypes << ['Pixmap Files', '.pixmap']
filetypes << ['SGI Files', '.sgi']
filetypes << ['Sun Raster Files', '.sun']
filetypes << ['TGA Files', '.tga']
filetypes << ['TIFF Files', '.tiff']
filetypes << ['XBM Files', '.xbm']
filetypes << ['XPM Files', '.xpm']
end
rescue
end
filetypes << ['ALL Files', '*']
fpath = Tk.getOpenFile(:filetypes=>filetypes)
return if fpath.empty?
begin
canvas.load_photo(fpath)
rescue => e
Tk.messageBox(:icon=>'error', :type=>'ok',
:message=>"Fail to read '#{fpath}'.\n#{e.message}")
end
canvas.fig_erase
canvas.reset_region
fname.value = fpath
end
def save_memo(canvas, fname)
initname = fname.value
if initname != '-'
initname = File.basename(initname, File.extname(initname))
fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'],
['ALL Files', '*'] ],
:initialfile=>initname)
else
fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'],
['ALL Files', '*'] ])
end
return if fpath.empty?
begin
fid = open(fpath, 'w')
rescue => e
Tk.messageBox(:icon=>'error', :type=>'ok',
:message=>"Fail to open '#{fname.value}'.\n#{e.message}")
end
begin
canvas.get_texts.each{|txt|
fid.print(txt, "\n")
}
ensure
fid.close
end
end
def ps_print(canvas, fname)
initname = fname.value
if initname != '-'
initname = File.basename(initname, File.extname(initname))
fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'],
['ALL Files', '*'] ],
:initialfile=>initname)
else
fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'],
['ALL Files', '*'] ])
end
return if fpath.empty?
bbox = canvas.bbox('all')
canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1],
:width=>bbox[2] - bbox[0], :height=>bbox[3] - bbox[1])
end
def quit(canvas)
ret = Tk.messageBox(:icon=>'warning', :type=>'okcancel',
:default=>'cancel',
:message=>'Realy quit? ')
exit if ret == 'ok'
end
# setup root
root = TkRoot.new(:title=>'Fig Memo')
# create canvas frame
canvas = PhotoCanvas.new(root).pack(:fill=>:both, :expand=>true)
usage_frame = TkFrame.new(root, :relief=>:ridge, :borderwidth=>2)
hide_btn = TkButton.new(usage_frame, :text=>'hide usage',
:font=>{:size=>8}, :pady=>1,
:command=>proc{usage_frame.unpack})
hide_btn.pack(:anchor=>'e', :padx=>5)
usage = TkLabel.new(usage_frame, :text=>PhotoCanvas::USAGE,
:font=>'Helvetica 8', :justify=>:left).pack
show_usage = proc{
usage_frame.pack(:before=>canvas, :fill=>:x, :expand=>true)
}
fname = TkVariable.new('-')
f = TkFrame.new(root, :relief=>:sunken, :borderwidth=>1).pack(:fill=>:x)
label = TkLabel.new(f, :textvariable=>fname,
:font=>{:size=>-12, :weight=>:bold},
:anchor=>'w').pack(:side=>:left, :fill=>:x, :padx=>10)
# create menu
mspec = [
[ ['File', 0],
['Show Usage', proc{show_usage.call}, 5],
'
['Open Image File', proc{open_file(canvas, fname)}, 0],
['Save Memo Texts', proc{save_memo(canvas, fname)}, 0],
'
['Save Postscript', proc{ps_print(canvas, fname)}, 5],
'
['Quit', proc{quit(canvas)}, 0]
]
]
root.add_menubar(mspec)
# manage wm_protocol
root.protocol(:WM_DELETE_WINDOW){quit(canvas)}
# show usage
show_usage.call
# start eventloop
Tk.mainloop |
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
using IronPython.Runtime.Binding;
using IronPython.Runtime.Operations;
#if FEATURE_CORE_DLR
using MSAst = System.Linq.Expressions;
#else
using MSAst = Microsoft.Scripting.Ast;
#endif
using AstUtils = Microsoft.Scripting.Ast.Utils;
namespace IronPython.Compiler.Ast {
using Ast = MSAst.Expression;
public abstract class SequenceExpression : Expression {
private readonly Expression[] _items;
protected SequenceExpression(Expression[] items) {
_items = items;
}
public IList<Expression> Items {
get { return _items; }
}
internal override MSAst.Expression TransformSet(SourceSpan span, MSAst.Expression right, PythonOperationKind op) {
// if we just have a simple named multi-assignment (e.g. a, b = 1,2)
// then go ahead and step over the entire statement at once. If we have a
// more complex statement (e.g. a.b, c.d = 1, 2) then we'll step over the
// sets individually as they could be property sets the user wants to step
// into. TODO: Enable stepping of the right hand side?
bool emitIndividualSets = false;
foreach (Expression e in _items) {
if (IsComplexAssignment(e)) {
emitIndividualSets = true;
break;
}
}
SourceSpan rightSpan = SourceSpan.None;
SourceSpan leftSpan =
(Span.Start.IsValid && span.IsValid) ?
new SourceSpan(Span.Start, span.End) :
SourceSpan.None;
SourceSpan totalSpan = SourceSpan.None;
if (emitIndividualSets) {
rightSpan = span;
leftSpan = SourceSpan.None;
totalSpan = (Span.Start.IsValid && span.IsValid) ?
new SourceSpan(Span.Start, span.End) :
SourceSpan.None;
}
// 1. Evaluate the expression and assign the value to the temp.
MSAst.ParameterExpression right_temp = Ast.Variable(typeof(object), "unpacking");
// 2. Add the assignment "right_temp = right" into the suite/block
MSAst.Expression assignStmt1 = MakeAssignment(right_temp, right);
// 3. Call GetEnumeratorValues on the right side (stored in temp)
MSAst.Expression enumeratorValues = Expression.Convert(LightExceptions.CheckAndThrow(
Expression.Call(
emitIndividualSets ?
AstMethods.GetEnumeratorValues :
AstMethods.<API key>, // method
// arguments
Parent.LocalContext,
right_temp,
AstUtils.Constant(_items.Length)
)
), typeof(object[]));
// 4. Create temporary variable for the array
MSAst.ParameterExpression array_temp = Ast.Variable(typeof(object[]), "array");
// 5. Assign the value of the method call (mce) into the array temp
// And add the assignment "array_temp = Ops.GetEnumeratorValues(...)" into the block
MSAst.Expression assignStmt2 = MakeAssignment(
array_temp,
enumeratorValues,
rightSpan
);
<API key><MSAst.Expression> sets = new <API key><MSAst.Expression>(_items.Length + 1);
for (int i = 0; i < _items.Length; i++) {
// target = array_temp[i]
Expression target = _items[i];
if (target == null) {
continue;
}
// 6. array_temp[i]
MSAst.Expression element = Ast.ArrayAccess(
array_temp, // array expression
AstUtils.Constant(i) // index
);
// 7. target = array_temp[i], and add the transformed assignment into the list of sets
MSAst.Expression set = target.TransformSet(
emitIndividualSets ? // span
target.Span :
SourceSpan.None,
element,
PythonOperationKind.None
);
sets.Add(set);
}
// 9. add the sets as their own block so they can be marked as a single span, if necessary.
sets.Add(AstUtils.Empty());
MSAst.Expression itemSet = GlobalParent.AddDebugInfo(Ast.Block(sets.<API key>()), leftSpan);
// 10. Return the suite statement (block)
return GlobalParent.AddDebugInfo(Ast.Block(new[] { array_temp, right_temp }, assignStmt1, assignStmt2, itemSet, AstUtils.Empty()), totalSpan);
}
internal override string CheckAssign() {
return null;
}
internal override string CheckDelete() {
return null;
}
internal override string <API key>() {
return "illegal expression for augmented assignment";
}
private static bool IsComplexAssignment(Expression expr) {
return !(expr is NameExpression);
}
internal override MSAst.Expression TransformDelete() {
MSAst.Expression[] statements = new MSAst.Expression[_items.Length + 1];
for (int i = 0; i < _items.Length; i++) {
statements[i] = _items[i].TransformDelete();
}
statements[_items.Length] = AstUtils.Empty();
return GlobalParent.AddDebugInfo(Ast.Block(statements), Span);
}
internal override bool CanThrow {
get {
foreach (Expression e in _items) {
if (e.CanThrow) {
return true;
}
}
return false;
}
}
}
} |
package play.test;
import org.junit.Test;
import play.i18n.MessagesApi;
import static org.junit.Assert.assertNotNull;
/**
* Tests WithApplication functionality.
*/
public class WithApplicationTest extends WithApplication {
@Test
public void withInject() {
MessagesApi messagesApi = inject(MessagesApi.class);
assertNotNull(messagesApi);
}
} |
#How to use server-core module
Server's services represent a tree structure. To run it in sequence we must add services in **ServiceTree** collection.
In this collection there are some rules:
* all services are **Threads**
* services implement **IService** interface
* services add in **ServiceTree** collection from the top to the bottom.
For example:
If server's service structure is:

We mast to add initially first servise with **null** parent:
java
services.addService(FirstService,null);
The next step to add second layer of services:
java
services.addService(SecondService,FirstService);
services.addService(ThirdService,FirstService);
and so on.
After adding services we must start server:
java
services.startServer();
After starting server we mast start monitoring.
java
services.monitoring();
If one or more services go into inconsistentname condition all serviceTree was stopped. |
package com.alibaba.otter.canal.parse.inbound.group;
import java.net.InetSocketAddress;
import org.junit.Test;
import com.alibaba.otter.canal.parse.exception.CanalParseException;
import com.alibaba.otter.canal.parse.inbound.<API key>;
import com.alibaba.otter.canal.parse.inbound.BinlogParser;
import com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser;
import com.alibaba.otter.canal.parse.stub.<API key>;
import com.alibaba.otter.canal.parse.support.AuthenticationInfo;
import com.alibaba.otter.canal.protocol.CanalEntry.Entry;
import com.alibaba.otter.canal.protocol.position.EntryPosition;
import com.alibaba.otter.canal.protocol.position.LogPosition;
import com.alibaba.otter.canal.sink.entry.EntryEventSink;
import com.alibaba.otter.canal.sink.entry.group.GroupEventSink;
import com.taobao.tddl.dbsync.binlog.LogEvent;
public class GroupEventPaserTest {
private static final String DETECTING_SQL = "insert into retl.xdual values(1,now()) on duplicate key update x=now()";
private static final String MYSQL_ADDRESS = "10.20.153.51";
private static final String USERNAME = "retl";
private static final String PASSWORD = "retl";
@Test
public void testMysqlWithMysql() {
// <API key> eventStore = new <API key>();
// eventStore.setBufferSize(8196);
GroupEventSink eventSink = new GroupEventSink(3);
eventSink.<API key>(false);
eventSink.setEventStore(new DummyEventStore());
eventSink.start();
// mysql
MysqlEventParser mysqlEventPaser1 = buildEventParser(3344);
mysqlEventPaser1.setEventSink(eventSink);
// mysql
MysqlEventParser mysqlEventPaser2 = buildEventParser(3345);
mysqlEventPaser2.setEventSink(eventSink);
// mysql
MysqlEventParser mysqlEventPaser3 = buildEventParser(3346);
mysqlEventPaser3.setEventSink(eventSink);
mysqlEventPaser1.start();
mysqlEventPaser2.start();
mysqlEventPaser3.start();
try {
Thread.sleep(30 * 10 * 1000L);
} catch (<API key> e) {
}
mysqlEventPaser1.stop();
mysqlEventPaser2.stop();
mysqlEventPaser3.stop();
}
private MysqlEventParser buildEventParser(int slaveId) {
MysqlEventParser mysqlEventPaser = new MysqlEventParser();
EntryPosition defaultPosition = buildPosition("mysql-bin.000001", 6163L, 1322803601000L);
mysqlEventPaser.setDestination("group-" + slaveId);
mysqlEventPaser.setSlaveId(slaveId);
mysqlEventPaser.setDetectingEnable(false);
mysqlEventPaser.setDetectingSQL(DETECTING_SQL);
mysqlEventPaser.setMasterInfo(buildAuthentication());
mysqlEventPaser.setMasterPosition(defaultPosition);
mysqlEventPaser.setBinlogParser(buildParser(buildAuthentication()));
mysqlEventPaser.setEventSink(new EntryEventSink());
mysqlEventPaser.<API key>(new <API key>() {
public void persistLogPosition(String destination, LogPosition logPosition) {
// System.out.println(logPosition);
}
public LogPosition getLatestIndexBy(String destination) {
return null;
}
});
return mysqlEventPaser;
}
private BinlogParser buildParser(AuthenticationInfo info) {
return new <API key><LogEvent>() {
public Entry parse(LogEvent event) throws CanalParseException {
// return _parser.parse(event);
return null;
}
};
}
private EntryPosition buildPosition(String binlogFile, Long offest, Long timestamp) {
return new EntryPosition(binlogFile, offest, timestamp);
}
private AuthenticationInfo buildAuthentication() {
return new AuthenticationInfo(new InetSocketAddress(MYSQL_ADDRESS, 3306), USERNAME, PASSWORD);
}
} |
require('should');
global.getApp = function(done) {
var app = require('compound').createServer()
app.renderedViews = [];
app.flashedMessages = {};
// Monkeypatch app#render so that it exposes the rendered view files
app._render = app.render;
app.render = function (viewName, opts, fn) {
app.renderedViews.push(viewName);
// Deep-copy flash messages
var flashes = opts.request.session.flash;
for(var type in flashes) {
app.flashedMessages[type] = [];
for(var i in flashes[type]) {
app.flashedMessages[type].push(flashes[type][i]);
}
}
return app._render.apply(this, arguments);
}
// Check whether a view has been rendered
app.didRender = function (viewRegex) {
var didRender = false;
app.renderedViews.forEach(function (renderedView) {
if(renderedView.match(viewRegex)) {
didRender = true;
}
});
return didRender;
}
// Check whether a flash has been called
app.didFlash = function (type) {
return !!(app.flashedMessages[type]);
}
return app;
}; |
# <API key>
## Properties
Name | Type | Description | Notes
**last_update_time** | **datetime** | timestamp for the last update to this condition | [optional]
**message** | **str** | human readable message with details about the request state | [optional]
**reason** | **str** | brief reason for the request state | [optional]
**type** | **str** | request approval state, currently Approved or Denied. |
[[Back to Model list]](../README.md#<API key>) [[Back to API list]](../README.md#<API key>) [[Back to README]](../README.md) |
package com.bxtel.bxdatadxgxdg.bo;
import com.bxtel.bxdatadxgxdg.model.*;
import com.bxtel.bxdatadxgxdg.dao.*;
import com.bxtel.exception.BusinessException;
import java.util.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
import dinamica.*;
import dinamica.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.annotation.Resource;
@Service("BxDataDxGxDgTBO")
public class BxDataDxGxDgTBO
{
@Resource
public BxDataDxGxDgTDAO dao;
private static final Log logger = LogFactory.getLog(BxDataDxGxDgTBO.class);
public BxDataDxGxDgT add(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.add(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public int delete(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.deleteByCoud(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public int update(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.updateCoudByRowId(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public int <API key>(BxDataDxGxDgT model,BxDataDxGxDgT wheremodel) throws BusinessException {
try {
return dao.<API key>(model,wheremodel);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public List<BxDataDxGxDgT> <API key>(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.<API key>(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public List<BxDataDxGxDgT> <API key>(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.<API key>(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public BxDataDxGxDgT <API key>(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.<API key>(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public BxDataDxGxDgT <API key>(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.<API key>(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public List<Map<String, Object>> getListMapByCoud(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.getListMapByCoud(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public List<Map<String, Object>> getListMapByExact(BxDataDxGxDgT model) throws BusinessException {
try {
return dao.getListMapByExact(model);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
public ListAndTotalCount<BxDataDxGxDgT> getPageList(BxDataDxGxDgT model, int pageIndex,int rows) throws BusinessException
{
try {
List<BxDataDxGxDgT> list = dao.getPageListByCound(model,pageIndex,rows);
ListAndTotalCount<BxDataDxGxDgT> lst = new ListAndTotalCount<BxDataDxGxDgT>();
if(list!=null&& list.size()>0)
{
lst.setTotal(list.get(0).getTotalCount());
lst.setRows(list);
}
return lst;
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e);
}
}
} |
// modification, are permitted provided that the following conditions
// are met:
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef <API key>
#define <API key>
/** \addtogroup common
@{
*/
#include "common/PxPhysXCommonConfig.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
/**
\brief an enumeration of concrete classes inheriting from PxBase
Enumeration space is reserved for future PhysX core types, PhysXExtensions,
PhysXVehicle and Custom application types.
@see PxBase, PxTypeInfo
*/
struct PxConcreteType
{
enum Enum
{
eUNDEFINED,
eHEIGHTFIELD,
eCONVEX_MESH,
<API key>,
<API key>,
eRIGID_DYNAMIC,
eRIGID_STATIC,
eSHAPE,
eMATERIAL,
eCONSTRAINT,
eAGGREGATE,
eARTICULATION,
<API key>,
eARTICULATION_LINK,
eARTICULATION_JOINT,
<API key>,
ePRUNING_STRUCTURE,
eBVH_STRUCTURE,
ePHYSX_CORE_COUNT,
<API key> = 256,
<API key> = 512,
<API key> = 1024
};
};
/**
\brief a structure containing per-type information for types inheriting from PxBase
@see PxBase, PxConcreteType
*/
template<typename T> struct PxTypeInfo {};
#define PX_DEFINE_TYPEINFO(_name, _fastType) \
class _name; \
template <> struct PxTypeInfo<_name> { static const char* name() { return #_name; } enum { eFastTypeId = _fastType }; };
/* the semantics of the fastType are as follows: an object A can be cast to a type B if B's fastType is defined, and A has the same fastType.
* This implies that B has no concrete subclasses or superclasses.
*/
PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL)
PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH)
PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::<API key>)
PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::<API key>)
PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD)
PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED)
PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC)
PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC)
PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK)
PX_DEFINE_TYPEINFO(PxArticulationJoint, PxConcreteType::eARTICULATION_JOINT)
PX_DEFINE_TYPEINFO(<API key>, PxConcreteType::<API key>)
PX_DEFINE_TYPEINFO(PxArticulation, PxConcreteType::eARTICULATION)
PX_DEFINE_TYPEINFO(<API key>, PxConcreteType::<API key>)
PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE)
PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT)
PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE)
PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE)
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif |
var scanner = require('./scanner');
module.exports = {
run: function(pattern) {
// load jasmine and a terminal reporter into global
load("jasmine-1.3.1/jasmine.js");
load('./terminalReporter.js');
color = !process.env.JASMINE_NOCOLOR;
// load the specs
var jasmineEnv = jasmine.getEnv(),
specs = scanner.findSpecs(pattern),
reporter = new jasmine.TerminalReporter({verbosity:3,color:color});
jasmineEnv.addReporter(reporter);
for(var i = 0; i < specs.length; i++) {
require(specs[i]);
}
process.nextTick(jasmineEnv.execute.bind(jasmineEnv));
}
}; |
package com.artemis.system.iterating;
import com.artemis.*;
import org.junit.Assert;
import org.junit.Test;
import java.lang.reflect.Method;
import static java.lang.reflect.Modifier.PRIVATE;
import static java.lang.reflect.Modifier.PROTECTED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@SuppressWarnings("static-method")
public class <API key> {
@Test
public void <API key>() {
Assert.assertEquals(BaseEntitySystem.class, IntOptimizedSystem.class.getSuperclass());
Method m = processMethod(IntOptimizedSystem.class);
assertEquals(m.toString(), PRIVATE, m.getModifiers() & PRIVATE);
}
@Test
public void <API key>() {
assertEquals(BaseEntitySystem.class, <API key>.class.getSuperclass());
Method m = processMethod(<API key>.class);
assertEquals(PROTECTED, m.getModifiers() & PROTECTED);
}
@Test
public void <API key>() {
Assert.assertEquals(BaseEntitySystem.class, <API key>.class.getSuperclass());
Method m = processMethod(<API key>.class);
assertEquals(PRIVATE, m.getModifiers() & PRIVATE);
World world = new World(new WorldConfiguration()
.setSystem(new <API key>()));
world.process();
}
private static Method processMethod(Class<?> klazz) {
try {
return klazz.getDeclaredMethod("process", int.class);
} catch (SecurityException e) {
fail(e.getMessage());
} catch (<API key> e) {
fail(e.getMessage());
}
return null;
}
} |
package com.alibaba.json.bvt.parser;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.util.TypeUtils;
public class TypeUtilsTest2 extends TestCase {
public void test_0() throws Exception {
Assert.assertNull(TypeUtils.cast("", Entity.class, null));
Assert.assertNull(TypeUtils.cast("", Type.class, null));
Assert.assertNull(TypeUtils.cast("", Byte.class, null));
Assert.assertNull(TypeUtils.cast("", Short.class, null));
Assert.assertNull(TypeUtils.cast("", Integer.class, null));
Assert.assertNull(TypeUtils.cast("", Long.class, null));
Assert.assertNull(TypeUtils.cast("", Float.class, null));
Assert.assertNull(TypeUtils.cast("", Double.class, null));
Assert.assertNull(TypeUtils.cast("", Character.class, null));
Assert.assertNull(TypeUtils.cast("", java.util.Date.class, null));
Assert.assertNull(TypeUtils.cast("", java.sql.Date.class, null));
Assert.assertNull(TypeUtils.cast("", java.sql.Timestamp.class, null));
Assert.assertNull(TypeUtils.castToChar(""));
Assert.assertNull(TypeUtils.castToChar(null));
Assert.assertEquals('A', TypeUtils.castToChar('A').charValue());
Assert.assertEquals('A', TypeUtils.castToChar("A").charValue());
Assert.assertNull(TypeUtils.castToBigDecimal(""));
Assert.assertNull(TypeUtils.castToBigInteger(""));
Assert.assertNull(TypeUtils.castToBoolean(""));
Assert.assertNull(TypeUtils.castToEnum("", Type.class, null));
Assert.assertEquals(null, TypeUtils.cast("", new TypeReference<Pair<Object, Object>>() {
}.getType(), null));
}
public void test_1() throws Exception {
Assert.assertEquals(null, TypeUtils.cast("", new TypeReference<List<Object>>() {
}.getType(), null));
}
public void test_error_2() throws Exception {
Exception error = null;
try {
Assert.assertEquals(null, TypeUtils.cast("a", new TypeReference<List<Object>>() {
}.getType(), null));
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
public void test_error_3() throws Exception {
Exception error = null;
try {
Assert.assertEquals(null, TypeUtils.cast("a", new TypeReference<Pair<Object, Object>>() {
}.getType(), null));
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
public void test_error_4() throws Exception {
Exception error = null;
try {
Assert.assertEquals(null, TypeUtils.cast("a", ((ParameterizedType) new TypeReference<List<?>>() {
}.getType()).<API key>()[0], null));
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
public void test_error_0() throws Exception {
Exception error = null;
try {
TypeUtils.castToChar("abc");
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
public void test_error_1() throws Exception {
Exception error = null;
try {
TypeUtils.castToChar(true);
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
public static class Entity {
}
public static class Pair<K, V> {
}
public static enum Type {
A, B, C
}
} |
package edu.fudan.weixin.model;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import edu.fudan.eservice.common.utils.CommonUtil;
import edu.fudan.eservice.common.utils.Config;
import edu.fudan.eservice.common.utils.EncodeHelper;
import edu.fudan.eservice.common.utils.MongoUtil;
/**
*
* @author wking
*
*/
public class SWEcardModel {
private static final DateFormat DF=new SimpleDateFormat("yyyyMMddHHmmss");
private static final DateFormat QDF=new SimpleDateFormat("yyyyMMdd");
private static final String CTYPE="application/<API key>";
private static final String HASH="SHA1";
private static final Logger log=LoggerFactory.getLogger(SWEcardModel.class);
/**
*
* @param uid
* @param amount
* @return
*/
@SuppressWarnings("unchecked")
public static Map<String,Object> order(String openid,String uid,int amount)
{
Map<String,Object> ret=new HashMap<String,Object>();
String nstr=DF.format(new Date());
Config conf=Config.getInstance();
String key=conf.get("ykt.key");
StringBuffer sb=new StringBuffer("stuempno=").append(uid)
.append("&amount=").append(amount).append("×tamp=").append(nstr).append("&sign=")
.append(EncodeHelper.hmac(HASH, uid+amount+nstr, key));
try {
StringBuffer retstr=CommonUtil.postWebRequest(conf.get("ykt.orderurl"), sb.toString().getBytes("utf-8"),CTYPE );
Object retobj=JSON.parse(retstr.toString());
if(retobj instanceof Map)
{
ret=(Map<String,Object>) retobj;
String retmsg= String.valueOf(ret.get("retcode"))+ret.get("retmsg")+ret.get("payid")+(CommonUtil.isEmpty(ret.get("url"))?"":URLDecoder.decode(ret.get("url").toString(), "utf-8"));
if(!EncodeHelper.hmac(HASH, retmsg,key).equals(ret.get("sign")))
{
ret.put("retcode", -997);
ret.put("retmsg", "CHECKSUM ERROR:");
}
//PCURLURL
String url=String.valueOf(ret.get("url"));
url=URLDecoder.decode(url, "utf-8");
int tk=url.indexOf("pwd=");
String pwd=null;
if(tk>0)
pwd=url.substring(tk+4);
else
pwd="";
tk=pwd.indexOf("&");
if(tk>0)
pwd=pwd.substring(0, tk);
//pwdpayid
DBObject dbo=new BasicDBObject();
dbo.put("pwd", pwd);
dbo.put("payid", ret.get("payid"));
dbo.put("uisid", uid);
MongoUtil.getInstance().getCollection("ecardpay").save(dbo);
ret.put("url",WiscomPayModel.formupDirecturl(openid, uid, pwd));
}else
{
ret.put("retcode", -998);
ret.put("retmsg", "PARSE ERROR:"+retstr);
}
} catch (Exception e) {
log.error("POST REQ", e );
ret.put("retcode", -999);
ret.put("retmsg", e.getMessage());
}
return ret;
}
/**
*
* @param uid
* @param payid
* @param bdate
* @param edate
* @param pageno
* @param pagesize
* @return
*/
@SuppressWarnings("unchecked")
public static Map<String,Object> query(String uid,String payid,Date bdate,Date edate,int pageno, int pagesize)
{
Map<String,Object> ret=new HashMap<String,Object>();
Config conf=Config.getInstance();
String key=conf.get("ykt.key");
String nstr=DF.format(new Date());
StringBuffer sb=new StringBuffer("stuempno=").append(CommonUtil.isEmpty(uid)?"":uid)
.append("&payid=").append(CommonUtil.isEmpty(payid)?"":payid)
.append("&startdate=").append(CommonUtil.isEmpty(bdate)?"":QDF.format(bdate))
.append("&enddate=").append(CommonUtil.isEmpty(edate)?"":QDF.format(edate))
.append("&pageno=").append(pageno)
.append("&pagesize=").append(pagesize)
.append("×tamp=").append(nstr)
.append("&sign=").append(EncodeHelper.hmac(HASH,(CommonUtil.isEmpty(uid)?"":uid)+ (CommonUtil.isEmpty(payid)?"":payid)+(CommonUtil.isEmpty(bdate)?"":QDF.format(bdate))
+(CommonUtil.isEmpty(edate)?"":QDF.format(edate))+pageno+""+pagesize+nstr
, key));
try {
StringBuffer retstr=CommonUtil.postWebRequest(conf.get("ykt.queryurl"), sb.toString().getBytes("utf-8"),CTYPE );
Object retobj=JSON.parse(retstr.toString());
if(retobj instanceof Map)
{
ret=(Map<String,Object>)retobj;
}else
{
ret.put("retcode", -998);
ret.put("retmsg", "PARSE ERROR:"+retstr);
}
} catch (Exception e) {
log.error("POST REQ", e );
ret.put("retcode", -999);
ret.put("retmsg", e.getMessage());
}
return ret;
}
/**
*
* @param uid
* @return
*/
public static List<Map<String,Object>> unpaid(String uid)
{
Map<String,Object> oret=query(uid,null,new Date(System.currentTimeMillis()-3600000L*24*15),null,1,10);
if(oret.get("retcode").equals(0))
{
Object ords=oret.get("data");
if(ords instanceof List)
{
Iterator<Map<String,Object>> i=((List<Map<String,Object>>)ords).iterator();
while(i.hasNext())
{
Map<String,Object> order=i.next();
if(order==null)
{
i.remove();
}else
{
if(!"".equals(order.get("status")))
i.remove();
}
}
return (List<Map<String,Object>>)ords;
}
}
return new ArrayList<Map<String,Object>>(0);
}
public static DBObject getPwd(String payid)
{
return MongoUtil.getInstance().getCollection("ecardpay").findOne(new BasicDBObject("payid",payid));
}
} |
package turbo.crawler.db
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.Table
/**
* SEQUENCEMYCAT-SERVERSEQUENCE
* @author mclaren
*/
trait IdGenerator {
def gernateId(dbname: String, sequenceId: Long) = this.synchronized {
val ebean = db(dbname).ebean
val sequence = ebean.find(classOf[SEQUENCE]).where().eq("id", sequenceId).findUnique()
if (sequence == null) throw new <API key>("No such sequence [" + sequenceId + "] found")
val v = sequence.getNextVal
sequence.setNextVal(v + sequence.getStep)
sequence.setValue(v)
ebean.update(sequence)
v
}
}
@Entity
@Table(name = "GLOBAL_SEQUENCE")
class SEQUENCE {
@Id
private var id = 0L
def setId(id: Long) = this.id = id
def getId = this.id
@Column(name = "CURRENT_VAL")
private var value = 0L
def setValue(v: Long) = this.value = v
def getValue = this.value
@Column(name = "STEP")
private var step = 1L
def setStep(s: Long) = this.step = s
def getStep = this.step
@Column(name = "NEXT_VAL")
private var nextVal = 0L
def setNextVal(v: Long) = this.nextVal = v
def getNextVal = this.nextVal
} |
import React from 'react';
import classSet from 'classnames';
const PageHeader = React.createClass({
render() {
return (
<div {...this.props} className={classSet(this.props.className, 'page-header')}>
<h1>{this.props.children}</h1>
</div>
);
}
});
export default PageHeader; |
title: <%= hoc_s(:title_prizes_terms) %>
layout: wide
nav: prizes_nav
## Amazon.com, iTunes and Windows Store credit:
The Amazon.com, iTunes and Windows Store credit are limited to K-12 faculty, educators for afterschool clubs, and education organizations. The $10 credit must be added to an existing account, and the credit expires after 1 year. Limit one redemption per organizer.
Every organizer must register for the Hour of Code in order to receive the Amazon.com, iTunes or Windows Store credit. Wenn Deine gesamte Schule an einer Hour of Code teilnimmt, muss sich jeder veranstaltende Lehrer separat registrieren.
Code.org will contact organizers after the Hour of Code (Dec. 7-13) to provide instructions for redeeming Amazon.com, iTunes and Windows Store credit.
<% if @country == 'us' %>
## Class-set of laptops (or $10,000 for other technology):
Prize limited to public K-12 U.S. schools only. To qualify, your entire school must register for the Hour of Code by November 16, 2015. One school in every U.S. state will receive a class-set of computers. Code.org will select and notify winners via email by December 1, 2015.
To clarify, this is not a sweepstakes or a contest involving pure chance.
1) There is no financial stake or risk involved in applying - any school or classroom may participate, without any payment to Code.org or any other organization
2) Winners will only be selected among schools where the entire classroom (or school) participates in an Hour of Code, which involves a test of the students' and teachers' collective skill.
<% end %>
<% if @country == 'us' || @country == 'ca' %>
## Video-Chat mit einem Gastredner:
Prize limited to K-12 classrooms in the U.S. and Canada only. Code.org will select winning classrooms, provide a time slot for the web chat, and work with the appropriate teacher to set up the technology details. Your whole school does not need to apply to qualify for this prize. Both public and private schools are eligible to win.
<% end %> |
"use strict";
const { <API key> } = require("../helpers/<API key>");
const { fireAnEvent } = require("../helpers/events");
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
class AbortSignalImpl extends EventTargetImpl {
constructor(globalObject, args, privateData) {
super(globalObject, args, privateData);
// make event firing possible
this._ownerDocument = globalObject.document;
this.aborted = false;
this.abortAlgorithms = new Set();
}
_signalAbort() {
if (this.aborted) {
return;
}
this.aborted = true;
for (const algorithm of this.abortAlgorithms) {
algorithm();
}
this.abortAlgorithms.clear();
fireAnEvent("abort", this);
}
_addAlgorithm(algorithm) {
if (this.aborted) {
return;
}
this.abortAlgorithms.add(algorithm);
}
_removeAlgorithm(algorithm) {
this.abortAlgorithms.delete(algorithm);
}
}
<API key>(AbortSignalImpl.prototype, ["abort"]);
module.exports = {
implementation: AbortSignalImpl
}; |
#include <aws/medialive/model/DeviceUpdateStatus.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/<API key>.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MediaLive
{
namespace Model
{
namespace <API key>
{
static const int UP_TO_DATE_HASH = HashingUtils::HashString("UP_TO_DATE");
static const int NOT_UP_TO_DATE_HASH = HashingUtils::HashString("NOT_UP_TO_DATE");
DeviceUpdateStatus <API key>(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == UP_TO_DATE_HASH)
{
return DeviceUpdateStatus::UP_TO_DATE;
}
else if (hashCode == NOT_UP_TO_DATE_HASH)
{
return DeviceUpdateStatus::NOT_UP_TO_DATE;
}
<API key>* overflowContainer = Aws::<API key>();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<DeviceUpdateStatus>(hashCode);
}
return DeviceUpdateStatus::NOT_SET;
}
Aws::String <API key>(DeviceUpdateStatus enumValue)
{
switch(enumValue)
{
case DeviceUpdateStatus::UP_TO_DATE:
return "UP_TO_DATE";
case DeviceUpdateStatus::NOT_UP_TO_DATE:
return "NOT_UP_TO_DATE";
default:
<API key>* overflowContainer = Aws::<API key>();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace <API key>
} // namespace Model
} // namespace MediaLive
} // namespace Aws |
// Code generated by protoc-gen-go.
// source: hapi/release/release.proto
// DO NOT EDIT!
package release
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import hapi_chart "k8s.io/helm/pkg/proto/hapi/chart"
import hapi_chart3 "k8s.io/helm/pkg/proto/hapi/chart"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// Release describes a deployment of a chart, together with the chart
// and the variables used to deploy that chart.
type Release struct {
// Name is the name of the release
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
// Info provides information about a release
Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"`
// Chart is the chart that was released.
Chart *hapi_chart3.Chart `protobuf:"bytes,3,opt,name=chart" json:"chart,omitempty"`
// Config is the set of extra Values added to the chart.
// These values override the default values inside of the chart.
Config *hapi_chart.Config `protobuf:"bytes,4,opt,name=config" json:"config,omitempty"`
// Manifest is the string representation of the rendered template.
Manifest string `protobuf:"bytes,5,opt,name=manifest" json:"manifest,omitempty"`
// Hooks are all of the hooks declared for this release.
Hooks []*Hook `protobuf:"bytes,6,rep,name=hooks" json:"hooks,omitempty"`
// Version is an int32 which represents the version of the release.
Version int32 `protobuf:"varint,7,opt,name=version" json:"version,omitempty"`
// Namespace is the kubernetes namespace of the release.
Namespace string `protobuf:"bytes,8,opt,name=namespace" json:"namespace,omitempty"`
}
func (m *Release) Reset() { *m = Release{} }
func (m *Release) String() string { return proto.CompactTextString(m) }
func (*Release) ProtoMessage() {}
func (*Release) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
func (m *Release) GetInfo() *Info {
if m != nil {
return m.Info
}
return nil
}
func (m *Release) GetChart() *hapi_chart3.Chart {
if m != nil {
return m.Chart
}
return nil
}
func (m *Release) GetConfig() *hapi_chart.Config {
if m != nil {
return m.Config
}
return nil
}
func (m *Release) GetHooks() []*Hook {
if m != nil {
return m.Hooks
}
return nil
}
func init() {
proto.RegisterType((*Release)(nil), "hapi.release.Release")
}
func init() { proto.RegisterFile("hapi/release/release.proto", fileDescriptor2) }
var fileDescriptor2 = []byte{
// 256 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xc3, 0x40,
0x0c, 0xc6, 0x95, 0x36, 0x7f, 0x1a, 0xc3, 0x82, 0x07, 0xb0, 0x22, 0x86, 0x88, 0x01, 0x22, 0x86,
0x54, 0x82, 0x37, 0x80, 0x05, 0xd6, 0x1b, 0xd9, 0x8e, 0xe8, 0x42, 0x4e, 0xa5, 0xe7, 0x28, 0x17,
0xf1, 0x2c, 0x3c, 0x2e, 0xba, 0x3f, 0x85, 0x94, 0x2e, 0x4e, 0xec, 0xdf, 0xa7, 0xcf, 0xdf, 0x19,
0xaa, 0x41, 0x8e, 0x7a, 0x3b, 0xa9, 0x4f, 0x25, 0xad, 0x3a, 0x7c, 0xdb, 0x71, 0xe2, 0x99, 0xf1,
0xdc, 0xb1, 0x36, 0xce, 0xaa, 0xab, 0x23, 0xe5, 0xc0, 0xbc, 0x0b, 0xb2, 0x7f, 0x40, 0x9b, 0x9e,
0x8f, 0x40, 0x37, 0xc8, 0x69, 0xde, 0x76, 0x6c, 0x7a, 0xfd, 0x11, 0xc1, 0xe5, 0x12, 0xb8, 0x1a,
0xe6, 0x37, 0xdf, 0x2b, 0x28, 0x44, 0xf0, 0x41, 0x84, 0xd4, 0xc8, 0xbd, 0xa2, 0xa4, 0x4e, 0x9a,
0x52, 0xf8, 0x7f, 0xbc, 0x85, 0xd4, 0xd9, 0xd3, 0xaa, 0x4e, 0x9a, 0xb3, 0x07, 0x6c, 0x97, 0xf9,
0xda, 0x57, 0xd3, 0xb3, 0xf0, 0x1c, 0xef, 0x20, 0xf3, 0xb6, 0xb4, 0xf6, 0xc2, 0x8b, 0x20, 0x0c,
0x9b, 0x9e, 0x5d, 0x15, 0x81, 0xe3, 0x3d, 0xe4, 0x21, 0x18, 0xa5, 0x4b, 0xcb, 0xa8, 0xf4, 0x44,
0x44, 0x05, 0x56, 0xb0, 0xd9, 0x4b, 0xa3, 0x7b, 0x65, 0x67, 0xca, 0x7c, 0xa8, 0xdf, 0x1e, 0x1b,
0xc8, 0xdc, 0x41, 0x2c, 0xe5, 0xf5, 0xfa, 0x34, 0xd9, 0x0b, 0xf3, 0x4e, 0x04, 0x01, 0x12, 0x14,
0x5f, 0x6a, 0xb2, 0x9a, 0x0d, 0x15, 0x75, 0xd2, 0x64, 0xe2, 0xd0, 0xe2, 0x35, 0x94, 0xee, 0x91,
0x76, 0x94, 0x9d, 0xa2, 0x8d, 0x5f, 0xf0, 0x37, 0x78, 0x2a, 0xdf, 0x8a, 0x68, 0xf7, 0x9e, 0xfb,
0x63, 0x3d, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x8f, 0xec, 0x97, 0xbb, 0x01, 0x00, 0x00,
} |
package s3
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/pkg/errors"
"gomodules.xyz/stow"
)
// Kind represents the name of the location/storage type.
const Kind = "s3"
var (
authTypeAccessKey = "accesskey"
authTypeIAM = "iam"
)
const (
// ConfigAuthType is an optional argument that defines whether to use an IAM role or access key based auth
ConfigAuthType = "auth_type"
// ConfigAccessKeyID is one key of a pair of AWS credentials.
ConfigAccessKeyID = "access_key_id"
// ConfigSecretKey is one key of a pair of AWS credentials.
ConfigSecretKey = "secret_key"
// ConfigToken is an optional argument which is required when providing
// credentials with temporary access.
// ConfigToken = "token"
// ConfigRegion represents the region/availability zone of the session.
ConfigRegion = "region"
// ConfigEndpoint is optional config value for changing s3 endpoint
// used for e.g. minio.io
ConfigEndpoint = "endpoint"
// ConfigCACertFile is optional config value for providing path to cacert file for custom endpoint like Minio
// to establish TLS secure connection
ConfigCACertFile = "cacert_file"
// ConfigCACertData is optional config value for providing path to cacert data for custom endpoint like Minio
// to establish TLS secure connection
ConfigCACertData = "cacert_data"
// ConfigDisableSSL is optional config value for disabling SSL support on custom endpoints
// Its default value is "false", to disable SSL set it to "true".
ConfigDisableSSL = "disable_ssl"
// ConfigV2Signing is an optional config value for signing requests with the v2 signature.
// Its default value is "false", to enable set to "true".
// This feature is useful for s3-compatible blob stores -- ie minio.
ConfigV2Signing = "v2_signing"
)
func init() {
validatefn := func(config stow.Config) error {
authType, ok := config.Config(ConfigAuthType)
if !ok || authType == "" {
authType = authTypeAccessKey
}
if !(authType == authTypeAccessKey || authType == authTypeIAM) {
return errors.New("invalid auth_type")
}
if authType == authTypeAccessKey {
_, ok := config.Config(ConfigAccessKeyID)
if !ok {
return errors.New("missing Access Key ID")
}
_, ok = config.Config(ConfigSecretKey)
if !ok {
return errors.New("missing Secret Key")
}
}
return nil
}
makefn := func(config stow.Config) (stow.Location, error) {
authType, ok := config.Config(ConfigAuthType)
if !ok || authType == "" {
authType = authTypeAccessKey
}
if !(authType == authTypeAccessKey || authType == authTypeIAM) {
return nil, errors.New("invalid auth_type")
}
if authType == authTypeAccessKey {
_, ok := config.Config(ConfigAccessKeyID)
if !ok {
return nil, errors.New("missing Access Key ID")
}
_, ok = config.Config(ConfigSecretKey)
if !ok {
return nil, errors.New("missing Secret Key")
}
}
// Create a new client (s3 session)
client, endpoint, err := newS3Client(config, "")
if err != nil {
return nil, err
}
// Create a location with given config and client (s3 session).
loc := &location{
config: config,
client: client,
customEndpoint: endpoint,
}
return loc, nil
}
kindfn := func(u *url.URL) bool {
return u.Scheme == Kind
}
stow.Register(Kind, makefn, kindfn, validatefn)
}
// Attempts to create a session based on the information given.
func newS3Client(config stow.Config, region string) (client *s3.S3, endpoint string, err error) {
authType, _ := config.Config(ConfigAuthType)
accessKeyID, _ := config.Config(ConfigAccessKeyID)
secretKey, _ := config.Config(ConfigSecretKey)
// token, _ := config.Config(ConfigToken)
if authType == "" {
authType = authTypeAccessKey
}
awsConfig := aws.NewConfig().
WithHTTPClient(new(http.Client)).
WithMaxRetries(aws.<API key>).
WithLogger(aws.NewDefaultLogger()).
WithLogLevel(aws.LogOff).
WithSleepDelay(time.Sleep)
if region == "" {
region, _ = config.Config(ConfigRegion)
}
if region != "" {
awsConfig.WithRegion(region)
} else {
awsConfig.WithRegion("us-east-1")
}
if authType == authTypeAccessKey {
awsConfig.WithCredentials(credentials.<API key>(accessKeyID, secretKey, ""))
}
endpoint, ok := config.Config(ConfigEndpoint)
if ok {
awsConfig.WithEndpoint(endpoint).
<API key>(true)
}
disableSSL, ok := config.Config(ConfigDisableSSL)
if ok && disableSSL == "true" {
awsConfig.WithDisableSSL(true)
}
cacertData, ok := config.Config(ConfigCACertData)
if ok {
awsConfig.HTTPClient.Transport, err = newSecureTransport([]byte(cacertData))
if err != nil {
return nil, "", err
}
} else {
cacertFile, ok := config.Config(ConfigCACertFile)
if ok {
cacert, err := ioutil.ReadFile(cacertFile)
if err != nil {
return nil, "", errors.Errorf("unable to read root certificate: %v", err)
}
awsConfig.HTTPClient.Transport, err = newSecureTransport(cacert)
if err != nil {
return nil, "", err
}
}
}
sess, err := session.NewSession(awsConfig)
if err != nil {
return nil, "", fmt.Errorf("failed to create S3 session. Reason: %s", err)
}
if sess == nil {
return nil, "", errors.New("creating the S3 session")
}
s3Client := s3.New(sess)
usev2, ok := config.Config(ConfigV2Signing)
if ok && usev2 == "true" {
setv2Handlers(s3Client)
}
return s3Client, endpoint, nil
}
func newSecureTransport(cacert []byte) (http.RoundTripper, error) {
if len(cacert) == 0 {
return nil, fmt.Errorf("missing root certificate")
}
tr := &http.Transport{
Proxy: http.<API key>,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
<API key>: 1 * time.Second,
TLSClientConfig: &tls.Config{},
}
pool := x509.NewCertPool()
if ok := pool.AppendCertsFromPEM(cacert); !ok {
return nil, errors.Errorf("cannot parse root certificate from %q", string(cacert))
}
tr.TLSClientConfig.RootCAs = pool
return tr, nil
} |
package org.metasyntactic.automata.compiler.python.scanner.keywords;
public class DelKeywordToken extends KeywordToken {
public static final DelKeywordToken instance = new DelKeywordToken();
private DelKeywordToken() {
super("del");
}
} |
using NuKeeper.Abstractions.Formats;
using NuKeeper.Abstractions.<API key>;
using System;
using System.Collections.Generic;
using System.Linq;
namespace NuKeeper.Engine
{
public static class BranchNamer
{
public static readonly string[] TemplateTokens = { "Default", "Name", "Version", "Count", "Hash" };
private const string <API key> = "nukeeper-update-{Count}-packages-{Hash}";
private const string <API key> = "nukeeper-update-{Name}-to-{Version}";
public static bool <API key>(string token)
{
return TemplateTokens.Any(t => t.Equals(token, StringComparison.<API key>));
}
<summary>
Replaces the tokens in the branchname with the predefined values.
</summary>
<param name="updates"></param>
<param name="branchTemplate"></param>
<returns></returns>
public static string MakeName(IReadOnlyCollection<PackageUpdateSet> updates, string branchTemplate = null)
{
if (updates == null)
{
throw new <API key>(nameof(updates));
}
var tokenValues = new Dictionary<string, string>();
foreach (var token in TemplateTokens)
{
var value = "";
switch (token)
{
case "Default":
value = updates.Count == 1 ? <API key> : <API key>;
break;
case "Name":
value = updates.Count > 1 ? "Multiple-Packages" : updates.First().SelectedId;
break;
case "Version":
//Multiple nugets, same version?
var versions = updates.Select(u => u.SelectedVersion).Distinct();
value = versions.Count() > 1 ? "Multiple-Versions" : $"{versions.First()}";
break;
case "Count":
value = $"{updates.Count}";
break;
case "Hash":
value = Hasher.Hash(<API key>(updates));
break;
}
tokenValues.Add(token, value);
}
return MakeName(tokenValues, branchTemplate);
}
<summary>
Replaces the tokens in the branchname with the given values
</summary>
<param name="tokenValuePairs"></param>
<param name="branchTemplate"></param>
<returns></returns>
internal static string MakeName(Dictionary<string, string> tokenValuePairs, string branchTemplate)
{
var branchName = branchTemplate ?? "{default}";
foreach (KeyValuePair<string, string> kvp in tokenValuePairs)
{
branchName = branchName.Replace(string.Concat("{", kvp.Key, "}"), kvp.Value, StringComparison.<API key>);
}
return branchName.Replace(" ", "-", StringComparison.<API key>);
}
private static string <API key>(IReadOnlyCollection<PackageUpdateSet> updates)
{
return string.Join(",", updates.Select(<API key>));
}
private static string <API key>(PackageUpdateSet updateSet)
{
return $"{updateSet.SelectedId}-v{updateSet.SelectedVersion}";
}
}
} |
from lymph.core.monitoring.metrics import Aggregate
from lymph.core.monitoring.global_metrics import RUsageMetrics, GeventMetrics, <API key>, ProcessMetrics
class Aggregator(Aggregate):
@classmethod
def from_config(cls, config):
tags = config.get_raw('tags', {})
# FIXME: move default metrics out
return cls([
RUsageMetrics(),
<API key>(),
GeventMetrics(),
ProcessMetrics(),
], tags=tags) |
# Remove desktop shortcut
$desktop = $([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory))
$link = Join-Path $desktop "Kitematic.lnk"
If (Test-Path $link) {
Remove-Item "$link"
}
# Remove docker tray sym-link
$kitematicDir = Join-Path $env:ProgramFiles "Docker\Kitematic"
$kitematicLink = Join-Path $kitematicDir "kitematic.exe"
if (Test-Path $kitematicLink) {
Remove-Item $kitematicLink
} |
package google
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"testing"
"github.com/hashicorp/<API key>/v2/diag"
"github.com/hashicorp/<API key>/v2/helper/resource"
"github.com/hashicorp/<API key>/v2/helper/schema"
"github.com/hashicorp/<API key>/v2/terraform"
)
var tfObjectAcl, errObjectAcl = ioutil.TempFile("", "tf-gce-test")
func testAclObjectName(t *testing.T) string {
return fmt.Sprintf("%s-%d", "tf-test-acl-object", randInt(t))
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
),
},
},
})
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
),
},
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic2),
<API key>(t, bucketName,
objectName, <API key>),
),
},
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
<API key>(t, bucketName,
objectName, <API key>),
),
},
},
})
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic2),
<API key>(t, bucketName,
objectName, <API key>),
),
},
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic2),
<API key>(t, bucketName,
objectName, <API key>),
),
},
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
<API key>(t, bucketName,
objectName, <API key>),
),
},
},
})
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
},
},
})
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
},
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
),
},
},
})
}
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
Check: resource.<API key>(
<API key>(t, bucketName,
objectName, roleEntityBasic1),
<API key>(t, bucketName,
objectName, roleEntityBasic2),
),
},
{
Config: <API key>(bucketName, objectName),
},
},
})
}
// Test that we allow the API to reorder our role entities without perma-diffing.
func <API key>(t *testing.T) {
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: <API key>(t),
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
},
},
})
}
// a round tripper that returns fake response for get object API removing `owner` attribute
// it only modifies the response once, since otherwise resource will fail to delete.
type testRoundTripper struct {
http.RoundTripper
bucketName, objectName string
done bool
}
func (t *testRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
response, err := t.RoundTripper.RoundTrip(r)
if err != nil {
return response, err
}
expectedPath := fmt.Sprintf("/storage/v1/b/%s/o/%s", t.bucketName, t.objectName)
if t.done || r.URL.Path != expectedPath || r.Host != "storage.googleapis.com" {
return response, err
}
t.done = true
responseBytes, err := ioutil.ReadAll(response.Body)
if err != nil {
return response, err
}
var responseMap map[string]json.RawMessage
err = json.Unmarshal(responseBytes, &responseMap)
if err != nil {
return response, err
}
delete(responseMap, "owner")
responseBytes, err = json.Marshal(responseMap)
if err != nil {
return response, err
}
response.Body = io.NopCloser(bytes.NewBuffer(responseBytes))
return response, nil
}
// Test that we don't fail if there's no owner for object
func <API key>(t *testing.T) {
skipIfVcr(t)
t.Parallel()
bucketName := testBucketName(t)
objectName := testAclObjectName(t)
objectData := []byte("data data data")
if err := ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644); err != nil {
t.Errorf("error writing file: %v", err)
}
provider := Provider()
oldConfigureFunc := provider.<API key>
provider.<API key> = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {
c, diagnostics := oldConfigureFunc(ctx, d)
config := c.(*Config)
roundTripper := &testRoundTripper{RoundTripper: config.client.Transport, bucketName: bucketName, objectName: objectName}
config.client.Transport = roundTripper
return c, diagnostics
}
providers := map[string]*schema.Provider{
"google": provider,
}
vcrTest(t, resource.TestCase{
PreCheck: func() {
if errObjectAcl != nil {
panic(errObjectAcl)
}
testAccPreCheck(t)
},
Providers: providers,
Steps: []resource.TestStep{
{
Config: <API key>(bucketName, objectName),
ExpectNonEmptyPlan: true,
},
},
})
}
func <API key>(t *testing.T, bucket, object, roleEntityS string) resource.TestCheckFunc {
return func(s *terraform.State) error {
roleEntity, _ := getRoleEntityPair(roleEntityS)
config := <API key>(t)
res, err := config.NewStorageClient(config.userAgent).<API key>.Get(bucket,
object, roleEntity.Entity).Do()
if err != nil {
return fmt.Errorf("Error retrieving contents of acl for bucket %s: %s", bucket, err)
}
if res.Role != roleEntity.Role {
return fmt.Errorf("Error, Role mismatch %s != %s", res.Role, roleEntity.Role)
}
return nil
}
}
func <API key>(t *testing.T, bucket, object, roleEntityS string) resource.TestCheckFunc {
return func(s *terraform.State) error {
roleEntity, _ := getRoleEntityPair(roleEntityS)
config := <API key>(t)
_, err := config.NewStorageClient(config.userAgent).<API key>.Get(bucket,
object, roleEntity.Entity).Do()
if err != nil {
return nil
}
return fmt.Errorf("Error, Entity still exists %s", roleEntity.Entity)
}
}
func <API key>(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
config := <API key>(t)
for _, rs := range s.RootModule().Resources {
if rs.Type != "<API key>" {
continue
}
bucket := rs.Primary.Attributes["bucket"]
object := rs.Primary.Attributes["object"]
_, err := config.NewStorageClient(config.userAgent).<API key>.List(bucket, object).Do()
if err == nil {
return fmt.Errorf("Acl for bucket %s still exists", bucket)
}
}
return nil
}
}
func <API key>(bucketName string, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
role_entity = []
}
`, bucketName, objectName, tfObjectAcl.Name())
}
func <API key>(bucketName string, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
role_entity = ["%s", "%s"]
}
`, bucketName, objectName, tfObjectAcl.Name(),
roleEntityBasic1, roleEntityBasic2)
}
func <API key>(bucketName string, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
role_entity = ["%s", "%s"]
}
`, bucketName, objectName, tfObjectAcl.Name(),
roleEntityBasic2, <API key>)
}
func <API key>(bucketName string, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
role_entity = ["%s", "%s"]
}
`, bucketName, objectName, tfObjectAcl.Name(),
roleEntityBasic2, <API key>)
}
func <API key>(bucketName string, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
predefined_acl = "projectPrivate"
}
`, bucketName, objectName, tfObjectAcl.Name())
}
func <API key>(bucketName, objectName string) string {
return fmt.Sprintf(`
resource "<API key>" "bucket" {
name = "%s"
location = "US"
}
resource "<API key>" "object" {
name = "%s"
bucket = <API key>.bucket.name
source = "%s"
}
resource "<API key>" "acl" {
object = <API key>.object.name
bucket = <API key>.bucket.name
role_entity = ["%s", "%s", "%s", "%s", "%s"]
}
`, bucketName, objectName, tfObjectAcl.Name(), roleEntityBasic1, roleEntityViewers, roleEntityOwners, roleEntityBasic2, roleEntityEditors)
} |
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for javascripts/components/ModalTrigger.jsx</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">javascripts/components</a> ModalTrigger.jsx
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">44.44% </span>
<span class="quiet">Statements</span>
<span class='fraction'>8/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">44.44% </span>
<span class="quiet">Lines</span>
<span class='fraction'>8/18</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { PropTypes } from 'react';
import { Modal } from 'react-bootstrap';
import cx from 'classnames';
const propTypes = {
triggerNode: PropTypes.node.isRequired,
modalTitle: PropTypes.string.isRequired,
modalBody: PropTypes.node.isRequired,
beforeOpen: PropTypes.func,
isButton: PropTypes.bool,
};
const defaultProps = {
beforeOpen: <span class="fstat-no" title="function not covered" >() => </span>{},
isButton: false,
};
export default class ModalTrigger extends React.Component {
<span class="fstat-no" title="function not covered" > constructor(</span>props) <span class="cstat-no" title="statement not covered" >{</span>
super(props);
<span class="cstat-no" title="statement not covered" > this.state = {</span>
showModal: false,
};
<span class="cstat-no" title="statement not covered" > this.open = this.open.bind(this);</span>
<span class="cstat-no" title="statement not covered" > this.close = this.close.bind(this);</span>
}
close() {
<span class="cstat-no" title="statement not covered" > this.setState({ showModal: false });</span>
}
open(e) {
<span class="cstat-no" title="statement not covered" > e.preventDefault();</span>
<span class="cstat-no" title="statement not covered" > this.props.beforeOpen();</span>
<span class="cstat-no" title="statement not covered" > this.setState({ showModal: true });</span>
}
render() {
c</span>onst classNames = <span class="cstat-no" title="statement not covered" >cx({
'btn btn-default btn-sm': this.props.isButton,
});
<span class="cstat-no" title="statement not covered" > return (</span>
<a href="#" className={classNames} onClick={this.open}>
{this.props.triggerNode}
<Modal show={this.state.showModal} onHide={this.close}>
<Modal.Header closeButton>
<Modal.Title>{this.props.modalTitle}</Modal.Title>
</Modal.Header>
<Modal.Body>
{this.props.modalBody}
</Modal.Body>
</Modal>
</a>
);
}
}
ModalTrigger.propTypes = propTypes;
ModalTrigger.defaultProps = defaultProps;
</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Sep 26 2016 23:09:10 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html> |
package fabrica.abstrata.botoes;
import javax.swing.JComboBox;
/**
*
* @author felip
*/
public class TelaInicial extends javax.swing.JFrame {
/**
* Creates new form Cadastro
*/
public TelaInicial() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
tema = new javax.swing.JComboBox();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
<API key>(javax.swing.WindowConstants.EXIT_ON_CLOSE);
tema.setModel(new javax.swing.<API key>(new String[] { "Tema1", "Tema2" }));
tema.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
<API key>(evt);
}
});
tema.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
temaActionPerformed(evt);
}
});
jMenu2.setText("Edição");
jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenu2MouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
jMenu2MousePressed(evt);
}
});
jMenu2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
<API key>(evt);
}
});
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.<API key>()
.addContainerGap(175, Short.MAX_VALUE)
.addComponent(tema, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(168, 168, 168))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.<API key>()
.addGap(90, 90, 90)
.addComponent(tema, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(169, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void <API key>(java.awt.event.ItemEvent evt) {//GEN-FIRST:<API key>
// TODO add your handling code here:
//Change button behaviour
}//GEN-LAST:<API key>
private void <API key>(java.awt.event.ActionEvent evt) {//GEN-FIRST:<API key>
// TODO add your handling code here:
}//GEN-LAST:<API key>
private void temaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:<API key>
// TODO add your handling code here:
}//GEN-LAST:<API key>
private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:<API key>
}//GEN-LAST:<API key>
private void jMenu2MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:<API key>
EditorTexto editor = new EditorTexto((String) this.getTema().getSelectedItem());
editor.setVisible(true);
}//GEN-LAST:<API key>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.<API key>()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (<API key> ex) {
java.util.logging.Logger.getLogger(TelaInicial.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (<API key> ex) {
java.util.logging.Logger.getLogger(TelaInicial.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (<API key> ex) {
java.util.logging.Logger.getLogger(TelaInicial.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.<API key> ex) {
java.util.logging.Logger.getLogger(TelaInicial.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaInicial().setVisible(true);
}
});
}
public JComboBox getTema(){
return this.tema;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JComboBox tema;
// End of variables declaration//GEN-END:variables
} |
// IBinaryVisitor.cs
// Jb Evain (jbevain@gmail.com)
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// 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
// 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.
namespace Mono.Cecil.Binary {
public interface IBinaryVisitor {
void VisitImage (Image img);
void VisitDOSHeader (DOSHeader header);
void VisitPEFileHeader (PEFileHeader header);
void <API key> (PEOptionalHeader header);
void <API key> (PEOptionalHeader.<API key> header);
void <API key> (PEOptionalHeader.<API key> header);
void <API key> (PEOptionalHeader.<API key> header);
void <API key> (SectionCollection coll);
void VisitSection (Section section);
void <API key> (ImportAddressTable iat);
void VisitDebugHeader (DebugHeader dh);
void VisitCLIHeader (CLIHeader header);
void VisitImportTable (ImportTable it);
void <API key> (ImportLookupTable ilt);
void VisitHintNameTable (HintNameTable hnt);
void TerminateImage (Image img);
}
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<title>Portland 2013
- Proposal</title>
<meta name="author" content="Chris Roberts" >
<link rel="alternate" type="application/rss+xml" title="devopsdays RSS Feed" href="http:
<script type="text/javascript" src="https:
<script type="text/javascript">
google.load('jquery', '1.3.2');
</script>
<!---This is a combined jAmpersand, jqwindont , jPullquote -->
<script type="text/javascript" src="/js/devops.js"></script>
<!--- Blueprint CSS Framework Screen + Fancytype-Screen + jedi.css -->
<link rel="stylesheet" href="/css/devops.min.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
<!--[if IE]>
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]
</head>
<body onload="initialize()">
<div class="container ">
<div class="span-24 last" id="header">
<div class="span-16 first">
<img src="/images/devopsdays-banner.png" title="devopsdays banner" width="801" height="115" alt="devopdays banner" ><br>
</div>
<div class="span-8 last">
</div>
</div>
<div class="span-24 last">
<div class="span-15 first">
<div id="headermenu">
<table >
<tr>
<td>
<a href="/"><img alt="home" title="home" src="/images/home.png"></a>
<a href="/">Home</a>
</td>
<td>
<a href="/contact/"><img alt="contact" title="contact" src="/images/contact.png"></a>
<a href="/contact/">Contact</a>
</td>
<td>
<a href="/events/"><img alt="events" title="events" src="/images/events.png"></a>
<a href="/events/">Events</a>
</td>
<td>
<a href="/presentations/"><img alt="presentations" title="presentations" src="/images/presentations.png"></a>
<a href="/presentations/">Presentations</a>
</td>
<td>
<a href="/blog/"><img alt="blog" title="blog" src="/images/blog.png"></a>
<a href="/blog/">Blog</a>
</td>
</tr>
</table>
</div>
</div>
<div class="span-8 last">
</div>
<div class="span-24 last" id="title">
<div class="span-15 first">
<h1>Portland 2013
- Proposal </h1>
</div>
<div class="span-8 last">
</div>
<h1>Gold sponsors</h1>
</div>
<div class="span-15 ">
<div class="span-15 last ">
<div class="submenu">
<h3>
<a href="/events/2013-portland/">welcome</a>
<a href="/events/2013-portland/propose">propose</a>
<a href="/events/2013-portland/program">program</a>
<a href="/events/2013-portland/location">location</a>
<a href="/events/2013-portland/registration">register</a>
<a href="/events/2013-portland/sponsor">sponsor</a>
<a href="/events/2013-portland/contact">contact</a>
<a href="/events/2013-portland/code-of-conduct">code of conduct</a>
</h3>
</div>
Back to <a href='..'>proposals overview</a> - <a href='../../program'>program</a>
<hr>
<h3>Adding sanity to AWS CloudFormation</h3>
<p><strong>Abstract:</strong></p>
<p>SparkleFormation is a helper library that allows building and maintaining of AWS CloudFormation templates in Ruby. It provides novel features like: reusable components, simple merging strategies, and automatic support for future CloudFormation resources. It also can be used with Opscode's knife CLI tool to build CloudFormations from the command line.</p>
<p>This talk will walk through the key features and demonstrate how the library works in action.</p>
<p><strong>Speaker:</strong></p>
<p>Chris Roberts</p>
</div>
<div class="span-15 first last">
<script type="text/javascript">
// var disqus_developer = 1;
</script>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'devopsdays';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.<API key>('head')[0] || document.<API key>('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<hr>
</div>
</div>
<div class="span-8 last">
<div class="span-8 last">
<a href='http://hw-ops.com/'><img border=0 alt='Heavy Water' title='Heavy Water' width=100px height=100px src='/events/2013-portland/logos/hw.png'></a>
<a href='http://simple.com/'><img border=0 alt='Simple' title='Simple' width=100px height=100px src='/events/2013-portland/logos/simple.png'></a>
<a href='http://iovation.com/'><img border=0 alt='iovation' title='iovation' width=100px height=100px src='/events/2013-portland/logos/iovation.png'></a>
<a href='http://puppetlabs.com/'><img border=0 alt='Puppet Labs' title='Puppet Labs' width=100px height=100px src='/events/2013-portland/logos/puppet.png'></a>
<a href='http://rentrak.com/'><img border=0 alt='Rentrak' title='Rentrak' width=100px height=100px src='/events/2013-portland/logos/rentrak.png'></a>
<a href='http://collab.net/'><img border=0 alt='CollabNet' title='CollabNet' width=100px height=100px src='/events/2013-portland/logos/collabnet.png'></a>
<h1>Lanyard sponsor</h1>
<a href='https:
<h1>Silver sponsors</h1>
<a href='http://opscode.com/'><img border=0 alt='Opscode' title='Opscode' width=100px height=100px src='/events/2013-portland/logos/opscode.png'></a>
<a href='http://ansibleworks.com/'><img border=0 alt='AnsibleWorks' title='AnsibleWorks' width=100px height=100px src='/events/2013-portland/logos/ansibleworks.png'></a>
<a href='http://boundary.com/'><img border=0 alt='Boundary' title='Boundary' width=100px height=100px src='/events/2013-portland/logos/boundary.png'></a>
<br />
</div>
<div class="span-8 last">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9713393-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https:
var s = document.<API key>('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html> |
create table t0 (x real primary key); |
package com.bwssystems.HABridge;
import java.util.List;
public class IpList {
private List<NamedIP> devices;
public List<NamedIP> getDevices() {
return devices;
}
public void setDevices(List<NamedIP> devices) {
this.devices = devices;
}
} |
KISSY.add("kison/utils",[],function(S){var doubleReg=/"/g,single=/'/g,escapeString;return{escapeString:escapeString=function(str,quote){var regexp=single;if(quote==='"')regexp=doubleReg;else quote="'";return str.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(regexp,"\\"+quote)},serializeObject:function serializeObject(obj,excludeReg){var r;if(excludeReg&&typeof excludeReg==="function"&&(r=excludeReg(obj))===false)return false;if(r!==undefined)obj=r;var ret=
[];if(typeof obj==="string")return"'"+escapeString(obj)+"'";else if(typeof obj==="number")return obj+"";else if(S.isRegExp(obj))return"/"+obj.source+"/"+(obj.global?"g":"")+(obj.ignoreCase?"i":"")+(obj.multiline?"m":"");else if(S.isArray(obj)){ret.push("[");var sub=[];S.each(obj,function(v){var t=serializeObject(v,excludeReg);if(t!==false)sub.push(t)});ret.push(sub.join(", "));ret.push("]");return ret.join("")}else if(S.isObject(obj)){ret=[];ret[0]="{";var start=1;for(var i in obj){var v=obj[i];if(excludeReg&&
S.isRegExp(excludeReg)&&i.match(excludeReg))continue;var t=serializeObject(v,excludeReg);if(t===false)continue;var key="'"+escapeString(i)+"'";ret.push((start?"":",")+key+": "+t);start=0}ret.push("}");return ret.join("\n")}else return obj+""}}});
KISSY.add("kison/item",["base"],function(S,require,exports,module){var Base=require("base");module.exports=Base.extend({equals:function(other,ignoreLookAhead){var self=this;if(!other.get("production").equals(self.get("production")))return false;if(other.get("dotPosition")!==self.get("dotPosition"))return false;if(!ignoreLookAhead)if(!S.equals(self.get("lookAhead"),other.get("lookAhead")))return false;return true},toString:function(ignoreLookAhead){return this.get("production").toString(this.get("dotPosition"))+
(ignoreLookAhead?"":","+S.keys(this.get("lookAhead")).join("/"))},addLookAhead:function(ls){var lookAhead=this.get("lookAhead"),ret=0;S.each(ls,function(_,l){if(!lookAhead[l]){lookAhead[l]=1;ret=1}});return ret}},{ATTRS:{production:{},dotPosition:{value:0},lookAhead:{value:{}}}})});
KISSY.add("kison/item-set",["base"],function(S,require){var Base=require("base");return Base.extend({addItem:function(item){var items=this.get("items");for(var i=0;i<items.length;i++)if(items[i].get("production").toString()>item.get("production").toString())break;items.splice(i,0,item)},size:function(){return this.get("items").length},findItemIndex:function(item,ignoreLookAhead){var oneItems=this.get("items");for(var i=0;i<oneItems.length;i++)if(oneItems[i].equals(item,ignoreLookAhead))return i;return-1},
getItemAt:function(index){return this.get("items")[index]},equals:function(other,ignoreLookAhead){var oneItems=this.get("items"),i,otherItems=other.get("items");if(oneItems.length!==otherItems.length)return false;for(i=0;i<oneItems.length;i++)if(!oneItems[i].equals(otherItems[i],ignoreLookAhead))return false;return true},toString:function(withGoto){var ret=[],gotos=this.get("gotos");S.each(this.get("items"),function(item){ret.push(item.toString())});if(withGoto){ret.push("start gotos:");S.each(gotos,
function(itemSet,symbol){ret.push(symbol+" -> ");ret.push(itemSet.toString())});ret.push("end gotos:")}return ret.join("\n")},addReverseGoto:function(symbol,item){var reverseGotos=this.get("reverseGotos");reverseGotos[symbol]=reverseGotos[symbol]||[];reverseGotos[symbol].push(item)}},{ATTRS:{items:{value:[]},gotos:{value:{}},reverseGotos:{value:{}}}})});
KISSY.add("kison/non-terminal",["base"],function(S,require){var Base=require("base");return Base.extend({},{ATTRS:{productions:{value:[]},firsts:{value:{}},symbol:{},nullable:{value:false}}})});
KISSY.add("kison/lexer",["./utils"],function(S,require){var Utils=require("./utils");var serializeObject=Utils.serializeObject,Lexer=function(cfg){var self=this;self.rules=[];S.mix(self,cfg);self.resetInput(self.input)};Lexer.STATIC={INITIAL:"I",DEBUG_CONTEXT_LIMIT:20,END_TAG:"$EOF"};Lexer.prototype={constructor:Lexer,resetInput:function(input){S.mix(this,{input:input,matched:"",stateStack:[Lexer.STATIC.INITIAL],match:"",text:"",firstLine:1,lineNumber:1,lastLine:1,firstColumn:1,lastColumn:1})},genShortId:function(field){var base=
97,max=122,interval=max-base+1;field+="__gen";var self=this;if(!(field in self))self[field]=-1;var index=self[field]=self[field]+1;var ret="";do{ret=String.fromCharCode(base+index%interval)+ret;index=Math.floor(index/interval)-1}while(index>=0);return ret},genCode:function(cfg){var STATIC=Lexer.STATIC,self=this,compressSymbol=cfg.compressSymbol,compressState=cfg.compressLexerState,code=["/*jslint quotmark: false*/"],stateMap;if(compressSymbol){self.symbolMap={};self.mapSymbol(STATIC.END_TAG)}if(compressState)stateMap=
self.stateMap={};code.push("var Lexer = "+Lexer.toString()+";");code.push("Lexer.prototype= "+serializeObject(Lexer.prototype,/genCode/)+";");code.push("Lexer.STATIC= "+serializeObject(STATIC)+";");var newCfg=serializeObject({rules:self.rules},compressState||compressSymbol?function(v){if(v&&v.regexp){var state=v.state,ret,action=v.action,token=v.token||0;if(token)token=self.mapSymbol(token);ret=[token,v.regexp,action||0];if(compressState&&state)state=S.map(state,function(s){return self.mapState(s)});
if(state)ret.push(state);return ret}return undefined}:0);code.push("var lexer = new Lexer("+newCfg+");");if(compressState||compressSymbol){self.rules=eval("("+newCfg+")").rules;if(compressState)code.push("lexer.stateMap = "+serializeObject(stateMap)+";")}return code.join("\n")},getCurrentRules:function(){var self=this,currentState=self.stateStack[self.stateStack.length-1],rules=[];currentState=self.mapState(currentState);S.each(self.rules,function(r){var state=r.state||r[3];if(!state){if(currentState===
Lexer.STATIC.INITIAL)rules.push(r)}else if(S.inArray(currentState,state))rules.push(r)});return rules},pushState:function(state){this.stateStack.push(state)},popState:function(){return this.stateStack.pop()},getStateStack:function(){return this.stateStack},showDebugInfo:function(){var self=this,DEBUG_CONTEXT_LIMIT=Lexer.STATIC.DEBUG_CONTEXT_LIMIT,matched=self.matched,match=self.match,input=self.input;matched=matched.slice(0,matched.length-match.length);var past=(matched.length>DEBUG_CONTEXT_LIMIT?
"...":"")+matched.slice(-DEBUG_CONTEXT_LIMIT).replace(/\n/," "),next=match+input;next=next.slice(0,DEBUG_CONTEXT_LIMIT)+(next.length>DEBUG_CONTEXT_LIMIT?"...":"");return past+next+"\n"+(new Array(past.length+1)).join("-")+"^"},mapSymbol:function(t){var self=this,symbolMap=self.symbolMap;if(!symbolMap)return t;return symbolMap[t]||(symbolMap[t]=self.genShortId("symbol"))},mapReverseSymbol:function(rs){var self=this,symbolMap=self.symbolMap,i,reverseSymbolMap=self.reverseSymbolMap;if(!reverseSymbolMap&&
symbolMap){reverseSymbolMap=self.reverseSymbolMap={};for(i in symbolMap)reverseSymbolMap[symbolMap[i]]=i}if(reverseSymbolMap)return reverseSymbolMap[rs];else return rs},mapState:function(s){var self=this,stateMap=self.stateMap;if(!stateMap)return s;return stateMap[s]||(stateMap[s]=self.genShortId("state"))},lex:function(){var self=this,input=self.input,i,rule,m,ret,lines,rules=self.getCurrentRules();self.match=self.text="";if(!input)return self.mapSymbol(Lexer.STATIC.END_TAG);for(i=0;i<rules.length;i++){rule=
rules[i];var regexp=rule.regexp||rule[1],token=rule.token||rule[0],action=rule.action||rule[2]||undefined;if(m=input.match(regexp)){lines=m[0].match(/\n.*/g);if(lines)self.lineNumber+=lines.length;S.mix(self,{firstLine:self.lastLine,lastLine:self.lineNumber+1,firstColumn:self.lastColumn,lastColumn:lines?lines[lines.length-1].length-1:self.lastColumn+m[0].length});var match;match=self.match=m[0];self.matches=m;self.text=match;self.matched+=match;ret=action&&action.call(self);if(ret===undefined)ret=
token;else ret=self.mapSymbol(ret);input=input.slice(match.length);self.input=input;if(ret)return ret;else return self.lex()}}S.error("lex error at line "+self.lineNumber+":\n"+self.showDebugInfo());return undefined}};return Lexer});
KISSY.add("kison/production",["base"],function(S,require){var Base=require("base");return Base.extend({equals:function(other){var self=this;if(!S.equals(other.get("rhs"),self.get("rhs")))return false;return other.get("symbol")===self.get("symbol")},toString:function(dot){var rhsStr="";var rhs=this.get("rhs");S.each(rhs,function(r,index){if(index===dot)rhsStr+=" . ";rhsStr+=r+" "});if(dot===rhs.length)rhsStr+=" . ";return this.get("symbol")+" => "+rhsStr}},{ATTRS:{firsts:{value:{}},follows:{value:[]},
symbol:{},rhs:{value:[]},nullable:{value:false},action:{}}})});
KISSY.add("kison/grammar",["base","./utils","./item","./item-set","./non-terminal","./lexer","./production"],function(S,require){var Base=require("base");var Utils=require("./utils");var Item=require("./item");var ItemSet=require("./item-set");var NonTerminal=require("./non-terminal");var Lexer=require("./lexer");var Production=require("./production");var logger=S.getLogger("s/kison");var GrammarConst={SHIFT_TYPE:1,REDUCE_TYPE:2,ACCEPT_TYPE:0,TYPE_INDEX:0,PRODUCTION_INDEX:1,TO_INDEX:2},serializeObject=
Utils.serializeObject,mix=S.mix,END_TAG=Lexer.STATIC.END_TAG,START_TAG="$START";function setSize(set3){var count=0,i;for(i in set3)count++;return count}function indexOf(obj,array){for(var i=0;i<array.length;i++)if(obj.equals(array[i]))return i;return-1}function visualizeAction(action,productions,itemSets){switch(action[GrammarConst.TYPE_INDEX]){case GrammarConst.SHIFT_TYPE:logger.debug("shift");break;case GrammarConst.REDUCE_TYPE:logger.debug("reduce");break;case GrammarConst.ACCEPT_TYPE:logger.debug("accept");
break}logger.debug("from production:");if(action[GrammarConst.PRODUCTION_INDEX]!==undefined)logger.debug(productions[action[GrammarConst.PRODUCTION_INDEX]]+"");else logger.debug("undefined");logger.debug("to itemSet:");if(action[GrammarConst.TO_INDEX]!==undefined)logger.debug(itemSets[action[GrammarConst.TO_INDEX]].toString(1));else logger.debug("undefined")}return Base.extend({build:function(){var self=this,lexer=self.lexer,vs=self.get("productions");vs.unshift({symbol:START_TAG,rhs:[vs[0].symbol]});
S.each(vs,function(v,index){v.symbol=lexer.mapSymbol(v.symbol);var rhs=v.rhs;S.each(rhs,function(r,index){rhs[index]=lexer.mapSymbol(r)});vs[index]=new Production(v)});self.buildTerminals();self.buildNonTerminals();self.buildNullable();self.buildFirsts();self.buildItemSet();self.buildLalrItemSets();self.buildTable()},buildTerminals:function(){var self=this,lexer=self.get("lexer"),rules=lexer&&lexer.rules,terminals=self.get("terminals");terminals[lexer.mapSymbol(END_TAG)]=1;S.each(rules,function(rule){var token=
rule.token||rule[0];if(token)terminals[token]=1})},buildNonTerminals:function(){var self=this,terminals=self.get("terminals"),nonTerminals=self.get("nonTerminals"),productions=self.get("productions");S.each(productions,function(production){var symbol=production.get("symbol"),nonTerminal=nonTerminals[symbol];if(!nonTerminal)nonTerminal=nonTerminals[symbol]=new NonTerminal({symbol:symbol});nonTerminal.get("productions").push(production);S.each(production.get("handles"),function(handle){if(!terminals[handle]&&
!nonTerminals[handle])nonTerminals[handle]=new NonTerminal({symbol:handle})})})},buildNullable:function(){var self=this,i,rhs,n,symbol,t,production,productions,nonTerminals=self.get("nonTerminals"),cont=true;while(cont){cont=false;S.each(self.get("productions"),function(production){if(!production.get("nullable")){rhs=production.get("rhs");for(i=0,n=0;t=rhs[i];++i)if(self.isNullable(t))n++;if(n===i)production.set("nullable",cont=true)}});for(symbol in nonTerminals)if(!nonTerminals[symbol].get("nullable")){productions=
nonTerminals[symbol].get("productions");for(i=0;production=productions[i];i++)if(production.get("nullable")){nonTerminals[symbol].set("nullable",cont=true);break}}}},isNullable:function(symbol){var self=this,nonTerminals=self.get("nonTerminals");if(symbol instanceof Array){for(var i=0,t;t=symbol[i];++i)if(!self.isNullable(t))return false;return true}else if(!nonTerminals[symbol])return false;else return nonTerminals[symbol].get("nullable")},findFirst:function(symbol){var self=this,firsts={},t,i,nonTerminals=
self.get("nonTerminals");if(symbol instanceof Array){for(i=0;t=symbol[i];++i){if(!nonTerminals[t])firsts[t]=1;else mix(firsts,nonTerminals[t].get("firsts"));if(!self.isNullable(t))break}return firsts}else if(!nonTerminals[symbol])return[symbol];else return nonTerminals[symbol].get("firsts")},buildFirsts:function(){var self=this,nonTerminal,nonTerminals=self.get("nonTerminals"),cont=true,symbol,firsts;while(cont){cont=false;S.each(self.get("productions"),function(production){var firsts=self.findFirst(production.get("rhs"));
if(setSize(firsts)!==setSize(production.get("firsts"))){production.set("firsts",firsts);cont=true}});for(symbol in nonTerminals){nonTerminal=nonTerminals[symbol];firsts={};S.each(nonTerminal.get("productions"),function(production){mix(firsts,production.get("firsts"))});if(setSize(firsts)!==setSize(nonTerminal.get("firsts"))){nonTerminal.set("firsts",firsts);cont=true}}}},closure:function(itemSet){var self=this,items=itemSet.get("items"),productions=self.get("productions"),cont=1;while(cont){cont=
false;S.each(items,function(item){var dotPosition=item.get("dotPosition"),production=item.get("production"),rhs=production.get("rhs"),dotSymbol=rhs[dotPosition],lookAhead=item.get("lookAhead"),finalFirsts={};S.each(lookAhead,function(_,ahead){var rightRhs=rhs.slice(dotPosition+1);rightRhs.push(ahead);S.mix(finalFirsts,self.findFirst(rightRhs))});S.each(productions,function(p2){if(p2.get("symbol")===dotSymbol){var newItem=new Item({production:p2}),itemIndex=itemSet.findItemIndex(newItem,true),findItem;
if(itemIndex!==-1){findItem=itemSet.getItemAt(itemIndex);cont=cont||!!findItem.addLookAhead(finalFirsts)}else{newItem.addLookAhead(finalFirsts);itemSet.addItem(newItem);cont=true}}})})}return itemSet},gotos:function(i,x){var j=new ItemSet,iItems=i.get("items");S.each(iItems,function(item){var production=item.get("production"),dotPosition=item.get("dotPosition"),markSymbol=production.get("rhs")[dotPosition];if(markSymbol===x){var newItem=new Item({production:production,dotPosition:dotPosition+1}),
itemIndex=j.findItemIndex(newItem,true),findItem;if(itemIndex!==-1){findItem=j.getItemAt(itemIndex);findItem.addLookAhead(item.get("lookAhead"))}else{newItem.addLookAhead(item.get("lookAhead"));j.addItem(newItem)}}});return this.closure(j)},findItemSetIndex:function(itemSet){var itemSets=this.get("itemSets"),i;for(i=0;i<itemSets.length;i++)if(itemSets[i].equals(itemSet))return i;return-1},buildItemSet:function(){var self=this,lexer=self.lexer,itemSets=self.get("itemSets"),lookAheadTmp={},productions=
self.get("productions");lookAheadTmp[lexer.mapSymbol(END_TAG)]=1;var initItemSet=self.closure(new ItemSet({items:[new Item({production:productions[0],lookAhead:lookAheadTmp})]}));itemSets.push(initItemSet);var condition=true,symbols=S.merge(self.get("terminals"),self.get("nonTerminals"));delete symbols[lexer.mapSymbol(END_TAG)];while(condition){condition=false;var itemSets2=itemSets.concat();S.each(itemSets2,function(itemSet){S.each(symbols,function(v,symbol){if(!itemSet.__cache)itemSet.__cache={};
if(itemSet.__cache[symbol])return;var itemSetNew=self.gotos(itemSet,symbol);itemSet.__cache[symbol]=1;if(itemSetNew.size()===0)return;var index=self.findItemSetIndex(itemSetNew);if(index>-1)itemSetNew=itemSets[index];else{itemSets.push(itemSetNew);condition=true}itemSet.get("gotos")[symbol]=itemSetNew;itemSetNew.addReverseGoto(symbol,itemSet)})})}},buildLalrItemSets:function(){var itemSets=this.get("itemSets"),i,j,one,two;for(i=0;i<itemSets.length;i++){one=itemSets[i];for(j=i+1;j<itemSets.length;j++){two=
itemSets[j];if(one.equals(two,true)){for(var k=0;k<one.get("items").length;k++)one.get("items")[k].addLookAhead(two.get("items")[k].get("lookAhead"));var oneGotos=one.get("gotos");S.each(two.get("gotos"),function(item,symbol){oneGotos[symbol]=item;item.addReverseGoto(symbol,one)});S.each(two.get("reverseGotos"),function(items,symbol){S.each(items,function(item){item.get("gotos")[symbol]=one;one.addReverseGoto(symbol,item)})});itemSets.splice(j--,1)}}}},buildTable:function(){var self=this,lexer=self.lexer,
table=self.get("table"),itemSets=self.get("itemSets"),productions=self.get("productions"),mappedStartTag=lexer.mapSymbol(START_TAG),mappedEndTag=lexer.mapSymbol(END_TAG),gotos={},action={},nonTerminals,i,itemSet,t;table.gotos=gotos;table.action=action;nonTerminals=self.get("nonTerminals");for(i=0;i<itemSets.length;i++){itemSet=itemSets[i];S.each(itemSet.get("items"),function(item){var production=item.get("production");var val;if(item.get("dotPosition")===production.get("rhs").length)if(production.get("symbol")===
mappedStartTag){if(item.get("lookAhead")[mappedEndTag]){action[i]=action[i]||{};t=action[i][mappedEndTag];val=[];val[GrammarConst.TYPE_INDEX]=GrammarConst.ACCEPT_TYPE;if(t&&t.toString()!==val.toString()){logger.debug((new Array(29)).join("*"));logger.debug("***** conflict in reduce: action already defined ->","warn");logger.debug("***** current item:","info");logger.debug(item.toString());logger.debug("***** current action:","info");visualizeAction(t,productions,itemSets);logger.debug("***** will be overwritten ->",
"info");visualizeAction(val,productions,itemSets)}action[i][mappedEndTag]=val}}else{action[i]=action[i]||{};S.each(item.get("lookAhead"),function(_,l){t=action[i][l];val=[];val[GrammarConst.TYPE_INDEX]=GrammarConst.REDUCE_TYPE;val[GrammarConst.PRODUCTION_INDEX]=S.indexOf(production,productions);if(t&&t.toString()!==val.toString()){logger.debug((new Array(29)).join("*"));logger.debug("conflict in reduce: action already defined ->","warn");logger.debug("***** current item:","info");logger.debug(item.toString());
logger.debug("***** current action:","info");visualizeAction(t,productions,itemSets);logger.debug("***** will be overwritten ->","info");visualizeAction(val,productions,itemSets)}action[i][l]=val})}});S.each(itemSet.get("gotos"),function(anotherItemSet,symbol){var val;if(!nonTerminals[symbol]){action[i]=action[i]||{};val=[];val[GrammarConst.TYPE_INDEX]=GrammarConst.SHIFT_TYPE;val[GrammarConst.TO_INDEX]=indexOf(anotherItemSet,itemSets);t=action[i][symbol];if(t&&t.toString()!==val.toString()){logger.debug((new Array(29)).join("*"));
logger.debug("conflict in shift: action already defined ->","warn");logger.debug("***** current itemSet:","info");logger.debug(itemSet.toString(1));logger.debug("***** current symbol:","info");logger.debug(symbol);logger.debug("***** goto itemSet:","info");logger.debug(anotherItemSet.toString(1));logger.debug("***** current action:","info");visualizeAction(t,productions,itemSets);logger.debug("***** will be overwritten ->","info");visualizeAction(val,productions,itemSets)}action[i][symbol]=val}else{gotos[i]=
gotos[i]||{};t=gotos[i][symbol];val=indexOf(anotherItemSet,itemSets);if(t&&val!==t){logger.debug((new Array(29)).join("*"));logger.debug("conflict in shift: goto already defined ->","warn");logger.debug("***** current itemSet:","info");logger.debug(itemSet.toString(1));logger.debug("***** current symbol:","info");logger.debug(symbol);logger.debug("***** goto itemSet:","info");logger.debug(anotherItemSet.toString(1));logger.debug("***** current goto state:","info");logger.debug(t);logger.debug("***** will be overwritten ->",
"info");logger.debug(val)}gotos[i][symbol]=val}})}},visualizeTable:function(){var self=this,table=self.get("table"),gotos=table.gotos,action=table.action,productions=self.get("productions"),ret=[];S.each(self.get("itemSets"),function(itemSet,i){ret.push((new Array(70)).join("*")+" itemSet : "+i);ret.push(itemSet.toString());ret.push("")});ret.push("");ret.push((new Array(70)).join("*")+" table : ");S.each(action,function(av,index){S.each(av,function(v,s){var str,type=v[GrammarConst.TYPE_INDEX];if(type===
GrammarConst.ACCEPT_TYPE)str="acc";else if(type===GrammarConst.REDUCE_TYPE){var production=productions[v[GrammarConst.PRODUCTION_INDEX]];str="r, "+production.get("symbol")+"="+production.get("rhs").join(" ")}else if(type===GrammarConst.SHIFT_TYPE)str="s, "+v[GrammarConst.TO_INDEX];ret.push("action["+index+"]"+"["+s+"] = "+str)})});ret.push("");S.each(gotos,function(sv,index){S.each(sv,function(v,s){ret.push("goto["+index+"]"+"["+s+"] = "+v)})});return ret},genCode:function(cfg){cfg=cfg||{};var self=
this,table=self.get("table"),lexer=self.get("lexer"),lexerCode=lexer.genCode(cfg);self.build();var productions=[];S.each(self.get("productions"),function(p){var action=p.get("action"),ret=[p.get("symbol"),p.get("rhs")];if(action)ret.push(action);productions.push(ret)});var code=[];code.push("/* Generated by kison from KISSY */");code.push("var parser = {},"+"S = KISSY,"+"GrammarConst = "+serializeObject(GrammarConst)+";");code.push(lexerCode);code.push("parser.lexer = lexer;");if(cfg.compressSymbol)code.push("lexer.symbolMap = "+
serializeObject(lexer.symbolMap)+";");code.push("parser.productions = "+serializeObject(productions)+";");code.push("parser.table = "+serializeObject(table)+";");code.push("parser.parse = "+parse.toString()+";");code.push("return parser;");return code.join("\n")}},{ATTRS:{table:{value:{}},itemSets:{value:[]},productions:{value:[]},nonTerminals:{value:{}},lexer:{setter:function(v){if(!(v instanceof Lexer))v=new Lexer(v);this.lexer=v;return v}},terminals:{value:{}}}});function parse(input){var self=
this,lexer=self.lexer,state,symbol,action,table=self.table,gotos=table.gotos,tableAction=table.action,productions=self.productions,valueStack=[null],stack=[0];lexer.resetInput(input);while(1){state=stack[stack.length-1];if(!symbol)symbol=lexer.lex();if(!symbol){S.log("it is not a valid input: "+input,"error");return false}action=tableAction[state]&&tableAction[state][symbol];if(!action){var expected=[],error;if(tableAction[state])for(var symbolForState in tableAction[state])expected.push(self.lexer.mapReverseSymbol(symbolForState));
error="Syntax error at line "+lexer.lineNumber+":\n"+lexer.showDebugInfo()+"\n"+"expect "+expected.join(", ");S.error(error);return false}switch(action[GrammarConst.TYPE_INDEX]){case GrammarConst.SHIFT_TYPE:stack.push(symbol);valueStack.push(lexer.text);stack.push(action[GrammarConst.TO_INDEX]);symbol=null;break;case GrammarConst.REDUCE_TYPE:var production=productions[action[GrammarConst.PRODUCTION_INDEX]],reducedSymbol=production.symbol||production[0],reducedAction=production.action||production[2],
reducedRhs=production.rhs||production[1],len=reducedRhs.length,i=0,ret,$$=valueStack[valueStack.length-len];ret=undefined;self.$$=$$;for(;i<len;i++)self["$"+(len-i)]=valueStack[valueStack.length-1-i];if(reducedAction)ret=reducedAction.call(self);if(ret!==undefined)$$=ret;else $$=self.$$;if(len){stack=stack.slice(0,-1*len*2);valueStack=valueStack.slice(0,-1*len)}stack.push(reducedSymbol);valueStack.push($$);var newState=gotos[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;
case GrammarConst.ACCEPT_TYPE:return $$}}return undefined}});KISSY.add("kison",["kison/grammar","kison/production","kison/lexer","kison/utils"],function(S,require){var Grammar=require("kison/grammar");var Production=require("kison/production");var Lexer=require("kison/lexer");var Utils=require("kison/utils");var Kison={};Kison.Grammar=Grammar;Kison.Production=Production;Kison.Lexer=Lexer;Kison.Utils=Utils;if("@DEBUG@")return Kison;else{window.alert("kison can only use uncompressed version!");return null}}); |
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Uniduino;
using Uniduino.Helpers;
#if (UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5)
public class UniduinoTestPanel : Uniduino.Examples.UniduinoTestPanel { }
#endif
namespace Uniduino.Examples
{
<summary>
Uniduino TestPanel - a GUI tool for easy visualization and manipulation of I/O functions
</summary>
public class UniduinoTestPanel : MonoBehaviour {
public GUISkin skin;
public Arduino arduino;
void Start () {
if (!<API key>.SerialPortAvailable())
{
#if UNITY_EDITOR
<API key>.OpenSetupWindow();
#else
Debug.LogError("Uniduino SerialPort Support must be installed: is libMonoPosixHelper on your path?");
#endif
}
arduino = Arduino.global; // convenience, alias the global arduino singleton
arduino.Log = (s) => Debug.Log("Arduino: " +s); // Attach arduino logs to Debug.Log
hookEvents(); // set up event callbacks for received data
}
List<Arduino.Pin> received_pins;
protected void hookEvents()
{
arduino.AnalogDataReceived += delegate(int pin, int value)
{
Debug.Log("Analog data received: pin " + pin.ToString() + "=" + value.ToString());
};
arduino.DigitalDataReceived += delegate(int portNumber, int portData)
{
Debug.Log("Digital data received: port " + portNumber.ToString() + "=" + System.Convert.ToString(portData, 2));
};
arduino.VersionDataReceived += delegate(int majorVersion, int minorVersion)
{
Debug.Log("Version data received");
arduino.queryCapabilities();
};
arduino.<API key> += delegate(List<Arduino.Pin> pins)
{
Debug.Log("Pin capabilities received");
received_pins = pins; // cache the complete pin list here so we can use it without worrying about it being complete yet
};
//arduino.reportVersion(); // some boards (like the micro) do not send the version right away for some reason. perhaps a timing issue.
}
protected void connect()
{
//Debug.Log ("Connectiong to arduino at " + PortName + "...");
//try {
arduino.Connect();
/*} catch ( Exception e)
{
Debug.Log("Exception initializing arduino:" + e.ToString());
}*/
}
Coroutine blinker;
int label_column_width = 100;
int test_column_width = 70;
Vector2 scroll_position = new Vector2(0,0);
void OnGUI()
{
GUI.skin = skin;
GUILayout.BeginArea(new Rect(50, 50, 2*Screen.width/2-100, Screen.height-100));
{
GUILayout.BeginVertical();
{
GUILayout.BeginHorizontal();
{
if (GUILayout.Button("Connect"))
{
connect();
}
if (GUILayout.Button("Disconnect"))
{
Debug.Log ("Closing connection to arduino");
//try {
arduino.Disconnect();
/*} catch ( Exception e)
{
Debug.Log("Exception initializing arduino:" + e.ToString());
}*/
received_pins = null;
}
GUILayout.FlexibleSpace();
GUILayout.Label("Serial port:");
arduino.PortName = GUILayout.TextField(arduino.PortName);
if (GUILayout.Button("Guess"))
{
string pn = Arduino.guessPortName();
if (pn.Length > 0) arduino.PortName = pn;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
string connection_status;
if (arduino != null && arduino.IsOpen && arduino.Connected)
{
connection_status = "Connected to Firmata protocol version " + arduino.MajorVersion + "." + arduino.MinorVersion;
GUILayout.Label(connection_status);
} else if (arduino != null && arduino.IsOpen)
{
GUILayout.Label("Connected but waiting for Firmata protocol version" );
} else
{
GUILayout.Label("Not connected");
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Query capabilities"))
{
arduino.queryCapabilities();
}
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
// draw pin states and controls
if (received_pins != null) //arduino != null && arduino.Pins != null)
{
GUILayout.BeginHorizontal();
{
GUIStyle style = new GUIStyle(GUI.skin.label);
style.fontSize +=3;
style.fontStyle = FontStyle.Bold;
GUILayout.Label("Pin:Value", style, GUILayout.Width(label_column_width));
GUILayout.Label("Output", style, GUILayout.Width(test_column_width));
GUILayout.Label("Modes",style, GUILayout.Width(label_column_width)); // these widths hacked due to awful unity bug in label size calculations
GUILayout.FlexibleSpace();
GUILayout.Label("Reporting",style, GUILayout.MinWidth(style.CalcSize(new GUIContent("Reporting")).x));
GUILayout.Space(15);
}
GUILayout.EndHorizontal();
scroll_position = GUILayout.BeginScrollView (scroll_position /*, GUILayout.Width (100), GUILayout.Height (100)*/);
{
foreach (var pin in received_pins)
{
drawPinGUI(pin);
}
}
GUILayout.EndScrollView();
}
}
GUILayout.EndVertical();
}
GUILayout.EndArea();
}
// ui states to track what states pins *should* be in.
// currently fetching actual pin status from firmata
// is not implemented so these are lazily updated
// when the user changes something through the ui
class PinUI
{
public bool reporting_analog;
public bool reporting_digital;
public bool test_state;
public PinMode last_pin_mode = PinMode.OUTPUT;
public string pwm_value_buffer = "";
}
Dictionary<Arduino.Pin, PinUI> pin_ui_states = new Dictionary<Arduino.Pin, PinUI>();
void drawPinGUI(Arduino.Pin pin)
{
GUIStyle green_button = new GUIStyle(GUI.skin.button);
green_button.normal.textColor = Color.green;
GUIStyle gray_button = new GUIStyle(GUI.skin.button);
gray_button.normal.textColor = Color.gray;
bool <API key> = false;
bool <API key> = false;
if (!pin_ui_states.ContainsKey(pin))
pin_ui_states[pin] = new PinUI();
var ui = pin_ui_states[pin];
foreach ( var pc in pin.capabilities)
{
if (pc.Mode == PinMode.ANALOG)
<API key> = true;
if (pc.Mode == PinMode.OUTPUT)
<API key> = true;
}
GUILayout.BeginHorizontal();
string label = "";
label = "D"+pin.number.ToString() + ":" + arduino.digitalRead(pin.number).ToString();
if (pin.analog_number >= 0)
label += " A"+pin.analog_number.ToString() + ":" + arduino.analogRead(pin.analog_number).ToString();
GUILayout.Label(label, GUILayout.Width(100));
// write test
GUILayout.BeginHorizontal(GUILayout.Width(test_column_width));
if (ui.last_pin_mode == PinMode.OUTPUT)
{
if (GUILayout.Button(ui.test_state ? "HIGH": "low", ui.test_state ? green_button : gray_button, GUILayout.Width(50)))
{
ui.test_state = !ui.test_state;
arduino.digitalWrite(pin.number, ui.test_state ? 1 : 0);
// NB: this appears not to interfere input pins for now, but the semantics are not
// well-defined so this could break later if either firmata implementation changes
// to autamatically update the pin mode on a digitalWrite
}
} else if (ui.last_pin_mode == PinMode.PWM || ui.last_pin_mode == PinMode.SERVO)
{
float current_pwm_value;
float.TryParse(ui.pwm_value_buffer, out current_pwm_value);
float pwm_value = GUILayout.HorizontalSlider(current_pwm_value, 0, ui.last_pin_mode == PinMode.SERVO ? 180 : 255, GUILayout.Height(21), GUILayout.Width(50));
if (pwm_value != current_pwm_value)
{
arduino.pinMode(pin.number, (int)ui.last_pin_mode);
arduino.analogWrite(pin.number, (int)pwm_value);
ui.pwm_value_buffer = pwm_value.ToString();
}
/* Old style: text entry of pwm values--could be useful for some
ui.pwm_value_buffer = GUILayout.TextField(ui.pwm_value_buffer, GUILayout.Width(30));
int pwm_value;
if (GUILayout.Button("!",GUILayout.Width(20)) && int.TryParse(ui.pwm_value_buffer, out pwm_value))
{
arduino.pinMode(pin.number, (int)PinMode.PWM);
arduino.analogWrite(pin.number, pwm_value);
}
*/
} else
{
GUILayout.Label(""); // workaround unity gui silliness
}
GUILayout.EndHorizontal();
foreach ( var pc in pin.capabilities)
{
if (GUILayout.Button(pc.Mode.ToString(), ui.last_pin_mode==pc.Mode ? green_button : gray_button))
{
arduino.pinMode(pin.number, pc.mode);
ui.last_pin_mode = pc.Mode;
if (pc.Mode == PinMode.ANALOG)
{
// mirror behavior of StardardFirmata. note that this behavior is different from digital ports, which do require an explicit reportDigital call to enable reporting
ui.reporting_analog = true;
// arduino.reportAnalog(k, (byte)<API key>[k]);
}
}
}
GUILayout.FlexibleSpace();
if (<API key>)
{
if (GUILayout.Button("Analog", ui.reporting_analog ? green_button : gray_button ))
{
ui.reporting_analog = !ui.reporting_analog;
arduino.reportAnalog(pin.analog_number, (byte)(ui.reporting_analog ? 1 : 0));
}
}
if (<API key>)
{
if (GUILayout.Button("Digital", ui.reporting_digital ? green_button : gray_button ))
{
ui.reporting_digital = !ui.reporting_digital;
arduino.reportDigital((byte)pin.port, (byte)(ui.reporting_digital ? 1 : 0));
foreach (var p in pin_ui_states.Keys)
{
if (p.port == pin.port)
{
pin_ui_states[p].reporting_digital = ui.reporting_digital;
}
}
}
}
GUILayout.EndHorizontal();
}
void OnDestroy()
{
if (arduino != null)
arduino.Disconnect();
Debug.Log("OnDestroy called");
}
void Update ()
{
if (arduino != null)
{
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Text;
using XenAPI;
using System.Windows.Forms;
using XenAdmin.Model;
using XenAdmin.Core;
using System.Reflection;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Collections.ObjectModel;
using System.Drawing;
using XenAdmin.Plugins;
namespace XenAdmin.Commands
{
<summary>
A class for building up the context menu for XenObjects.
</summary>
internal class ContextMenuBuilder
{
private readonly PluginManager _pluginManager;
private readonly IMainWindow _mainWindow;
private static readonly ReadOnlyCollection<Builder> Builders;
static ContextMenuBuilder()
{
List<Builder> list = new List<Builder>();
foreach (Type type in Assembly.GetCallingAssembly().GetTypes())
{
if (typeof(Builder).IsAssignableFrom(type) && !type.IsAbstract)
{
try
{
list.Add((Builder)Activator.CreateInstance(type));
}
catch (<API key>)
{
}
}
}
Builders = new ReadOnlyCollection<Builder>(list);
}
<summary>
Initializes a new instance of the <see cref="ContextMenuBuilder"/> class.
</summary>
<param name="pluginManager">The plugin manager. This can be found on MainWindow.</param>
<param name="mainWindow">The main window command interface. This can be found on mainwindow.</param>
public ContextMenuBuilder(PluginManager pluginManager, IMainWindow mainWindow)
{
Util.<API key>(pluginManager, "pluginManager");
Util.<API key>(pluginManager, "mainWindow");
_pluginManager = pluginManager;
_mainWindow = mainWindow;
}
<summary>
Shows the context menu for the specified xen object at the current mouse location.
</summary>
<param name="xenObject">The xen object for which the context menu is required.</param>
public void Show(IXenObject xenObject)
{
Show(xenObject, Form.MousePosition);
}
<summary>
Shows the context menu for the specified xen object at the specified location.
</summary>
<param name="xenObject">The xen object for which the context menu is required.</param>
<param name="point">The location of the context menu.</param>
public void Show(IXenObject xenObject, Point point)
{
ContextMenuStrip menu = new ContextMenuStrip();
menu.Items.AddRange(Build(xenObject));
menu.Show(point);
}
<summary>
Builds the context menu for the specified XenObject.
</summary>
<param name="xenObject">The xen object for which the context menu items are required.</param>
<returns>The context menu items.</returns>
public ToolStripItem[] Build(IXenObject xenObject)
{
return Build(new SelectedItem(xenObject));
}
<summary>
Builds the context menu for the specified selection.
</summary>
<param name="selection">The selection for which the context menu items are required.</param>
<returns>The context menu items.</returns>
public ToolStripItem[] Build(SelectedItem selection)
{
return Build(new SelectedItem[] { selection });
}
<summary>
Builds the context menu for the specified selection.
</summary>
<param name="selection">The selection for which the context menu items are required.</param>
<returns>The context menu items.</returns>
public ToolStripItem[] Build(IEnumerable<SelectedItem> selection)
{
Util.<API key>(selection, "selection");
foreach (Builder builder in Builders)
{
<API key> selectionList = new <API key>(selection);
if (builder.IsValid(selectionList))
{
<API key> items = new <API key>(_mainWindow, _pluginManager);
builder.Build(_mainWindow, selectionList, items);
CheckAccessKeys(items);
items.<API key>();
return items.ToArray();
}
}
return new ToolStripItem[0];
}
[Conditional("DEBUG")]
private void CheckAccessKeys(<API key> items)
{
List<string> usedKeys = new List<string>();
foreach (ToolStripItem item in items)
{
string text = item.Text.Replace("&&", "");
int index = text.IndexOf("&");
if (index >= 0)
{
string c = text[index + 1].ToString().ToLower();
if (usedKeys.Contains(c))
{
Debug.Fail("Duplicated access key: " + c);
}
else
{
usedKeys.Add(c);
}
}
}
}
private abstract class Builder
{
public abstract void Build(IMainWindow mainWindow, <API key> selection, <API key> items);
public abstract bool IsValid(<API key> selection);
}
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection), true);
items.AddIfEnabled(new <API key>(mainWindow, selection), true);
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
bool containsPool = false;
bool containsHost = false;
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
Pool pool = item.XenObject as Pool;
Host host = item.XenObject as Host;
if (pool != null)
{
containsPool = true;
}
else if (host != null && item.PoolAncestor == null)
{
containsHost = true;
}
else
{
return false;
}
}
}
return containsPool && containsHost;
}
}
#endregion
#region MultiplePools class
private class MultiplePools : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection), true);
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.pool, selection);
}
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
Pool pool = item.XenObject as Pool;
if (pool == null)
{
return false;
}
}
return true;
}
return false;
}
}
#endregion
#region <API key>
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
List<string> types = new List<string>();
if (selection.AllItemsAre<IXenObject>())
{
foreach (SelectedItem item in selection)
{
string name = item.XenObject.GetType().Name;
VM vm = item.XenObject as VM;
if (vm != null && vm.is_a_template)
{
name = vm.is_a_snapshot ? "snapshot" : "template";
}
if (!types.Contains(name))
{
types.Add(name);
}
}
}
if (types.Count > 1)
{
// if types only contains a mix of vms and templates then don't use this Builder. <API key> should be used instead.
types.Remove("VM");
types.Remove("template");
return types.Count > 0;
}
return false;
}
}
#endregion
#region MultipleSRs
private class MultipleSRs : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new RepairSRCommand(mainWindow, selection));
items.AddIfEnabled(new DetachSRCommand(mainWindow, selection));
items.AddIfEnabled(new ForgetSRCommand(mainWindow, selection));
items.AddIfEnabled(new DestroySRCommand(mainWindow, selection));
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.Count > 1 && selection.AllItemsAre<SR>();
}
}
#endregion
#region SingleVDI
private class SingleVDI : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.Add(new <API key>(mainWindow, selection));
// Default behaviour of this command is very conservative, they wont be able to delete if there are multi vbds,
// or if any of the vbds are plugged on top of the other constraints.
items.Add(new <API key>(mainWindow, selection));
items.AddSeparator();
items.Add(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.Count == 1 && selection[0].XenObject is VDI;
}
}
#endregion
#region MultipleVDI
private class MultipleVDI : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
// Default behaviour of this command is very conservative, they wont be able to delete if there are multi vbds,
// or if any of the vbds are plugged on top of the other constraints.
items.Add(new <API key>(mainWindow, selection));
items.AddSeparator();
items.Add(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<VDI>();
}
}
#endregion
#region SingleNetwork
private class SingleNetwork : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.Add(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.<API key><XenAPI.Network>();
}
}
#endregion
#region DisconnectedHosts
private class DisconnectedHosts : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
List<SelectedItem> inProgressItems = new List<SelectedItem>();
foreach (SelectedItem item in selection)
{
if (item.Connection != null && !item.Connection.IsConnected && item.Connection.InProgress)
{
inProgressItems.Add(item);
}
}
if (inProgressItems.Count > 0)
{
items.Add(new <API key>(mainWindow, inProgressItems));
}
else
{
items.AddIfEnabled(new <API key>(mainWindow, selection), true);
items.Add(new <API key>(mainWindow, selection), true);
items.Add(new <API key>(mainWindow, selection));
items.Add(new RemoveHostCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
}
public override bool IsValid(<API key> selection)
{
foreach (SelectedItem item in selection)
{
if (item.Connection != null && !item.Connection.IsConnected)
{
return true;
}
}
return false;
}
}
#endregion
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
bool vmFound = false, templateFound = false;
foreach (SelectedItem item in selection)
{
VM vm = item.XenObject as VM;
if (vm != null)
{
if (vm.is_a_template && !vm.is_a_snapshot)
{
templateFound = true;
}
else
{
vmFound = true;
}
}
else
{
return false;
}
}
return vmFound && templateFound;
}
return false;
}
}
#endregion
#region MultipleAliveHosts class
private class MultipleAliveHosts : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new RebootHostCommand(mainWindow, selection));
items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddSeparator();
items.AddPluginItems(PluginContextMenu.server, selection);
items.AddSeparator();
}
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
Host host = item.XenObject as Host;
if (host == null || !host.IsLive)
{
return false;
}
}
return true;
}
return false;
}
}
#endregion
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
Host host = (Host)selection[0].XenObject;
items.AddIfEnabled(new NewVMCommand(mainWindow, selection));
items.AddIfEnabled(new NewSRCommand(mainWindow, selection));
items.AddIfEnabled(new ImportCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new RebootHostCommand(mainWindow, selection));
items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
if (host != Helpers.GetMaster(host.Connection) )
{
items.AddSeparator();
items.Add(new <API key>(mainWindow, selection));
}
items.AddPluginItems(PluginContextMenu.server, selection);
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1 && selection[0].PoolAncestor != null)
{
Host host = selection[0].XenObject as Host;
if (host != null)
{
return host.IsLive;
}
}
return false;
}
}
#endregion
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
Host host = (Host)selection[0].XenObject;
items.AddIfEnabled(new NewVMCommand(mainWindow, selection));
items.AddIfEnabled(new NewSRCommand(mainWindow, selection));
items.AddIfEnabled(new ImportCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new RebootHostCommand(mainWindow, selection));
items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection));
items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.server, selection);
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1 && selection[0].PoolAncestor == null)
{
Host host = selection[0].XenObject as Host;
return host != null && host.IsLive;
}
return false;
}
}
#endregion
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection));
items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
bool foundAlive = false;
bool foundDead = false;
foreach (SelectedItem item in selection)
{
Host host = item.XenObject as Host;
if (host == null)
{
return false;
}
foundAlive |= host.IsLive;
foundDead |= !host.IsLive;
}
return foundAlive && foundDead;
}
}
#endregion
#region DeadHosts class
private class DeadHosts : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection));
items.AddIfEnabled(new DestroyHostCommand(mainWindow, selection));
if (selection.Count == 1)
{
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
}
public override bool IsValid(<API key> selection)
{
if (selection.Count > 0)
{
foreach (SelectedItem item in selection)
{
Host host = item.XenObject as Host;
if (host == null || host.IsLive)
{
return false;
}
}
return true;
}
return false;
}
}
#endregion
#region SinglePool class
private class SinglePool : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.Add(new NewVMCommand(mainWindow, selection));
items.Add(new NewSRCommand(mainWindow, selection));
items.Add(new ImportCommand(mainWindow, selection));
items.AddSeparator();
if (selection.FirstAsXenObject != null )
items.Add(new HACommand(mainWindow, selection));
items.AddIfEnabled(new VMGroupCommand<VMPP>(mainWindow, selection));
items.AddIfEnabled(new VMGroupCommand<VM_appliance>(mainWindow, selection));
var drItem = new <API key>(new DRCommand(mainWindow, selection), true);
if (drItem.Command.CanExecute())
{
drItem.DropDownItems.Add(new <API key>(
new DRConfigureCommand(mainWindow, selection), true));
drItem.DropDownItems.Add(new <API key>(new <API key>(mainWindow, selection),
true));
items.Add(drItem);
}
var pool = selection.FirstAsXenObject as Pool;
if (pool != null && !pool.IsPoolFullyUpgraded)
items.Add(new <API key>(mainWindow));
items.AddSeparator();
items.Add(new <API key>(mainWindow, selection, true));
items.Add(new <API key>(mainWindow, selection));
items.Add(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddPluginItems(PluginContextMenu.pool, selection);
items.AddSeparator();
items.Add(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.<API key><Pool>();
}
}
#endregion
#region SingleSnapshot class
private class SingleSnapshot : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.vm, selection);
items.AddSeparator();
items.AddIfEnabled(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1)
{
VM vm = selection[0].XenObject as VM;
return vm != null && vm.is_a_snapshot;
}
return false;
}
}
#endregion
#region SingleTemplate class
private class SingleTemplate : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection), true);
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new CopyTemplateCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.template, selection);
items.AddSeparator();
items.AddIfEnabled(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1)
{
VM vm = selection[0].XenObject as VM;
return vm != null && vm.is_a_template;
}
return false;
}
}
#endregion
#region SingleVmAppliance class
private class SingleVmAppliance : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new VappStartCommand(mainWindow,selection));
items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new ExportCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1)
{
VM_appliance app = selection[0].XenObject as VM_appliance;
return app != null;
}
return false;
}
}
#endregion
#region Multiple VMAppliance class
private class MultipleVmAppliance : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new VappStartCommand(mainWindow, selection));
items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<VM_appliance>();
}
}
#endregion
#region SingleVM class
private class SingleVM : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
VM vm = (VM)selection[0].XenObject;
items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection));
items.AddIfEnabled(new StartVMCommand(mainWindow, selection), vm.power_state == vm_power_state.Halted);
items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection));
items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection));
items.AddIfEnabled(new RebootVMCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new VappStartCommand(mainWindow, selection));
items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddSeparator();
items.AddIfEnabled(new CopyVMCommand(mainWindow, selection));
items.AddIfEnabled(new MoveVMCommand(mainWindow, selection));
items.AddIfEnabled(new ExportCommand(mainWindow, selection));
items.AddIfEnabled(new TakeSnapshotCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key><VMPP>(mainWindow, selection, true));
items.AddIfEnabled(new <API key><VM_appliance>(mainWindow, selection, true));
items.AddSeparator();
items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.vm, selection);
items.AddSeparator();
items.AddIfEnabled(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1)
{
VM vm = selection[0].XenObject as VM;
return vm != null && !vm.is_a_snapshot && !vm.is_a_template;
}
return false;
}
}
#endregion
#region SingleSR class
private class SingleSR : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new RepairSRCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new DetachSRCommand(mainWindow, selection));
items.AddIfEnabled(new ReattachSRCommand(mainWindow, selection));
items.AddIfEnabled(new ForgetSRCommand(mainWindow, selection));
items.AddIfEnabled(new DestroySRCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.storage, selection);
items.AddSeparator();
items.AddIfEnabled(new PropertiesCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.<API key><SR>();
}
}
#endregion
#region SingleFolder class
private class SingleFolder : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new NewFolderCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new DeleteFolderCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.folder, selection);
}
public override bool IsValid(<API key> selection)
{
return selection.<API key><Folder>();
}
}
#endregion
#region MultipleVMs class
private abstract class MultipleVMs : Builder
{
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
VM vm = item.XenObject as VM;
if (vm == null || vm.is_a_template || vm.is_a_snapshot)
{
return false;
}
}
return true;
}
return false;
}
}
#endregion
#region MultipleTemplates class
private class MultipleTemplates : Builder
{
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
VM vm = item.XenObject as VM;
if (vm == null || !vm.is_a_template || vm.is_a_snapshot)
{
return false;
}
}
return true;
}
return false;
}
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.template, selection);
}
}
#endregion
#region MultipleSnapshots class
private class MultipleSnapshots : Builder
{
public override bool IsValid(<API key> selection)
{
if (selection.Count > 1)
{
foreach (SelectedItem item in selection)
{
VM vm = item.XenObject as VM;
if (vm == null || !vm.is_a_snapshot)
{
return false;
}
}
return true;
}
return false;
}
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
}
#endregion
#region MultipleVMsInPool class
private class MultipleVMsInPool : MultipleVMs
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection));
items.AddIfEnabled(new StartVMCommand(mainWindow, selection));
items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection));
items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection));
items.AddIfEnabled(new RebootVMCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new VappStartCommand(mainWindow, selection));
items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new <API key>(mainWindow, selection, true));
items.AddIfEnabled(new ExportCommand(mainWindow, selection));
items.AddIfEnabled(new <API key><VMPP>(mainWindow, selection, true));
items.AddIfEnabled(new <API key><VM_appliance>(mainWindow, selection, true));
items.AddSeparator();
items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection));
items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection));
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.vm, selection);
}
public override bool IsValid(<API key> selection)
{
if (base.IsValid(selection))
{
Pool firstPool = Helpers.GetPoolOfOne(selection[0].Connection);
if (firstPool != null)
{
foreach (SelectedItem item in selection)
{
Pool pool = Helpers.GetPoolOfOne(item.Connection);
if (pool == null || !firstPool.Equals(pool))
{
return false;
}
}
return true;
}
}
return false;
}
}
#endregion
#region <API key> class
private class <API key> : MultipleVMs
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection));
items.AddIfEnabled(new StartVMCommand(mainWindow, selection));
items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection));
items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection));
items.AddIfEnabled(new RebootVMCommand(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddSeparator();
items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection));
items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection));
items.AddIfEnabled(new EditTagsCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.vm, selection);
}
public override bool IsValid(<API key> selection)
{
if (base.IsValid(selection))
{
return !new MultipleVMsInPool().IsValid(selection);
}
return false;
}
}
#endregion
#region MultipleFolders class
private class MultipleFolders : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new DeleteFolderCommand(mainWindow, selection));
items.AddPluginItems(PluginContextMenu.folder, selection);
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<Folder>() && selection.Count > 1;
}
}
#endregion
#region SingleTag class
private class SingleTag : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new DeleteTagCommand(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<GroupingTag>(IsValid) && selection.Count == 1;
}
private static bool IsValid(GroupingTag groupingTag)
{
return groupingTag.Grouping.GroupingName == Messages.TAGS;
}
}
#endregion
#region MultipleTags class
private class MultipleTags : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new DeleteTagCommand(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<GroupingTag>(IsValid) && selection.Count > 1;
}
private static bool IsValid(GroupingTag groupingTag)
{
return groupingTag.Grouping.GroupingName == Messages.TAGS;
}
}
#endregion
#region <API key> class
private class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
DockerContainer vm = (DockerContainer)selection[0].XenObject;
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
if (selection.Count == 1)
{
DockerContainer dockerContainer = selection[0].XenObject as DockerContainer;
return dockerContainer != null;
}
return false;
}
}
#endregion
#region <API key> class
private abstract class <API key> : Builder
{
public override void Build(IMainWindow mainWindow, <API key> selection, <API key> items)
{
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
items.AddIfEnabled(new <API key>(mainWindow, selection));
}
public override bool IsValid(<API key> selection)
{
return selection.AllItemsAre<DockerContainer>();
}
}
#endregion
}
} |
#ifndef <API key>
#define <API key>
#include "ash/ash_export.h"
#include "ash/common/<API key>.h"
#include "base/macros.h"
namespace aura {
class Window;
}
namespace ash {
class <API key>;
class ASH_EXPORT <API key> : public <API key> {
public:
explicit <API key>(
<API key>* <API key>);
~<API key>() override;
static <API key>* Get(aura::Window* window) {
return const_cast<<API key>*>(
Get(const_cast<const aura::Window*>(window)));
}
static const <API key>* Get(const aura::Window* window);
// <API key>:
bool HasShelf() override;
WmShell* GetShell() override;
WmShelf* GetShelf() override;
WmWindow* GetWindow() override;
void <API key>(
views::Widget* widget,
int shell_container_id,
views::Widget::InitParams* init_params) override;
WmWindow* FindEventTarget(const gfx::Point& location_in_screen) override;
gfx::Point <API key>() override;
void <API key>() override;
void <API key>(views::Widget* widget) override;
protected:
// <API key>:
bool <API key>(WmWindow* window) override;
private:
friend class <API key>;
<API key>* <API key>;
<API key>(<API key>);
};
} // namespace ash
#endif // <API key> |
#ifndef OCI_ORACLE
# include <oci.h>
#endif
#ifndef ODCI_ORACLE
# define ODCI_ORACLE
/* SHORT NAMES SUPPORT SECTION */
#ifdef SLSHORTNAME
/* The following are short names that are only supported on IBM mainframes
* with the SLSHORTNAME defined.
* With this all subsequent long names will actually be substituted with
* the short names here
*/
#define ODCIColInfo_ref odcicir
#define ODCIColInfoList odcicil
#define ODCIColInfoList2 odcicil2
#define ODCIIndexInfo_ref odciiir
#define ODCIPredInfo_ref odcipir
#define ODCIRidList odcirl
#define ODCIIndexCtx_ref odciicr
#define ODCIObject_ref odcior
#define ODCIObjectList odciol
#define ODCIQueryInfo_ref odciqir
#define ODCIFuncInfo_ref odcifir
#define ODCICost_ref odcicr
#define ODCIArgDesc_ref odciadr
#define ODCIArgDescList odciadl
#define <API key> odcisor
#define ODCIColInfo odcici
#define ODCIColInfo_ind odcicii
#define ODCIIndexInfo odciii
#define ODCIIndexInfo_ind odciiii
#define ODCIPredInfo odcipi
#define ODCIPredInfo_ind odcipii
#define ODCIIndexCtx odciic
#define ODCIIndexCtx_ind odciici
#define ODCIObject odcio
#define ODCIObject_ind odcioi
#define ODCIQueryInfo odciqi
#define ODCIQueryInfo_ind odciqii
#define ODCIFuncInfo odcifi
#define ODCIFuncInfo_infd odcifii
#define ODCICost odcic
#define ODCICost_ind odcici
#define ODCIArgDesc odciad
#define ODCIArgDesc_ind odciadi
#define ODCIStatsOptions odciso
#define <API key> odcisoi
#define ODCIPartInfo odcipti
#define ODCIPartInfo_ind odciptii
#define ODCIPartInfo_ref odciptir
#define ODCIExtTableInfo odcixt
#define <API key> odcixti
#define <API key> odcixtr
#define ODCIExtTableQCInfo odcixq
#define <API key> odcixqi
#define <API key> odcixqr
#define ODCIFuncCallInfo odcifc
#define ODCIFuncCall_ind odcifci
#define ODCIFuncCall_ref odcifcr
#define ODCIColValList odcicvl
#define ODCIColArrayList odcical
#define ODCIFilterInfoList odciflil
#define ODCIOrderByInfoList odciobil
#define ODCIFilterInfo_ref odciflir
#define ODCIOrderByInfo_ref odciobir
#define <API key> odcicqir
#define ODCIFilterInfo odcifli
#define ODCIOrderByInfo odciobi
#define ODCICompQueryInfo odcicqi
#define ODCIFilterInfo_ind odciflii
#define ODCIOrderByInfo_ind odciobii
#define <API key> odcicqii
#endif /* SLSHORTNAME */
/* Constants for Return Status */
#define ODCI_SUCCESS 0
#define ODCI_ERROR 1
#define ODCI_WARNING 2
#define ODCI_ERROR_CONTINUE 3
#define ODCI_FATAL 4
/* Constants for ODCIPredInfo.Flags */
#define <API key> 0x0001
#define <API key> 0x0002
#define <API key> 0x0004
#define <API key> 0x0008
#define <API key> 0x0010
#define <API key> 0x0020
#define <API key> 0x0040
#define <API key> 0x0080
#define ODCI_PRED_NOT_EQUAL 0x0100
/* Constants for QueryInfo.Flags */
#define <API key> 0x01
#define ODCI_QUERY_ALL_ROWS 0x02
#define ODCI_QUERY_SORT_ASC 0x04
#define <API key> 0x08
#define ODCI_QUERY_BLOCKING 0x10
/* Constants for ScnFlg(Func /w Index Context) */
#define ODCI_CLEANUP_CALL 1
#define ODCI_REGULAR_CALL 2
/* Constants for ODCIFuncInfo.Flags */
#define ODCI_OBJECT_FUNC 0x01
#define ODCI_OBJECT_PKG 0x02
#define ODCI_OBJECT_TYPE 0x04
/* Constants for ODCIArgDesc.ArgType */
#define ODCI_ARG_OTHER 1
#define ODCI_ARG_COL 2 /* column */
#define ODCI_ARG_LIT 3 /* literal */
#define ODCI_ARG_ATTR 4 /* object attribute */
#define ODCI_ARG_NULL 5
#define ODCI_ARG_CURSOR 6
/* Maximum size of ODCIArgDescList array */
#define <API key> 32767
/* Constants for ODCIStatsOptions.Options */
#define ODCI_PERCENT_OPTION 1
#define ODCI_ROW_OPTION 2
/* Constants for ODCIStatsOptions.Flags */
#define ODCI_ESTIMATE_STATS 0x01
#define ODCI_COMPUTE_STATS 0x02
#define ODCI_VALIDATE 0x04
/* Constants for ODCIIndexAlter parameter alter_option */
#define ODCI_ALTIDX_NONE 0
#define ODCI_ALTIDX_RENAME 1
#define ODCI_ALTIDX_REBUILD 2
#define <API key> 3
#define <API key> 4
#define <API key> 5
#define <API key> 6
#define <API key> 7
#define ODCI_ALTIDX_MIGRATE 8
/* Constants for ODCIIndexInfo.IndexInfoFlags */
#define ODCI_INDEX_LOCAL 0x0001
#define <API key> 0x0002
#define <API key> 0x0004
#define ODCI_INDEX_ONLINE 0x0008
#define ODCI_INDEX_PARALLEL 0x0010
#define ODCI_INDEX_UNUSABLE 0x0020
#define ODCI_INDEX_ONIOT 0x0040
#define <API key> 0x0080
#define <API key> 0x0100
#define <API key> 0x0200
#define ODCI_INDEX_UGI 0x0400
/* Constants for ODCIIndexInfo.IndexParaDegree */
#define <API key> 32767
/* Constants for ODCIEnv.EnvFlags */
#define ODCI_DEBUGGING_ON 0x01
#define ODCI_NODATA 0x02
/* Constants for ODCIEnv.CallProperty */
#define ODCI_CALL_NONE 0
#define ODCI_CALL_FIRST 1
#define <API key> 2
#define ODCI_CALL_FINAL 3
#define <API key> 4
#define <API key> 5
#define <API key> 6
#define <API key> 7
#define <API key> 8
/* Constants for ODCIExtTableInfo.OpCode */
#define <API key> 1
#define <API key> 2
/* Constants (bit definitions) for ODCIExtTableInfo.Flag */
/* sampling type: row or block */
#define <API key> 0x00000001
#define <API key> 0x00000002
/* AccessParmClob, AccessParmBlob discriminator */
#define <API key> 0x00000004
#define <API key> 0x00000008
/* Constants for ODCIExtTableInfo.<API key> */
#define ODCI_TRUE 1
#define ODCI_FALSE 0
/* Constants (bit definitions) for ODCIExtTable{Open,Fetch,Populate,Close}
* Flag argument.
*/
#define <API key> 0x00000001 /* caller is Query Coord */
#define <API key> 0x00000002 /* caller is shadow proc */
#define <API key> 0x00000004 /* caller is slave proc */
#define <API key> 0x00000001 /* end-of-stream on fetch */
/* Constants for Flags argument to <API key> */
#define <API key> 1
/* Constants for ODCIColInfo.Flags */
#define <API key> 0x0001
#define <API key> 0x0002
#define <API key> 0x0004
#define <API key> 0x0008
#define <API key> 0x0010
#define <API key> 0x0020
/* Constants for ODCIOrderByInfo.ExprType */
#define ODCI_COLUMN_EXPR 1
#define ODCI_ANCOP_EXPR 2
/* Constants for ODCIOrderByInfo.SortOrder */
#define ODCI_SORT_ASC 1
#define ODCI_SORT_DESC 2
#define ODCI_NULLS_FIRST 4
/* Constants for ODCIPartInfo.PartOp */
#define ODCI_ADD_PARTITION 1
#define ODCI_DROP_PARTITION 2
/*
* These are C mappings for the OTS types defined in catodci.sql
*/
typedef OCIRef ODCIColInfo_ref;
typedef OCIArray ODCIColInfoList;
typedef OCIArray ODCIColInfoList2;
typedef OCIRef ODCIIndexInfo_ref;
typedef OCIRef ODCIPredInfo_ref;
typedef OCIArray ODCIRidList;
typedef OCIRef ODCIIndexCtx_ref;
typedef OCIRef ODCIObject_ref;
typedef OCIArray ODCIObjectList;
typedef OCIRef ODCIQueryInfo_ref;
typedef OCIRef ODCIFuncInfo_ref;
typedef OCIRef ODCICost_ref;
typedef OCIRef ODCIArgDesc_ref;
typedef OCIArray ODCIArgDescList;
typedef OCIRef <API key>;
typedef OCIRef ODCIPartInfo_ref;
typedef OCIRef ODCIEnv_ref;
typedef OCIRef <API key>; /* external table support */
typedef OCIArray ODCIGranuleList; /* external table support */
typedef OCIRef <API key>; /* external table support */
typedef OCIRef <API key>;
typedef OCIArray ODCINumberList;
typedef OCIArray ODCIPartInfoList;
typedef OCIArray ODCIColValList;
typedef OCIArray ODCIColArrayList;
typedef OCIArray ODCIFilterInfoList;
typedef OCIArray ODCIOrderByInfoList;
typedef OCIRef ODCIFilterInfo_ref;
typedef OCIRef ODCIOrderByInfo_ref;
typedef OCIRef <API key>;
struct ODCIColInfo
{
OCIString* TableSchema;
OCIString* TableName;
OCIString* ColName;
OCIString* ColTypName;
OCIString* ColTypSchema;
OCIString* TablePartition;
OCINumber ColFlags;
OCINumber ColOrderPos;
OCINumber TablePartitionIden;
OCINumber TablePartitionTotal;
};
typedef struct ODCIColInfo ODCIColInfo;
struct ODCIColInfo_ind
{
OCIInd atomic;
OCIInd TableSchema;
OCIInd TableName;
OCIInd ColName;
OCIInd ColTypName;
OCIInd ColTypSchema;
OCIInd TablePartition;
OCIInd ColFlags;
OCIInd ColOrderPos;
OCIInd TablePartitionIden;
OCIInd TablePartitionTotal;
};
typedef struct ODCIColInfo_ind ODCIColInfo_ind;
struct ODCIFuncCallInfo
{
struct ODCIColInfo ColInfo;
};
struct <API key>
{
struct ODCIColInfo_ind ColInfo;
};
struct ODCIIndexInfo
{
OCIString* IndexSchema;
OCIString* IndexName;
ODCIColInfoList* IndexCols;
OCIString* IndexPartition;
OCINumber IndexInfoFlags;
OCINumber IndexParaDegree;
OCINumber IndexPartitionIden;
OCINumber IndexPartitionTotal;
};
typedef struct ODCIIndexInfo ODCIIndexInfo;
struct ODCIIndexInfo_ind
{
OCIInd atomic;
OCIInd IndexSchema;
OCIInd IndexName;
OCIInd IndexCols;
OCIInd IndexPartition;
OCIInd IndexInfoFlags;
OCIInd IndexParaDegree;
OCIInd IndexPartitionIden;
OCIInd IndexPartitionTotal;
};
typedef struct ODCIIndexInfo_ind ODCIIndexInfo_ind;
struct ODCIPredInfo
{
OCIString* ObjectSchema;
OCIString* ObjectName;
OCIString* MethodName;
OCINumber Flags;
};
typedef struct ODCIPredInfo ODCIPredInfo;
struct ODCIPredInfo_ind
{
OCIInd atomic;
OCIInd ObjectSchema;
OCIInd ObjectName;
OCIInd MethodName;
OCIInd Flags;
};
typedef struct ODCIPredInfo_ind ODCIPredInfo_ind;
struct ODCIFilterInfo
{
ODCIColInfo ColInfo;
OCINumber Flags;
OCIAnyData *strt;
OCIAnyData *stop;
};
typedef struct ODCIFilterInfo ODCIFilterInfo;
struct ODCIFilterInfo_ind
{
OCIInd atomic;
ODCIColInfo_ind ColInfo;
OCIInd Flags;
OCIInd strt;
OCIInd stop;
};
typedef struct ODCIFilterInfo_ind ODCIFilterInfo_ind;
struct ODCIOrderByInfo
{
OCINumber ExprType;
OCIString *ObjectSchema;
OCIString *TableName;
OCIString *ExprName;
OCINumber SortOrder;
};
typedef struct ODCIOrderByInfo ODCIOrderByInfo;
struct ODCIOrderByInfo_ind
{
OCIInd atomic;
OCIInd ExprType;
OCIInd ObjectSchema;
OCIInd TableName;
OCIInd ExprName;
OCIInd SortOrder;
};
typedef struct ODCIOrderByInfo_ind ODCIOrderByInfo_ind;
struct ODCICompQueryInfo
{
ODCIFilterInfoList *PredInfo;
ODCIOrderByInfoList *ObyInfo;
};
typedef struct ODCICompQueryInfo ODCICompQueryInfo;
struct <API key>
{
OCIInd atomic;
OCIInd PredInfo;
OCIInd ObyInfo;
};
typedef struct <API key> <API key>;
struct ODCIObject
{
OCIString* ObjectSchema;
OCIString* ObjectName;
};
typedef struct ODCIObject ODCIObject;
struct ODCIObject_ind
{
OCIInd atomic;
OCIInd ObjectSchema;
OCIInd ObjectName;
};
typedef struct ODCIObject_ind ODCIObject_ind;
struct ODCIQueryInfo
{
OCINumber Flags;
ODCIObjectList* AncOps;
ODCICompQueryInfo CompInfo;
};
typedef struct ODCIQueryInfo ODCIQueryInfo;
struct ODCIQueryInfo_ind
{
OCIInd atomic;
OCIInd Flags;
OCIInd AncOps;
<API key> CompInfo;
};
typedef struct ODCIQueryInfo_ind ODCIQueryInfo_ind;
struct ODCIIndexCtx
{
struct ODCIIndexInfo IndexInfo;
OCIString* Rid;
struct ODCIQueryInfo QueryInfo;
};
typedef struct ODCIIndexCtx ODCIIndexCtx;
struct ODCIIndexCtx_ind
{
OCIInd atomic;
struct ODCIIndexInfo_ind IndexInfo;
OCIInd Rid;
struct ODCIQueryInfo_ind QueryInfo;
};
typedef struct ODCIIndexCtx_ind ODCIIndexCtx_ind;
struct ODCIFuncInfo
{
OCIString* ObjectSchema;
OCIString* ObjectName;
OCIString* MethodName;
OCINumber Flags;
};
typedef struct ODCIFuncInfo ODCIFuncInfo;
struct ODCIFuncInfo_ind
{
OCIInd atomic;
OCIInd ObjectSchema;
OCIInd ObjectName;
OCIInd MethodName;
OCIInd Flags;
};
typedef struct ODCIFuncInfo_ind ODCIFuncInfo_ind;
struct ODCICost
{
OCINumber CPUcost;
OCINumber IOcost;
OCINumber NetworkCost;
OCIString* IndexCostInfo;
};
typedef struct ODCICost ODCICost;
struct ODCICost_ind
{
OCIInd atomic;
OCIInd CPUcost;
OCIInd IOcost;
OCIInd NetworkCost;
OCIInd IndexCostInfo;
};
typedef struct ODCICost_ind ODCICost_ind;
struct ODCIArgDesc
{
OCINumber ArgType;
OCIString* TableName;
OCIString* TableSchema;
OCIString* ColName;
OCIString* TablePartitionLower;
OCIString* TablePartitionUpper;
OCINumber Cardinality;
};
typedef struct ODCIArgDesc ODCIArgDesc;
struct ODCIArgDesc_ind
{
OCIInd atomic;
OCIInd ArgType;
OCIInd TableName;
OCIInd TableSchema;
OCIInd ColName;
OCIInd TablePartitionLower;
OCIInd TablePartitionUpper;
OCIInd Cardinality;
};
typedef struct ODCIArgDesc_ind ODCIArgDesc_ind;
struct ODCIStatsOptions
{
OCINumber Sample;
OCINumber Options;
OCINumber Flags;
};
typedef struct ODCIStatsOptions ODCIStatsOptions;
struct <API key>
{
OCIInd atomic;
OCIInd Sample;
OCIInd Options;
OCIInd Flags;
};
typedef struct <API key> <API key>;
struct ODCIEnv
{
OCINumber EnvFlags;
OCINumber CallProperty;
OCINumber DebugLevel;
OCINumber CursorNum;
};
typedef struct ODCIEnv ODCIEnv;
struct ODCIEnv_ind
{
OCIInd _atomic;
OCIInd EnvFlags;
OCIInd CallProperty;
OCIInd DebugLevel;
OCIInd CursorNum;
};
typedef struct ODCIEnv_ind ODCIEnv_ind;
struct ODCIPartInfo
{
OCIString* TablePartition;
OCIString* IndexPartition;
OCINumber IndexPartitionIden;
OCINumber PartOp;
};
typedef struct ODCIPartInfo ODCIPartInfo;
struct ODCIPartInfo_ind
{
OCIInd atomic;
OCIInd TablePartition;
OCIInd IndexPartition;
OCIInd IndexPartitionIden;
OCIInd PartOp;
};
typedef struct ODCIPartInfo_ind ODCIPartInfo_ind;
struct ODCIExtTableInfo
{
OCIString* TableSchema;
OCIString* TableName;
ODCIColInfoList* RefCols;
OCIClobLocator* AccessParmClob;
OCIBlobLocator* AccessParmBlob;
ODCIArgDescList* Locations;
ODCIArgDescList* Directories;
OCIString* DefaultDirectory;
OCIString* DriverType;
OCINumber OpCode;
OCINumber AgentNum;
OCINumber GranuleSize;
OCINumber Flag;
OCINumber SamplePercent;
OCINumber MaxDoP;
OCIRaw* SharedBuf;
OCIString* MTableName;
OCIString* MTableSchema;
OCINumber TableObjNo;
};
typedef struct ODCIExtTableInfo ODCIExtTableInfo;
struct <API key>
{
OCIInd _atomic;
OCIInd TableSchema;
OCIInd TableName;
OCIInd RefCols;
OCIInd AccessParmClob;
OCIInd AccessParmBlob;
OCIInd Locations;
OCIInd Directories;
OCIInd DefaultDirectory;
OCIInd DriverType;
OCIInd OpCode;
OCIInd AgentNum;
OCIInd GranuleSize;
OCIInd Flag;
OCIInd SamplePercent;
OCIInd MaxDoP;
OCIInd SharedBuf;
OCIInd MTableName;
OCIInd MTableSchema;
OCIInd TableObjNo;
};
typedef struct <API key> <API key>;
struct ODCIExtTableQCInfo
{
OCINumber NumGranules;
OCINumber NumLocations;
ODCIGranuleList* GranuleInfo;
OCINumber <API key>;
OCINumber MaxDoP;
OCIRaw* SharedBuf;
};
typedef struct ODCIExtTableQCInfo ODCIExtTableQCInfo;
struct <API key>
{
OCIInd _atomic;
OCIInd NumGranules;
OCIInd NumLocations;
OCIInd GranuleInfo;
OCIInd <API key>;
OCIInd MaxDoP;
OCIInd SharedBuf;
};
typedef struct <API key> <API key>;
/* Table Function Info types (used by ODCITablePrepare) */
struct ODCITabFuncInfo
{
ODCINumberList* Attrs;
OCIType* RetType;
};
typedef struct ODCITabFuncInfo ODCITabFuncInfo;
struct ODCITabFuncInfo_ind
{
OCIInd _atomic;
OCIInd Attrs;
OCIInd RetType;
};
typedef struct ODCITabFuncInfo_ind ODCITabFuncInfo_ind;
/* Table Function Statistics types (used by <API key>) */
struct ODCITabFuncStats
{
OCINumber num_rows;
};
typedef struct ODCITabFuncStats ODCITabFuncStats;
struct <API key>
{
OCIInd _atomic;
OCIInd num_rows;
};
typedef struct <API key> <API key>;
#endif /* ODCI_ORACLE */ |
/**
* @module ol/VectorImageTile
*/
import {getUid} from './util.js';
import Tile from './Tile.js';
import TileState from './TileState.js';
import {<API key>} from './dom.js';
import {listen, unlistenByKey} from './events.js';
import {getHeight, getIntersection, getWidth} from './extent.js';
import EventType from './events/EventType.js';
import {loadFeaturesXhr} from './featureloader.js';
import {VOID} from './functions.js';
/**
* @typedef {Object} ReplayState
* @property {boolean} dirty
* @property {null|import("./render.js").OrderFunction} renderedRenderOrder
* @property {number} <API key>
* @property {number} renderedRevision
*/
class VectorImageTile extends Tile {
/**
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {TileState} state State.
* @param {number} sourceRevision Source revision.
* @param {import("./format/Feature.js").default} format Feature format.
* @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
* @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
* @param {import("./Tile.js").UrlFunction} tileUrlFunction Tile url function.
* @param {import("./tilegrid/TileGrid.js").default} sourceTileGrid Tile grid of the source.
* @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid of the renderer.
* @param {Object<string, import("./VectorTile.js").default>} sourceTiles Source tiles.
* @param {number} pixelRatio Pixel ratio.
* @param {import("./proj/Projection.js").default} projection Projection.
* @param {typeof import("./VectorTile.js").default} tileClass Class to
* instantiate for source tiles.
* @param {function(this: import("./source/VectorTile.js").default, import("./events/Event.js").default)} handleTileChange
* Function to call when a source tile's state changes.
* @param {number} zoom Integer zoom to render the tile for.
*/
constructor(tileCoord, state, sourceRevision, format, tileLoadFunction,
urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid, sourceTiles,
pixelRatio, projection, tileClass, handleTileChange, zoom) {
super(tileCoord, state, {transition: 0});
/**
* @private
* @type {!Object<string, <API key>>}
*/
this.context_ = {};
/**
* @private
* @type {import("./featureloader.js").FeatureLoader}
*/
this.loader_;
/**
* @private
* @type {!Object<string, ReplayState>}
*/
this.replayState_ = {};
/**
* @private
* @type {Object<string, import("./VectorTile.js").default>}
*/
this.sourceTiles_ = sourceTiles;
/**
* Keys of source tiles used by this tile. Use with {@link #getTile}.
* @type {Array<string>}
*/
this.tileKeys = [];
/**
* @type {import("./extent.js").Extent}
*/
this.extent = null;
/**
* @type {number}
*/
this.sourceRevision_ = sourceRevision;
/**
* @type {import("./tilecoord.js").TileCoord}
*/
this.wrappedTileCoord = urlTileCoord;
/**
* @type {Array<import("./events.js").EventsKey>}
*/
this.loadListenerKeys_ = [];
/**
* @type {Array<import("./events.js").EventsKey>}
*/
this.<API key> = [];
if (urlTileCoord) {
const extent = this.extent = tileGrid.getTileCoordExtent(urlTileCoord);
const resolution = tileGrid.getResolution(zoom);
const sourceZ = sourceTileGrid.getZForResolution(resolution);
const useLoadedOnly = zoom != tileCoord[0];
let loadCount = 0;
sourceTileGrid.forEachTileCoord(extent, sourceZ, function(sourceTileCoord) {
let sharedExtent = getIntersection(extent,
sourceTileGrid.getTileCoordExtent(sourceTileCoord));
const sourceExtent = sourceTileGrid.getExtent();
if (sourceExtent) {
sharedExtent = getIntersection(sharedExtent, sourceExtent, sharedExtent);
}
if (getWidth(sharedExtent) / resolution >= 0.5 &&
getHeight(sharedExtent) / resolution >= 0.5) {
// only include source tile if overlap is at least 1 pixel
++loadCount;
const sourceTileKey = sourceTileCoord.toString();
let sourceTile = sourceTiles[sourceTileKey];
if (!sourceTile && !useLoadedOnly) {
const tileUrl = tileUrlFunction(sourceTileCoord, pixelRatio, projection);
sourceTile = sourceTiles[sourceTileKey] = new tileClass(sourceTileCoord,
tileUrl == undefined ? TileState.EMPTY : TileState.IDLE,
tileUrl == undefined ? '' : tileUrl,
format, tileLoadFunction);
this.<API key>.push(
listen(sourceTile, EventType.CHANGE, handleTileChange));
}
if (sourceTile && (!useLoadedOnly || sourceTile.getState() == TileState.LOADED)) {
sourceTile.consumers++;
this.tileKeys.push(sourceTileKey);
}
}
}.bind(this));
if (useLoadedOnly && loadCount == this.tileKeys.length) {
this.finishLoading_();
}
if (zoom <= tileCoord[0] && this.state != TileState.LOADED) {
while (zoom > tileGrid.getMinZoom()) {
const tile = new VectorImageTile(tileCoord, state, sourceRevision,
format, tileLoadFunction, urlTileCoord, tileUrlFunction,
sourceTileGrid, tileGrid, sourceTiles, pixelRatio, projection,
tileClass, VOID, --zoom);
if (tile.state == TileState.LOADED) {
this.interimTile = tile;
break;
}
}
}
}
}
/**
* @inheritDoc
*/
disposeInternal() {
this.state = TileState.ABORT;
this.changed();
if (this.interimTile) {
this.interimTile.dispose();
}
for (let i = 0, ii = this.tileKeys.length; i < ii; ++i) {
const sourceTileKey = this.tileKeys[i];
const sourceTile = this.getTile(sourceTileKey);
sourceTile.consumers
if (sourceTile.consumers == 0) {
delete this.sourceTiles_[sourceTileKey];
sourceTile.dispose();
}
}
this.tileKeys.length = 0;
this.sourceTiles_ = null;
this.loadListenerKeys_.forEach(unlistenByKey);
this.loadListenerKeys_.length = 0;
this.<API key>.forEach(unlistenByKey);
this.<API key>.length = 0;
super.disposeInternal();
}
/**
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {<API key>} The rendering context.
*/
getContext(layer) {
const key = getUid(layer);
if (!(key in this.context_)) {
this.context_[key] = <API key>();
}
return this.context_[key];
}
/**
* Get the Canvas for this tile.
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {HTMLCanvasElement} Canvas.
*/
getImage(layer) {
return this.getReplayState(layer).<API key> == -1 ?
null : this.getContext(layer).canvas;
}
/**
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {ReplayState} The replay state.
*/
getReplayState(layer) {
const key = getUid(layer);
if (!(key in this.replayState_)) {
this.replayState_[key] = {
dirty: false,
renderedRenderOrder: null,
renderedRevision: -1,
<API key>: -1
};
}
return this.replayState_[key];
}
/**
* @inheritDoc
*/
getKey() {
return this.tileKeys.join('/') + '-' + this.sourceRevision_;
}
/**
* @param {string} tileKey Key (tileCoord) of the source tile.
* @return {import("./VectorTile.js").default} Source tile.
*/
getTile(tileKey) {
return this.sourceTiles_[tileKey];
}
/**
* @inheritDoc
*/
load() {
// Source tiles with LOADED state - we just count them because once they are
// loaded, we're no longer listening to state changes.
let leftToLoad = 0;
// Source tiles with ERROR state - we track them because they can still have
// an ERROR state after another load attempt.
const errorSourceTiles = {};
if (this.state == TileState.IDLE) {
this.setState(TileState.LOADING);
}
if (this.state == TileState.LOADING) {
this.tileKeys.forEach(function(sourceTileKey) {
const sourceTile = this.getTile(sourceTileKey);
if (sourceTile.state == TileState.IDLE) {
sourceTile.setLoader(this.loader_);
sourceTile.load();
}
if (sourceTile.state == TileState.LOADING) {
const key = listen(sourceTile, EventType.CHANGE, function(e) {
const state = sourceTile.getState();
if (state == TileState.LOADED ||
state == TileState.ERROR) {
const uid = getUid(sourceTile);
if (state == TileState.ERROR) {
errorSourceTiles[uid] = true;
} else {
--leftToLoad;
delete errorSourceTiles[uid];
}
if (leftToLoad - Object.keys(errorSourceTiles).length == 0) {
this.finishLoading_();
}
}
}.bind(this));
this.loadListenerKeys_.push(key);
++leftToLoad;
}
}.bind(this));
}
if (leftToLoad - Object.keys(errorSourceTiles).length == 0) {
setTimeout(this.finishLoading_.bind(this), 0);
}
}
/**
* @private
*/
finishLoading_() {
let loaded = this.tileKeys.length;
let empty = 0;
for (let i = loaded - 1; i >= 0; --i) {
const state = this.getTile(this.tileKeys[i]).getState();
if (state != TileState.LOADED) {
--loaded;
}
if (state == TileState.EMPTY) {
++empty;
}
}
if (loaded == this.tileKeys.length) {
this.loadListenerKeys_.forEach(unlistenByKey);
this.loadListenerKeys_.length = 0;
this.setState(TileState.LOADED);
} else {
this.setState(empty == this.tileKeys.length ? TileState.EMPTY : TileState.ERROR);
}
}
}
export default VectorImageTile;
/**
* Sets the loader for a tile.
* @param {import("./VectorTile.js").default} tile Vector tile.
* @param {string} url URL.
*/
export function defaultLoadFunction(tile, url) {
const loader = loadFeaturesXhr(url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
tile.setLoader(loader);
} |
#include "test-assert.h"
#include <cfloat>
#include <climits>
#include <cstring>
#include <functional>
#include <limits>
#if FMT_USE_TYPE_TRAITS
# include <type_traits>
#endif
#include "gmock/gmock.h"
#include "gtest-extra.h"
#include "mock-allocator.h"
#include "util.h"
// Check if format.h compiles with windows.h included.
#ifdef _WIN32
# include <windows.h>
#endif
#include "fmt/format.h"
#undef max
using fmt::StringRef;
using fmt::internal::Arg;
using fmt::Buffer;
using fmt::internal::MemoryBuffer;
using testing::Return;
using testing::StrictMock;
namespace {
struct Test {};
template <typename Char>
void format_arg(fmt::BasicFormatter<Char> &f, const Char *, Test) {
f.writer() << "test";
}
template <typename Char, typename T>
Arg make_arg(const T &value) {
typedef fmt::internal::MakeValue< fmt::BasicFormatter<Char> > MakeValue;
Arg arg = MakeValue(value);
arg.type = static_cast<Arg::Type>(MakeValue::type(value));
return arg;
}
} // namespace
void CheckForwarding(
MockAllocator<int> &alloc, AllocatorRef< MockAllocator<int> > &ref) {
int mem;
// Check if value_type is properly defined.
AllocatorRef< MockAllocator<int> >::value_type *ptr = &mem;
// Check forwarding.
EXPECT_CALL(alloc, allocate(42, 0)).WillOnce(Return(ptr));
ref.allocate(42, 0);
EXPECT_CALL(alloc, deallocate(ptr, 42));
ref.deallocate(ptr, 42);
}
TEST(AllocatorTest, AllocatorRef) {
StrictMock< MockAllocator<int> > alloc;
typedef AllocatorRef< MockAllocator<int> > TestAllocatorRef;
TestAllocatorRef ref(&alloc);
// Check if AllocatorRef forwards to the underlying allocator.
CheckForwarding(alloc, ref);
TestAllocatorRef ref2(ref);
CheckForwarding(alloc, ref2);
TestAllocatorRef ref3;
EXPECT_EQ(0, ref3.get());
ref3 = ref;
CheckForwarding(alloc, ref3);
}
#if FMT_USE_TYPE_TRAITS
TEST(BufferTest, Noncopyable) {
EXPECT_FALSE(std::<API key><Buffer<char> >::value);
EXPECT_FALSE(std::is_copy_assignable<Buffer<char> >::value);
}
TEST(BufferTest, Nonmoveable) {
EXPECT_FALSE(std::<API key><Buffer<char> >::value);
EXPECT_FALSE(std::is_move_assignable<Buffer<char> >::value);
}
#endif
// A test buffer with a dummy grow method.
template <typename T>
struct TestBuffer : Buffer<T> {
void grow(std::size_t size) { this->capacity_ = size; }
};
template <typename T>
struct MockBuffer : Buffer<T> {
MOCK_METHOD1(do_grow, void (std::size_t size));
void grow(std::size_t size) {
this->capacity_ = size;
do_grow(size);
}
MockBuffer() {}
MockBuffer(T *ptr) : Buffer<T>(ptr) {}
MockBuffer(T *ptr, std::size_t capacity) : Buffer<T>(ptr, capacity) {}
};
TEST(BufferTest, Ctor) {
{
MockBuffer<int> buffer;
EXPECT_EQ(0, &buffer[0]);
EXPECT_EQ(0u, buffer.size());
EXPECT_EQ(0u, buffer.capacity());
}
{
int dummy;
MockBuffer<int> buffer(&dummy);
EXPECT_EQ(&dummy, &buffer[0]);
EXPECT_EQ(0u, buffer.size());
EXPECT_EQ(0u, buffer.capacity());
}
{
int dummy;
std::size_t capacity = std::numeric_limits<std::size_t>::max();
MockBuffer<int> buffer(&dummy, capacity);
EXPECT_EQ(&dummy, &buffer[0]);
EXPECT_EQ(0u, buffer.size());
EXPECT_EQ(capacity, buffer.capacity());
}
}
struct DyingBuffer : TestBuffer<int> {
MOCK_METHOD0(die, void());
~DyingBuffer() { die(); }
};
TEST(BufferTest, VirtualDtor) {
typedef StrictMock<DyingBuffer> StictMockBuffer;
StictMockBuffer *mock_buffer = new StictMockBuffer();
EXPECT_CALL(*mock_buffer, die());
Buffer<int> *buffer = mock_buffer;
delete buffer;
}
TEST(BufferTest, Access) {
char data[10];
MockBuffer<char> buffer(data, sizeof(data));
buffer[0] = 11;
EXPECT_EQ(11, buffer[0]);
buffer[3] = 42;
EXPECT_EQ(42, *(&buffer[0] + 3));
const Buffer<char> &const_buffer = buffer;
EXPECT_EQ(42, const_buffer[3]);
}
TEST(BufferTest, Resize) {
char data[123];
MockBuffer<char> buffer(data, sizeof(data));
buffer[10] = 42;
EXPECT_EQ(42, buffer[10]);
buffer.resize(20);
EXPECT_EQ(20u, buffer.size());
EXPECT_EQ(123u, buffer.capacity());
EXPECT_EQ(42, buffer[10]);
buffer.resize(5);
EXPECT_EQ(5u, buffer.size());
EXPECT_EQ(123u, buffer.capacity());
EXPECT_EQ(42, buffer[10]);
// Check if resize calls grow.
EXPECT_CALL(buffer, do_grow(124));
buffer.resize(124);
EXPECT_CALL(buffer, do_grow(200));
buffer.resize(200);
}
TEST(BufferTest, Clear) {
TestBuffer<char> buffer;
buffer.resize(20);
buffer.clear();
EXPECT_EQ(0u, buffer.size());
EXPECT_EQ(20u, buffer.capacity());
}
TEST(BufferTest, PushBack) {
int data[15];
MockBuffer<int> buffer(data, 10);
buffer.push_back(11);
EXPECT_EQ(11, buffer[0]);
EXPECT_EQ(1u, buffer.size());
buffer.resize(10);
EXPECT_CALL(buffer, do_grow(11));
buffer.push_back(22);
EXPECT_EQ(22, buffer[10]);
EXPECT_EQ(11u, buffer.size());
}
TEST(BufferTest, Append) {
char data[15];
MockBuffer<char> buffer(data, 10);
const char *test = "test";
buffer.append(test, test + 5);
EXPECT_STREQ(test, &buffer[0]);
EXPECT_EQ(5u, buffer.size());
buffer.resize(10);
EXPECT_CALL(buffer, do_grow(12));
buffer.append(test, test + 2);
EXPECT_EQ('t', buffer[10]);
EXPECT_EQ('e', buffer[11]);
EXPECT_EQ(12u, buffer.size());
}
TEST(BufferTest, <API key>) {
char data[19];
MockBuffer<char> buffer(data, 10);
const char *test = "abcdefgh";
buffer.resize(10);
EXPECT_CALL(buffer, do_grow(19));
buffer.append(test, test + 9);
}
TEST(MemoryBufferTest, Ctor) {
MemoryBuffer<char, 123> buffer;
EXPECT_EQ(0u, buffer.size());
EXPECT_EQ(123u, buffer.capacity());
}
#if <API key>
typedef AllocatorRef< std::allocator<char> > TestAllocator;
void check_move_buffer(const char *str,
MemoryBuffer<char, 5, TestAllocator> &buffer) {
std::allocator<char> *alloc = buffer.get_allocator().get();
MemoryBuffer<char, 5, TestAllocator> buffer2(std::move(buffer));
// Move shouldn't destroy the inline content of the first buffer.
EXPECT_EQ(str, std::string(&buffer[0], buffer.size()));
EXPECT_EQ(str, std::string(&buffer2[0], buffer2.size()));
EXPECT_EQ(5u, buffer2.capacity());
// Move should transfer allocator.
EXPECT_EQ(0, buffer.get_allocator().get());
EXPECT_EQ(alloc, buffer2.get_allocator().get());
}
TEST(MemoryBufferTest, MoveCtor) {
std::allocator<char> alloc;
MemoryBuffer<char, 5, TestAllocator> buffer((TestAllocator(&alloc)));
const char test[] = "test";
buffer.append(test, test + 4);
check_move_buffer("test", buffer);
// Adding one more character fills the inline buffer, but doesn't cause
// dynamic allocation.
buffer.push_back('a');
check_move_buffer("testa", buffer);
const char *inline_buffer_ptr = &buffer[0];
// Adding one more character causes the content to move from the inline to
// a dynamically allocated buffer.
buffer.push_back('b');
MemoryBuffer<char, 5, TestAllocator> buffer2(std::move(buffer));
// Move should rip the guts of the first buffer.
EXPECT_EQ(inline_buffer_ptr, &buffer[0]);
EXPECT_EQ("testab", std::string(&buffer2[0], buffer2.size()));
EXPECT_GT(buffer2.capacity(), 5u);
}
void <API key>(const char *str, MemoryBuffer<char, 5> &buffer) {
MemoryBuffer<char, 5> buffer2;
buffer2 = std::move(buffer);
// Move shouldn't destroy the inline content of the first buffer.
EXPECT_EQ(str, std::string(&buffer[0], buffer.size()));
EXPECT_EQ(str, std::string(&buffer2[0], buffer2.size()));
EXPECT_EQ(5u, buffer2.capacity());
}
TEST(MemoryBufferTest, MoveAssignment) {
MemoryBuffer<char, 5> buffer;
const char test[] = "test";
buffer.append(test, test + 4);
<API key>("test", buffer);
// Adding one more character fills the inline buffer, but doesn't cause
// dynamic allocation.
buffer.push_back('a');
<API key>("testa", buffer);
const char *inline_buffer_ptr = &buffer[0];
// Adding one more character causes the content to move from the inline to
// a dynamically allocated buffer.
buffer.push_back('b');
MemoryBuffer<char, 5> buffer2;
buffer2 = std::move(buffer);
// Move should rip the guts of the first buffer.
EXPECT_EQ(inline_buffer_ptr, &buffer[0]);
EXPECT_EQ("testab", std::string(&buffer2[0], buffer2.size()));
EXPECT_GT(buffer2.capacity(), 5u);
}
#endif // <API key>
TEST(MemoryBufferTest, Grow) {
typedef AllocatorRef< MockAllocator<int> > Allocator;
typedef MemoryBuffer<int, 10, Allocator> Base;
MockAllocator<int> alloc;
struct TestMemoryBuffer : Base {
TestMemoryBuffer(Allocator alloc) : Base(alloc) {}
void grow(std::size_t size) { Base::grow(size); }
} buffer((Allocator(&alloc)));
buffer.resize(7);
using fmt::internal::to_unsigned;
for (int i = 0; i < 7; ++i)
buffer[to_unsigned(i)] = i * i;
EXPECT_EQ(10u, buffer.capacity());
int mem[20];
mem[7] = 0xdead;
EXPECT_CALL(alloc, allocate(20, 0)).WillOnce(Return(mem));
buffer.grow(20);
EXPECT_EQ(20u, buffer.capacity());
// Check if size elements have been copied
for (int i = 0; i < 7; ++i)
EXPECT_EQ(i * i, buffer[to_unsigned(i)]);
// and no more than that.
EXPECT_EQ(0xdead, buffer[7]);
EXPECT_CALL(alloc, deallocate(mem, 20));
}
TEST(MemoryBufferTest, Allocator) {
typedef AllocatorRef< MockAllocator<char> > TestAllocator;
MemoryBuffer<char, 10, TestAllocator> buffer;
EXPECT_EQ(0, buffer.get_allocator().get());
StrictMock< MockAllocator<char> > alloc;
char mem;
{
MemoryBuffer<char, 10, TestAllocator> buffer2((TestAllocator(&alloc)));
EXPECT_EQ(&alloc, buffer2.get_allocator().get());
std::size_t size = 2 * fmt::internal::INLINE_BUFFER_SIZE;
EXPECT_CALL(alloc, allocate(size, 0)).WillOnce(Return(&mem));
buffer2.reserve(size);
EXPECT_CALL(alloc, deallocate(&mem, size));
}
}
TEST(MemoryBufferTest, <API key>) {
typedef AllocatorRef< MockAllocator<char> > TestAllocator;
StrictMock< MockAllocator<char> > alloc;
MemoryBuffer<char, 10, TestAllocator> buffer((TestAllocator(&alloc)));
std::size_t size = 2 * fmt::internal::INLINE_BUFFER_SIZE;
std::vector<char> mem(size);
{
EXPECT_CALL(alloc, allocate(size, 0)).WillOnce(Return(&mem[0]));
buffer.resize(size);
std::fill(&buffer[0], &buffer[0] + size, 'x');
}
std::vector<char> mem2(2 * size);
{
EXPECT_CALL(alloc, allocate(2 * size, 0)).WillOnce(Return(&mem2[0]));
std::exception e;
EXPECT_CALL(alloc, deallocate(&mem[0], size)).WillOnce(testing::Throw(e));
EXPECT_THROW(buffer.reserve(2 * size), std::exception);
EXPECT_EQ(&mem2[0], &buffer[0]);
// Check that the data has been copied.
for (std::size_t i = 0; i < size; ++i)
EXPECT_EQ('x', buffer[i]);
}
EXPECT_CALL(alloc, deallocate(&mem2[0], 2 * size));
}
TEST(UtilTest, Increment) {
char s[10] = "123";
increment(s);
EXPECT_STREQ("124", s);
s[2] = '8';
increment(s);
EXPECT_STREQ("129", s);
increment(s);
EXPECT_STREQ("130", s);
s[1] = s[2] = '9';
increment(s);
EXPECT_STREQ("200", s);
}
template <Arg::Type>
struct ArgInfo;
#define ARG_INFO(type_code, Type, field) \
template <> \
struct ArgInfo<Arg::type_code> { \
static Type get(const Arg &arg) { return arg.field; } \
}
ARG_INFO(INT, int, int_value);
ARG_INFO(UINT, unsigned, uint_value);
ARG_INFO(LONG_LONG, fmt::LongLong, long_long_value);
ARG_INFO(ULONG_LONG, fmt::ULongLong, ulong_long_value);
ARG_INFO(BOOL, int, int_value);
ARG_INFO(CHAR, int, int_value);
ARG_INFO(DOUBLE, double, double_value);
ARG_INFO(LONG_DOUBLE, long double, long_double_value);
ARG_INFO(CSTRING, const char *, string.value);
ARG_INFO(STRING, const char *, string.value);
ARG_INFO(WSTRING, const wchar_t *, wstring.value);
ARG_INFO(POINTER, const void *, pointer);
ARG_INFO(CUSTOM, Arg::CustomValue, custom);
#define CHECK_ARG_INFO(Type, field, value) { \
Arg arg = Arg(); \
arg.field = value; \
EXPECT_EQ(value, ArgInfo<Arg::Type>::get(arg)); \
}
TEST(ArgTest, ArgInfo) {
CHECK_ARG_INFO(INT, int_value, 42);
CHECK_ARG_INFO(UINT, uint_value, 42u);
CHECK_ARG_INFO(LONG_LONG, long_long_value, 42);
CHECK_ARG_INFO(ULONG_LONG, ulong_long_value, 42u);
CHECK_ARG_INFO(DOUBLE, double_value, 4.2);
CHECK_ARG_INFO(LONG_DOUBLE, long_double_value, 4.2);
CHECK_ARG_INFO(CHAR, int_value, 'x');
const char STR[] = "abc";
CHECK_ARG_INFO(CSTRING, string.value, STR);
const wchar_t WSTR[] = L"abc";
CHECK_ARG_INFO(WSTRING, wstring.value, WSTR);
int p = 0;
CHECK_ARG_INFO(POINTER, pointer, &p);
Arg arg = Arg();
arg.custom.value = &p;
EXPECT_EQ(&p, ArgInfo<Arg::CUSTOM>::get(arg).value);
}
#define EXPECT_ARG_(Char, type_code, MakeArgType, ExpectedType, value) { \
MakeArgType input = static_cast<MakeArgType>(value); \
Arg arg = make_arg<Char>(input); \
EXPECT_EQ(Arg::type_code, arg.type); \
ExpectedType expected_value = static_cast<ExpectedType>(value); \
EXPECT_EQ(expected_value, ArgInfo<Arg::type_code>::get(arg)); \
}
#define EXPECT_ARG(type_code, Type, value) \
EXPECT_ARG_(char, type_code, Type, Type, value)
#define EXPECT_ARGW(type_code, Type, value) \
EXPECT_ARG_(wchar_t, type_code, Type, Type, value)
TEST(ArgTest, MakeArg) {
// Test bool.
EXPECT_ARG_(char, BOOL, bool, int, true);
EXPECT_ARG_(wchar_t, BOOL, bool, int, true);
// Test char.
EXPECT_ARG(CHAR, char, 'a');
EXPECT_ARG(CHAR, char, CHAR_MIN);
EXPECT_ARG(CHAR, char, CHAR_MAX);
// Test wchar_t.
EXPECT_ARGW(CHAR, wchar_t, L'a');
EXPECT_ARGW(CHAR, wchar_t, WCHAR_MIN);
EXPECT_ARGW(CHAR, wchar_t, WCHAR_MAX);
// Test signed/unsigned char.
EXPECT_ARG(INT, signed char, 42);
EXPECT_ARG(INT, signed char, SCHAR_MIN);
EXPECT_ARG(INT, signed char, SCHAR_MAX);
EXPECT_ARG(UINT, unsigned char, 42);
EXPECT_ARG(UINT, unsigned char, UCHAR_MAX );
// Test short.
EXPECT_ARG(INT, short, 42);
EXPECT_ARG(INT, short, SHRT_MIN);
EXPECT_ARG(INT, short, SHRT_MAX);
EXPECT_ARG(UINT, unsigned short, 42);
EXPECT_ARG(UINT, unsigned short, USHRT_MAX);
// Test int.
EXPECT_ARG(INT, int, 42);
EXPECT_ARG(INT, int, INT_MIN);
EXPECT_ARG(INT, int, INT_MAX);
EXPECT_ARG(UINT, unsigned, 42);
EXPECT_ARG(UINT, unsigned, UINT_MAX);
// Test long.
#if LONG_MAX == INT_MAX
# define LONG INT
# define ULONG UINT
# define long_value int_value
# define ulong_value uint_value
#else
# define LONG LONG_LONG
# define ULONG ULONG_LONG
# define long_value long_long_value
# define ulong_value ulong_long_value
#endif
EXPECT_ARG(LONG, long, 42);
EXPECT_ARG(LONG, long, LONG_MIN);
EXPECT_ARG(LONG, long, LONG_MAX);
EXPECT_ARG(ULONG, unsigned long, 42);
EXPECT_ARG(ULONG, unsigned long, ULONG_MAX);
// Test long long.
EXPECT_ARG(LONG_LONG, fmt::LongLong, 42);
EXPECT_ARG(LONG_LONG, fmt::LongLong, LLONG_MIN);
EXPECT_ARG(LONG_LONG, fmt::LongLong, LLONG_MAX);
EXPECT_ARG(ULONG_LONG, fmt::ULongLong, 42);
EXPECT_ARG(ULONG_LONG, fmt::ULongLong, ULLONG_MAX);
// Test float.
EXPECT_ARG(DOUBLE, float, 4.2);
EXPECT_ARG(DOUBLE, float, FLT_MIN);
EXPECT_ARG(DOUBLE, float, FLT_MAX);
// Test double.
EXPECT_ARG(DOUBLE, double, 4.2);
EXPECT_ARG(DOUBLE, double, DBL_MIN);
EXPECT_ARG(DOUBLE, double, DBL_MAX);
// Test long double.
EXPECT_ARG(LONG_DOUBLE, long double, 4.2);
EXPECT_ARG(LONG_DOUBLE, long double, LDBL_MIN);
EXPECT_ARG(LONG_DOUBLE, long double, LDBL_MAX);
// Test string.
char STR[] = "test";
EXPECT_ARG(CSTRING, char*, STR);
EXPECT_ARG(CSTRING, const char*, STR);
EXPECT_ARG(STRING, std::string, STR);
EXPECT_ARG(STRING, fmt::StringRef, STR);
// Test wide string.
wchar_t WSTR[] = L"test";
EXPECT_ARGW(WSTRING, wchar_t*, WSTR);
EXPECT_ARGW(WSTRING, const wchar_t*, WSTR);
EXPECT_ARGW(WSTRING, std::wstring, WSTR);
EXPECT_ARGW(WSTRING, fmt::WStringRef, WSTR);
int n = 42;
EXPECT_ARG(POINTER, void*, &n);
EXPECT_ARG(POINTER, const void*, &n);
::Test t;
Arg arg = make_arg<char>(t);
EXPECT_EQ(fmt::internal::Arg::CUSTOM, arg.type);
EXPECT_EQ(&t, arg.custom.value);
fmt::MemoryWriter w;
fmt::BasicFormatter<char> formatter(fmt::ArgList(), w);
const char *s = "}";
arg.custom.format(&formatter, &t, &s);
EXPECT_EQ("test", w.str());
}
TEST(UtilTest, ArgList) {
fmt::ArgList args;
EXPECT_EQ(Arg::NONE, args[1].type);
}
struct CustomFormatter {
typedef char Char;
};
void format_arg(CustomFormatter &, const char *&s, const Test &) {
s = "custom_format";
}
TEST(UtilTest, <API key>) {
::Test t;
Arg arg = fmt::internal::MakeValue<CustomFormatter>(t);
CustomFormatter formatter;
const char *s = "";
arg.custom.format(&formatter, &t, &s);
EXPECT_STREQ("custom_format", s);
}
struct Result {
Arg arg;
Result() : arg(make_arg<char>(0xdeadbeef)) {}
template <typename T>
Result(const T& value) : arg(make_arg<char>(value)) {}
Result(const wchar_t *s) : arg(make_arg<wchar_t>(s)) {}
};
struct TestVisitor : fmt::ArgVisitor<TestVisitor, Result> {
Result visit_int(int value) { return value; }
Result visit_uint(unsigned value) { return value; }
Result visit_long_long(fmt::LongLong value) { return value; }
Result visit_ulong_long(fmt::ULongLong value) { return value; }
Result visit_double(double value) { return value; }
Result visit_long_double(long double value) { return value; }
Result visit_char(int value) { return static_cast<char>(value); }
Result visit_cstring(const char *s) { return s; }
Result visit_string(fmt::internal::Arg::StringValue<char> s) {
return s.value;
}
Result visit_wstring(fmt::internal::Arg::StringValue<wchar_t> s) {
return s.value;
}
Result visit_pointer(const void *p) { return p; }
Result visit_custom(fmt::internal::Arg::CustomValue c) {
return *static_cast<const ::Test*>(c.value);
}
};
#define EXPECT_RESULT_(Char, type_code, value) { \
Arg arg = make_arg<Char>(value); \
Result result = TestVisitor().visit(arg); \
EXPECT_EQ(Arg::type_code, result.arg.type); \
EXPECT_EQ(value, ArgInfo<Arg::type_code>::get(result.arg)); \
}
#define EXPECT_RESULT(type_code, value) \
EXPECT_RESULT_(char, type_code, value)
#define EXPECT_RESULTW(type_code, value) \
EXPECT_RESULT_(wchar_t, type_code, value)
TEST(ArgVisitorTest, VisitAll) {
EXPECT_RESULT(INT, 42);
EXPECT_RESULT(UINT, 42u);
EXPECT_RESULT(LONG_LONG, 42ll);
EXPECT_RESULT(ULONG_LONG, 42ull);
EXPECT_RESULT(DOUBLE, 4.2);
EXPECT_RESULT(LONG_DOUBLE, 4.2l);
EXPECT_RESULT(CHAR, 'x');
const char STR[] = "abc";
EXPECT_RESULT(CSTRING, STR);
const wchar_t WSTR[] = L"abc";
EXPECT_RESULTW(WSTRING, WSTR);
const void *p = STR;
EXPECT_RESULT(POINTER, p);
::Test t;
Result result = TestVisitor().visit(make_arg<char>(t));
EXPECT_EQ(Arg::CUSTOM, result.arg.type);
EXPECT_EQ(&t, result.arg.custom.value);
}
struct TestAnyVisitor : fmt::ArgVisitor<TestAnyVisitor, Result> {
template <typename T>
Result visit_any_int(T value) { return value; }
template <typename T>
Result visit_any_double(T value) { return value; }
};
#undef EXPECT_RESULT
#define EXPECT_RESULT(type_code, value) { \
Result result = TestAnyVisitor().visit(make_arg<char>(value)); \
EXPECT_EQ(Arg::type_code, result.arg.type); \
EXPECT_EQ(value, ArgInfo<Arg::type_code>::get(result.arg)); \
}
TEST(ArgVisitorTest, VisitAny) {
EXPECT_RESULT(INT, 42);
EXPECT_RESULT(UINT, 42u);
EXPECT_RESULT(LONG_LONG, 42ll);
EXPECT_RESULT(ULONG_LONG, 42ull);
EXPECT_RESULT(DOUBLE, 4.2);
EXPECT_RESULT(LONG_DOUBLE, 4.2l);
}
struct <API key> :
fmt::ArgVisitor<<API key>, const char *> {
const char *visit_unhandled_arg() { return "test"; }
};
#define EXPECT_UNHANDLED(value) \
EXPECT_STREQ("test", <API key>().visit(make_arg<wchar_t>(value)));
TEST(ArgVisitorTest, VisitUnhandledArg) {
EXPECT_UNHANDLED(42);
EXPECT_UNHANDLED(42u);
EXPECT_UNHANDLED(42ll);
EXPECT_UNHANDLED(42ull);
EXPECT_UNHANDLED(4.2);
EXPECT_UNHANDLED(4.2l);
EXPECT_UNHANDLED('x');
const char STR[] = "abc";
EXPECT_UNHANDLED(STR);
const wchar_t WSTR[] = L"abc";
EXPECT_UNHANDLED(WSTR);
const void *p = STR;
EXPECT_UNHANDLED(p);
EXPECT_UNHANDLED(::Test());
}
TEST(ArgVisitorTest, VisitInvalidArg) {
Arg arg = Arg();
arg.type = static_cast<Arg::Type>(Arg::NONE);
EXPECT_ASSERT(TestVisitor().visit(arg), "invalid argument type");
}
// Tests fmt::internal::count_digits for integer type Int.
template <typename Int>
void test_count_digits() {
for (Int i = 0; i < 10; ++i)
EXPECT_EQ(1u, fmt::internal::count_digits(i));
for (Int i = 1, n = 1,
end = std::numeric_limits<Int>::max() / 10; n <= end; ++i) {
n *= 10;
EXPECT_EQ(i, fmt::internal::count_digits(n - 1));
EXPECT_EQ(i + 1, fmt::internal::count_digits(n));
}
}
TEST(UtilTest, StringRef) {
// Test that StringRef::size() returns string length, not buffer size.
char str[100] = "some string";
EXPECT_EQ(std::strlen(str), StringRef(str).size());
EXPECT_LT(std::strlen(str), sizeof(str));
}
// Check StringRef's comparison operator.
template <template <typename> class Op>
void CheckOp() {
const char *inputs[] = {"foo", "fop", "fo"};
std::size_t num_inputs = sizeof(inputs) / sizeof(*inputs);
for (std::size_t i = 0; i < num_inputs; ++i) {
for (std::size_t j = 0; j < num_inputs; ++j) {
StringRef lhs(inputs[i]), rhs(inputs[j]);
EXPECT_EQ(Op<int>()(lhs.compare(rhs), 0), Op<StringRef>()(lhs, rhs));
}
}
}
TEST(UtilTest, StringRefCompare) {
EXPECT_EQ(0, StringRef("foo").compare(StringRef("foo")));
EXPECT_GT(StringRef("fop").compare(StringRef("foo")), 0);
EXPECT_LT(StringRef("foo").compare(StringRef("fop")), 0);
EXPECT_GT(StringRef("foo").compare(StringRef("fo")), 0);
EXPECT_LT(StringRef("fo").compare(StringRef("foo")), 0);
CheckOp<std::equal_to>();
CheckOp<std::not_equal_to>();
CheckOp<std::less>();
CheckOp<std::less_equal>();
CheckOp<std::greater>();
CheckOp<std::greater_equal>();
}
TEST(UtilTest, CountDigits) {
test_count_digits<uint32_t>();
test_count_digits<uint64_t>();
}
#ifdef _WIN32
TEST(UtilTest, UTF16ToUTF8) {
std::string s = "ёжик";
fmt::internal::UTF16ToUTF8 u(L"\x0451\x0436\x0438\x043A");
EXPECT_EQ(s, u.str());
EXPECT_EQ(s.size(), u.size());
}
TEST(UtilTest, UTF8ToUTF16) {
std::string s = "лошадка";
fmt::internal::UTF8ToUTF16 u(s.c_str());
EXPECT_EQ(L"\x043B\x043E\x0448\x0430\x0434\x043A\x0430", u.str());
EXPECT_EQ(7, u.size());
}
template <typename Converter, typename Char>
void <API key>(
const char *message,
fmt::BasicStringRef<Char> str = fmt::BasicStringRef<Char>(0, 0)) {
fmt::MemoryWriter out;
fmt::internal::<API key>(out, <API key>, message);
fmt::SystemError error(0, "");
try {
(Converter)(str);
} catch (const fmt::SystemError &e) {
error = e;
}
EXPECT_EQ(<API key>, error.error_code());
EXPECT_EQ(out.str(), error.what());
}
TEST(UtilTest, UTF16ToUTF8Error) {
<API key><fmt::internal::UTF16ToUTF8, wchar_t>(
"cannot convert string from UTF-16 to UTF-8");
}
TEST(UtilTest, UTF8ToUTF16Error) {
const char *message = "cannot convert string from UTF-8 to UTF-16";
<API key><fmt::internal::UTF8ToUTF16, char>(message);
<API key><fmt::internal::UTF8ToUTF16, char>(
message, fmt::StringRef("foo", INT_MAX + 1u));
}
TEST(UtilTest, UTF16ToUTF8Convert) {
fmt::internal::UTF16ToUTF8 u;
EXPECT_EQ(<API key>, u.convert(fmt::WStringRef(0, 0)));
EXPECT_EQ(<API key>,
u.convert(fmt::WStringRef(L"foo", INT_MAX + 1u)));
}
#endif // _WIN32
typedef void (*FormatErrorMessage)(
fmt::Writer &out, int error_code, StringRef message);
template <typename Error>
void check_throw_error(int error_code, FormatErrorMessage format) {
fmt::SystemError error(0, "");
try {
throw Error(error_code, "test {}", "error");
} catch (const fmt::SystemError &e) {
error = e;
}
fmt::MemoryWriter message;
format(message, error_code, "test error");
EXPECT_EQ(message.str(), error.what());
EXPECT_EQ(error_code, error.error_code());
}
TEST(UtilTest, FormatSystemError) {
fmt::MemoryWriter message;
fmt::format_system_error(message, EDOM, "test");
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), message.str());
message.clear();
fmt::format_system_error(
message, EDOM, fmt::StringRef(0, std::numeric_limits<size_t>::max()));
EXPECT_EQ(fmt::format("error {}", EDOM), message.str());
}
TEST(UtilTest, SystemError) {
fmt::SystemError e(EDOM, "test");
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), e.what());
EXPECT_EQ(EDOM, e.error_code());
check_throw_error<fmt::SystemError>(EDOM, fmt::format_system_error);
}
TEST(UtilTest, ReportSystemError) {
fmt::MemoryWriter out;
fmt::format_system_error(out, EDOM, "test error");
out << '\n';
EXPECT_WRITE(stderr, fmt::report_system_error(EDOM, "test error"), out.str());
}
#ifdef _WIN32
TEST(UtilTest, FormatWindowsError) {
LPWSTR message = 0;
FormatMessageW(<API key> |
<API key> | <API key>, 0,
ERROR_FILE_EXISTS, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<LPWSTR>(&message), 0, 0);
fmt::internal::UTF16ToUTF8 utf8_message(message);
LocalFree(message);
fmt::MemoryWriter actual_message;
fmt::internal::<API key>(
actual_message, ERROR_FILE_EXISTS, "test");
EXPECT_EQ(fmt::format("test: {}", utf8_message.str()),
actual_message.str());
actual_message.clear();
fmt::internal::<API key>(
actual_message, ERROR_FILE_EXISTS,
fmt::StringRef(0, std::numeric_limits<size_t>::max()));
EXPECT_EQ(fmt::format("error {}", ERROR_FILE_EXISTS), actual_message.str());
}
TEST(UtilTest, <API key>) {
LPWSTR message = 0;
// this error code is not available on all Windows platforms and
// Windows SDKs, so do not fail the test if the error string cannot
// be retrieved.
const int <API key> = 0x80284013L /*<API key>*/;
if (FormatMessageW(<API key> |
<API key> | <API key>, 0,
<API key>, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<LPWSTR>(&message), 0, 0) == 0) {
return;
}
fmt::internal::UTF16ToUTF8 utf8_message(message);
LocalFree(message);
fmt::MemoryWriter actual_message;
fmt::internal::<API key>(
actual_message, <API key>, "test");
EXPECT_EQ(fmt::format("test: {}", utf8_message.str()),
actual_message.str());
}
TEST(UtilTest, WindowsError) {
check_throw_error<fmt::WindowsError>(
ERROR_FILE_EXISTS, fmt::internal::<API key>);
}
TEST(UtilTest, ReportWindowsError) {
fmt::MemoryWriter out;
fmt::internal::<API key>(out, ERROR_FILE_EXISTS, "test error");
out << '\n';
EXPECT_WRITE(stderr,
fmt::<API key>(ERROR_FILE_EXISTS, "test error"), out.str());
}
#endif // _WIN32
enum TestEnum2 {};
TEST(UtilTest, ConvertToInt) {
EXPECT_TRUE(fmt::internal::ConvertToInt<char>::enable_conversion);
EXPECT_FALSE(fmt::internal::ConvertToInt<const char *>::enable_conversion);
EXPECT_TRUE(fmt::internal::ConvertToInt<TestEnum2>::value);
}
#if FMT_USE_ENUM_BASE
enum TestEnum : char {TestValue};
TEST(UtilTest, <API key>) {
EXPECT_TRUE(fmt::internal::ConvertToInt<TestEnum>::enable_conversion);
}
#endif
template <typename T>
bool check_enable_if(
typename fmt::internal::EnableIf<sizeof(T) == sizeof(int), T>::type *) {
return true;
}
template <typename T>
bool check_enable_if(
typename fmt::internal::EnableIf<sizeof(T) != sizeof(int), T>::type *) {
return false;
}
TEST(UtilTest, EnableIf) {
int i = 0;
EXPECT_TRUE(check_enable_if<int>(&i));
char c = 0;
EXPECT_FALSE(check_enable_if<char>(&c));
}
TEST(UtilTest, Conditional) {
int i = 0;
fmt::internal::Conditional<true, int, char>::type *pi = &i;
(void)pi;
char c = 0;
fmt::internal::Conditional<false, int, char>::type *pc = &c;
(void)pc;
}
struct TestLConv {
char *thousands_sep;
};
struct EmptyLConv {};
TEST(UtilTest, ThousandsSep) {
char foo[] = "foo";
TestLConv lc = {foo};
EXPECT_EQ("foo", fmt::internal::thousands_sep(&lc).to_string());
EmptyLConv empty_lc;
EXPECT_EQ("", fmt::internal::thousands_sep(&empty_lc));
} |
""" Test imageio avbin functionality.
"""
from pytest import raises
from imageio.testing import run_tests_if_main, get_test_dir, need_internet
import imageio
from imageio import core
from imageio.core import get_remote_file
# if IS_PYPY:
# skip('AVBIn not supported on pypy')
test_dir = get_test_dir()
mean = lambda x: x.sum() / x.size # pypy-compat mean
def test_select():
fname1 = get_remote_file('images/cockatoo.mp4', test_dir)
F = imageio.formats['avbin']
assert F.name == 'AVBIN'
assert F.can_read(core.Request(fname1, 'rI'))
assert not F.can_write(core.Request(fname1, 'wI'))
assert not F.can_read(core.Request(fname1, 'ri'))
assert not F.can_read(core.Request(fname1, 'rv'))
# ffmpeg is default
#formats = imageio.formats
#assert formats['.mp4'] is F
#assert formats.search_write_format(core.Request(fname1, 'wI')) is F
#assert formats.search_read_format(core.Request(fname1, 'rI')) is F
def test_read():
need_internet()
R = imageio.read(get_remote_file('images/cockatoo.mp4'), 'avbin')
assert R.format is imageio.formats['avbin']
fname = get_remote_file('images/cockatoo.mp4', force_download='2014-11-05')
reader = imageio.read(fname, 'avbin')
assert reader.get_length() == 280
assert 'fps' in reader.get_meta_data()
raises(Exception, imageio.save, '~/foo.mp4', 'abin')
#assert not reader.format.can_write(core.Request('test.mp4', 'wI'))
for i in range(10):
im = reader.get_next_data()
assert im.shape == (720, 1280, 3)
# todo: fix this
#assert mean(im) > 100 and mean(im) < 115 KNOWN FAIL
# We can rewind
reader.get_data(0)
# But not seek
with raises(IndexError):
reader.get_data(4)
def test_reader_more():
need_internet()
fname1 = get_remote_file('images/cockatoo.mp4')
fname3 = fname1[:-4] + '.stub.mp4'
# Get meta data
R = imageio.read(fname1, 'avbin', loop=True)
meta = R.get_meta_data()
assert isinstance(meta, dict)
assert 'fps' in meta
R.close()
# Read all frames and test length
R = imageio.read(get_remote_file('images/realshort.mp4'), 'avbin')
count = 0
while True:
try:
R.get_next_data()
except IndexError:
break
else:
count += 1
assert count == len(R)
assert count in (35, 36) # allow one frame off size that we know
# Test index error -1
raises(IndexError, R.get_data, -1)
# Test loop
R = imageio.read(get_remote_file('images/realshort.mp4'), 'avbin', loop=1)
im1 = R.get_next_data()
for i in range(1, len(R)):
R.get_next_data()
im2 = R.get_next_data()
im3 = R.get_data(0)
assert (im1 == im2).all()
assert (im1 == im3).all()
R.close()
# Test size when skipping empty frames, are there *any* valid frames?
# todo: use mimread once 1) len(R) == inf, or 2) len(R) is correct
R = imageio.read(get_remote_file('images/realshort.mp4'),
'avbin', skipempty=True)
ims = []
with R:
try:
while True:
ims.append(R.get_next_data())
except IndexError:
pass
assert len(ims) > 20 # todo: should be 35/36 but with skipempty ...
# Read invalid
open(fname3, 'wb')
raises(IOError, imageio.read, fname3, 'avbin')
def test_read_format():
need_internet()
# Set videofomat
# Also set skipempty, so we can test mean
reader = imageio.read(get_remote_file('images/cockatoo.mp4'), 'avbin',
videoformat='mp4', skipempty=True)
for i in range(10):
im = reader.get_next_data()
assert im.shape == (720, 1280, 3)
assert mean(im) > 100 and mean(im) < 115
def test_stream():
need_internet()
with raises(IOError):
imageio.read(get_remote_file('images/cockatoo.mp4'), 'avbin', stream=5)
def test_invalidfile():
need_internet()
filename = test_dir+'/empty.mp4'
with open(filename, 'w'):
pass
with raises(IOError):
imageio.read(filename, 'avbin')
# Check AVbinResult
imageio.plugins.avbin.AVbinResult(imageio.plugins.avbin.AVBIN_RESULT_OK)
for i in (2, 3, 4):
with raises(RuntimeError):
imageio.plugins.avbin.AVbinResult(i)
def show_in_mpl():
reader = imageio.read('cockatoo.mp4', 'avbin')
for i in range(10):
reader.get_next_data()
import pylab
pylab.ion()
pylab.show(reader.get_next_data())
def show_in_visvis():
reader = imageio.read('cockatoo.mp4', 'avbin')
#reader = imageio.read('<video0>')
import visvis as vv
im = reader.get_next_data()
f = vv.clf()
f.title = reader.format.name
t = vv.imshow(im, clim=(0, 255))
while not f._destroyed:
t.SetData(reader.get_next_data())
vv.processEvents()
run_tests_if_main() |
int x;
int
foo()
{
x = x + 1;
return 1;
}
int
bar()
{
x = x + 2;
return 2;
}
main()
{
int v;
x = 0;
v = (foo(),bar());
if(v != 2)
return 1;
if(x != 3)
return 2;
return 0;
} |
var <API key> = function(options){
this._quadtree = undefined;
this._url = (options.url)? options.url : undefined; // URL
this._viewer = options.viewer; // viewer
this._cacheTiles = {};
this._showTiles = [];
//this._tilingScheme = new Cesium.<API key>();
this._tilingScheme = new Cesium.<API key>();
this._errorEvent = new Cesium.Event();
this.<API key> = Cesium.<API key>.<API key>(this._tilingScheme);
this._range = {
_north: 46.179830, //lat
_south: 19.756364, //lat
_east: 154.819336, //lon
_west: 122.343750, //lon
tiles: [] // tiles[z].north, tiles[z].south, tiles[z].east, tiles[z].west
};
this._maxLevel = 15;
this._currentLevel = 0;
this._show = true;
this.show = function(bool){
this._show = bool;
};
this._stylejs = undefined;
var that = this;
(function(url){
var styleurl = url.replace(/\{z\}\/\{x\}\/\{y\}.*$/, "style.js");
styleurl = 'http://' + location.host + location.pathname.substr(0, location.pathname.lastIndexOf('/')+1) + styleurl;
$.ajax({
type: "GET",
url: styleurl,
async: true,
ifModified: true,
dataType:"json",
crossDomain:true,
success: function(res){
if(res){
console.log(that);
that._stylejs = res;
}
},
error: function(res){
that._stylejs = {};
}
});
}(this._url));
this._styleObj = {
"annoproperties" :{
"class":"",
"rID":" ID",
"lfSpanFr":"",
"lfSpanTo":"",
"tmpFlg":"",
"orgGILvl":"",
"ftCode":"",
"admCode":"",
"devDate":"",
"annoCtg":"",
"knj":"",
"kana":"",
"arrng":"",
"arrngAgl":"",
"repPt":"",
"gaiji":"",
"noChar":"",
/*
"charG1":"1",
"charG2":"2",
"charG3":"3",
"charG4":"4",
"charG5":"5",
"charG6":"6",
"charG7":"7",
"charG8":"8",
"charG9":"9",
"charG10":"10",
"charG11":"11",
"charG12":"12",
"charG13":"13",
"charG14":"14",
"charG15":"15",
"charG16":"16",
"charG17":"17",
"charG18":"18",
"charG19":"19",
"charG20":"20",
"charG21":"21",
"charG22":"22"
*/
},
"annostyle" : {
"": {"size": 32.5,"color": "#000000"},
"": {"size": 18.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 32.5,"color": "#000000"},
"": {"size": 20.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 17.5,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 13.8,"color": "#005a3c"},
"": {"size": 20.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#005a3c"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#0000ff"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 13.8,"color": "#000000"},
"": {"size": 10.0,"color": "#000000"},
"": {"size": 11.3,"color": "#000000"},
"": {"size": 15.0,"color": "#000000"}
}
};
};
Object.defineProperties(<API key>.prototype, {
quadtree : {
get : function() {
return this._quadtree;
},
set : function(value) {
this._quadtree = value;
}
},
ready : {
get : function() {
return true;
}
},
tilingScheme : {
get : function() {
return this._tilingScheme;
}
},
errorEvent : {
get : function() {
return this._errorEvent;
}
}
});
<API key>.prototype.initialize = function(frameState) {
};
//<API key>.prototype.beginUpdate = function(context, frameState, commandList) {
<API key>.prototype.beginUpdate = function(frameState) {
if ( this._show )
{
this._currentLevel = this.getCurrentZoom();
this.quadtree.beginFrame(frameState);
}
};
/*
* Cesium.jsendUpdate
*/
//<API key>.prototype.endUpdate = function(context, frameState, commandList) {
<API key>.prototype.endUpdate = function(frameState) {
if ( this._show )
{
this._quadtree.endFrame(frameState);
}
/*
//
var renderList = [];
var tilesToRender = this._quadtree._tilesToRender;
for(var i=0, len=tilesToRender.length; i<len; i++){
var item = tilesToRender[i];
renderList.push(item._x+"/"+item._y+"/"+item._level);
}
// showTiles
var keyList = [];
for(var i=0, len=this._showTiles.length; i<len; i++){
var key = this._showTiles[i];
if(renderList.indexOf(key) == -1 ){
keyList.push(key);
}
}
for(var i=0, len=keyList.length; i<len; i++){
var key = keyList[i];
// showTiles
var idx = this._showTiles.indexOf(key);
this._showTiles.splice(idx, 1);
// LabelCollection
for(var j=this._viewer.scene._primitives._primitives.length-1; j>=0; j--){
var labelCollection = this._viewer.scene._primitives._primitives[j];
if(labelCollection.key == key){
var res = this._viewer.scene._primitives.remove(labelCollection);
}
}
}
*/
};
<API key>.prototype.updateForPick = function(frameState) {
//console.log("japan updateForPick:", frameState);
};
<API key>.prototype.cancelReprojections = function() {
//console.log("japan cancelReprojections");
};
<API key>.prototype.<API key> = function(level) {
//console.log("japan <API key>", level);
return this.<API key> / (1 << level);
};
/*
* Cesium.jsprocessTileLoadQueue
*/
<API key>.prototype.loadTile = function( frameState, tile) {
if ( !this.isNeedTile(frameState, tile) )
{
return;
}
var x = tile.x, y = tile.y, level = tile.level;
var key = x + "/" + y + "/" + level;
var that = this;
if(tile.state === Cesium.<API key>.LOADING) {
if(tile.data===undefined){
return;
}
if ( tile.data && tile.data.primitive )
{
if ( tile.data.primitive.update )
tile.data.primitive.update( frameState, []);
if (tile.data.primitive.ready) {
tile.state = Cesium.<API key>.DONE;
tile.renderable = true;
}
}
return;
}
if(tile.state === Cesium.<API key>.START){
tile.state = Cesium.<API key>.FAILED;
// geojson
var url = this.buildUrl(this._url, x, y, level);
$.ajax({
type: "GET",
url: url,
async: true,
ifModified: true,
dataType:"json",
crossDomain:true,
success: function(res){
if(res){
that.drawGeojson(res, x, y, level);
}
},
// (404)
error: function(res){
geojson = null;
},
// (successerror)
complete: function(){
if (tile.state === Cesium.<API key>.FAILED) {
that.addTileData(frameState, tile);
Cesium.Cartesian3.fromElements(tile.data.boundingSphere2D.center.z, tile.data.boundingSphere2D.center.x, tile.data.boundingSphere2D.center.y, tile.data.boundingSphere2D.center);
}
tile.state = Cesium.<API key>.LOADING;
}
});
}
};
<API key>.prototype.isNeedTile = function(frameState, tile) {
// Reject1
if ( tile.level > this._currentLevel || tile.level > this._maxLevel )
{
return false;
}
// Reject2
if ( this._range.tiles.length == 0 ) this.initRangeTiles();
if ( tile.x < this._range.tiles[tile.level].west || tile.x > this._range.tiles[tile.level].east || tile.y < this._range.tiles[tile.level].north || tile.y > this._range.tiles[tile.level].south )
{
this.addTileData(frameState, tile);
tile.state = Cesium.<API key>.DONE;
tile.renderable = true;
return false;
}
return true;
};
<API key>.prototype.addTileData = function(frameState, tile){
tile.data = {
primitive : undefined,
freeResources : function() {
if (Cesium.defined(this.primitive)) {
this.primitive.destroy();
this.primitive = undefined;
}
}
};
// alpha255
//var color = Cesium.Color.fromBytes(255, 0, 0, 255);
var color = Cesium.Color.fromBytes(255, 0, 0, 0);
tile.data.primitive = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.<API key>({
rectangle : tile.rectangle
}),
attributes : {
color : Cesium.<API key>.fromColor(color)
}
}),
appearance : new Cesium.<API key>({
flat : true
})
});
tile.data.boundingSphere3D = Cesium.BoundingSphere.fromRectangle3D(tile.rectangle);
tile.data.boundingSphere2D = Cesium.BoundingSphere.fromRectangle2D(tile.rectangle, frameState.mapProjection);
};
<API key>.prototype.buildUrl = function(url, x, y, level){
var url = url.replace("{z}", level).replace("{x}", x).replace("{y}", y);
return url;
}
<API key>.prototype.hexToRgb = function(hex){
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
/**
* geojson
*
* @param geojson geojson
*/
<API key>.prototype.drawGeojson = function(geojson, x, y, level){
//console.log("stylejs:", this._stylejs);
var that = this;
var key = x+"/"+y+"/"+level;
if(this._cacheTiles[key]){
return;
}else{
this._cacheTiles[key] = [];
}
for(var i=0; i<geojson.features.length; i++){
var feature = geojson.features[i];
var coord = feature.geometry.coordinates;
var labelObj = {
"position" : new Cesium.Cartesian3.fromDegrees(coord[0], coord[1]),
"text" : feature.properties.knj,
"style" : Cesium.LabelStyle.FILL_AND_OUTLINE,
"outlineColor" : Cesium.Color.WHITE,
"outlineWidth" : 3.0,
"fillColor" : this.getLabelColor(feature.properties),
"font" : this.getFont(feature.properties),
"fontY" : 18,
"verticalOrigin" : Cesium.VerticalOrigin.CENTER,
"strokeWidth" : 2.0,
"strokeColor" : Cesium.Color.WHITE,
"stroke" : true,
"pixelOffset" : new Cesium.Cartesian2(0, -70),
"heightReference" : Cesium.HeightReference.CLAMP_TO_GROUND,
"description" : this.getDescription(feature.properties),
"name" : feature.properties.knj,
};
this._cacheTiles[key].push(labelObj);
}
}
<API key>.prototype.getDegArr = function(geom){
var arr = [];
if(geom.type == "LineString"){
for(var i=0, len1=geom.coordinates.length; i<len1; i++){
var coord = geom.coordinates[i]
arr.push(coord[0]);
arr.push(coord[1]);
}
}else if(geom.type == "Polygon"){
for(var i=0, len1=geom.coordinates.length; i<len1; i++){
for(var j=0, len2=geom.coordinates[i].length; j<len2; j++){
var coord = geom.coordinates[i][j]
Array.prototype.push.apply(arr, coord);
}
}
}
return arr;
}
/*
<API key>.prototype.getDegArr = function(geom){
var arr = [];
for(var i=0, len1=geom.coordinates.length; i<len1; i++){
for(var j=0, len2=geom.coordinates[i].length; j<len2; j++){
arr.push(geom.coordinates[i][j][0]);
arr.push(geom.coordinates[i][j][1]);
}
}
return arr;
}
*/
/**
*
*
* @param prop ()
*/
<API key>.prototype.getLabelColor = function(prop){
var style = this._styleObj.annostyle;
var color = style[prop.annoCtg].color;
var rgb = this.hexToRgb(color);
var cesiumColor = new Cesium.Color(rgb.r/255, rgb.g/255, rgb.b/255, 1.0);
return cesiumColor;
};
/**
*
*
* @param prop ()
*/
<API key>.prototype.getFont = function(prop){
var style = this._styleObj.annostyle;
var size = style[prop.annoCtg].size;
size = size + (size*0.5);
return 'bold '+size+'px ""';
};
/**
* infobox
*
* @param prop ()
*/
<API key>.prototype.getDescription = function(prop){
var style = this._styleObj.annoproperties;
var str = "";
for(var key in style){
str += "<tr><td>" + style[key] + "</td><td>" + prop[key] + "</td></tr>";
}
str = "<table>"+str+"</table>";
return str;
};
<API key>.prototype.<API key> = function(tile, frameState, occluders) {
var boundingSphere;
if (frameState.mode === Cesium.SceneMode.SCENE3D) {
boundingSphere = tile.data.boundingSphere3D;
} else {
boundingSphere = tile.data.boundingSphere2D;
}
var rtn = frameState.cullingVolume.computeVisibility(boundingSphere);
return rtn;
};
/*
* Cesium.jscreateRenderCommandsForSelectedTiles
*/
<API key>.prototype.showTileThisFrame = function(tile, context, frameState, commandList){
var key = tile._x+"/"+tile._y+"/"+tile._level;
var that = this;
if(this._cacheTiles[key]){
if(this._showTiles.indexOf(key) == -1){
this._showTiles.push(key);
// LabelCollection
var LabelCollection = new Cesium.BillboardCollection({
scene : this._viewer.scene
});
LabelCollection["type"] = "<API key>";
LabelCollection["key"] = key;
//this._viewer.scene.primitives.add(LabelCollection);
var labels = this._viewer.scene.primitives.add(LabelCollection);
// LabelCollection
for(var i=0, len=this._cacheTiles[key].length; i<len; i++){
var labelObj = this._cacheTiles[key][i];
var label = LabelCollection.add({
position : labelObj.position,
pixelOffset: labelObj.pixelOffset,
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
scaleByDistance : new Cesium.NearFarScalar(1.0e2, 1.5, 1.0e5, 0.0),
image : Cesium.writeTextToCanvas(labelObj.name, labelObj),
show: that._show
});
label["type"] = "clickPrimitive";
//label["fontY"] = labelObj["fontY"];
label["description"] = labelObj["description"];
label["name"] = labelObj["name"];
}
}
}
tile.data.primitive.update(context, frameState, commandList);
};
var subtractScratch = new Cesium.Cartesian3();
<API key>.prototype.<API key> = function(tile, frameState) {
var boundingSphere;
if (frameState.mode === Cesium.SceneMode.SCENE3D) {
boundingSphere = tile.data.boundingSphere3D;
} else {
boundingSphere = tile.data.boundingSphere2D;
}
return Math.max(0.0, Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(boundingSphere.center, frameState.camera.positionWC, subtractScratch)) - boundingSphere.radius);
};
<API key>.prototype.isDestroyed = function() {
return false;
};
<API key>.prototype.destroy = function() {
return Cesium.destroyObject(this);
};
<API key>.prototype.getCurrentZoom = function() {
var zoom = 1;
var tilesToRender = this._viewer.scene.globe._surface._tilesToRender;
//this.getZoomLevel();
if ( Cesium.defined( tilesToRender ) )
{
var levels = [];
var levelTotal = 0;
for( var i=0; i<tilesToRender.length; i++ )
levelTotal += tilesToRender[i]._level;
if ( tilesToRender.length > 0 )
zoom = parseInt( Math.round( levelTotal / tilesToRender.length ) );
if ( zoom < 2 ) zoom = 2;
if ( zoom > 18 ) zoom = 18;
}
return zoom;
};
// Geojson
<API key>.prototype.initRangeTiles = function() {
var lt = Cesium.Cartographic.fromDegrees(this._range._west, this._range._north, 0);
var rb = Cesium.Cartographic.fromDegrees(this._range._east, this._range._south, 0);
for ( var z=0; z<=18; z++ )
{
var ltxy = this._tilingScheme.positionToTileXY(lt, z);
var rbxy = this._tilingScheme.positionToTileXY(rb, z);
this._range.tiles[z] = {
north: ltxy.y,
south: rbxy.y,
west: ltxy.x,
east: rbxy.x
};
}
//console.log(this._range.tiles);
};
<API key>.prototype.show = function(bool){
this._show = bool;
};
<API key>.prototype.drawRect = function(rectangle){
var color = Cesium.Color.fromBytes(0, 0, 255, 70);
var g = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : rectangle
}),
attributes : {
color : Cesium.<API key>.fromColor(color)
}
});
/*
var g = new Cesium.GeometryInstance({
geometry : new Cesium.<API key>({
rectangle : rectangle
}),
attributes : {
color : Cesium.<API key>.fromColor(color)
}
});
*/
var p = new Cesium.Primitive({
geometryInstances : g,
appearance : new Cesium.<API key>({
flat : true
})
});
this._viewer.scene.primitives.add(p);
}; |
# revision identifiers, used by Alembic.
revision = '435d360d3398'
down_revision = '2a68ba66c32b'
from alembic import op
import sqlalchemy as sa
def upgrade():
commands auto generated by Alembic - please adjust!
op.add_column('<API key>', sa.Column('category', sa.Unicode(length=255), nullable=True))
op.add_column('<API key>', sa.Column('position', sa.Integer(), nullable=True))
op.create_index(u'<API key>', '<API key>', ['category'], unique=False)
op.create_index(u'<API key>', '<API key>', ['position'], unique=False)
end Alembic commands
def downgrade():
commands auto generated by Alembic - please adjust!
op.drop_index(u'<API key>', table_name='<API key>')
op.drop_index(u'<API key>', table_name='<API key>')
op.drop_column('<API key>', 'position')
op.drop_column('<API key>', 'category')
end Alembic commands |
// modification, are permitted provided that the following conditions are met:
// and/or other materials provided with the distribution.
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define WL_EGL_PLATFORM 1
#define _POSIX_C_SOURCE 200112 // glib feature macro for unsetenv()
#include <stdlib.h>
#include <dlfcn.h>
#include "waffle_wayland.h"
#include "wcore_error.h"
#include "linux_platform.h"
#include "wegl_config.h"
#include "wegl_context.h"
#include "wegl_platform.h"
#include "wegl_util.h"
#include "wayland_display.h"
#include "wayland_platform.h"
#include "wayland_window.h"
#include "wayland_wrapper.h"
static const char *libwl_egl_filename = "libwayland-egl.so.1";
static const struct wcore_platform_vtbl <API key>;
static bool
<API key>(struct wcore_platform *wc_self)
{
struct wayland_platform *self = wayland_platform(wegl_platform(wc_self));
bool ok = true;
int error;
if (!self)
return true;
unsetenv("EGL_PLATFORM");
if (self->linux)
ok &= <API key>(self->linux);
if (self->dl_wl_egl) {
error = dlclose(self->dl_wl_egl);
if (error) {
ok &= false;
wcore_errorf(<API key>,
"dlclose(\"%s\") failed: %s",
libwl_egl_filename, dlerror());
}
}
ok &= <API key>();
ok &= <API key>(&self->wegl);
free(self);
return ok;
}
struct wcore_platform*
<API key>(void)
{
struct wayland_platform *self;
bool ok = true;
self = wcore_calloc(sizeof(*self));
if (self == NULL)
return NULL;
ok = wegl_platform_init(&self->wegl);
if (!ok)
goto error;
ok = <API key>();
if (!ok)
goto error;
self->dl_wl_egl = dlopen(libwl_egl_filename, RTLD_LAZY | RTLD_LOCAL);
if (!self->dl_wl_egl) {
wcore_errorf(WAFFLE_ERROR_FATAL,
"dlopen(\"%s\") failed: %s",
libwl_egl_filename, dlerror());
goto error;
}
#define <API key>(function) \
self->function = dlsym(self->dl_wl_egl, #function); \
if (!self->function) { \
wcore_errorf(WAFFLE_ERROR_FATAL, \
"dlsym(\"%s\", \"" #function "\") failed: %s", \
libwl_egl_filename, dlerror()); \
goto error; \
}
<API key>(<API key>);
<API key>(<API key>);
<API key>(<API key>);
#undef <API key>
self->linux = <API key>();
if (!self->linux)
goto error;
setenv("EGL_PLATFORM", "wayland", true);
self->wegl.wcore.vtbl = &<API key>;
return &self->wegl.wcore;
error:
<API key>(&self->wegl.wcore);
return NULL;
}
static bool
wayland_dl_can_open(struct wcore_platform *wc_self,
int32_t waffle_dl)
{
struct wayland_platform *self = wayland_platform(wegl_platform(wc_self));
return <API key>(self->linux, waffle_dl);
}
static void*
wayland_dl_sym(struct wcore_platform *wc_self,
int32_t waffle_dl,
const char *name)
{
struct wayland_platform *self = wayland_platform(wegl_platform(wc_self));
return <API key>(self->linux, waffle_dl, name);
}
static union <API key>*
<API key>(struct wcore_config *wc_config)
{
struct wegl_config *config = wegl_config(wc_config);
struct wayland_display *dpy = wayland_display(wc_config->display);
union <API key> *n_config;
<API key>(n_config, wayland);
if (!n_config)
return NULL;
<API key>(dpy, &n_config->wayland->display);
n_config->wayland->egl_config = config->egl;
return n_config;
}
static union <API key>*
<API key>(struct wcore_context *wc_ctx)
{
struct wayland_display *dpy = wayland_display(wc_ctx->display);
struct wegl_context *ctx = wegl_context(wc_ctx);
union <API key> *n_ctx;
<API key>(n_ctx, wayland);
if (!n_ctx)
return NULL;
<API key>(dpy, &n_ctx->wayland->display);
n_ctx->wayland->egl_context = ctx->egl;
return n_ctx;
}
static const struct wcore_platform_vtbl <API key> = {
.destroy = <API key>,
.make_current = wegl_make_current,
.get_proc_address = <API key>,
.dl_can_open = wayland_dl_can_open,
.dl_sym = wayland_dl_sym,
.display = {
.connect = <API key>,
.destroy = <API key>,
.<API key> = <API key>,
.get_native = <API key>,
},
.config = {
.choose = wegl_config_choose,
.destroy = wegl_config_destroy,
.get_native = <API key>,
},
.context = {
.create = wegl_context_create,
.destroy = <API key>,
.get_native = <API key>,
},
.window = {
.create = <API key>,
.destroy = <API key>,
.show = wayland_window_show,
.swap_buffers = <API key>,
.resize = <API key>,
.get_native = <API key>,
},
}; |
(function($){
var settings = {
'sort': false,
'sort-attr': 'data-priority',
'sort-desc': false,
'autoselect': true,
'<API key>': true,
'<API key>': '<API key>',
'<API key>': true,
'<API key>': true,
'autocomplete-plugin': 'jquery_ui',
'relevancy-sorting': true,
'<API key>': 1,
'<API key>': 5,
'<API key>': '<API key>',
<API key>: function( context ) {
context.$text_field.val( context.$select_field.find('option:selected:first').text() );
},
handle_select_field: function( $select_field ) {
return $select_field.hide();
},
insert_text_field: function( context ) {
var $text_field = $( "<input></input>" );
if ( settings['<API key>'] ) {
var attrs = {};
var raw_attrs = context.$select_field[0].attributes;
for (var i=0; i < raw_attrs.length; i++) {
var key = raw_attrs[i].nodeName;
var value = raw_attrs[i].nodeValue;
if ( key !== 'name' && key !== 'id' && typeof context.$select_field.attr(key) !== 'undefined' ) {
attrs[key] = value;
}
};
$text_field.attr( attrs );
}
$text_field.blur(function() {
var valid_values = context.$select_field.find('option').map(function(i, option) { return $(option).text(); });
if ( ($.inArray($text_field.val(), valid_values) < 0) && typeof settings['<API key>'] === 'function' ) {
settings['<API key>'](context);
}
});
// give the input box the ability to select all text on mouse click
if ( context.settings['autoselect'] ) {
$text_field.click( function() {
this.select();
});
}
return $text_field.val( context.$select_field.find('option:selected:first').text() )
.insertAfter( context.$select_field );
},
extract_options: function( $select_field ) {
var options = [];
var $options = $select_field.find('option');
var number_of_options = $options.length;
// go over each option in the select tag
$options.each(function(){
var $option = $(this);
var option = {
'real-value': $option.attr('value'),
'label': $option.text()
}
if ( settings['<API key>'] && option['real-value'] === '') {
// skip options without a value
} else {
// prepare the 'matches' string which must be filtered on later
option['matches'] = option['label'];
var <API key> = $option.attr( settings['<API key>'] );
if ( <API key> ) {
option['matches'] += ' ' + <API key>;
}
// give each option a weight paramter for sorting
if ( settings['sort'] ) {
var weight = parseInt( $option.attr( settings['sort-attr'] ), 10 );
if ( weight ) {
option['weight'] = weight;
} else {
option['weight'] = number_of_options;
}
}
// add relevancy score
if ( settings['relevancy-sorting'] ) {
option['relevancy-score'] = 0;
option['<API key>'] = 1;
var boost_by = parseFloat( $option.attr( settings['<API key>'] ) );
if ( boost_by ) {
option['<API key>'] = boost_by;
}
}
// add option to combined array
options.push( option );
}
});
// sort the options based on weight
if ( settings['sort'] ) {
if ( settings['sort-desc'] ) {
options.sort( function( a, b ) { return b['weight'] - a['weight']; } );
} else {
options.sort( function( a, b ) { return a['weight'] - b['weight']; } );
}
}
// return the set of options, each with the following attributes: real-value, label, matches, weight (optional)
return options;
}
};
var public_methods = {
init: function( customizations ) {
if ( $.browser.msie && parseInt($.browser.version, 10) <= 6) {
return this;
} else {
settings = $.extend( settings, customizations );
return this.each(function(){
var $select_field = $(this);
var context = {
'$select_field': $select_field,
'options': settings['extract_options']( $select_field ),
'settings': settings
};
context['$text_field'] = settings['insert_text_field']( context );
settings['handle_select_field']( $select_field );
if ( typeof settings['autocomplete-plugin'] === 'string' ) {
adapters[settings['autocomplete-plugin']]( context );
} else {
settings['autocomplete-plugin']( context );
}
});
}
}
};
var adapters = {
jquery_ui: function( context ) {
// loose matching of search terms
var filter_options = function( term ) {
var split_term = term.split(' ');
var matchers = [];
for (var i=0; i < split_term.length; i++) {
if ( split_term[i].length > 0 ) {
var matcher = {};
matcher['partial'] = new RegExp( $.ui.autocomplete.escapeRegex( split_term[i] ), "i" );
if ( context.settings['relevancy-sorting'] ) {
matcher['strict'] = new RegExp( "^" + $.ui.autocomplete.escapeRegex( split_term[i] ), "i" );
}
matchers.push( matcher );
}
};
return $.grep( context.options, function( option ) {
var partial_matches = 0;
if ( context.settings['relevancy-sorting'] ) {
var strict_match = false;
var <API key> = option.matches.split(' ');
}
for ( var i=0; i < matchers.length; i++ ) {
if ( matchers[i]['partial'].test( option.matches ) ) {
partial_matches++;
}
if ( context.settings['relevancy-sorting'] ) {
for (var q=0; q < <API key>.length; q++) {
if ( matchers[i]['strict'].test( <API key>[q] ) ) {
strict_match = true;
break;
}
};
}
};
if ( context.settings['relevancy-sorting'] ) {
var option_score = 0;
option_score += partial_matches * context.settings['<API key>'];
if ( strict_match ) {
option_score += context.settings['<API key>'];
}
option_score = option_score * option['<API key>'];
option['relevancy-score'] = option_score;
}
return (!term || matchers.length === partial_matches );
});
}
// update the select field value using either selected option or current input in the text field
var update_select_value = function( option ) {
if ( option ) {
if ( context.$select_field.val() !== option['real-value'] ) {
context.$select_field.val( option['real-value'] );
context.$select_field.change();
}
} else {
var option_name = context.$text_field.val().toLowerCase();
var matching_option = { 'real-value': false };
for (var i=0; i < context.options.length; i++) {
if ( option_name === context.options[i]['label'].toLowerCase() ) {
matching_option = context.options[i];
break;
}
};
if ( context.$select_field.val() !== matching_option['real-value'] ) {
context.$select_field.val( matching_option['real-value'] || '' );
context.$select_field.change();
}
if ( matching_option['real-value'] ) {
context.$text_field.val( matching_option['label'] );
}
if ( typeof context.settings['<API key>'] === 'function' && context.$select_field.val() === '' ) {
context.settings['<API key>']( context );
}
}
}
// jQuery UI autocomplete settings & behavior
context.$text_field.autocomplete({
'minLength': 0,
'delay': 0,
'autoFocus': true,
source: function( request, response ) {
var filtered_options = filter_options( request.term );
if ( context.settings['relevancy-sorting'] ) {
filtered_options = filtered_options.sort( function( a, b ) { return b['relevancy-score'] - a['relevancy-score']; } );
}
response( filtered_options );
},
select: function( event, ui ) {
update_select_value( ui.item );
},
change: function( event, ui ) {
update_select_value( ui.item );
}
});
// force refresh value of select field when form is submitted
context.$text_field.parents('form:first').submit(function(){
update_select_value();
});
// select current value
update_select_value();
}
};
$.fn.<API key> = function( method ) {
if ( public_methods[method] ) {
return public_methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return public_methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.fn.<API key>' );
}
};
})(jQuery); |
class OpenSceneGraph < Formula
desc "3D graphics toolkit"
homepage "https://github.com/openscenegraph/OpenSceneGraph"
url "https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-3.5.6.tar.gz"
sha256 "<SHA256-like>"
head "https://github.com/openscenegraph/OpenSceneGraph.git"
bottle do
rebuild 1
sha256 "<SHA256-like>" => :sierra
sha256 "<SHA256-like>" => :el_capitan
sha256 "<SHA256-like>" => :yosemite
end
option :cxx11
option "with-docs", "Build the documentation with Doxygen and Graphviz"
deprecated_option "docs" => "with-docs"
deprecated_option "with-qt5" => "with-qt"
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "jpeg"
depends_on "gtkglext"
depends_on "freetype"
depends_on "gdal" => :optional
depends_on "jasper" => :optional
depends_on "openexr" => :optional
depends_on "dcmtk" => :optional
depends_on "librsvg" => :optional
depends_on "collada-dom" => :optional
depends_on "gnuplot" => :optional
depends_on "ffmpeg" => :optional
depends_on "qt" => :optional
# patch necessary to ensure support for gtkglext-quartz
patch :DATA
if build.with? "docs"
depends_on "doxygen" => :build
depends_on "graphviz" => :build
end
def install
ENV.cxx11 if build.cxx11?
# Turning off FFMPEG takes this change or a dozen "-DFFMPEG_" variables
if build.without? "ffmpeg"
inreplace "CMakeLists.txt", "FIND_PACKAGE(FFmpeg)", "#FIND_PACKAGE(FFmpeg)"
end
args = std_cmake_args
args << "-<API key>=" + (build.with?("docs") ? "ON" : "OFF")
args << "-DCMAKE_CXX_FLAGS=-Wno-error=narrowing" # or: -Wno-c++11-narrowing
if MacOS.prefer_64_bit?
args << "-<API key>=#{Hardware::CPU.arch_64_bit}"
args << "-<API key>=imageio"
args << "-<API key>=Cocoa"
else
args << "-<API key>=#{Hardware::CPU.arch_32_bit}"
end
if build.with? "collada-dom"
args << "-<API key>=#{Formula["collada-dom"].opt_include}/collada-dom"
end
if build.with? "qt"
args << "-DCMAKE_PREFIX_PATH=#{Formula["qt"].opt_prefix}"
end
mkdir "build" do
system "cmake", "..", *args
system "make"
system "make", "doc_openscenegraph" if build.with? "docs"
system "make", "install" |
#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_WEB_SCHEDULER_IMPL_H_
#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_WEB_SCHEDULER_IMPL_H_
#include "platform/scheduler/child/web_scheduler_impl.h"
namespace blink {
namespace scheduler {
class <API key>;
class <API key> <API key> : public WebSchedulerImpl {
public:
explicit <API key>(<API key>* renderer_scheduler);
~<API key>() override;
// WebScheduler implementation:
void suspendTimerQueue() override;
void resumeTimerQueue() override;
std::unique_ptr<WebViewScheduler> <API key>(
<API key>* <API key>) override;
void onNavigationStarted() override;
private:
<API key>* renderer_scheduler_; // NOT OWNED
};
} // namespace scheduler
} // namespace blink
#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_WEB_SCHEDULER_IMPL_H_ |
#ifndef <API key>
#define <API key>
#include <stddef.h>
#include <stdint.h>
#include <map>
#include <string>
#include <vector>
#include "base/macros.h"
#include "courgette/disassembler.h"
#include "courgette/image_utils.h"
#include "courgette/memory_allocator.h"
#include "courgette/types_win_pe.h"
namespace courgette {
class AssemblyProgram;
class DisassemblerWin32 : public Disassembler {
public:
virtual ~DisassemblerWin32() = default;
// Disassembler interfaces.
RVA FileOffsetToRVA(FileOffset file_offset) const override;
FileOffset RVAToFileOffset(RVA rva) const override;
virtual ExecutableType kind() const override = 0;
virtual RVA PointerToTargetRVA(const uint8_t* p) const override = 0;
bool ParseHeader() override;
bool Disassemble(AssemblyProgram* target) override;
// Exposed for test purposes
bool has_text_section() const { return has_text_section_; }
uint32_t size_of_code() const { return size_of_code_; }
// Returns 'true' if the base relocation table can be parsed.
// Output is a vector of the RVAs corresponding to locations within executable
// that are listed in the base relocation table.
bool ParseRelocs(std::vector<RVA>* addresses);
// Returns Section containing the relative virtual address, or null if none.
const Section* RVAToSection(RVA rva) const;
static std::string SectionName(const Section* section);
protected:
// Returns true if a valid executable is detected using only quick checks.
// Derived classes should inject |magic| corresponding to their architecture,
// which will be checked against the detected one.
static bool QuickDetect(const uint8_t* start, size_t length, uint16_t magic);
// Disassembler interfaces.
RvaVisitor* <API key>() override;
RvaVisitor* <API key>() override;
void <API key>(AssemblyProgram* program) override;
DisassemblerWin32(const uint8_t* start, size_t length);
CheckBool ParseFile(AssemblyProgram* target) WARN_UNUSED_RESULT;
bool ParseAbs32Relocs();
void <API key>();
virtual void <API key>(const Section* section) = 0;
CheckBool <API key>(FileOffset start_file_offset,
FileOffset end_file_offset,
AssemblyProgram* program)
WARN_UNUSED_RESULT;
CheckBool ParseFileRegion(const Section* section,
FileOffset start_file_offset,
FileOffset end_file_offset,
AssemblyProgram* program) WARN_UNUSED_RESULT;
// Returns address width in byte count.
virtual int AbsVAWidth() const = 0;
// Emits Abs 32/64 |label| to the |program|.
virtual CheckBool EmitAbs(Label* label, AssemblyProgram* program) = 0;
// Returns true if type is recognized.
virtual bool <API key>(int type) const = 0;
virtual uint16_t <API key>() const = 0;
#if <API key>
void HistogramTargets(const char* kind, const std::map<RVA, int>& map);
#endif
// Most addresses are represented as 32-bit RVAs. The one address we can't
// do this with is the image base address.
uint64_t image_base() const { return image_base_; }
const ImageDataDirectory& <API key>() const {
return <API key>;
}
// Returns description of the RVA, e.g. ".text+0x1243". For debugging only.
std::string DescribeRVA(RVA rva) const;
// Finds the first section at file_offset or above. Does not return sections
// that have no raw bytes in the file.
const Section* FindNextSection(FileOffset file_offset) const;
bool ReadDataDirectory(int index, ImageDataDirectory* dir);
bool <API key> =
false; // true if can omit "uninteresting" bits.
std::vector<RVA> abs32_locations_;
std::vector<RVA> rel32_locations_;
// Location and size of <API key> in the buffer.
const uint8_t* optional_header_ = nullptr;
uint16_t <API key> = 0;
uint16_t machine_type_ = 0;
uint16_t number_of_sections_ = 0;
const Section* sections_ = nullptr;
bool has_text_section_ = false;
uint32_t size_of_code_ = 0;
uint32_t <API key> = 0;
uint32_t <API key> = 0;
RVA base_of_code_ = 0;
RVA base_of_data_ = 0;
uint64_t image_base_ = 0; // Range limited to 32 bits for 32 bit executable
uint32_t size_of_image_ = 0;
int <API key> = 0;
ImageDataDirectory export_table_;
ImageDataDirectory import_table_;
ImageDataDirectory resource_table_;
ImageDataDirectory exception_table_;
ImageDataDirectory <API key>;
ImageDataDirectory bound_import_table_;
ImageDataDirectory <API key>;
ImageDataDirectory <API key>;
ImageDataDirectory clr_runtime_header_;
#if <API key>
std::map<RVA, int> abs32_target_rvas_;
std::map<RVA, int> rel32_target_rvas_;
#endif
private:
<API key>(DisassemblerWin32);
};
} // namespace courgette
#endif // <API key> |
// WBDNSSpeedTester.h
// DNSCache
@protocol WBDNSSpeedTester <NSObject>
-(int) testSpeedOf:(NSString *)ip;
@end |
! the network module provides the information about the species we are
! advecting:
!
! nspec -- the number of species
!
! aion -- atomic number
! zion -- proton number
! eion -- nuclear binding energy (in erg/g)
!
! spec_names -- the name of the isotope
! short_spec_names -- the abbreviated name of the isotope
!
! This module contains two routines:
!
! network_init() -- initialize the isotope properties
!
! <API key> -- return the index of the species given its name
!
module network
use bl_types
use network_indices
implicit none
character (len=*), parameter :: network_name = "ignition_simple"
! nspec = number of species this network carries
! nspec_advance = the number of species that are explicitly integrated
! in the ODE solve (the others are solved for
! algebraically).
integer, parameter :: nspec = 3
integer, parameter :: nspec_advance = 1
integer, parameter :: naux = 0
!$acc declare copyin(nspec, nspec_advance, naux)
character (len=16), allocatable :: spec_names(:)
!TODO: Commented out because compilers
! don't like Fortran character arrays on GPUs
!!$acc declare create(spec_names)
character (len= 5), allocatable :: short_spec_names(:)
!!$acc declare create(short_spec_names)
real(kind=dp_t), allocatable :: aion(:)
!$acc declare create(aion)
real(kind=dp_t), allocatable :: zion(:)
!$acc declare create(zion)
real(kind=dp_t), allocatable :: ebin(:)
!$acc declare create(ebin)
contains
subroutine network_init()
allocate(spec_names(nspec))
spec_names = [&
"carbon-12 ",&
"oxygen-16 ",&
"magnesium-24 "]
!!$acc update device(spec_names)
allocate(short_spec_names(nspec))
short_spec_names = [&
"C12 ",&
"O16 ",&
"Mg24 "]
!!$acc update device(short_spec_names)
allocate(aion(nspec))
aion = [&
12.0_dp_t,&
16.0_dp_t,&
24.0_dp_t]
!$acc update device(aion)
!!$acc enter data copyin(aion)
allocate(zion(nspec))
zion = [&
6.0_dp_t,&
8.0_dp_t,&
12.0_dp_t]
!$acc update device(zion)
!!$acc enter data copyin(zion)
allocate(ebin(nspec))
ebin = [&
-7.4103097e18_dp_t,& ! 92.16294 MeV
-7.6959672e18_dp_t,& ! 127.62093 MeV
-7.9704080e18_dp_t] ! 198.2579 MeV
!$acc update device(ebin)
!!$acc enter data copyin(ebin)
end subroutine network_init
function <API key>(name) result(r)
character(len=*) :: name
integer :: r, n
r = -1
do n = 1, nspec
if (name == spec_names(n) .or. name == short_spec_names(n)) then
r = n
exit
endif
enddo
return
end function <API key>
subroutine network_finalize()
end subroutine network_finalize
end module network |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Rendering</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Pango Reference Manual">
<link rel="up" href="pango.html" title="Basic Pango Interfaces">
<link rel="prev" href="pango.html" title="Basic Pango Interfaces">
<link rel="next" href="pango-Glyph-Storage.html" title="Glyph Storage">
<meta name="generator" content="GTK-Doc V1.15.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="pango.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="pango.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Pango Reference Manual</th>
<td><a accesskey="n" href="pango-Glyph-Storage.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#<API key>.synopsis" class="shortcut">Top</a>
|
<a href="#<API key>.description" class="shortcut">Description</a>
|
<a href="#<API key>.object-hierarchy" class="shortcut">Object Hierarchy</a>
</td></tr>
</table>
<div class="refentry">
<a name="<API key>"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="<API key>.top_of_page"></a>Rendering</span></h2>
<p>Rendering — Functions to run the rendering pipeline</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="<API key>.synopsis"></a><h2>Synopsis</h2>
<a name="PangoContext"></a><pre class="synopsis"> <a class="link" href="<API key>.html#PangoContext-struct" title="PangoContext">PangoContext</a>;
struct <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem">PangoItem</a>;
struct <a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis">PangoAnalysis</a>;
#define <a class="link" href="<API key>.html#<API key>:CAPS" title="<API key>"><API key></a>
#define <a class="link" href="<API key>.html#<API key>:CAPS" title="<API key>"><API key></a>
<span class="returnvalue">GList</span> * <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()">pango_itemize</a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> start_index</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrList" title="PangoAttrList"><span class="type">PangoAttrList</span></a> *attrs</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrIterator" title="PangoAttrIterator"><span class="type">PangoAttrIterator</span></a> *cached_iter</code></em>);
<span class="returnvalue">GList</span> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="type">PangoDirection</span></a> base_dir</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> start_index</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrList" title="PangoAttrList"><span class="type">PangoAttrList</span></a> *attrs</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrIterator" title="PangoAttrIterator"><span class="type">PangoAttrIterator</span></a> *cached_iter</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#pango-item-free" title="pango_item_free ()">pango_item_free</a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *item</code></em>);
<a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * <a class="link" href="<API key>.html#pango-item-copy" title="pango_item_copy ()">pango_item_copy</a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *item</code></em>);
<a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * <a class="link" href="<API key>.html#pango-item-new" title="pango_item_new ()">pango_item_new</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * <a class="link" href="<API key>.html#pango-item-split" title="pango_item_split ()">pango_item_split</a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *orig</code></em>,
<em class="parameter"><code><span class="type">int</span> split_index</code></em>,
<em class="parameter"><code><span class="type">int</span> split_offset</code></em>);
<span class="returnvalue">GList</span> * <a class="link" href="<API key>.html#pango-reorder-items" title="pango_reorder_items ()">pango_reorder_items</a> (<em class="parameter"><code><span class="type">GList</span> *logical_items</code></em>);
<a class="link" href="<API key>.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * <a class="link" href="<API key>.html#pango-context-new" title="pango_context_new ()">pango_context_new</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Fonts.html#PangoFontMap"><span class="type">PangoFontMap</span></a> *font_map</code></em>);
<a class="link" href="pango-Fonts.html#PangoFontMap"><span class="returnvalue">PangoFontMap</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="returnvalue"><API key></span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a>
(<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>);
<a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="returnvalue">PangoLanguage</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);
<a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="returnvalue">PangoDirection</span></a> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="type">PangoDirection</span></a> direction</code></em>);
<a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="returnvalue">PangoGravity</span></a> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="type">PangoGravity</span></a> gravity</code></em>);
<a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="returnvalue">PangoGravity</span></a> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<a class="link" href="pango-Vertical-Text.html#PangoGravityHint" title="enum PangoGravityHint"><span class="returnvalue">PangoGravityHint</span></a> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Vertical-Text.html#PangoGravityHint" title="enum PangoGravityHint"><span class="type">PangoGravityHint</span></a> hint</code></em>);
const <a class="link" href="pango-Glyph-Storage.html#PangoMatrix" title="struct PangoMatrix"><span class="returnvalue">PangoMatrix</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Glyph-Storage.html#PangoMatrix" title="struct PangoMatrix"><span class="type">PangoMatrix</span></a> *matrix</code></em>);
<a class="link" href="pango-Fonts.html#PangoFont"><span class="returnvalue">PangoFont</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>);
<a class="link" href="pango-Fonts.html#PangoFontset"><span class="returnvalue">PangoFontset</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);
<a class="link" href="pango-Fonts.html#PangoFontMetrics" title="struct PangoFontMetrics"><span class="returnvalue">PangoFontMetrics</span></a> * <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Fonts.html
<em class="parameter"><code><span class="type">int</span> *n_families</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#pango-break" title="pango_break ()">pango_break</a> (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#pango-get-log-attrs" title="pango_get_log_attrs ()">pango_get_log_attrs</a> (<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><span class="type">int</span> level</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *log_attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><API key></a> (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">gint</span> length</code></em>,
<em class="parameter"><code><span class="type">gint</span> *<API key></code></em>,
<em class="parameter"><code><span class="type">gint</span> *<API key></code></em>);
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#pango-default-break" title="pango_default_break ()">pango_default_break</a> (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);
<a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr">PangoLogAttr</a>;
<span class="returnvalue">void</span> <a class="link" href="<API key>.html#pango-shape" title="pango_shape ()">pango_shape</a> (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">gint</span> length</code></em>,
<em class="parameter"><code>const <a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="struct PangoGlyphString"><span class="type">PangoGlyphString</span></a> *glyphs</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="<API key>.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
GObject
+----PangoContext
</pre>
</div>
<div class="refsect1">
<a name="<API key>.description"></a><h2>Description</h2>
<p>
The Pango rendering pipeline takes a string of
Unicode characters and converts it into glyphs.
The functions described in this section accomplish
various steps of this process.
</p>
</div>
<div class="refsect1">
<a name="<API key>.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="PangoContext-struct"></a><h3>PangoContext</h3>
<pre class="programlisting">typedef struct _PangoContext PangoContext;</pre>
<p>
The <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> structure stores global information
used to control the itemization process.
</p>
</div>
<hr>
<div class="refsect2">
<a name="PangoItem"></a><h3>struct PangoItem</h3>
<pre class="programlisting">struct PangoItem {
gint offset;
gint length;
gint num_chars;
PangoAnalysis analysis;
};
</pre>
<p>
The <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structure stores information about
a segment of text. It contains the following fields:
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><span class="type">gint</span> <em class="structfield"><code><a name="PangoItem.offset"></a>offset</code></em>;</span></p></td>
<td>the offset of the segment from the beginning of the
string in bytes.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">gint</span> <em class="structfield"><code><a name="PangoItem.length"></a>length</code></em>;</span></p></td>
<td>the length of the segment in bytes.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">gint</span> <em class="structfield"><code><a name="PangoItem.num-chars"></a>num_chars</code></em>;</span></p></td>
<td>the length of the segment in characters.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> <em class="structfield"><code><a name="PangoItem.analysis"></a>analysis</code></em>;</span></p></td>
<td>the properties of the segment.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="PangoAnalysis"></a><h3>struct PangoAnalysis</h3>
<pre class="programlisting">struct PangoAnalysis {
PangoEngineShape *shape_engine;
PangoEngineLang *lang_engine;
PangoFont *font;
guint8 level;
guint8 gravity; /* PangoGravity */
guint8 flags;
guint8 script; /* PangoScript */
PangoLanguage *language;
GSList *extra_attrs;
};
</pre>
<p>
The <a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> structure stores information about
the properties of a segment of text. It has the following
fields:
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="PangoEngineShape.html" title="PangoEngineShape"><span class="type">PangoEngineShape</span></a> *<em class="structfield"><code><a name="PangoAnalysis.shape-engine"></a>shape_engine</code></em>;</span></p></td>
<td>the engine for doing <API key> processing.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="PangoEngineLang.html" title="PangoEngineLang"><span class="type">PangoEngineLang</span></a> *<em class="structfield"><code><a name="PangoAnalysis.lang-engine"></a>lang_engine</code></em>;</span></p></td>
<td>the engine for doing <API key> processing.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a> *<em class="structfield"><code><a name="PangoAnalysis.font"></a>font</code></em>;</span></p></td>
<td>the font for this segment.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint8</span> <em class="structfield"><code><a name="PangoAnalysis.level"></a>level</code></em>;</span></p></td>
<td>the bidirectional level for this segment.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint8</span> <em class="structfield"><code><a name="PangoAnalysis.gravity"></a>gravity</code></em>;</span></p></td>
<td>the glyph orientation for this segment (A <a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="type">PangoGravity</span></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint8</span> <em class="structfield"><code><a name="PangoAnalysis.flags"></a>flags</code></em>;</span></p></td>
<td>boolean flags for this segment (currently only one) (Since: 1.16).
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint8</span> <em class="structfield"><code><a name="PangoAnalysis.script"></a>script</code></em>;</span></p></td>
<td>the detected script for this segment (A <a class="link" href="<API key>.html#PangoScript" title="enum PangoScript"><span class="type">PangoScript</span></a>) (Since: 1.18).
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *<em class="structfield"><code><a name="PangoAnalysis.language"></a>language</code></em>;</span></p></td>
<td>the detected language for this segment.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">GSList</span> *<em class="structfield"><code><a name="PangoAnalysis.extra-attrs"></a>extra_attrs</code></em>;</span></p></td>
<td>extra attributes for this segment.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>:CAPS"></a><h3><API key></h3>
<pre class="programlisting">#define <API key> (1 << 0)
</pre>
<p>
Whether the segment should be shifted to center around the baseline.
Used in vertical writing directions mostly.
Since: 1.16
</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>:CAPS"></a><h3><API key></h3>
<pre class="programlisting">#define <API key> (<API key>())
</pre>
<p>
The <span class="type">GObject</span> type for <a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="type">PangoDirection</span></a>.
</p>
</div>
<hr>
<div class="refsect2">
<a name="pango-itemize"></a><h3>pango_itemize ()</h3>
<pre class="programlisting"><span class="returnvalue">GList</span> * pango_itemize (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> start_index</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrList" title="PangoAttrList"><span class="type">PangoAttrList</span></a> *attrs</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrIterator" title="PangoAttrIterator"><span class="type">PangoAttrIterator</span></a> *cached_iter</code></em>);</pre>
<p>
Breaks a piece of text into segments with consistent
directional level and shaping engine. Each byte of <em class="parameter"><code>text</code></em> will
be contained in exactly one of the items in the returned list;
the generated list of items will be in logical order (the start
offsets of the items are ascending).
</p>
<p>
<em class="parameter"><code>cached_iter</code></em> should be an iterator over <em class="parameter"><code>attrs</code></em> currently positioned at a
range before or containing <em class="parameter"><code>start_index</code></em>; <em class="parameter"><code>cached_iter</code></em> will be advanced to
the range covering the position just after <em class="parameter"><code>start_index</code></em> + <em class="parameter"><code>length</code></em>.
(i.e. if itemizing in a loop, just keep passing in the same <em class="parameter"><code>cached_iter</code></em>).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a structure holding information that affects
the itemization process.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>the text to itemize.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>start_index</code></em> :</span></p></td>
<td>first byte in <em class="parameter"><code>text</code></em> to process
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>the number of bytes (not characters) to process
after <em class="parameter"><code>start_index</code></em>.
This must be >= 0.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs</code></em> :</span></p></td>
<td>the set of attributes that apply to <em class="parameter"><code>text</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cached_iter</code></em> :</span></p></td>
<td>Cached attribute iterator, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a <span class="type">GList</span> of <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structures.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">GList</span> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="type">PangoDirection</span></a> base_dir</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> start_index</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrList" title="PangoAttrList"><span class="type">PangoAttrList</span></a> *attrs</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAttrIterator" title="PangoAttrIterator"><span class="type">PangoAttrIterator</span></a> *cached_iter</code></em>);</pre>
<p>
Like <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>, but the base direction to use when
computing bidirectional levels (see <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>),
is specified explicitly rather than gotten from the <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a structure holding information that affects
the itemization process.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>base_dir</code></em> :</span></p></td>
<td>base direction to use for bidirectional processing
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>the text to itemize.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>start_index</code></em> :</span></p></td>
<td>first byte in <em class="parameter"><code>text</code></em> to process
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>the number of bytes (not characters) to process
after <em class="parameter"><code>start_index</code></em>.
This must be >= 0.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs</code></em> :</span></p></td>
<td>the set of attributes that apply to <em class="parameter"><code>text</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cached_iter</code></em> :</span></p></td>
<td>Cached attribute iterator, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a <span class="type">GList</span> of <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structures. The items should be
freed using <a class="link" href="<API key>.html#pango-item-free" title="pango_item_free ()"><code class="function">pango_item_free()</code></a> probably in combination with <code class="function">g_list_foreach()</code>,
and the list itself using <code class="function">g_list_free()</code>.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="pango-item-free"></a><h3>pango_item_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> pango_item_free (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *item</code></em>);</pre>
<p>
Free a <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> and all associated memory.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>item</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a>, may be <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-item-copy"></a><h3>pango_item_copy ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * pango_item_copy (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *item</code></em>);</pre>
<p>
Copy an existing <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structure.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>item</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a>, may be <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the newly allocated <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a>, which should
be freed with <a class="link" href="<API key>.html#pango-item-free" title="pango_item_free ()"><code class="function">pango_item_free()</code></a>, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if
<em class="parameter"><code>item</code></em> was NULL.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-item-new"></a><h3>pango_item_new ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * pango_item_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structure initialized to default values.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the newly allocated <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a>, which should
be freed with <a class="link" href="<API key>.html#pango-item-free" title="pango_item_free ()"><code class="function">pango_item_free()</code></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-item-split"></a><h3>pango_item_split ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="returnvalue">PangoItem</span></a> * pango_item_split (<em class="parameter"><code><a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> *orig</code></em>,
<em class="parameter"><code><span class="type">int</span> split_index</code></em>,
<em class="parameter"><code><span class="type">int</span> split_offset</code></em>);</pre>
<p>
Modifies <em class="parameter"><code>orig</code></em> to cover only the text after <em class="parameter"><code>split_index</code></em>, and
returns a new item that covers the text before <em class="parameter"><code>split_index</code></em> that
used to be in <em class="parameter"><code>orig</code></em>. You can think of <em class="parameter"><code>split_index</code></em> as the length of
the returned item. <em class="parameter"><code>split_index</code></em> may not be 0, and it may not be
greater than or equal to the length of <em class="parameter"><code>orig</code></em> (that is, there must
be at least one byte assigned to each item, you can't create a
zero-length item). <em class="parameter"><code>split_offset</code></em> is the length of the first item in
chars, and must be provided because the text used to generate the
item isn't available, so <a class="link" href="<API key>.html#pango-item-split" title="pango_item_split ()"><code class="function">pango_item_split()</code></a> can't count the char
length of the split items itself.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>orig</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>split_index</code></em> :</span></p></td>
<td>byte index of position to split item, relative to the start of the item
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>split_offset</code></em> :</span></p></td>
<td>number of chars between start of <em class="parameter"><code>orig</code></em> and <em class="parameter"><code>split_index</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> new item representing text before <em class="parameter"><code>split_index</code></em>, which
should be freed with <a class="link" href="<API key>.html#pango-item-free" title="pango_item_free ()"><code class="function">pango_item_free()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-reorder-items"></a><h3>pango_reorder_items ()</h3>
<pre class="programlisting"><span class="returnvalue">GList</span> * pango_reorder_items (<em class="parameter"><code><span class="type">GList</span> *logical_items</code></em>);</pre>
<p>
From a list of items in logical order and the associated
directional levels, produce a list in visual order.
The original list is unmodified.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>logical_items</code></em> :</span></p></td>
<td>a <span class="type">GList</span> of <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> in logical order.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a <span class="type">GList</span> of <a class="link" href="<API key>.html#PangoItem" title="struct PangoItem"><span class="type">PangoItem</span></a> structures in visual order.
(Please open a bug if you use this function.
It is not a particularly convenient interface, and the code
is duplicated elsewhere in Pango for that reason.)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-context-new"></a><h3>pango_context_new ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * pango_context_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> initialized to default values.
</p>
<p>
This function is not particularly useful as it should always
be followed by a <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a> call, and the
function <a class="link" href="pango-Fonts.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a> does these two steps
together and hence users are recommended to use that.
</p>
<p>
If you are using Pango as part of a higher-level system,
that system may have it's own way of create a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>.
For instance, the GTK+ toolkit has, among others,
<code class="function"><API key>()</code>, and
<code class="function"><API key>()</code>. Use those instead.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the newly allocated <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>, which should
be freed with <code class="function">g_object_unref()</code>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Fonts.html#PangoFontMap"><span class="type">PangoFontMap</span></a> *font_map</code></em>);</pre>
<p>
Sets the font map to be searched when fonts are looked-up in this context.
This is only for internal use by Pango backends, a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> obtained
via one of the recommended methods should already have a suitable font map.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>font_map</code></em> :</span></p></td>
<td>the <a class="link" href="pango-Fonts.html#PangoFontMap"><span class="type">PangoFontMap</span></a> to set.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFontMap"><span class="returnvalue">PangoFontMap</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Gets the <span class="type">PangoFontmap</span> used to look up fonts for this context.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the font map for the <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>. This value
is owned by Pango and should not be unreferenced.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.6</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="returnvalue"><API key></span></a> * <API key>
(<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieve the default font description for the context.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a pointer to the context's default font description.
This value must not be modified or freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>);</pre>
<p>
Set the default font description for the context
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>desc</code></em> :</span></p></td>
<td>the new pango font description
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="returnvalue">PangoLanguage</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieves the global language tag for the context.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the global language tag.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);</pre>
<p>
Sets the global language tag for the context. The default language
for the locale of the running process can be found using
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>language</code></em> :</span></p></td>
<td>the new language tag.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="returnvalue">PangoDirection</span></a> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieves the base direction for the context. See
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the base direction for the context.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoDirection" title="enum PangoDirection"><span class="type">PangoDirection</span></a> direction</code></em>);</pre>
<p>
Sets the base direction for the context.
</p>
<p>
The base direction is used in applying the Unicode bidirectional
algorithm; if the <em class="parameter"><code>direction</code></em> is <a class="link" href="<API key>.html#PANGO-DIRECTION-LTR:CAPS"><code class="literal">PANGO_DIRECTION_LTR</code></a> or
<a class="link" href="<API key>.html#PANGO-DIRECTION-RTL:CAPS"><code class="literal">PANGO_DIRECTION_RTL</code></a>, then the value will be used as the paragraph
direction in the Unicode bidirectional algorithm. A value of
<a class="link" href="<API key>.html#<API key>:CAPS"><code class="literal"><API key></code></a> or <a class="link" href="<API key>.html#<API key>:CAPS"><code class="literal"><API key></code></a> is used only
for paragraphs that do not contain any strong characters themselves.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>direction</code></em> :</span></p></td>
<td>the new base direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="returnvalue">PangoGravity</span></a> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieves the base gravity for the context. See
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the base gravity for the context.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.16</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="type">PangoGravity</span></a> gravity</code></em>);</pre>
<p>
Sets the base gravity for the context.
</p>
<p>
The base gravity is used in laying vertical text out.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>gravity</code></em> :</span></p></td>
<td>the new base gravity
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.16</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Vertical-Text.html#PangoGravity" title="enum PangoGravity"><span class="returnvalue">PangoGravity</span></a> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieves the gravity for the context. This is similar to
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>, except for when the base gravity
is <a class="link" href="pango-Vertical-Text.html#PANGO-GRAVITY-AUTO:CAPS"><code class="literal">PANGO_GRAVITY_AUTO</code></a> for which <a class="link" href="pango-Vertical-Text.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a> is used
to return the gravity from the current context matrix.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the resolved gravity for the context.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.16</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Vertical-Text.html#PangoGravityHint" title="enum PangoGravityHint"><span class="returnvalue">PangoGravityHint</span></a> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Retrieves the gravity hint for the context. See
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a> for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the gravity hint for the context.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.16</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Vertical-Text.html#PangoGravityHint" title="enum PangoGravityHint"><span class="type">PangoGravityHint</span></a> hint</code></em>);</pre>
<p>
Sets the gravity hint for the context.
</p>
<p>
The gravity hint is used in laying vertical text out, and is only relevant
if gravity of the context as returned by <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>
is set <a class="link" href="pango-Vertical-Text.html#PANGO-GRAVITY-EAST:CAPS"><code class="literal">PANGO_GRAVITY_EAST</code></a> or <a class="link" href="pango-Vertical-Text.html#PANGO-GRAVITY-WEST:CAPS"><code class="literal">PANGO_GRAVITY_WEST</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>hint</code></em> :</span></p></td>
<td>the new gravity hint
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.16</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting">const <a class="link" href="pango-Glyph-Storage.html#PangoMatrix" title="struct PangoMatrix"><span class="returnvalue">PangoMatrix</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>);</pre>
<p>
Gets the transformation matrix that will be applied when
rendering with this context. See <a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the matrix, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if no matrix has been set
(which is the same as the identity matrix). The returned
matrix is owned by Pango and must not be modified or
freed.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.6</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Glyph-Storage.html#PangoMatrix" title="struct PangoMatrix"><span class="type">PangoMatrix</span></a> *matrix</code></em>);</pre>
<p>
Sets the transformation matrix that will be applied when rendering
with this context. Note that reported metrics are in the user space
coordinates before the application of the matrix, not device-space
coordinates after the application of the matrix. So, they don't scale
with the matrix, though they may change slightly for different
matrices, depending on how the text is fit to the pixel grid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td>a <a class="link" href="pango-Glyph-Storage.html#PangoMatrix" title="struct PangoMatrix"><span class="type">PangoMatrix</span></a>, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> to unset any existing matrix.
(No matrix set is the same as setting the identity matrix.)
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.6</p>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFont"><span class="returnvalue">PangoFont</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>);</pre>
<p>
Loads the font in one of the fontmaps in the context
that is the closest match for <em class="parameter"><code>desc</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>desc</code></em> :</span></p></td>
<td>a <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> describing the font to load
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the font loaded, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if no font matched.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFontset"><span class="returnvalue">PangoFontset</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);</pre>
<p>
Load a set of fonts in the context that can be used to render
a font matching <em class="parameter"><code>desc</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>desc</code></em> :</span></p></td>
<td>a <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> describing the fonts to load
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>language</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> the fonts will be used for
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the fontset, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if no font matched.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFontMetrics" title="struct PangoFontMetrics"><span class="returnvalue">PangoFontMetrics</span></a> * <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code>const <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> *desc</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>);</pre>
<p>
Get overall metric information for a particular font
description. Since the metrics may be substantially different for
different scripts, a language tag can be provided to indicate that
the metrics should be retrieved that correspond to the script(s)
used by that language.
</p>
<p>
The <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> is interpreted in the same way as
by <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>, and the family name may be a comma separated
list of figures. If characters from multiple of these families
would be used to render the string, then the returned fonts would
be a composite of the metrics for the fonts loaded for the
individual families.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>desc</code></em> :</span></p></td>
<td>a <a class="link" href="pango-Fonts.html#<API key>" title="<API key>"><span class="type"><API key></span></a> structure. <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> means that the font
description from the context will be used.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>language</code></em> :</span></p></td>
<td>language tag used to determine which script to get the metrics
for. <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> means that the language tag from the context will
be used. If no language tag is set on the context, metrics
for the default language (as determined by
<a class="link" href="<API key>.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>) will be returned.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a <a class="link" href="pango-Fonts.html#PangoFontMetrics" title="struct PangoFontMetrics"><span class="type">PangoFontMetrics</span></a> object. The caller must call <a class="link" href="pango-Fonts.html#<API key>" title="<API key> ()"><code class="function"><API key>()</code></a>
when finished using the object.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code><a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
<em class="parameter"><code><a class="link" href="pango-Fonts.html
<em class="parameter"><code><span class="type">int</span> *n_families</code></em>);</pre>
<p>
List all families for a context.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoContext"><span class="type">PangoContext</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>families</code></em> :</span></p></td>
<td>location to store a pointer to an array of <a class="link" href="pango-Fonts.html#PangoFontFamily"><span class="type">PangoFontFamily</span></a> *.
This array should be freed with <code class="function">g_free()</code>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_families</code></em> :</span></p></td>
<td>location to store the number of elements in <em class="parameter"><code>descs</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-break"></a><h3>pango_break ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> pango_break (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);</pre>
<p>
Determines possible line, word, and character breaks
for a string of Unicode text with a single analysis. For most
purposes you may want to use <a class="link" href="<API key>.html#pango-get-log-attrs" title="pango_get_log_attrs ()"><code class="function">pango_get_log_attrs()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>the text to process
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>length of <em class="parameter"><code>text</code></em> in bytes (may be -1 if <em class="parameter"><code>text</code></em> is nul-terminated)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>analysis</code></em> :</span></p></td>
<td>
<a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> structure from <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs</code></em> :</span></p></td>
<td>an array to store character information in
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs_len</code></em> :</span></p></td>
<td>size of the array passed as <em class="parameter"><code>attrs</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-get-log-attrs"></a><h3>pango_get_log_attrs ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> pango_get_log_attrs (<em class="parameter"><code>const <span class="type">char</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><span class="type">int</span> level</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLanguage" title="PangoLanguage"><span class="type">PangoLanguage</span></a> *language</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *log_attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);</pre>
<p>
Computes a <a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> for each character in <em class="parameter"><code>text</code></em>. The <em class="parameter"><code>log_attrs</code></em>
array must have one <a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> for each position in <em class="parameter"><code>text</code></em>; if
<em class="parameter"><code>text</code></em> contains N characters, it has N+1 positions, including the
last position at the end of the text. <em class="parameter"><code>text</code></em> should be an entire
paragraph; logical attributes can't be computed without context
(for example you need to see spaces on either side of a word to know
the word is a word).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>text to process
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>length in bytes of <em class="parameter"><code>text</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>level</code></em> :</span></p></td>
<td>embedding level, or -1 if unknown
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>language</code></em> :</span></p></td>
<td>language tag
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_attrs</code></em> :</span></p></td>
<td>array with one <a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> per character in <em class="parameter"><code>text</code></em>, plus one extra, to be filled in
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs_len</code></em> :</span></p></td>
<td>length of <em class="parameter"><code>log_attrs</code></em> array
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="<API key>"></a><h3><API key> ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> <API key> (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">gint</span> length</code></em>,
<em class="parameter"><code><span class="type">gint</span> *<API key></code></em>,
<em class="parameter"><code><span class="type">gint</span> *<API key></code></em>);</pre>
<p>
Locates a paragraph boundary in <em class="parameter"><code>text</code></em>. A boundary is caused by
delimiter characters, such as a newline, carriage return, carriage
return-newline pair, or Unicode paragraph separator character. The
index of the run of delimiters is returned in
<em class="parameter"><code><API key></code></em>. The index of the start of the paragraph
(index after all delimiters) is stored in <em class="parameter"><code><API key></code></em>.
</p>
<p>
If no delimiters are found, both <em class="parameter"><code><API key></code></em> and
<em class="parameter"><code><API key></code></em> are filled with the length of <em class="parameter"><code>text</code></em> (an index one
off the end).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>UTF-8 text
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>length of <em class="parameter"><code>text</code></em> in bytes, or -1 if nul-terminated
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code><API key></code></em> :</span></p></td>
<td>return location for index of delimiter
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code><API key></code></em> :</span></p></td>
<td>return location for start of next paragraph
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-default-break"></a><h3>pango_default_break ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> pango_default_break (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">int</span> length</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> *attrs</code></em>,
<em class="parameter"><code><span class="type">int</span> attrs_len</code></em>);</pre>
<p>
This is the default break algorithm, used if no language
engine overrides it. Normally you should use <a class="link" href="<API key>.html#pango-break" title="pango_break ()"><code class="function">pango_break()</code></a>
instead. Unlike <a class="link" href="<API key>.html#pango-break" title="pango_break ()"><code class="function">pango_break()</code></a>,
<em class="parameter"><code>analysis</code></em> can be <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a>, but only do that if you know what
you're doing. If you need an analysis to pass to <a class="link" href="<API key>.html#pango-break" title="pango_break ()"><code class="function">pango_break()</code></a>,
you need to <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>. In most cases however you should
simply use <a class="link" href="<API key>.html#pango-get-log-attrs" title="pango_get_log_attrs ()"><code class="function">pango_get_log_attrs()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>text to break
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>length of text in bytes (may be -1 if <em class="parameter"><code>text</code></em> is nul-terminated)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>analysis</code></em> :</span></p></td>
<td>a <a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> for the <em class="parameter"><code>text</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs</code></em> :</span></p></td>
<td>logical attributes to fill in
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>attrs_len</code></em> :</span></p></td>
<td>size of the array passed as <em class="parameter"><code>attrs</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="PangoLogAttr"></a><h3>PangoLogAttr</h3>
<pre class="programlisting">typedef struct {
guint is_line_break : 1; /* Can break line in front of character */
guint is_mandatory_break : 1; /* Must break line in front of character */
guint is_char_break : 1; /* Can break here when doing char wrap */
guint is_white : 1; /* Whitespace character */
/* Cursor can appear in front of character (i.e. this is a grapheme
* boundary, or the first character in the text).
*/
guint is_cursor_position : 1;
/* Note that in degenerate cases, you could have both start/end set on
* some text, most likely for sentences (e.g. no space after a period, so
* the next sentence starts right away).
*/
guint is_word_start : 1; /* first character in a word */
guint is_word_end : 1; /* is first non-word char after a word */
/* There are two ways to divide sentences. The first assigns all
* intersentence whitespace/control/format chars to some sentence,
* so all chars are in some sentence; <API key> denotes
* the boundaries there. The second way doesn't assign
* between-sentence spaces, etc. to any sentence, so
* is_sentence_start/is_sentence_end mark the boundaries of those
* sentences.
*/
guint <API key> : 1;
guint is_sentence_start : 1; /* first character in a sentence */
guint is_sentence_end : 1; /* first non-sentence char after a sentence */
/* If set, backspace deletes one character rather than
* the entire grapheme cluster.
*/
guint <API key> : 1;
/* Only few space variants (U+0020 and U+00A0) have variable
* width during justification.
*/
guint is_expandable_space : 1;
/* Word boundary as defined by UAX#29 */
guint is_word_boundary : 1; /* is NOT in the middle of a word */
} PangoLogAttr;
</pre>
<p>
The <a class="link" href="<API key>.html#PangoLogAttr" title="PangoLogAttr"><span class="type">PangoLogAttr</span></a> structure stores information
about the attributes of a single character.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-line-break"></a>is_line_break</code></em> : 1;</span></p></td>
<td>if set, can break line in front of character
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-mandatory-break"></a>is_mandatory_break</code></em> : 1;</span></p></td>
<td>if set, must break line in front of character
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-char-break"></a>is_char_break</code></em> : 1;</span></p></td>
<td>if set, can break here when doing character wrapping
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-white"></a>is_white</code></em> : 1;</span></p></td>
<td>is whitespace character
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-cursor-position"></a>is_cursor_position</code></em> : 1;</span></p></td>
<td>if set, cursor can appear in front of character.
i.e. this is a grapheme boundary, or the first character
in the text.
This flag implements Unicode's
<a class="ulink" href="http:
Cluster Boundaries</a> semantics.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-word-start"></a>is_word_start</code></em> : 1;</span></p></td>
<td>is first character in a word
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-word-end"></a>is_word_end</code></em> : 1;</span></p></td>
<td>is first non-word char after a word
Note that in degenerate cases, you could have both <em class="parameter"><code>is_word_start</code></em>
and <em class="parameter"><code>is_word_end</code></em> set for some character.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.<API key>"></a><API key></code></em> : 1;</span></p></td>
<td>is a sentence boundary.
There are two ways to divide sentences. The first assigns all
inter-sentence whitespace/control/format chars to some sentence,
so all chars are in some sentence; <em class="parameter"><code><API key></code></em> denotes
the boundaries there. The second way doesn't assign
between-sentence spaces, etc. to any sentence, so
<em class="parameter"><code>is_sentence_start</code></em>/<em class="parameter"><code>is_sentence_end</code></em> mark the boundaries
of those sentences.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-sentence-start"></a>is_sentence_start</code></em> : 1;</span></p></td>
<td>is first character in a sentence
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-sentence-end"></a>is_sentence_end</code></em> : 1;</span></p></td>
<td>is first char after a sentence.
Note that in degenerate cases, you could have both <em class="parameter"><code>is_sentence_start</code></em>
and <em class="parameter"><code>is_sentence_end</code></em> set for some character. (e.g. no space after a
period, so the next sentence starts right away)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.<API key>"></a><API key></code></em> : 1;</span></p></td>
<td>if set, backspace deletes one character
rather than the entire grapheme cluster. This
field is only meaningful on grapheme
boundaries (where <em class="parameter"><code>is_cursor_position</code></em> is
set). In some languages, the full grapheme
(e.g. letter + diacritics) is considered a
unit, while in others, each decomposed
character in the grapheme is a unit. In the
default implementation of <a class="link" href="<API key>.html#pango-break" title="pango_break ()"><code class="function">pango_break()</code></a>, this
bit is set on all grapheme boundaries except
those following Latin, Cyrillic or Greek base
characters.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-expandable-space"></a>is_expandable_space</code></em> : 1;</span></p></td>
<td>is a whitespace character that can possibly be
expanded for justification purposes. (Since: 1.18)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="type">guint</span> <em class="structfield"><code><a name="PangoLogAttr.is-word-boundary"></a>is_word_boundary</code></em> : 1;</span></p></td>
<td>is a word boundary.
More specifically, means that this is not a position in the middle
of a word. For example, both sides of a punctuation mark are
considered word boundaries. This flag is particularly useful when
selecting text word-by-word.
This flag implements Unicode's
<a class="ulink" href="http:
Boundaries</a> semantics.
(Since: 1.22)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="pango-shape"></a><h3>pango_shape ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> pango_shape (<em class="parameter"><code>const <span class="type">gchar</span> *text</code></em>,
<em class="parameter"><code><span class="type">gint</span> length</code></em>,
<em class="parameter"><code>const <a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> *analysis</code></em>,
<em class="parameter"><code><a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="struct PangoGlyphString"><span class="type">PangoGlyphString</span></a> *glyphs</code></em>);</pre>
<p>
Given a segment of text and the corresponding
<a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> structure returned from <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>,
convert the characters into glyphs. You may also pass
in only a substring of the item from <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
<td>the text to process
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td>the length (in bytes) of <em class="parameter"><code>text</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>analysis</code></em> :</span></p></td>
<td>
<a class="link" href="<API key>.html#PangoAnalysis" title="struct PangoAnalysis"><span class="type">PangoAnalysis</span></a> structure from <a class="link" href="<API key>.html#pango-itemize" title="pango_itemize ()"><code class="function">pango_itemize()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>glyphs</code></em> :</span></p></td>
<td>glyph string in which to store results
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.15.1</div>
</body>
</html> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.