code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 3 1.01M |
|---|---|---|---|---|---|
package com.bright_side_it.fliesenui.base.model;
import java.util.List;
import com.bright_side_it.fliesenui.dto.model.DTODefinition;
import com.bright_side_it.fliesenui.project.model.AssistValue;
import com.bright_side_it.fliesenui.project.model.Project;
import com.bright_side_it.fliesenui.project.model.ResourceDefinition;
public class AssistValueList implements AssistValueListProvider {
private List<AssistValue> values;
public AssistValueList(List<AssistValue> values) {
this.values = values;
}
@Override
public List<AssistValue> getValues(Project project, ResourceDefinition resourceDefinition, DTODefinition tableDTODefinition, String replacedText) {
return values;
}
public List<AssistValue> getValues() {
return values;
}
}
| FliesenUI/FliesenUI | src/com/bright_side_it/fliesenui/base/model/AssistValueList.java | Java | apache-2.0 | 794 |
<template name="NonCasLogin">
<div class="ui container raised padded text segment">
{{> atForm }}
</div>
</template>
| henricasanova/databet_meteor | databet/client/templates/login/NonCasLogin.html | HTML | apache-2.0 | 133 |
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.compiler.server;
import com.intellij.compiler.CompilerMessageImpl;
import com.intellij.compiler.ProblemsView;
import com.intellij.compiler.impl.CompileDriver;
import com.intellij.notification.Notification;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.problems.Problem;
import com.intellij.problems.WolfTheProblemSolver;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.api.CmdlineRemoteProto;
import org.jetbrains.jps.api.GlobalOptions;
import javax.swing.*;
import java.util.Collections;
import java.util.UUID;
/**
* @author Eugene Zhuravlev
*/
class AutoMakeMessageHandler extends DefaultMessageHandler {
private static final Key<Notification> LAST_AUTO_MAKE_NOTIFICATION = Key.create("LAST_AUTO_MAKE_NOTIFICATION");
private CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status myBuildStatus;
private final Project myProject;
private final WolfTheProblemSolver myWolf;
private volatile boolean myUnprocessedFSChangesDetected = false;
private final AutomakeCompileContext myContext;
AutoMakeMessageHandler(@NotNull Project project) {
super(project);
myProject = project;
myBuildStatus = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.SUCCESS;
myWolf = WolfTheProblemSolver.getInstance(project);
myContext = new AutomakeCompileContext(project);
myContext.getProgressIndicator().start();
}
public boolean unprocessedFSChangesDetected() {
return myUnprocessedFSChangesDetected;
}
@Override
protected void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event) {
if (myProject.isDisposed()) {
return;
}
switch (event.getEventType()) {
case BUILD_COMPLETED:
myContext.getProgressIndicator().stop();
if (event.hasCompletionStatus()) {
final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status = event.getCompletionStatus();
myBuildStatus = status;
if (status == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED) {
myContext.getProgressIndicator().cancel();
}
}
final int errors = myContext.getMessageCount(CompilerMessageCategory.ERROR);
final int warnings = myContext.getMessageCount(CompilerMessageCategory.WARNING);
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
if (myProject.isDisposed()) {
return;
}
final CompilationStatusListener publisher = myProject.getMessageBus().syncPublisher(CompilerTopics.COMPILATION_STATUS);
publisher.automakeCompilationFinished(errors, warnings, myContext);
});
return;
case FILES_GENERATED:
final CompilationStatusListener publisher = myProject.getMessageBus().syncPublisher(CompilerTopics.COMPILATION_STATUS);
for (CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile : event.getGeneratedFilesList()) {
final String root = FileUtil.toSystemIndependentName(generatedFile.getOutputRoot());
final String relativePath = FileUtil.toSystemIndependentName(generatedFile.getRelativePath());
publisher.fileGenerated(root, relativePath);
}
return;
case CUSTOM_BUILDER_MESSAGE:
if (event.hasCustomBuilderMessage()) {
final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.CustomBuilderMessage message = event.getCustomBuilderMessage();
if (GlobalOptions.JPS_SYSTEM_BUILDER_ID.equals(message.getBuilderId()) && GlobalOptions.JPS_UNPROCESSED_FS_CHANGES_MESSAGE_ID.equals(message.getMessageType())) {
myUnprocessedFSChangesDetected = true;
}
}
return;
default:
}
}
@Override
protected void handleCompileMessage(final UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {
if (myProject.isDisposed()) {
return;
}
final CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind = message.getKind();
if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.PROGRESS) {
final ProblemsView view = ProblemsView.getInstance(myProject);
if (message.hasDone()) {
view.setProgress(message.getText(), message.getDone());
}
else {
view.setProgress(message.getText());
}
}
else {
final CompilerMessageCategory category = CompileDriver.convertToCategory(kind, null);
if (category != null) { // only process supported kinds of messages
final String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;
final String url = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(sourceFilePath)) : null;
final long line = message.hasLine() ? message.getLine() : -1;
final long column = message.hasColumn() ? message.getColumn() : -1;
final CompilerMessage msg = myContext.createAndAddMessage(category, message.getText(), url, (int)line, (int)column, null);
if (category == CompilerMessageCategory.ERROR || kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.JPS_INFO) {
if (category == CompilerMessageCategory.ERROR) {
ReadAction.run(() -> informWolf(myProject, message));
}
if (msg != null) {
ProblemsView.getInstance(myProject).addMessage(msg, sessionId);
}
}
}
}
}
@Override
public void handleFailure(@NotNull UUID sessionId, CmdlineRemoteProto.Message.Failure failure) {
if (myProject.isDisposed()) {
return;
}
String descr = failure.hasDescription() ? failure.getDescription() : null;
if (descr == null) {
descr = failure.hasStacktrace()? failure.getStacktrace() : "";
}
final String msg = "Auto build failure: " + descr;
CompilerManager.NOTIFICATION_GROUP.createNotification(msg, MessageType.INFO);
ProblemsView.getInstance(myProject).addMessage(new CompilerMessageImpl(myProject, CompilerMessageCategory.ERROR, msg), sessionId);
}
@Override
public void sessionTerminated(@NotNull UUID sessionId) {
String statusMessage = null/*"Auto make completed"*/;
switch (myBuildStatus) {
case SUCCESS:
//statusMessage = "Auto make completed successfully";
break;
case UP_TO_DATE:
//statusMessage = "All files are up-to-date";
break;
case ERRORS:
statusMessage = "Auto build completed with errors";
break;
case CANCELED:
//statusMessage = "Auto make has been canceled";
break;
}
if (statusMessage != null) {
final Notification notification = CompilerManager.NOTIFICATION_GROUP.createNotification(statusMessage, MessageType.INFO);
if (!myProject.isDisposed()) {
notification.notify(myProject);
}
myProject.putUserData(LAST_AUTO_MAKE_NOTIFICATION, notification);
}
else {
Notification notification = myProject.getUserData(LAST_AUTO_MAKE_NOTIFICATION);
if (notification != null) {
notification.expire();
myProject.putUserData(LAST_AUTO_MAKE_NOTIFICATION, null);
}
}
if (!myProject.isDisposed()) {
ProblemsView view = ProblemsView.getInstanceIfCreated(myProject);
if (view != null) {
view.clearProgress();
view.clearOldMessages(null, sessionId);
}
}
}
private void informWolf(Project project, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {
final String srcPath = message.getSourceFilePath();
if (srcPath != null && !project.isDisposed()) {
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(srcPath);
if (vFile != null) {
final int line = (int)message.getLine();
final int column = (int)message.getColumn();
if (line > 0 && column > 0) {
final Problem problem = myWolf.convertToProblem(vFile, line, column, new String[]{message.getText()});
myWolf.weHaveGotProblems(vFile, Collections.singletonList(problem));
}
else {
myWolf.queue(vFile);
}
}
}
}
}
| leafclick/intellij-community | java/compiler/impl/src/com/intellij/compiler/server/AutoMakeMessageHandler.java | Java | apache-2.0 | 8,799 |
#
# Cookbook Name:: atig
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
%w(ruby ruby-all-dev build-essential libsqlite3-dev ca-certificates).each do|name|
package name do
action :install
end
end
gem_package "atig" do
action :install
end
| mzp/chef-repo | cookbooks/atig/recipes/default.rb | Ruby | apache-2.0 | 306 |
/*
* Copyright 2017 Young Digital Planet S.A.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.ydp.empiria.player.client.controller.extensions.internal.modules;
import com.google.inject.Inject;
import eu.ydp.empiria.player.client.controller.extensions.types.FlowRequestSocketUserExtension;
import eu.ydp.empiria.player.client.controller.extensions.types.ModuleConnectorExtension;
import eu.ydp.empiria.player.client.controller.flow.request.FlowRequestInvoker;
import eu.ydp.empiria.player.client.gin.factory.LinkModuleFactory;
import eu.ydp.empiria.player.client.module.core.creator.AbstractModuleCreator;
import eu.ydp.empiria.player.client.module.core.base.IModule;
import eu.ydp.empiria.player.client.module.core.creator.ModuleCreator;
import eu.ydp.empiria.player.client.module.ModuleTagName;
public class LinkModuleConnectorExtension extends ModuleExtension implements ModuleConnectorExtension, FlowRequestSocketUserExtension {
@Inject
private LinkModuleFactory moduleFactory;
protected FlowRequestInvoker flowRequestInvoker;
@Override
public ModuleCreator getModuleCreator() {
return new AbstractModuleCreator() {
@Override
public IModule createModule() {
return moduleFactory.getLinkModule(flowRequestInvoker);
}
};
}
@Override
public String getModuleNodeName() {
return ModuleTagName.LINK.tagName();
}
@Override
public void setFlowRequestsInvoker(FlowRequestInvoker fri) {
flowRequestInvoker = fri;
}
}
| YoungDigitalPlanet/empiria.player | src/main/java/eu/ydp/empiria/player/client/controller/extensions/internal/modules/LinkModuleConnectorExtension.java | Java | apache-2.0 | 2,143 |
using System;
using System.Collections.Generic;
using System.Linq;
using Couchbase.Core;
using Couchbase.Linq.UnitTests.Documents;
using Moq;
using Newtonsoft.Json.Serialization;
using NUnit.Framework;
using Couchbase.Linq.Extensions;
namespace Couchbase.Linq.UnitTests.QueryGeneration
{
[TestFixture]
public class ArrayOperatorTests : N1QLTestBase
{
[Test]
public void Test_ArrayContains()
{
SetContractResolver(new DefaultContractResolver());
var mockBucket = new Mock<IBucket>();
mockBucket.SetupGet(e => e.Name).Returns("default");
var query =
QueryFactory.Queryable<DocumentWithArray>(mockBucket.Object)
.Where(e => e.Array.Contains("abc"));
const string expected = "SELECT RAW `Extent1` FROM `default` as `Extent1` WHERE 'abc' IN (`Extent1`.`Array`)";
var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression);
Assert.AreEqual(expected, n1QlQuery);
}
[Test]
public void Test_ListContains()
{
SetContractResolver(new DefaultContractResolver());
var mockBucket = new Mock<IBucket>();
mockBucket.SetupGet(e => e.Name).Returns("default");
var query =
QueryFactory.Queryable<DocumentWithIList>(mockBucket.Object)
.Where(e => e.List.Contains("abc"));
const string expected = "SELECT RAW `Extent1` FROM `default` as `Extent1` WHERE 'abc' IN (`Extent1`.`List`)";
var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression);
Assert.AreEqual(expected, n1QlQuery);
}
[Test]
public void Test_StaticArrayContains()
{
SetContractResolver(new DefaultContractResolver());
var mockBucket = new Mock<IBucket>();
mockBucket.SetupGet(e => e.Name).Returns("default");
var staticArray = new[] {"abc", "def"};
var query =
QueryFactory.Queryable<Beer>(mockBucket.Object)
.Where(e => staticArray.Contains(e.Name));
const string expected = "SELECT RAW `Extent1` FROM `default` as `Extent1` WHERE `Extent1`.`name` IN (['abc', 'def'])";
var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression);
Assert.AreEqual(expected, n1QlQuery);
}
[Test]
public void Test_AlteredStaticArrayContains()
{
SetContractResolver(new DefaultContractResolver());
var mockBucket = new Mock<IBucket>();
mockBucket.SetupGet(e => e.Name).Returns("default");
var staticArray = new[] { "abc", "def" };
var query =
QueryFactory.Queryable<Beer>(mockBucket.Object)
.Where(e => staticArray.Select(p => "a" + p).Contains(e.Name));
const string expected = "SELECT RAW `Extent1` FROM `default` as `Extent1` WHERE `Extent1`.`name` IN (ARRAY ('a' || `Extent2`) FOR `Extent2` IN ['abc', 'def'] END)";
var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression);
Assert.AreEqual(expected, n1QlQuery);
}
[Test]
public void Test_StaticListContains()
{
SetContractResolver(new DefaultContractResolver());
var mockBucket = new Mock<IBucket>();
mockBucket.SetupGet(e => e.Name).Returns("default");
var staticArray = new List<string> { "abc", "def" };
var query =
QueryFactory.Queryable<Beer>(mockBucket.Object)
.Where(e => staticArray.Contains(e.Name));
const string expected = "SELECT RAW `Extent1` FROM `default` as `Extent1` WHERE `Extent1`.`name` IN (['abc', 'def'])";
var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression);
Assert.AreEqual(expected, n1QlQuery);
}
#region Helper Classes
// ReSharper disable once ClassNeverInstantiated.Local
private class DocumentWithArray
{
// ReSharper disable once UnusedAutoPropertyAccessor.Local
public string[] Array { get; set; }
}
// ReSharper disable once ClassNeverInstantiated.Local
private class DocumentWithIList
{
// ReSharper disable once UnusedAutoPropertyAccessor.Local
public IList<string> List { get; set; }
}
#endregion
}
} | brantburnett/Linq2Couchbase | Src/Couchbase.Linq.UnitTests/QueryGeneration/ArrayOperatorTests.cs | C# | apache-2.0 | 4,549 |
<header id="casmgmt-header">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="manage.html" target="_self" id="homepageUrlLink">
<div class="navbar-brand">
<img th:src="@{/images/logo_cas.png}" alt="apereo CAS logo" />
</div>
<h4 th:text="#{management.services.header.apptitle}"/>
</a>
</div>
<div class="collapse navbar-collapse" id="casmgt-navbar-collapse">
<ul class="nav navbar-nav navbar-right quicklinks">
<li>
<a id="manageServices" href="javascript://" ng-click="action.homepage()">
<i class="fa fa-th" aria-hidden="true"></i>
<span th:text="#{management.services.header.navbar.navitem.manageService}" />
</a>
</li>
<li>
<a href="javascript://" ng-click="action.serviceAdd()">
<i class="fa fa-plus-circle" aria-hidden="true"></i>
<span th:text="#{management.services.header.navbar.navitem.addNewService}" />
</a>
</li>
<li>
<a th:href="@{/logout?url=/logout.html}" target="_self" id="logoutUrlLink">
<i class="fa fa-sign-out" aria-hidden="true"></i>
<span th:text="#{management.services.header.navbar.navitem.logout}" />
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
| Unicon/cas | webapp-mgmt/cas-management-webapp/src/main/resources/templates/fragments/header.html | HTML | apache-2.0 | 1,784 |
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>KCoreMain - ONJAG documentation - it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain</title>
<meta name="description" content="KCoreMain - ONJAG documentation - it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain" />
<meta name="keywords" content="KCoreMain ONJAG documentation it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../../../../../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../../../../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />
<script type="text/javascript">
if(top === self) {
var url = '../../../../../../../index.html';
var hash = 'it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain$';
var anchor = window.location.hash;
var anchor_opt = '';
if (anchor.length >= 1)
anchor_opt = '@' + anchor.substring(1);
window.location.href = url + '#' + hash + anchor_opt;
}
</script>
</head>
<body class="value">
<div id="definition">
<img src="../../../../../../../lib/object_big.png" />
<p id="owner"><a href="../../../../../../package.html" class="extype" name="it">it</a>.<a href="../../../../../package.html" class="extype" name="it.unipi">unipi</a>.<a href="../../../../package.html" class="extype" name="it.unipi.thesis">thesis</a>.<a href="../../../package.html" class="extype" name="it.unipi.thesis.andrea">andrea</a>.<a href="../../package.html" class="extype" name="it.unipi.thesis.andrea.esposito">esposito</a>.<a href="../package.html" class="extype" name="it.unipi.thesis.andrea.esposito.onjag">onjag</a>.<a href="package.html" class="extype" name="it.unipi.thesis.andrea.esposito.onjag.test">test</a></p>
<h1>KCoreMain</h1>
</div>
<h4 id="signature" class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">object</span>
</span>
<span class="symbol">
<span class="name">KCoreMain</span>
</span>
</h4>
<div id="comment" class="fullcommenttop"><div class="comment cmt"><p>Created by Andrea Esposito <and1989@gmail.com> on 06/02/14.
</p></div><div class="toggleContainer block">
<span class="toggle">Linear Supertypes</span>
<div class="superTypes hiddenContent"><span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div>
</div></div>
<div id="mbrsel">
<div id="textfilter"><span class="pre"></span><span class="input"><input id="mbrsel-input" type="text" accesskey="/" /></span><span class="post"></span></div>
<div id="order">
<span class="filtertype">Ordering</span>
<ol>
<li class="alpha in"><span>Alphabetic</span></li>
<li class="inherit out"><span>By inheritance</span></li>
</ol>
</div>
<div id="ancestors">
<span class="filtertype">Inherited<br />
</span>
<ol id="linearization">
<li class="in" name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain"><span>KCoreMain</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li>
</ol>
</div><div id="ancestors">
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
<li class="showall in"><span>Show all</span></li>
</ol>
<a href="http://docs.scala-lang.org/overviews/scaladoc/usage.html#members" target="_blank">Learn more about member selection</a>
</div>
<div id="visbl">
<span class="filtertype">Visibility</span>
<ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol>
</div>
</div>
<div id="template">
<div id="allMembers">
<div id="values" class="values members">
<h3>Value Members</h3>
<ol><li name="scala.AnyRef#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:AnyRef):Boolean"></a>
<a id="!=(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:Any):Boolean"></a>
<a id="!=(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef###" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="##():Int"></a>
<a id="##():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:AnyRef):Boolean"></a>
<a id="==(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:Any):Boolean"></a>
<a id="==(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.Any#asInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="asInstanceOf[T0]:T0"></a>
<a id="asInstanceOf[T0]:T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef#clone" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="clone():Object"></a>
<a id="clone():AnyRef"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../../../../../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.CloneNotSupportedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#eq" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="eq(x$1:AnyRef):Boolean"></a>
<a id="eq(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#equals" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="equals(x$1:Any):Boolean"></a>
<a id="equals(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">equals</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#finalize" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="finalize():Unit"></a>
<a id="finalize():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../../../../../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="symbol">classOf[java.lang.Throwable]</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#getClass" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getClass():Class[_]"></a>
<a id="getClass():Class[_]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<a id="hashCode():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.Any#isInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isInstanceOf[T0]:Boolean"></a>
<a id="isInstanceOf[T0]:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain#main" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="main(args:Array[String]):Unit"></a>
<a id="main(Array[String]):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">main</span><span class="params">(<span name="args">args: <span class="extype" name="scala.Array">Array</span>[<span class="extype" name="scala.Predef.String">String</span>]</span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
</li><li name="scala.AnyRef#ne" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ne(x$1:AnyRef):Boolean"></a>
<a id="ne(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notify" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notify():Unit"></a>
<a id="notify():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notifyAll" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notifyAll():Unit"></a>
<a id="notifyAll():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain#printInitialGraph" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="printInitialGraph[K](vertices:org.apache.spark.rdd.RDD[(K,it.unipi.thesis.andrea.esposito.onjag.core.Vertex[K])]):Unit"></a>
<a id="printInitialGraph[K](RDD[(K,Vertex[K])]):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">printInitialGraph</span><span class="tparams">[<span name="K">K</span>]</span><span class="params">(<span name="vertices">vertices: <span class="extype" name="org.apache.spark.rdd.RDD">RDD</span>[(<span class="extype" name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain.printInitialGraph.K">K</span>, <a href="../core/Vertex.html" class="extype" name="it.unipi.thesis.andrea.esposito.onjag.core.Vertex">Vertex</a>[<span class="extype" name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain.printInitialGraph.K">K</span>])]</span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
</li><li name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain#printResultGraph" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="printResultGraph[K](result:org.apache.spark.rdd.RDD[(K,it.unipi.thesis.andrea.esposito.onjag.core.Vertex[K])]):Unit"></a>
<a id="printResultGraph[K](RDD[(K,Vertex[K])]):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">printResultGraph</span><span class="tparams">[<span name="K">K</span>]</span><span class="params">(<span name="result">result: <span class="extype" name="org.apache.spark.rdd.RDD">RDD</span>[(<span class="extype" name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain.printResultGraph.K">K</span>, <a href="../core/Vertex.html" class="extype" name="it.unipi.thesis.andrea.esposito.onjag.core.Vertex">Vertex</a>[<span class="extype" name="it.unipi.thesis.andrea.esposito.onjag.test.KCoreMain.printResultGraph.K">K</span>])]</span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
</li><li name="scala.AnyRef#synchronized" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="synchronized[T0](x$1:=>T0):T0"></a>
<a id="synchronized[T0](⇒T0):T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#toString" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="toString():String"></a>
<a id="toString():String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait():Unit"></a>
<a id="wait():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long,x$2:Int):Unit"></a>
<a id="wait(Long,Int):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long):Unit"></a>
<a id="wait(Long):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li></ol>
</div>
</div>
<div id="inheritedMembers">
<div class="parent" name="scala.AnyRef">
<h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3>
</div><div class="parent" name="scala.Any">
<h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3>
</div>
</div>
<div id="groupedMembers">
<div class="group" name="Ungrouped">
<h3>Ungrouped</h3>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="footer"> </div>
<script defer="defer" type="text/javascript" id="jquery-js" src="../../../../../../../lib/jquery.js"></script><script defer="defer" type="text/javascript" id="jquery-ui-js" src="../../../../../../../lib/jquery-ui.js"></script><script defer="defer" type="text/javascript" id="tools-tooltip-js" src="../../../../../../../lib/tools.tooltip.js"></script><script defer="defer" type="text/javascript" id="template-js" src="../../../../../../../lib/template.js"></script>
</body>
</html> | roy20021/ONJAG | doc/it/unipi/thesis/andrea/esposito/onjag/test/KCoreMain$.html | HTML | apache-2.0 | 25,559 |
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.remote;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.intellij.util.AbstractPathMapper;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.PathMapper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collection;
import java.util.List;
public class RemoteProcessUtil {
@Contract("null -> null")
public static String toRemoteFileSystemStyle(@Nullable String path) {
if (path == null) {
return null;
}
return RemoteFile.detectSystemByPath(path).createRemoteFile(path).getPath();
}
public static String[] buildRemoteCommand(@NotNull AbstractPathMapper pathMapper, @NotNull Collection<String> commands) {
return ArrayUtilRt.toStringArray(pathMapper.convertToRemote(commands));
}
@NotNull
public static String remapPathsList(@NotNull String pathsValue, @NotNull PathMapper pathMapper, @NotNull String interpreterPath) {
boolean isWin = RemoteFile.isWindowsPath(interpreterPath);
List<String> paths = Lists.newArrayList(pathsValue.split(File.pathSeparator));
List<String> mappedPaths = Lists.newArrayList();
for (String path : paths) {
mappedPaths.add(new RemoteFile(pathMapper.convertToRemote(path), isWin).getPath());
}
return Joiner.on(isWin ? ';' : ':').join(mappedPaths);
}
}
| leafclick/intellij-community | platform/platform-impl/src/com/intellij/remote/RemoteProcessUtil.java | Java | apache-2.0 | 1,582 |
require 'spec_helper'
describe 'neutron::designate' do
let :req_params do
{ :password => 'secret',
:url => 'http://ip/designate' }
end
shared_examples 'neutron designate' do
context 'with default parameters' do
let :params do
req_params
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret').with_secret(true)
should contain_neutron_config('designate/auth_type').with_value('password')
should contain_neutron_config('designate/username').with_value('neutron')
should contain_neutron_config('designate/user_domain_name').with_value('Default')
should contain_neutron_config('designate/project_name').with_value('services')
should contain_neutron_config('designate/project_domain_name').with_value('Default')
should contain_neutron_config('designate/system_scope').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/auth_url').with_value('http://127.0.0.1:5000')
should contain_neutron_config('designate/allow_reverse_dns_lookup').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/ptr_zone_email').with_value('<SERVICE DEFAULT>')
end
end
context 'with provided parameters' do
let :params do
req_params.merge!({
:auth_type => 'token',
:username => 'user',
:user_domain_name => 'Domain2',
:project_id => 'id1',
:project_name => 'proj',
:project_domain_name => 'Domain1',
:auth_url => 'http://auth/',
:allow_reverse_dns_lookup => false,
:ipv4_ptr_zone_prefix_size => 765,
:ipv6_ptr_zone_prefix_size => 876,
:ptr_zone_email => 'foo@example.com'
})
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret').with_secret(true)
should contain_neutron_config('designate/auth_type').with_value('token')
should contain_neutron_config('designate/username').with_value('user')
should contain_neutron_config('designate/user_domain_name').with_value('Domain2')
should contain_neutron_config('designate/project_id').with_value('id1')
should contain_neutron_config('designate/project_name').with_value('proj')
should contain_neutron_config('designate/project_domain_name').with_value('Domain1')
should contain_neutron_config('designate/system_scope').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/auth_url').with_value('http://auth/')
should contain_neutron_config('designate/allow_reverse_dns_lookup').with_value(false)
should contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value(765)
should contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value(876)
should contain_neutron_config('designate/ptr_zone_email').with_value('foo@example.com')
end
end
context 'with system_scope' do
let :params do
req_params.merge!({
:project_id => 'id1',
:project_name => 'proj',
:project_domain_name => 'Domain1',
:system_scope => 'all',
})
end
it 'configures designate in neutron.conf' do
should contain_neutron_config('designate/project_id').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/project_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/project_domain_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('designate/system_scope').with_value('all')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'neutron designate'
end
end
end
| openstack/puppet-neutron | spec/classes/neutron_designate_spec.rb | Ruby | apache-2.0 | 4,751 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import, division, print_function, \
with_statement # use the features of python 3
import collections
import logging
import time
# this LRUCache is optimized for concurrency, not QPS
# n: concurrency, keys stored in the cache
# m: visits not timed out, proportional to QPS * timeout
# get & set is O(1), not O(n). thus we can support very large n
# TODO: if timeout or QPS is too large, then this cache is not very efficient,
# as sweep() causes long pause
class LRUCache(collections.MutableMapping): # ABCs for read-only and mutable mappings.
"""This class is not thread safe"""
def __init__(self, timeout=60, close_callback=None, *args, **kwargs):
self.timeout = timeout # the cache expire time
self.close_callback = close_callback # called when value will be swept from cache
self._store = {} # dict<key, value>: store cache data key value
self._time_to_keys = collections.defaultdict(list) # defaultdict<time, list<key>>
# defaultdict: dict subclass that calls a factory function to supply missing values
self._keys_to_last_time = {} # dict<key, time> stores the last time of one key visited.
self._last_visits = collections.deque() # deque<time> store all the time once key is visited.
self.update(dict(*args, **kwargs)) # use the free update to set keys
def __getitem__(self, key):
# O(1)
t = time.time()
self._keys_to_last_time[key] = t
self._time_to_keys[t].append(key)
self._last_visits.append(t)
return self._store[key]
def __setitem__(self, key, value):
# O(1)
t = time.time()
self._keys_to_last_time[key] = t
self._store[key] = value
self._time_to_keys[t].append(key)
self._last_visits.append(t)
def __delitem__(self, key):
# O(1)
del self._store[key]
del self._keys_to_last_time[key]
def __iter__(self):
return iter(self._store)
def __len__(self):
return len(self._store)
def sweep(self):
# O(m)
now = time.time()
c = 0 # use to log how many keys has been swept.
while len(self._last_visits) > 0:
least = self._last_visits[0] # fetch the oldest time point
if now - least <= self.timeout: # the oldest time point hasn't expire
break
if self.close_callback is not None: # callback function has been set
for key in self._time_to_keys[least]: # fetch each key visited on the oldest time
if key in self._store: # finded the cache key
if now - self._keys_to_last_time[key] > self.timeout:
value = self._store[key] # get the key of the last time and check expire or yet.
self.close_callback(value) # call callback
for key in self._time_to_keys[least]:
self._last_visits.popleft() # can't understand and have error personally
# @Sunny: use popleft to remove oldest time point in last visits
if key in self._store:
if now - self._keys_to_last_time[key] > self.timeout:
del self._store[key]
del self._keys_to_last_time[key]
c += 1
del self._time_to_keys[least]
if c:
logging.debug('%d keys swept' % c)
def test():
c = LRUCache(timeout=0.3)
c['a'] = 1
assert c['a'] == 1
time.sleep(0.5)
c.sweep()
assert 'a' not in c
c['a'] = 2
c['b'] = 3
time.sleep(0.2)
c.sweep()
assert c['a'] == 2
assert c['b'] == 3
time.sleep(0.2)
c.sweep()
c['b']
time.sleep(0.2)
c.sweep()
assert 'a' not in c
assert c['b'] == 3
time.sleep(0.5)
c.sweep()
assert 'a' not in c
assert 'b' not in c
if __name__ == '__main__':
test()
| meowlab/shadowsocks-comment | shadowsocks/lru_cache.py | Python | apache-2.0 | 4,886 |
<div ng-controller="LoginCtrl">
<span>
<h5>Veuillez vous connectez</h5>
</span>
<span>
<button id="button-google" ng-click="connectGoogle()">Connexion avec Google</button>
</span>
</div> | Thomas55170/Mess | www/template/main.html | HTML | apache-2.0 | 218 |
div {
border: 5px solid #EDF3F3;
border-radius: 1em;
text-align: center;
}
span {
display: inline-block;
font-size: 10px;
}
.inner {
margin: 5px;
padding: 5px;
}
.outer {
width: 400px;
} | katonap/ng2-test-seed | src/app/border-component.css | CSS | apache-2.0 | 197 |
package ca.uhn.fhir.jpa.dao.data;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.entity.SearchParamPresent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/*
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2021 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface ISearchParamPresentDao extends JpaRepository<SearchParamPresent, Long> {
@Query("SELECT s FROM SearchParamPresent s WHERE s.myResource = :res")
List<SearchParamPresent> findAllForResource(@Param("res") ResourceTable theResource);
@Modifying
@Query("delete from SearchParamPresent t WHERE t.myResourcePid = :resid")
void deleteByResourceId(@Param("resid") Long theResourcePid);
}
| SingingTree/hapi-fhir | hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/ISearchParamPresentDao.java | Java | apache-2.0 | 1,455 |
package it.unibz.inf.ontop.protege.panels;
/*
* #%L
* ontop-protege4
* %%
* Copyright (C) 2009 - 2013 KRDB Research Centre. Free University of Bozen Bolzano.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import it.unibz.inf.ontop.protege.gui.treemodels.TreeElement;
import it.unibz.inf.ontop.protege.gui.IconLoader;
import it.unibz.inf.ontop.protege.gui.treemodels.QueryControllerTreeModel;
import it.unibz.inf.ontop.protege.gui.treemodels.QueryGroupTreeElement;
import it.unibz.inf.ontop.protege.gui.treemodels.QueryTreeElement;
import it.unibz.inf.ontop.protege.utils.DialogUtils;
import it.unibz.inf.ontop.querymanager.QueryController;
import it.unibz.inf.ontop.querymanager.QueryControllerEntity;
import it.unibz.inf.ontop.querymanager.QueryControllerGroup;
import it.unibz.inf.ontop.querymanager.QueryControllerListener;
import it.unibz.inf.ontop.querymanager.QueryControllerQuery;
import java.awt.Dialog.ModalityType;
import java.util.Vector;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
/**
* This class represents the display of stored queries using a tree structure.
*/
public class SavedQueriesPanel extends JPanel implements QueryControllerListener {
private static final long serialVersionUID = 6920100822784727963L;
private Vector<SavedQueriesPanelListener> listeners = new Vector<SavedQueriesPanelListener>();
private QueryControllerTreeModel queryControllerModel = new QueryControllerTreeModel();
private QueryController queryController;
private QueryTreeElement currentId;
private QueryTreeElement previousId;
/**
* Creates new form SavedQueriesPanel
*/
public SavedQueriesPanel(QueryController queryController) {
initComponents();
this.queryController = queryController;
this.queryController.addListener(queryControllerModel);
this.queryController.addListener(this);
// Fill the tree model with existing elements from the controller
queryControllerModel.synchronize(queryController.getElements());
queryControllerModel.reload();
}
public void changeQueryController(QueryController newQueryController) {
// Reset and reload the current tree model
queryControllerModel.reset();
queryControllerModel.synchronize(queryController.getElements());
queryControllerModel.reload();
if (queryController != null) {
queryController.removeAllListeners();
}
queryController = newQueryController;
queryController.addListener(queryControllerModel);
queryController.addListener(this);
}
public void addQueryManagerListener(SavedQueriesPanelListener listener) {
if (listener == null) {
return;
}
if (listeners.contains(listener)) {
return;
}
listeners.add(listener);
}
public void removeQueryManagerListener(SavedQueriesPanelListener listener) {
if (listener == null) {
return;
}
if (listeners.contains(listener)) {
listeners.remove(listener);
}
}
/**
* 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
pnlSavedQuery = new javax.swing.JPanel();
scrSavedQuery = new javax.swing.JScrollPane();
treSavedQuery = new javax.swing.JTree();
pnlCommandPanel = new javax.swing.JPanel();
lblSavedQuery = new javax.swing.JLabel();
cmdRemove = new javax.swing.JButton();
cmdAdd = new javax.swing.JButton();
cmdExport = new javax.swing.JButton();
cmdImport = new javax.swing.JButton();
setLayout(new java.awt.BorderLayout());
pnlSavedQuery.setMinimumSize(new java.awt.Dimension(200, 50));
pnlSavedQuery.setLayout(new java.awt.BorderLayout());
scrSavedQuery.setMinimumSize(new java.awt.Dimension(400, 200));
scrSavedQuery.setOpaque(false);
scrSavedQuery.setPreferredSize(new java.awt.Dimension(300, 200));
treSavedQuery.setBorder(javax.swing.BorderFactory.createEtchedBorder());
treSavedQuery.setForeground(new java.awt.Color(51, 51, 51));
treSavedQuery.setModel(queryControllerModel);
treSavedQuery.setCellRenderer(new SavedQueriesTreeCellRenderer());
treSavedQuery.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
treSavedQuery.setMaximumSize(new java.awt.Dimension(5000, 5000));
treSavedQuery.setRootVisible(false);
treSavedQuery.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
reselectQueryNode(evt);
}
});
treSavedQuery.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
selectQueryNode(evt);
}
});
scrSavedQuery.setViewportView(treSavedQuery);
pnlSavedQuery.add(scrSavedQuery, java.awt.BorderLayout.CENTER);
pnlCommandPanel.setLayout(new java.awt.GridBagLayout());
lblSavedQuery.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
lblSavedQuery.setForeground(new java.awt.Color(153, 153, 153));
lblSavedQuery.setText("Stored Query:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.5;
pnlCommandPanel.add(lblSavedQuery, gridBagConstraints);
cmdRemove.setIcon(IconLoader.getImageIcon("images/minus.png"));
cmdRemove.setText("Remove");
cmdRemove.setToolTipText("Remove the selected query");
cmdRemove.setBorder(javax.swing.BorderFactory.createEtchedBorder());
cmdRemove.setContentAreaFilled(false);
cmdRemove.setIconTextGap(5);
cmdRemove.setMaximumSize(new java.awt.Dimension(25, 25));
cmdRemove.setMinimumSize(new java.awt.Dimension(25, 25));
cmdRemove.setPreferredSize(new java.awt.Dimension(80, 25));
cmdRemove.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdRemoveActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
pnlCommandPanel.add(cmdRemove, gridBagConstraints);
cmdAdd.setIcon(IconLoader.getImageIcon("images/plus.png"));
cmdAdd.setText("Add");
cmdAdd.setToolTipText("Add a new query");
cmdAdd.setBorder(javax.swing.BorderFactory.createEtchedBorder());
cmdAdd.setContentAreaFilled(false);
cmdAdd.setIconTextGap(4);
cmdAdd.setMaximumSize(new java.awt.Dimension(25, 25));
cmdAdd.setMinimumSize(new java.awt.Dimension(25, 25));
cmdAdd.setPreferredSize(new java.awt.Dimension(63, 25));
cmdAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdAddActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
pnlCommandPanel.add(cmdAdd, gridBagConstraints);
cmdExport.setText("Export");
cmdExport.setBorder(javax.swing.BorderFactory.createEtchedBorder());
cmdExport.setContentAreaFilled(false);
cmdExport.setEnabled(false);
cmdExport.setMaximumSize(new java.awt.Dimension(100, 25));
cmdExport.setMinimumSize(new java.awt.Dimension(50, 25));
cmdExport.setPreferredSize(new java.awt.Dimension(60, 25));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
pnlCommandPanel.add(cmdExport, gridBagConstraints);
cmdImport.setText("Import");
cmdImport.setToolTipText("Import queries from an obda file");
cmdImport.setBorder(javax.swing.BorderFactory.createEtchedBorder());
cmdImport.setContentAreaFilled(false);
cmdImport.setEnabled(false);
cmdImport.setMaximumSize(new java.awt.Dimension(100, 25));
cmdImport.setMinimumSize(new java.awt.Dimension(25, 25));
cmdImport.setPreferredSize(new java.awt.Dimension(60, 25));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
pnlCommandPanel.add(cmdImport, gridBagConstraints);
pnlSavedQuery.add(pnlCommandPanel, java.awt.BorderLayout.NORTH);
add(pnlSavedQuery, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
private void selectQueryNode(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_selectQueryNode
String currentQuery = "";
DefaultMutableTreeNode node = (DefaultMutableTreeNode) evt.getPath().getLastPathComponent();
if (node instanceof QueryTreeElement) {
QueryTreeElement queryElement = (QueryTreeElement)node;
currentQuery = queryElement.getQuery();
currentId = queryElement;
TreeNode parent = queryElement.getParent();
if (parent == null || parent.toString().equals("")) {
fireQueryChanged("", currentQuery, currentId.getID());
}
else {
fireQueryChanged(parent.toString(), currentQuery, currentId.getID());
}
}
else if (node instanceof QueryGroupTreeElement) {
QueryGroupTreeElement groupElement = (QueryGroupTreeElement)node;
currentId = null;
currentQuery = null;
fireQueryChanged(groupElement.toString(), "", "");
}
else if (node == null) {
currentId = null;
currentQuery = null;
}
}//GEN-LAST:event_selectQueryNode
private void reselectQueryNode(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reselectQueryNode
if (currentId == null) {
return;
}
if (previousId == currentId) {
fireQueryChanged(currentId.getParent().toString(), currentId.getQuery(), currentId.getID());
}
else { // register the selected node
previousId = currentId;
}
}//GEN-LAST:event_reselectQueryNode
private void cmdAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAddActionPerformed
// Open a save dialog if it is a new query
JDialog saveDialog = new JDialog();
saveDialog.setTitle("New Query");
saveDialog.setModalityType(ModalityType.MODELESS);
SaveQueryPanel savePanel = new SaveQueryPanel("", saveDialog, queryController);
saveDialog.getContentPane().add(savePanel, java.awt.BorderLayout.CENTER);
saveDialog.pack();
DialogUtils.centerDialogWRTParent(this, saveDialog);
DialogUtils.installEscapeCloseOperation(saveDialog);
saveDialog.setVisible(true);
}//GEN-LAST:event_cmdAddActionPerformed
private void cmdRemoveActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_removeQueryButtonActionPerformed
TreePath selected_path = treSavedQuery.getSelectionPath();
if (selected_path == null)
return;
if (JOptionPane.showConfirmDialog(this, "This will delete the selected query. \n Continue? ", "Delete confirmation",
JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION) == JOptionPane.CANCEL_OPTION) {
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) selected_path.getLastPathComponent();
if (node instanceof TreeElement) {
TreeElement element = (TreeElement) node;
QueryController qc = this.queryController;
if (node instanceof QueryTreeElement) {
qc.removeQuery(element.getID());
} else if (node instanceof QueryGroupTreeElement) {
qc.removeGroup(element.getID());
}
}
}// GEN-LAST:event_removeQueryButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cmdAdd;
private javax.swing.JButton cmdExport;
private javax.swing.JButton cmdImport;
private javax.swing.JButton cmdRemove;
private javax.swing.JLabel lblSavedQuery;
private javax.swing.JPanel pnlCommandPanel;
private javax.swing.JPanel pnlSavedQuery;
private javax.swing.JScrollPane scrSavedQuery;
private javax.swing.JTree treSavedQuery;
// End of variables declaration//GEN-END:variables
public void fireQueryChanged(String newgroup, String newquery, String newid) {
for (SavedQueriesPanelListener listener : listeners) {
listener.selectedQueryChanged(newgroup, newquery, newid);
}
}
@Override
public void elementAdded(QueryControllerEntity element) {
String elementId = element.getID();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) queryControllerModel.getNode(elementId);
// Select the new node in the JTree
treSavedQuery.setSelectionPath(new TreePath(node.getPath()));
treSavedQuery.scrollPathToVisible(new TreePath(node.getPath()));
}
@Override
public void elementAdded(QueryControllerQuery query, QueryControllerGroup group) {
String queryId = query.getID();
String groupId = group.getID();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) queryControllerModel.getElementQuery(queryId, groupId);
// Select the new node in the JTree
treSavedQuery.setSelectionPath(new TreePath(node.getPath()));
treSavedQuery.scrollPathToVisible(new TreePath(node.getPath()));
}
@Override
public void elementRemoved(QueryControllerEntity element) {
fireQueryChanged("", "", "");
}
@Override
public void elementRemoved(QueryControllerQuery query, QueryControllerGroup group) {
fireQueryChanged("", "", "");
}
@Override
public void elementChanged(QueryControllerQuery query, QueryControllerGroup group) {
String queryId = query.getID();
String groupId = group.getID();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) queryControllerModel.getElementQuery(queryId, groupId);
// Select the modified node in the JTree
treSavedQuery.setSelectionPath(new TreePath(node.getPath()));
treSavedQuery.scrollPathToVisible(new TreePath(node.getPath()));
}
@Override
public void elementChanged(QueryControllerQuery query) {
String queryId = query.getID();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) queryControllerModel.getNode(queryId);
// Select the modified node in the JTree
treSavedQuery.setSelectionPath(new TreePath(node.getPath()));
treSavedQuery.scrollPathToVisible(new TreePath(node.getPath()));
}
}
| srapisarda/ontop | ontop-protege/src/main/java/it/unibz/inf/ontop/protege/panels/SavedQueriesPanel.java | Java | apache-2.0 | 16,188 |
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.editorconfig.configmanagement.extended;
import com.intellij.application.options.CodeStyle;
import com.intellij.application.options.codeStyle.properties.*;
import com.intellij.util.containers.ContainerUtil;
import org.editorconfig.Utils;
import org.editorconfig.language.extensions.EditorConfigOptionDescriptorProvider;
import org.editorconfig.language.schema.descriptors.EditorConfigDescriptor;
import org.editorconfig.language.schema.descriptors.impl.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class IntellijConfigOptionDescriptorProvider implements EditorConfigOptionDescriptorProvider {
@NotNull
@Override
public List<EditorConfigOptionDescriptor> getOptionDescriptors() {
if (!Utils.isFullIntellijSettingsSupport()) {
return Collections.emptyList();
}
return getAllOptions();
}
@Override
public boolean requiresFullSupport() {
return Utils.isFullIntellijSettingsSupport();
}
private static List<EditorConfigOptionDescriptor> getAllOptions() {
List<EditorConfigOptionDescriptor> descriptors = new ArrayList<>();
List<AbstractCodeStylePropertyMapper> mappers = new ArrayList<>();
CodeStylePropertiesUtil.collectMappers(CodeStyle.getDefaultSettings(), mapper -> mappers.add(mapper));
for (AbstractCodeStylePropertyMapper mapper : mappers) {
for (String property : mapper.enumProperties()) {
if (IntellijPropertyKindMap.getPropertyKind(property) == EditorConfigPropertyKind.EDITOR_CONFIG_STANDARD) {
// Descriptions for standard properties are added separately
continue;
}
List<String> ecNames = EditorConfigIntellijNameUtil.toEditorConfigNames(mapper, property);
final EditorConfigDescriptor valueDescriptor = createValueDescriptor(property, mapper);
if (valueDescriptor != null) {
for (String ecName : ecNames) {
EditorConfigOptionDescriptor descriptor = new EditorConfigOptionDescriptor(
new EditorConfigConstantDescriptor(ecName, mapper.getPropertyDescription(property), null),
valueDescriptor,
null, null);
descriptors.add(descriptor);
}
}
}
}
return descriptors;
}
@Nullable
private static EditorConfigDescriptor createValueDescriptor(@NotNull String property, @NotNull AbstractCodeStylePropertyMapper mapper) {
CodeStylePropertyAccessor accessor = mapper.getAccessor(property);
if (accessor instanceof CodeStyleChoiceList) {
return new EditorConfigUnionDescriptor(choicesToDescriptorList((CodeStyleChoiceList)accessor), null, null);
}
else if (isFormatterOnOffTag(accessor)) {
return new EditorConfigPairDescriptor(
new EditorConfigStringDescriptor(null, null, ".*"),
new EditorConfigStringDescriptor(null, null, ".*"),
null, null);
}
else if (accessor instanceof IntegerAccessor) {
return new EditorConfigNumberDescriptor(null, null);
}
else if (accessor instanceof ValueListPropertyAccessor) {
return new EditorConfigListDescriptor(0, true, Collections.singletonList(new EditorConfigStringDescriptor(null, null, ".*")), null, null);
}
else if (accessor instanceof ExternalStringAccessor) {
return new EditorConfigStringDescriptor(null, null, ".*");
}
else if (accessor instanceof VisualGuidesAccessor) {
return new EditorConfigListDescriptor(0, true, Collections.singletonList(new EditorConfigNumberDescriptor(null, null)), null, null);
}
return null;
}
private static boolean isFormatterOnOffTag(@NotNull CodeStylePropertyAccessor accessor) {
String name = accessor.getPropertyName();
return "formatter_on_tag".equals(name) || "formatter_off_tag".equals(name);
}
private static List<EditorConfigDescriptor> choicesToDescriptorList(@NotNull CodeStyleChoiceList list) {
return ContainerUtil.map(list.getChoices(), s -> new EditorConfigConstantDescriptor(s, null, null));
}
}
| leafclick/intellij-community | plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijConfigOptionDescriptorProvider.java | Java | apache-2.0 | 4,255 |
package com.crawler.autowereld;
import java.io.File;
import java.io.FileNotFoundException;
import com.crawler.autowereld.export.CrawlerExportException;
import com.crawler.autowereld.export.serialization.SerializationException;
public class Main {
public static void main(String[] args) {
try {
checkAndDoExport(args);
go();
} catch (Exception e) {
DefaultExceptionHandler.handleException(e);
}
System.exit(0);
}
private static void go() throws Exception {
File inputFile = new FileSelector().selectFileXls();
Crawler crawler = new Crawler();
crawler.go(inputFile);
}
private static void checkAndDoExport(String[] args) throws FileNotFoundException, CrawlerExportException, SerializationException {
String arg = "";
try {
arg = args[0];
} catch (Exception e) {
return;
}
if (arg.compareTo("export") == 0) {
File filePath = new FileSelector().selectFileDat();
File pathToSave = null;
try {
pathToSave = new FileSelector().selectPathToSave();
} catch (Exception e) {
DefaultExceptionHandler.handleException(e);
System.exit(0);
}
new Crawler().export(filePath, pathToSave);
System.exit(0);
} else {
System.out.println("Program obsługuje tylko jeden argument:\n export");
}
}
}
| tomasz-galuszka/HttpCrawlers | autowereld/AutoWereldOfferrsCrawler/src/com/crawler/autowereld/Main.java | Java | apache-2.0 | 1,265 |
function New-VSS3Object {
<#
.SYNOPSIS
Uploads an object to S3
.PARAMETER BucketName
The name of the bucket to contain the object.
.PARAMETER CannedACL
The canned access control list (CACL) to apply to the object. Valid options are: "NoACL","Private","PublicRead","PublicReadWrite","AuthenticatedRead","AWSExecRead","BucketOwnerRead","BucketOwnerFullControl","LogDeliveryWrite"
.PARAMETER ContentBody
Text content to be uploaded. Use this property if you want to upload plaintext to S3. The content type will be set to 'text/plain'.
.PARAMETER ContentBody
Text content to be uploaded. Use this property if you want to upload plaintext to S3. The content type will be set to 'text/plain'.
.PARAMETER FilePath
The full path and name to a file to be uploaded. If this is set the request will upload the specified file to S3.
.PARAMETER Key
The key used to identify the object in S3.
.PARAMETER KMSKeyId
The id of the AWS Key Management Service key that Amazon S3 should use to encrypt and decrypt the object. If a key id is not specified, the default key will be used for encryption and decryption.
.PARAMETER ProfileName
The name of the configuration profile to deploy the stack with. Defaults to $env:AWS_PROFILE, if set.
.FUNCTIONALITY
Vaporshell
#>
[cmdletbinding()]
Param (
[parameter(Mandatory = $true,Position = 0)]
[String]
$BucketName,
[parameter(Mandatory = $false)]
[ValidateSet("NoACL","Private","PublicRead","PublicReadWrite","AuthenticatedRead","AWSExecRead","BucketOwnerRead","BucketOwnerFullControl","LogDeliveryWrite")]
[String]
$CannedACL,
[parameter(Mandatory = $false)]
[System.String]
$ContentBody,
[parameter(Mandatory = $false)]
[System.String]
$FilePath,
[parameter(Mandatory = $false)]
[System.String]
$Key,
[parameter(Mandatory = $false)]
[System.String]
$KMSKeyId,
[parameter(Mandatory = $false)]
[String]
$ProfileName = $env:AWS_PROFILE
)
Begin {
Import-AWSSDK
}
Process {
$method = "PutObject"
$requestType = "Amazon.S3.Model.$($method)Request"
$request = New-Object $requestType
foreach ($key in $PSBoundParameters.Keys) {
switch ($key) {
CannedACL {
$request.CannedACL = [Amazon.S3.S3CannedACL]::$CannedACL
}
KMSKeyId {
$request.ServerSideEncryptionKeyManagementServiceKeyId = $KMSKeyId
}
Default {
if ($request.PSObject.Properties.Name -contains $key) {
$request.$key = $PSBoundParameters[$key]
}
}
}
}
$results = ProcessRequest $PSCmdlet.ParameterSetName $ProfileName $method $request
if (!$results) {
return
}
elseif ($results -is 'System.Management.Automation.ErrorRecord') {
$PSCmdlet.ThrowTerminatingError($results)
}
elseif ($results) {
return $results
}
}
}
| scrthq/Vaporshell | VaporShell/Public/SDK Wrappers/S3/New-VSS3Object.ps1 | PowerShell | apache-2.0 | 3,259 |
package com.jiakaiyang.androider.web.bbs.base;
import com.google.gson.Gson;
import com.jiakaiyang.androider.web.common.convert.JsonConverter;
import spark.ResponseTransformer;
import java.util.Map;
/**
* 把返回值处理成json格式的字符串
*/
public class JsonTransformer implements ResponseTransformer {
@Override
public String render(Object model) throws Exception {
Gson gson = new Gson();
if(model instanceof Map){
return JsonConverter.mapToJson((Map<String, Object>)model);
}else{
return gson.toJson(model);
}
}
}
| kaiyangjia/androider-web | bbs/src/main/java/com/jiakaiyang/androider/web/bbs/base/JsonTransformer.java | Java | artistic-2.0 | 602 |
/**
* PokemonController
*
* @description :: Server-side logic for managing Pokemons
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
hola: function (req, res) {
return res.send("Hola desde el controlador pokemon");
},
adios: function (req, res) {
return res.send("Adios desde el controlador");
}
};
| adrianeguez/PruebaWeb | Pokedex/api/controllers/PokemonController.js | JavaScript | artistic-2.0 | 437 |
package Mojo::EventEmitter;
use Mojo::Base -base;
use Scalar::Util qw(blessed weaken);
use constant DEBUG => $ENV{MOJO_EVENTEMITTER_DEBUG} || 0;
sub catch { $_[0]->on(error => $_[1]) and return $_[0] }
sub emit {
my ($self, $name) = (shift, shift);
if (my $s = $self->{events}{$name}) {
warn "-- Emit $name in @{[blessed $self]} (@{[scalar @$s]})\n" if DEBUG;
for my $cb (@$s) { $self->$cb(@_) }
}
else {
warn "-- Emit $name in @{[blessed $self]} (0)\n" if DEBUG;
die "@{[blessed $self]}: $_[0]" if $name eq 'error';
}
return $self;
}
sub has_subscribers { !!shift->{events}{shift()} }
sub on { push @{$_[0]{events}{$_[1]}}, $_[2] and return $_[2] }
sub once {
my ($self, $name, $cb) = @_;
weaken $self;
my $wrapper = sub {
$self->unsubscribe($name => __SUB__);
$cb->(@_);
};
$self->on($name => $wrapper);
return $wrapper;
}
sub subscribers { shift->{events}{shift()} ||= [] }
sub unsubscribe {
my ($self, $name, $cb) = @_;
# One
if ($cb) {
$self->{events}{$name} = [grep { $cb ne $_ } @{$self->{events}{$name}}];
delete $self->{events}{$name} unless @{$self->{events}{$name}};
}
# All
else { delete $self->{events}{$name} }
return $self;
}
1;
=encoding utf8
=head1 NAME
Mojo::EventEmitter - Event emitter base class
=head1 SYNOPSIS
package Cat;
use Mojo::Base 'Mojo::EventEmitter', -signatures;
# Emit events
sub poke ($self) { $self->emit(roar => 3) }
package main;
# Subscribe to events
my $tiger = Cat->new;
$tiger->on(roar => sub ($tiger, $times) { say 'RAWR!' for 1 .. $times });
$tiger->poke;
=head1 DESCRIPTION
L<Mojo::EventEmitter> is a simple base class for event emitting objects.
=head1 EVENTS
L<Mojo::EventEmitter> can emit the following events.
=head2 error
$e->on(error => sub ($e, $err) {...});
This is a special event for errors, it will not be emitted directly by this class, but is fatal if unhandled.
Subclasses may choose to emit it, but are not required to do so.
$e->on(error => sub ($e, $err) { say "This looks bad: $err" });
=head1 METHODS
L<Mojo::EventEmitter> inherits all methods from L<Mojo::Base> and implements the following new ones.
=head2 catch
$e = $e->catch(sub {...});
Subscribe to L</"error"> event.
# Longer version
$e->on(error => sub {...});
=head2 emit
$e = $e->emit('foo');
$e = $e->emit('foo', 123);
Emit event.
=head2 has_subscribers
my $bool = $e->has_subscribers('foo');
Check if event has subscribers.
=head2 on
my $cb = $e->on(foo => sub {...});
Subscribe to event.
$e->on(foo => sub ($e, @args) {...});
=head2 once
my $cb = $e->once(foo => sub {...});
Subscribe to event and unsubscribe again after it has been emitted once.
$e->once(foo => sub ($e, @args) {...});
=head2 subscribers
my $subscribers = $e->subscribers('foo');
All subscribers for event.
# Unsubscribe last subscriber
$e->unsubscribe(foo => $e->subscribers('foo')->[-1]);
# Change order of subscribers
@{$e->subscribers('foo')} = reverse @{$e->subscribers('foo')};
=head2 unsubscribe
$e = $e->unsubscribe('foo');
$e = $e->unsubscribe(foo => $cb);
Unsubscribe from event.
=head1 DEBUGGING
You can set the C<MOJO_EVENTEMITTER_DEBUG> environment variable to get some advanced diagnostics information printed to
C<STDERR>.
MOJO_EVENTEMITTER_DEBUG=1
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
=cut
| polettix/mojo | lib/Mojo/EventEmitter.pm | Perl | artistic-2.0 | 3,461 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_292) on Fri Jul 02 16:35:40 UTC 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface com.destroystokyo.paper.event.executor.asm.ClassDefiner (Glowkit 1.16.5-R0.1-SNAPSHOT API)</title>
<meta name="date" content="2021-07-02">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.destroystokyo.paper.event.executor.asm.ClassDefiner (Glowkit 1.16.5-R0.1-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?com/destroystokyo/paper/event/executor/asm/class-use/ClassDefiner.html" target="_top">Frames</a></li>
<li><a href="ClassDefiner.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface com.destroystokyo.paper.event.executor.asm.ClassDefiner" class="title">Uses of Interface<br>com.destroystokyo.paper.event.executor.asm.ClassDefiner</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">ClassDefiner</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.destroystokyo.paper.event.executor.asm">com.destroystokyo.paper.event.executor.asm</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.destroystokyo.paper.event.executor.asm">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">ClassDefiner</a> in <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/package-summary.html">com.destroystokyo.paper.event.executor.asm</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/package-summary.html">com.destroystokyo.paper.event.executor.asm</a> that implement <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">ClassDefiner</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.html" title="class in com.destroystokyo.paper.event.executor.asm">SafeClassDefiner</a></span></code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/package-summary.html">com.destroystokyo.paper.event.executor.asm</a> that return <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">ClassDefiner</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/org/jetbrains/annotations/NotNull.html?is-external=true" title="class or interface in org.jetbrains.annotations">@NotNull</a> <a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">ClassDefiner</a></code></td>
<td class="colLast"><span class="typeNameLabel">ClassDefiner.</span><code><span class="memberNameLink"><a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html#getInstance--">getInstance</a></span>()</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../com/destroystokyo/paper/event/executor/asm/ClassDefiner.html" title="interface in com.destroystokyo.paper.event.executor.asm">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?com/destroystokyo/paper/event/executor/asm/class-use/ClassDefiner.html" target="_top">Frames</a></li>
<li><a href="ClassDefiner.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2021. All rights reserved.</small></p>
</body>
</html>
| GlowstoneMC/glowstonemc.github.io | content/jd/glowkit/1.16/com/destroystokyo/paper/event/executor/asm/class-use/ClassDefiner.html | HTML | artistic-2.0 | 8,497 |
/*
This file was autogenerated by tags.py
*/
#import "GCEventDetailAttribute.h"
/**
*/
@interface GCPhoneNumberAttribute : GCEventDetailAttribute
// Methods:
/// @name Initializing
/** Initializes and returns a phoneNumber.
@return A new phoneNumber.
*/
+(instancetype)phoneNumber;
/// @name Initializing
/** Initializes and returns a phoneNumber.
@param value The value as a GCValue object.
@return A new phoneNumber.
*/
+(instancetype)phoneNumberWithValue:(GCValue *)value;
/// @name Initializing
/** Initializes and returns a phoneNumber.
@param value The value as an NSString.
@return A new phoneNumber.
*/
+(instancetype)phoneNumberWithGedcomStringValue:(NSString *)value;
// Properties:
@end
| mikkelee/Gedcom-Framework | Gedcom/_Generated/generated_headers/GCPhoneNumberAttribute.h | C | artistic-2.0 | 724 |
package Map::Tube;
$Map::Tube::VERSION = '3.12';
$Map::Tube::AUTHORITY = 'cpan:MANWAR';
=head1 NAME
Map::Tube - Core library as Role (Moo) to process map data.
=head1 VERSION
Version 3.12
=cut
use 5.006;
use XML::Twig;
use Data::Dumper;
use Map::Tube::Node;
use Map::Tube::Line;
use Map::Tube::Table;
use Map::Tube::Route;
use Map::Tube::Pluggable;
use Map::Tube::Exception::MissingStationName;
use Map::Tube::Exception::InvalidStationName;
use Map::Tube::Exception::MissingStationId;
use Map::Tube::Exception::InvalidStationId;
use Map::Tube::Exception::MissingLineId;
use Map::Tube::Exception::InvalidLineId;
use Map::Tube::Exception::MissingLineName;
use Map::Tube::Exception::InvalidLineName;
use Map::Tube::Exception::FoundMultiLinedStation;
use Map::Tube::Exception::FoundMultiLinkedStation;
use Map::Tube::Exception::FoundSelfLinkedStation;
use Map::Tube::Exception::DuplicateStationId;
use Map::Tube::Exception::DuplicateStationName;
use Map::Tube::Exception::MissingPluginGraph;
use Map::Tube::Exception::MissingPluginFormatter;
use Map::Tube::Exception::MissingPluginFuzzyFind;
use Map::Tube::Utils qw(is_same trim common_lines get_method_map);
use Moo::Role;
use Role::Tiny qw();
use namespace::clean;
requires 'xml';
=encoding utf8
=head1 DESCRIPTION
The core module defined as Role (Moo) to process the map data. It provides the
the interface to find the shortest route in terms of stoppage between two nodes.
Also you can get all possible routes between two given nodes.
This role has been taken by the following modules (and many more):
=over 2
=item * L<Map::Tube::London>
=item * L<Map::Tube::Tokyo>
=item * L<Map::Tube::NYC>
=item * L<Map::Tube::Delhi>
=item * L<Map::Tube::Barcelona>
=item * L<Map::Tube::Prague>
=item * L<Map::Tube::Warsaw>
=item * L<Map::Tube::Sofia>
=item * L<Map::Tube::Berlin>
=back
=cut
has name => (is => 'rw');
has nodes => (is => 'rw');
has lines => (is => 'rw');
has tables => (is => 'rw');
has routes => (is => 'rw');
has name_to_id => (is => 'rw');
has plugins => (is => 'rw');
has _active_links => (is => 'rw');
has _other_links => (is => 'rw');
has _lines => (is => 'rw');
has _line_stations => (is => 'rw');
our $AUTOLOAD;
sub AUTOLOAD {
my $name = $AUTOLOAD;
$name =~ s/.*://;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
my $method_map = get_method_map();
if (exists $method_map->{$name}) {
my $module = $method_map->{$name}->{module};
my $exception = $method_map->{$name}->{exception};
$exception->throw({
method => "${module}::${name}",
message => "ERROR: Missing plugin $module.",
filename => $caller[1],
line_number => $caller[2] });
}
}
sub BUILD {
my ($self) = @_;
$self->_init_map;
$self->_load_plugins;
}
=head1 SYNOPSIS
=head2 Common Usage
use strict; use warnings;
use Map::Tube::London;
my $tube = Map::Tube::London->new;
print $tube->get_shortest_route('Baker Street', 'Euston Square'), "\n";
You should expect the result like below:
Baker Street (Circle, Hammersmith & City, Bakerloo, Metropolitan, Jubilee), Great Portland Street (Circle, Hammersmith & City, Metropolitan), Euston Square (Circle, Hammersmith & City, Metropolitan)
=head2 Special Usage
use strict; use warnings;
use Map::Tube::London;
my $tube = Map::Tube::London->new;
print $tube->get_shortest_route('Baker Street', 'Euston Square')->preferred, "\n";
You should now expect the result like below:
Baker Street (Circle, Hammersmith & City, Metropolitan), Great Portland Street (Circle, Hammersmith & City, Metropolitan), Euston Square (Circle, Hammersmith & City, Metropolitan)
=head1 METHODS
=head2 get_shortest_routes($from, $to)
It expects C<$from> and C<$to> station name, required param. It returns an object
of type L<Map::Tube::Route>. On error it throws exception of type L<Map::Tube::Exception>.
=cut
sub get_shortest_route {
my ($self, $from, $to) = @_;
($from, $to) =
$self->_validate_input('get_shortest_route', $from, $to);
my $_from = $self->get_node_by_id($from);
my $_to = $self->get_node_by_id($to);
$self->_get_shortest_route($from);
my $nodes = [];
while (defined($to) && !(is_same($from, $to))) {
push @$nodes, $self->get_node_by_id($to);
$to = $self->_get_path($to);
}
push @$nodes, $_from;
return Map::Tube::Route->new(
{ from => $_from,
to => $_to,
nodes => [ reverse(@$nodes) ] } );
}
=head2 get_all_routes($from, $to) *** EXPERIMENTAL ***
It expects C<$from> and C<$to> station name, required param. It returns ref to a
list of objects of type L<Map::Tube::Route>. On error it throws exception of type
L<Map::Tube::Exception>.
Be carefull when using against a large map. You may encounter warning similar to
as shown below when run against London map.
Deep recursion on subroutine "Map::Tube::_get_all_routes"
However for comparatively smaller map, like below,it is happy to give all routes.
A(1) ---- B(2)
/ \
C(3) -------- F(6) --- G(7) ---- H(8)
\ /
D(4) ---- E(5)
=cut
sub get_all_routes {
my ($self, $from, $to) = @_;
($from, $to) =
$self->_validate_input('get_all_routes', $from, $to);
return $self->_get_all_routes([ $from ], $to);
}
=head2 name()
Returns map name.
=head2 get_node_by_id($node_id)
Returns an object of type L<Map::Tube::Node>.
=cut
sub get_node_by_id {
my ($self, $id) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingStationId->throw({
method => __PACKAGE__."::get_node_by_id",
message => "ERROR: Missing Station ID.",
filename => $caller[1],
line_number => $caller[2] }) unless defined $id;
my $node = $self->{nodes}->{$id};
Map::Tube::Exception::InvalidStationId->throw({
method => __PACKAGE__."::get_node_by_id",
message => "ERROR: Invalid Station ID [$id].",
filename => $caller[1],
line_number => $caller[2] }) unless defined $node;
# Check if the node name appears more than once with different id.
my @nodes = $self->_get_node_id($node->name);
return $node if (scalar(@nodes) == 1);
my $lines = {};
foreach my $l (@{$node->line}) {
$lines->{$l->name} = $l if defined $l->name;
}
foreach my $i (@nodes) {
foreach my $j (@{$self->{nodes}->{$i}->line}) {
$lines->{$j->name} = $j if defined $j->name;
}
}
$node->line([ values %$lines ]);
return $node;
}
=head2 get_node_by_name($node_name)
Returns ref to a list of object(s) of type L<Map::Tube::Node> matching node name
C<$node_name> in scalar context otherwise returns just a list.
=cut
sub get_node_by_name {
my ($self, $name) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingStationName->throw({
method => __PACKAGE__."::get_node_by_name",
message => "ERROR: Missing Station Name.",
filename => $caller[1],
line_number => $caller[2] }) unless defined $name;
my @nodes = $self->_get_node_id($name);
Map::Tube::Exception::InvalidStationName->throw({
method => __PACKAGE__."::get_node_by_name",
message => "ERROR: Invalid Station Name [$name].",
filename => $caller[1],
line_number => $caller[2] }) unless scalar(@nodes);
my $nodes = [];
foreach (@nodes) {
push @$nodes, $self->get_node_by_id($_);
}
if (wantarray) {
return @{$nodes};
}
else {
return $nodes->[0];
}
}
=head2 get_line_by_id($line_id)
Returns an object of type L<Map::Tube::Line>.
=cut
sub get_line_by_id {
my ($self, $id) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingLineId->throw({
method => __PACKAGE__."::get_line_by_id",
message => "ERROR: Missing Line ID.",
filename => $caller[1],
line_number => $caller[2] }) unless defined $id;
my $line = $self->_get_line_object_by_id($id);
Map::Tube::Exception::InvalidLineId->throw({
method => __PACKAGE__."::get_line_by_id",
message => "ERROR: Invalid Line ID [$id].",
filename => $caller[1],
line_number => $caller[2] }) unless defined $line;
return $line;
}
=head2 get_line_by_name($line_name)
Returns an object of type L<Map::Tube::Line>.
=cut
sub get_line_by_name {
my ($self, $name) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingLineName->throw({
method => __PACKAGE__."::get_line_by_name",
message => "ERROR: Missing Line Name.",
filename => $caller[1],
line_number => $caller[2] }) unless defined $name;
my $line = $self->_get_line_object_by_name($name);
Map::Tube::Exception::InvalidLineName->throw({
method => __PACKAGE__."::get_line_by_name",
message => "ERROR: Invalid Line Name [$name].",
filename => $caller[1],
line_number => $caller[2] }) unless defined $line;
return $line;
}
=head2 get_lines()
Returns ref to a list of objects of type L<Map::Tube::Line>.
=cut
sub get_lines {
my ($self) = @_;
my $lines = [];
foreach (@{$self->{lines}}) {
push @$lines, $_ if defined $_->name;
}
return $lines;
}
=head2 get_stations($line_name)
Returns ref to a list of objects of type L<Map::Tube::Node> for the C<$line_name>.
=cut
sub get_stations {
my ($self, $line_name) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingLineName->throw({
method => __PACKAGE__."::get_stations",
message => "ERROR: Missing Line Name.",
filename => $caller[1],
line_number => $caller[2] })
unless (defined $line_name);
my $line = $self->_get_line_object_by_name($line_name);
Map::Tube::Exception::InvalidLineName->throw({
method => __PACKAGE__."::get_stations",
message => "ERROR: Invalid Line Name [$line_name].",
filename => $caller[1],
line_number => $caller[2] })
unless defined $line;
my $stations = [];
my $seen = {};
foreach (@{$line->{stations}}) {
unless (exists $seen->{$_->id}) {
push @$stations, $self->get_node_by_id($_->id);
$seen->{$_->id} = 1;
}
}
return $stations;
}
=head1 PLUGINS
=head2 * L<Map::Tube::Plugin::Graph>
The L<Map::Tube::Plugin::Graph> plugin add the support to generate the entire map
or map for a particular line as base64 encoded string (png image).
Please refer to the L<documentation|Map::Tube::Plugin::Graph> for more details.
=head2 * L<Map::Tube::Plugin::Formatter>
The L<Map::Tube::Plugin::Formatter> plugin adds the support to format the object
supported by the plugin.
Please refer to the L<documentation|Map::Tube::Plugin::Formatter> for more info.
=head2 * L<Map::Tube::Plugin::FuzzyFind>
Gisbert W. Selke, built the add-on for L<Map::Tube> to find stations and lines by
name, possibly partly or inexactly specified. The module is a Moo role which gets
plugged into the Map::Tube::* family automatically once it is installed.
Please refer to the L<documentation|Map::Tube::Plugin::FuzzyFind> for more info.
=head1 MAP VALIDATION
=head2 DATA VALIDATION
The package L<Test::Map::Tube> can easily be used to validate raw map data.Anyone
building a new map using L<Map::Tube> is advised to have a unit test as a part of
their distribution.Just like in L<Map::Tube::London> package,there is a unit test
something like below:
use strict; use warnings;
use Test::More;
use Map::Tube::London;
eval "use Test::Map::Tube";
plan skip_all => "Test::Map::Tube required" if $@;
ok_map(Map::Tube::London->new);
=head2 FUNCTIONAL VALIDATION
The package L<Test::Map::Tube> v0.09 or above can easily be used to validate map
basic functions provided by L<Map::Tube>.
use strict; use warnings;
use Test::More;
my $min_ver = 0.09;
eval "use Test::Map::Tube $min_ver";
plan skip_all => "Test::Map::Tube $min_ver required" if $@;
use Map::Tube::London;
ok_map_functions(Map::Tube::London->new);
=cut
#
#
# PRIVATE METHODS
sub _get_shortest_route {
my ($self, $from) = @_;
my $nodes = [];
my $index = 0;
my $seen = {};
$self->_init_table;
$self->_set_length($from, $index);
$self->_set_path($from, $from);
my $all_nodes = $self->{nodes};
while (defined($from)) {
my $length = $self->_get_length($from);
my $f_node = $all_nodes->{$from};
$self->_set_active_links($f_node);
if (defined $f_node) {
my $links = [ split /\,/, $f_node->{link} ];
while (scalar(@$links) > 0) {
my ($success, $link) = $self->_get_next_link($from, $seen, $links);
$success or ($links = [ grep(!/\b$link\b/, @$links) ]) and next;
if (($self->_get_length($link) == 0) || ($length > ($index + 1))) {
$self->_set_length($link, $length + 1);
$self->_set_path($link, $from);
push @$nodes, $link;
}
$seen->{$link} = 1;
$links = [ grep(!/\b$link\b/, @$links) ];
}
}
$index = $length + 1;
$from = shift @$nodes;
$nodes = [ grep(!/\b$from\b/, @$nodes) ] if defined $from;
}
}
sub _get_all_routes {
my ($self, $visited, $to) = @_;
my $last = $visited->[-1];
my $nodes = $self->get_node_by_id($last)->link;
foreach my $id (split /\,/, $nodes) {
next if _is_visited($id, $visited);
if (is_same($id, $to)) {
push @$visited, $id;
$self->_set_routes($visited);
pop @$visited;
last;
}
}
foreach my $id (split /\,/, $nodes) {
next if (_is_visited($id, $visited) || is_same($id, $to));
push @$visited, $id;
$self->_get_all_routes($visited, $to);
pop @$visited;
}
return $self->{routes};
}
sub _map_node_name {
my ($self, $name, $id) = @_;
push @{$self->{name_to_id}->{uc($name)}}, $id;
}
sub _validate_input {
my ($self, $method, $from, $to) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
Map::Tube::Exception::MissingStationName->throw({
method => __PACKAGE__."::$method",
message => "ERROR: Missing Station Name.",
filename => $caller[1],
line_number => $caller[2] })
unless (defined($from) && defined($to));
$from = trim($from);
my $_from = $self->get_node_by_name($from);
$to = trim($to);
my $_to = $self->get_node_by_name($to);
return ($_from->{id}, $_to->{id});
}
sub _xml_data {
my ($self) = @_;
return XML::Twig->new->parsefile($self->xml)->simplify(keyattr => 'stations', forcearray => 0);
}
sub _init_map {
my ($self) = @_;
my $_lines = {};
my $lines = {};
my $nodes = {};
my $tables = {};
my $_other_links = {};
my $_seen_nodes = {};
my $xml = $self->_xml_data;
$self->{name} = $xml->{name};
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
my $name_to_id = $self->{name_to_id};
my $has_station_index = 0;
foreach my $station (@{$xml->{stations}->{station}}) {
my $id = $station->{id};
Map::Tube::Exception::DuplicateStationId->throw({
method => __PACKAGE__."::_init_map",
message => "ERROR: Duplicate Station ID [$id].",
filename => $caller[1],
line_number => $caller[2] }) if (exists $_seen_nodes->{$id});
$_seen_nodes->{$id} = 1;
my $name = $station->{name};
Map::Tube::Exception::DuplicateStationName->throw({
method => __PACKAGE__."::_init_map",
message => "ERROR: Duplicate Station Name [$name].",
filename => $caller[1],
line_number => $caller[2] }) if (defined $name_to_id->{uc($name)});
$self->_map_node_name($name, $id);
$tables->{$id} = Map::Tube::Table->new({ id => $id });
my $_station_lines = [];
foreach my $_line (split /\,/, $station->{line}) {
if ($_line =~ /\:/) {
$has_station_index = 1;
$_line = $self->_capture_line_station($_line, $id);
}
my $uc_line = uc($_line);
my $line = $lines->{$uc_line};
$line = Map::Tube::Line->new({ id => $_line }) unless defined $line;
$_lines->{$uc_line} = $line;
$lines->{$uc_line} = $line;
push @$_station_lines, $line;
}
if (exists $station->{other_link} && defined $station->{other_link}) {
my @link_nodes = ();
foreach my $_entry (split /\,/, $station->{other_link}) {
my ($_link_type, $_nodes) = split /\:/, $_entry, 2;
my $uc_link_type = uc($_link_type);
my $line = $lines->{$uc_link_type};
$line = Map::Tube::Line->new({ id => $_link_type }) unless defined $line;
$_lines->{$uc_link_type} = $line;
$lines->{$uc_link_type} = $line;
$_other_links->{$uc_link_type} = 1;
push @$_station_lines, $line;
push @link_nodes, (split /\|/, $_nodes);
}
$station->{link} .= "," . join(",", @link_nodes);
}
$station->{line} = $_station_lines;
my $node = Map::Tube::Node->new($station);
$nodes->{$id} = $node;
unless ($has_station_index) {
foreach (@{$_station_lines}) {
push @{$_->{stations}}, $node;
}
}
}
my @lines;
if (exists $xml->{lines} && exists $xml->{lines}->{line}) {
@lines = (ref $xml->{lines}->{line} eq 'HASH')
? ($xml->{lines}->{line})
: @{$xml->{lines}->{line}};
}
foreach my $_line (@lines) {
my $uc_line = uc($_line->{id});
my $line = $_lines->{$uc_line};
if (defined $line) {
$line->{name} = $_line->{name};
$line->{color} = $_line->{color};
if ($has_station_index) {
foreach (sort { $a <=> $b } keys %{$self->{_line_stations}->{$uc_line}}) {
my $station_id = $self->{_line_stations}->{$uc_line}->{$_};
$line->add_station($nodes->{$station_id});
}
}
$_lines->{$uc_line} = $line;
}
}
$self->_order_station_lines($nodes);
$self->lines([ values %$lines ]);
$self->_lines($_lines);
$self->_other_links($_other_links);
$self->nodes($nodes);
$self->tables($tables);
}
sub _init_table {
my ($self) = @_;
foreach my $id (keys %{$self->{tables}}) {
$self->{tables}->{$id}->{path} = undef;
$self->{tables}->{$id}->{length} = 0;
}
$self->{_active_links} = undef;
}
sub _load_plugins {
my ($self) = @_;
$self->{plugins} = [ Map::Tube::Pluggable::plugins ];
foreach (@{$self->plugins}) {
Role::Tiny->apply_roles_to_object($self, $_);
}
}
sub _get_next_link {
my ($self, $from, $seen, $links) = @_;
my $nodes = $self->{nodes};
my $active_links = $self->{_active_links};
my @common_lines = common_lines($active_links->[0], $active_links->[1]);
my $link = undef;
foreach my $_link (@$links) {
return (0, $_link) if ((exists $seen->{$_link}) || ($from eq $_link));
my $node = $nodes->{$_link};
next unless defined $node;
my @lines = ();
foreach (@{$node->{line}}) { push @lines, $_->{id}; }
my @common = common_lines(\@common_lines, \@lines);
return (1, $_link) if (scalar(@common) > 0);
$link = $_link;
}
return (1, $link);
}
sub _set_active_links {
my ($self, $node) = @_;
my $active_links = $self->{_active_links};
my $links = [ split /\,/, $node->{link} ];
if (defined $active_links) {
shift @$active_links;
push @$active_links, $links;
}
else {
push @$active_links, $links;
push @$active_links, $links;
}
$self->{_active_links} = $active_links;
}
sub _validate_map_data {
my ($self) = @_;
my @caller = caller(0);
@caller = caller(2) if $caller[3] eq '(eval)';
my $nodes = $self->{nodes};
my $seen = {};
foreach my $id (keys %$nodes) {
Map::Tube::Exception::InvalidStationId->throw({
method => __PACKAGE__."::_validate_map_data",
message => "ERROR: Station ID can't have ',' character.",
filename => $caller[1],
line_number => $caller[2] }) if ($id =~ /\,/);
my $node = $nodes->{$id};
$self->_validate_nodes(\@caller, $nodes, $node, $seen);
$self->_validate_self_linked_nodes(\@caller, $node, $id);
$self->_validate_multi_linked_nodes(\@caller, $node, $id);
$self->_validate_multi_lined_nodes(\@caller, $node, $id);
}
}
sub _validate_nodes {
my ($self, $caller, $nodes, $node, $seen) = @_;
foreach (split /\,/, $node->{link}) {
next if (exists $seen->{$_});
my $_node = $nodes->{$_};
Map::Tube::Exception::InvalidStationId->throw({
method => __PACKAGE__."::_validate_map_data",
message => "ERROR: Invalid Station ID [$_].",
filename => $caller->[1],
line_number => $caller->[2] }) unless (defined $_node);
$seen->{$_} = 1;
}
}
sub _validate_self_linked_nodes {
my ($self, $caller, $node, $id) = @_;
if (grep { $_ eq $id } (split /\,/, $node->{link})) {
Map::Tube::Exception::FoundSelfLinkedStation->throw({
method => __PACKAGE__."::_validate_map_data",
message => sprintf("ERROR: %s is self linked,", $id),
filename => $caller->[1],
line_number => $caller->[2] });
}
}
sub _validate_multi_linked_nodes {
my ($self, $caller, $node, $id) = @_;
my %links = ();
my $max_link = 1;
foreach my $link (split( /\,/, $node->{link})) {
$links{$link}++;
}
foreach (keys %links) {
$max_link = $links{$_} if ($max_link < $links{$_});
}
if ($max_link > 1) {
my $message = sprintf("ERROR: %s linked to %s multiple times,",
$id, join( ',', grep { $links{$_} > 1 } keys %links));
Map::Tube::Exception::FoundMultiLinkedStation->throw({
method => __PACKAGE__."::_validate_map_data",
message => $message,
filename => $caller->[1],
line_number => $caller->[2] });
}
}
sub _capture_line_station {
my ($self, $line, $station_id) = @_;
my ($line_id, $sequence) = split /\:/, $line, 2;
$self->{_line_stations}->{uc($line_id)}->{$sequence} = $station_id;
return $line_id;
}
sub _validate_multi_lined_nodes {
my ($self, $caller, $node, $id) = @_;
my %lines = ();
foreach (@{$node->{line}}) { $lines{$_->{id}}++; }
my $max_link = 1;
foreach (keys %lines) {
$max_link = $lines{$_} if ($max_link < $lines{$_});
}
if ($max_link > 1) {
my $message = sprintf("ERROR: %s has multiple lines %s,",
$id, join( ',', grep { $lines{$_} > 1 } keys %lines));
Map::Tube::Exception::FoundMultiLinedStation->throw({
method => __PACKAGE__."::_validate_map_data",
message => $message,
filename => $caller->[1],
line_number => $caller->[2] });
}
}
sub _set_routes {
my ($self, $routes) = @_;
my $_routes = [];
my $nodes = $self->{nodes};
foreach my $id (@$routes) {
push @$_routes, $nodes->{$id};
}
my $from = $_routes->[0];
my $to = $_routes->[-1];
my $route = Map::Tube::Route->new({ from => $from, to => $to, nodes => $_routes });
push @{$self->{routes}}, $route;
}
sub _get_path {
my ($self, $id) = @_;
return $self->{tables}->{$id}->{path};
}
sub _set_path {
my ($self, $id, $node_id) = @_;
$self->{tables}->{$id}->{path} = $node_id;
}
sub _get_length {
my ($self, $id) = @_;
return 0 unless defined $self->{tables}->{$id};
return $self->{tables}->{$id}->{length};
}
sub _set_length {
my ($self, $id, $value) = @_;
$self->{tables}->{$id}->{length} = $value;
}
sub _get_table {
my ($self, $id) = @_;
return $self->{tables}->{$id};
}
sub _get_node_id {
my ($self, $name) = @_;
my $nodes = $self->{name_to_id}->{uc($name)};
return unless defined $nodes;
if (wantarray) {
return @{$nodes};
}
else {
return $nodes->[0];
}
}
sub _get_line_object_by_name {
my ($self, $name) = @_;
$name = uc($name);
foreach my $line_id (keys %{$self->{_lines}}) {
my $line = $self->{_lines}->{$line_id};
if (defined $line && defined $line->name) {
return $line if ($name eq uc($line->name));
}
}
return;
}
sub _get_line_object_by_id {
my ($self, $id) = @_;
$id = uc($id);
foreach my $line_id (keys %{$self->{_lines}}) {
my $line = $self->{_lines}->{$line_id};
if (defined $line && defined $line->name) {
return $line if ($id eq uc($line->id));
}
}
return;
}
sub _order_station_lines {
my ($self, $nodes) = @_;
return unless scalar(keys %$nodes);
foreach my $node (keys %$nodes) {
my $_lines_h = {};
foreach (@{$nodes->{$node}->{line}}) {
$_lines_h->{$_->id} = $_ if defined $_->name;
}
my $_lines_a = [];
foreach (sort keys %$_lines_h) {
push @$_lines_a, $_lines_h->{$_};
}
$nodes->{$node}->line($_lines_a);
}
}
sub _is_visited {
my ($id, $list) = @_;
foreach (@$list) {
return 1 if is_same($_, $id);
}
return 0;
}
=head1 AUTHOR
Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
=head1 REPOSITORY
L<https://github.com/Manwar/Map-Tube>
=head1 SEE ALSO
L<Map::Metro>
=head1 CONTRIBUTORS
=over 2
=item * Gisbert W. Selke, C<< <gws at cpan.org> >>
=item * Michal Špaček, C<< <skim at cpan.org> >>
=back
=head1 BUGS
Please report any bugs or feature requests to C<bug-map-tube at rt.cpan.org>, or
through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Map-Tube>.
I will be notified and then you'll automatically be notified of progress on your
bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Map::Tube
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker (report bugs here)
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Map-Tube>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Map-Tube>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Map-Tube>
=item * Search CPAN
L<http://search.cpan.org/dist/Map-Tube/>
=back
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2010 - 2015 Mohammad S Anwar.
This program is free software; you can redistribute it and / or modify it under
the terms of the the Artistic License (2.0). You may obtain a copy of the full
license at:
L<http://www.perlfoundation.org/artistic_license_2_0>
Any use, modification, and distribution of the Standard or Modified Versions is
governed by this Artistic License.By using, modifying or distributing the Package,
you accept this license. Do not use, modify, or distribute the Package, if you do
not accept this license.
If your Modified Version has been derived from a Modified Version made by someone
other than you,you are nevertheless required to ensure that your Modified Version
complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark,
tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license
to make, have made, use, offer to sell, sell, import and otherwise transfer the
Package with respect to any patent claims licensable by the Copyright Holder that
are necessarily infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging that the
Package constitutes direct or contributory patent infringement,then this Artistic
License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=cut
1; # End of Map::Tube
| tupinek/Map-Tube | lib/Map/Tube.pm | Perl | artistic-2.0 | 29,817 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_292) on Fri Jul 02 16:35:39 UTC 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.bukkit.event.player.PlayerInteractAtEntityEvent (Glowkit 1.16.5-R0.1-SNAPSHOT API)</title>
<meta name="date" content="2021-07-02">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.bukkit.event.player.PlayerInteractAtEntityEvent (Glowkit 1.16.5-R0.1-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/bukkit/event/player/PlayerInteractAtEntityEvent.html" title="class in org.bukkit.event.player">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/bukkit/event/player/class-use/PlayerInteractAtEntityEvent.html" target="_top">Frames</a></li>
<li><a href="PlayerInteractAtEntityEvent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.bukkit.event.player.PlayerInteractAtEntityEvent" class="title">Uses of Class<br>org.bukkit.event.player.PlayerInteractAtEntityEvent</h2>
</div>
<div class="classUseContainer">No usage of org.bukkit.event.player.PlayerInteractAtEntityEvent</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/bukkit/event/player/PlayerInteractAtEntityEvent.html" title="class in org.bukkit.event.player">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/bukkit/event/player/class-use/PlayerInteractAtEntityEvent.html" target="_top">Frames</a></li>
<li><a href="PlayerInteractAtEntityEvent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2021. All rights reserved.</small></p>
</body>
</html>
| GlowstoneMC/glowstonemc.github.io | content/jd/glowkit/1.16/org/bukkit/event/player/class-use/PlayerInteractAtEntityEvent.html | HTML | artistic-2.0 | 4,744 |
package pTracker::Domain::Project::Test;
use strict;
use warnings;
=head1 NAME
pTracker::Domain::Project::Test
=head1 SYNOPSIS
=head1 METHODS
=over
=cut
use pTracker::Domain::Project;
use pTracker::Domain::Project::Category;
use pTracker::Domain::Project::EditLock;
use pTracker::Domain::Project::File;
use pTracker::Domain::Project::Tag;
use pTracker::Domain::Util;
use pTracker::Domain::Watcher;
my $db_conn;
my $register;
my $categories;
my $editlock;
my $files;
my $project;
my $tags;
my $utils;
my $watcher;
=item register (args)
Takes a hashref of arguments as input consisting of a config section
and a register section where the register section is a hash of pointers
to already registered objects.
Adds blessed instance of itself to the register and also returns the
blessed instance.
=cut
sub register {
my ( $class, $args ) = @_;
my $me = _whoami();
if ( exists $args->{register}{$me} ) {
return $args->{register}{$me};
}
my $self = bless {}, $class;
# Update register immediately to avoid "Deep recursion on subroutine" error
$args->{register}{$me} = $self;
# Grab a pointer to the database connection broker
$db_conn = $args->{register}{'pTracker::DB'};
$register = $args->{register};
$project = pTracker::Domain::Project->register($args);
$files = pTracker::Domain::Project::File->register($args);
$editlock = pTracker::Domain::Project::EditLock->register($args);
$categories = pTracker::Domain::Project::Category->register($args);
$tags = pTracker::Domain::Project::Tag->register($args);
$utils = pTracker::Domain::Util->register($args);
$watcher = pTracker::Domain::Watcher->register($args);
return $self;
}
=item can_view
Determines whether the supplied auth_user can view documents
=cut
sub can_view {
my ( $self, $args ) = @_;
return $project->can_view($args);
}
=item can_edit
Determines whether the supplied auth_user can edit tests
=cut
sub can_edit {
my ( $self, $args ) = @_;
my $auth_user = $utils->get_arg( 'auth_user', $args );
my $project_id = $utils->get_arg( 'project_id', $args );
my $test_id = $utils->get_arg( 'test_id', $args );
my $is_project_user = 0;
my $can_manage = 0;
# Check the edit-lock status:
if ($test_id) {
my ( $is_locked, $username, $message, $lock_remaining ) =
$editlock->edit_lock_status( { item_type => 'test', item_id => $test_id, auth_user => $auth_user } );
if ( $is_locked and $username ne $auth_user ) {
return 0;
}
}
my $query = q{
SELECT priv_code
FROM user__privs ( ?::character varying, ?::integer )
WHERE has_priv
};
my $d = $db_conn->record_set( { query => $query, parms => [ $auth_user, $project_id ] } );
foreach my $rec ( @{ $d->{data} } ) {
if ( $rec->{priv_code} eq 'is_active_project_user' ) {
$is_project_user = 1;
}
elsif ( $rec->{priv_code} eq 'manage_test' ) {
$can_manage = 1;
}
}
return ( $is_project_user && $can_manage );
}
=item can_delete
Determines whether the supplied auth_user can delete the specified test
=cut
sub can_delete {
my ( $self, $args ) = @_;
if ( $self->has_requirements($args) ) {
return 0;
}
return $self->can_edit($args);
}
=item list_tests
Return a list of all tests for a project
=cut
sub list_tests {
my ( $self, $args ) = @_;
if ( $self->can_view($args) ) {
my $query = q{
SELECT t.id AS test_id,
t.project_id,
t.test_name,
t.type_name,
t.created_by,
fmt_tmsp ( t.created_dt ) AS created_dt,
t.updated_by,
fmt_tmsp ( t.updated_dt ) AS updated_dt,
t.created_username,
t.created_user_full_name,
t.updated_username,
t.updated_user_full_name
FROM v_test t
WHERE t.project_id = ?::integer
};
my $project_id = $utils->get_arg( 'project_id', $args );
my @parms = ($project_id);
if ( $utils->is_integer( $args->{type} ) ) {
$query .= "\n AND t.test_type_id = ?::integer ";
push @parms, $args->{type};
}
if ( $args->{tags} ) {
foreach ( split /[\s,]+/, $args->{tags} ) {
next unless ($_);
$query .= q{
AND EXISTS ( SELECT 1 FROM pt_test_tag a
JOIN pt_tag b
ON ( b.id = a.tag_id )
WHERE a.test_id = b.id
AND b.tag_name = ?::character varying ) };
push @parms, $_;
}
}
if ( $args->{categories} ) {
foreach ( split /[\s,]+/, $args->{categories} ) {
next unless ($_);
$query .= q{
AND EXISTS ( SELECT 1 FROM pt_test_category a
JOIN pt_category b
ON ( b.id = a.category_id )
WHERE a.test_id = b.id
AND b.category_name = ?::character varying ) };
push @parms, $_;
}
}
$query .= "\n ORDER BY t.test_name ";
# Paging...
my $limit = $args->{page_size} || 50;
my $page_no = $args->{page_no} || 1;
if ( $page_no !~ m/^[0-9]+$/ ) {
$page_no = 1;
}
my $offset = ( $page_no - 1 ) * $limit;
# $query .= "\n OFFSET $offset LIMIT $limit ";
my $d = $db_conn->record_set( { query => $query, parms => \@parms } );
my $record_count;
my $is_last_page = 0;
if ( $d->{data} ) {
$record_count = scalar @{ $d->{data} };
$d->{is_last_page} = $record_count < $limit;
$d->{page_no} = $page_no;
}
return $d;
}
else {
return { error => ['FORBIDDEN'] };
}
}
=item view_test
View a test
=cut
sub view_test {
my ( $self, $args ) = @_;
if ( $self->can_view($args) ) {
my $project_id = $utils->get_arg( 'project_id', $args );
my $test_id = $utils->get_arg( 'test_id', $args );
my $query = q{
SELECT t.ctid::text AS ctid,
t.id AS test_id,
t.test_type_id,
t.type_name,
t.project_id,
t.test_name,
t.wiki_format_id,
t.description_text,
t.description_html,
t.created_by,
fmt_tmsp ( t.created_dt ) AS created_dt,
t.updated_by,
fmt_tmsp ( t.updated_dt ) AS updated_dt,
t.created_username,
t.created_user_full_name,
t.updated_username,
t.updated_user_full_name
FROM v_test t
WHERE t.project_id = ?::integer
AND t.id = ?::integer
};
return $db_conn->record( { query => $query, parms => [ $project_id, $test_id ] } );
}
else {
return { error => ['FORBIDDEN'] };
}
}
=item create_test
Create a test
=cut
sub create_test {
my ( $self, $args ) = @_;
if ( $self->can_edit($args) ) {
my $auth_user = $utils->get_arg( 'auth_user', $args );
my $category_csv = $utils->get_arg( 'categories', $args );
my $description_html = $utils->get_arg( 'description_html', $args );
my $description_text = $utils->get_arg( 'description_text', $args );
my $project_id = $utils->get_arg( 'project_id', $args );
my $tag_csv = $utils->get_arg( 'tags', $args );
my $test_name = $utils->get_arg( 'test_name', $args );
my $test_type_id = $utils->get_arg( 'test_type_id', $args );
my $wiki_format_id = $utils->get_arg( 'wiki_format_id', $args );
my $lang = $utils->get_arg( 'lang', $args );
my $query = q{
SELECT test__insert AS test_id
FROM test__insert(
?::integer,
?::integer,
?::integer,
?::character varying,
?::text,
?::text,
?::character varying )
};
my @parms = (
$project_id, $test_type_id, $wiki_format_id, $test_name, $description_text, $description_html, $auth_user,
);
my $d = $db_conn->record( { query => $query, parms => \@parms } );
if ( $d->{data} ) {
my $test_id = $d->{data}{test_id};
if ( defined $test_id && $test_id < 0 ) {
my $error_description = $db_conn->error_description( { error_code => $test_id } );
return { failed => [ _loc( 'Failed to add test.', $lang ) . ' ' . _loc( $error_description, $lang ) ] };
}
$categories->update_item_categories(
{
'project_id' => $project_id,
'item_type' => 'test',
'item_id' => $test_id,
'categories' => $category_csv,
'auth_user' => $auth_user,
}
);
$tags->update_item_tags(
{
'project_id' => $project_id,
'item_type' => 'test',
'item_id' => $test_id,
'tags' => $tag_csv,
'auth_user' => $auth_user,
}
);
$d->{success} = [ _loc( 'Test added.', $lang ) ];
return $d;
}
else {
return { failed => [ _loc( 'Failed to add test.', $lang ) ] };
}
}
else {
return { error => ['FORBIDDEN'] };
}
}
=item update_test
Update a test
=cut
sub update_test {
my ( $self, $args ) = @_;
if ( $self->can_edit($args) ) {
# TODO: include project_id in update
my $test_id = $utils->get_arg( 'test_id', $args );
my $prev_ctid = $utils->get_arg( 'ctid', $args );
my $auth_user = $utils->get_arg( 'auth_user', $args );
my $category_csv = $utils->get_arg( 'categories', $args );
my $description_html = $utils->get_arg( 'description_html', $args );
my $description_text = $utils->get_arg( 'description_text', $args );
my $project_id = $utils->get_arg( 'project_id', $args );
my $tag_csv = $utils->get_arg( 'tags', $args );
my $test_name = $utils->get_arg( 'test_name', $args );
my $test_type_id = $utils->get_arg( 'test_type_id', $args );
my $wiki_format_id = $utils->get_arg( 'wiki_format_id', $args );
my $lang = $utils->get_arg( 'lang', $args );
# Check the edit-lock status:
{
my ( $is_locked, $username, $message, $lock_remaining ) =
$editlock->edit_lock_status(
{ item_type => 'test', item_id => $test_id, auth_user => $auth_user, lang => $lang } );
if ( $is_locked and $username ne $auth_user ) {
return { failed => [ _loc( 'Failed to update test.', $lang ) . ' ' . $message ] };
}
}
# If the project record has changed since it was retrieved then it
# should fail as we do not want to overwrite someone elses changes.
my $ctid_query = 'SELECT ctid::text FROM pt_test WHERE id = ?::integer';
my ($curr_ctid) = $db_conn->record( { query => $ctid_query, parms => [$test_id] } )->{data}{ctid};
if ( $curr_ctid ne $prev_ctid ) {
$editlock->clear_edit_lock( { item_type => 'test', item_id => $test_id, auth_user => $auth_user } );
return {
failed => [ _loc( 'Failed to update test. The test changed between retrieve and update.', $lang ) ]
};
}
my $query = q{
SELECT test__update AS rc
FROM test__update (
?::integer,
?::integer,
?::integer,
?::character varying,
?::text,
?::text,
?::character varying )
};
my @parms =
( $test_id, $test_type_id, $wiki_format_id, $test_name, $description_text, $description_html, $auth_user );
my $d = $db_conn->record( { query => $query, parms => \@parms } );
if ( $d->{data} ) {
my $rc = $d->{data}{rc};
if ( defined $rc && $rc < 0 ) {
my $error_description = $db_conn->error_description( { error_code => $rc } );
return {
failed => [ _loc( 'Failed to update test.', $lang ) . ' ' . _loc( $error_description, $lang ) ]
};
}
$categories->update_item_categories(
{
'project_id' => $project_id,
'item_type' => 'test',
'item_id' => $test_id,
'categories' => $category_csv,
'auth_user' => $auth_user,
}
);
$tags->update_item_tags(
{
'project_id' => $project_id,
'item_type' => 'test',
'item_id' => $test_id,
'tags' => $tag_csv,
'auth_user' => $auth_user,
}
);
$watcher->notify_watchers(
{
'subject' => [ 'pTracker notification: Test %1 updated for project %2', $test_id, $project_id ],
'action' => 'updated',
'item_id' => $test_id,
'item_type' => 'test',
'project_id' => $project_id,
'auth_user' => $auth_user,
}
);
$d->{success} = [ _loc( 'Test updated.', $lang ) ];
}
else {
$d->{failed} = [ _loc( 'Failed to update test.', $lang ) ];
}
$editlock->clear_edit_lock( { item_type => 'test', item_id => $test_id, auth_user => $auth_user } );
return $d;
}
else {
return { error => ['FORBIDDEN'] };
}
}
=item delete_test
Delete a test. Note that a issue may not be deleted if another
user has an edit-lock on the issue.
=cut
sub delete_test {
my ( $self, $args ) = @_;
if ( $self->can_edit($args) ) {
my $auth_user = $utils->get_arg( 'auth_user', $args );
my $test_id = $utils->get_arg( 'test_id', $args );
my $project_id = $utils->get_arg( 'project_id', $args );
my $lang = $utils->get_arg( 'lang', $args );
# TODO: include project_id in delete
# Ensure there are no referencing requirements
if ( $self->has_requirements($args) ) {
return {
failed => [
_loc(
'Failed to delete test. The test is referenced by one or more requirements and may not be deleted.',
$lang
)
]
};
}
# Ensure that there is no edit-lock
{
my ( $is_locked, $username, $message, $lock_remaining ) =
$editlock->edit_lock_status(
{ item_type => 'test', item_id => $test_id, auth_user => $auth_user, lang => $lang } );
if ( $is_locked and $username ne $auth_user ) {
return { failed => [ _loc( 'Failed to delete test.', $lang ) . ' ' . $message ] };
}
elsif ( $is_locked and $username eq $auth_user ) {
$editlock->clear_edit_lock( { item_type => 'test', item_id => $test_id, auth_user => $auth_user } );
}
}
my $query = 'SELECT test__delete( ?::integer )';
my $d = $db_conn->record( { query => $query, parms => [$test_id] } );
if ( $d->{data} ) {
my $rc = $d->{data}{rc};
if ( defined $rc && $rc < 0 ) {
my $error_description = $db_conn->error_description( { error_code => $rc } );
return {
failed => [ _loc( 'Failed to delete test.', $lang ) . ' ' . _loc( $error_description, $lang ) ]
};
}
$files->delete_item_files( { project_id => $project_id, item_type => 'test', item_id => $test_id } );
$d->{success} = [ _loc( 'Test deleted.', $lang ) ];
}
else {
$d->{failed} = [ _loc( 'Failed to delete test.', $lang ) ];
}
return $d;
}
else {
return { error => ['FORBIDDEN'] };
}
}
sub requirement_list {
my ( $self, $args ) = @_;
my $test_id = $utils->get_arg( 'test_id', $args );
my $project_id = $utils->get_arg( 'project_id', $args );
my $query = q{
SELECT REPEAT ('-- ', v.level ) AS prefix,
v.level,
v.reqt_number,
v.id AS requirement_id,
v.parent_id,
v.project_id,
v.parent_title,
v.requirement_title,
v.status_id,
v.status_name,
v.priority_id,
v.priority_name,
v.requirement_type_id,
v.type_name,
v.planned_pip_id,
v.planned_pip_name,
v.project_name
FROM requirement__list ( ?::integer ) v
JOIN pt_requirement_test t
ON ( t.requirement_id = v.id )
WHERE t.test_id = ?::integer
};
return $db_conn->record_set( { query => $query, parms => [ $project_id, $test_id ] } );
}
=item has_requirements
Determines if a test has any requirements referencing it.
=cut
sub has_requirements {
my ( $self, $args ) = @_;
my $test_id = $utils->get_arg( 'test_id', $args );
my $query = q{
SELECT count (1) AS rc
WHERE EXISTS (
SELECT 1
FROM pt_requirement_test
WHERE test_id = ?::integer )
};
return $db_conn->record( { query => $query, parms => [$test_id] } )->{data}{rc};
}
sub _loc {
my ( $msgid, $lang, @parms ) = @_;
return $utils->translate_msg( $msgid, $lang, @parms );
}
sub _whoami { return (caller)[0]; }
1;
=back
=head1 Copyright (C) 2015-2016 gsiems.
This file is licensed under the Artistic License 2.0
=cut
| gsiems/pTracker | application/lib/pTracker/Domain/Project/Test.pm | Perl | artistic-2.0 | 18,105 |
use v6;
use GGE::Match;
class CodeString {
has Str $!contents = '';
my $counter = 0;
method emit($string, *@args, *%kwargs) {
$!contents ~= $string\
.subst(/\%(\d)/, { @args[$0] // '...' }, :g)\
.subst(/\%(\w)/, { %kwargs{$0} // '...' }, :g);
}
method escape($string) {
q['] ~ $string.trans( [ q['], q[\\] ] => [ q[\\'], q[\\\\] ] ) ~ q['];
}
method unique($prefix = '') {
$prefix ~ $counter++
}
method Str { $!contents }
}
# a GGE::Exp describing what it contains, most commonly its .ast property,
# but sometimes other things.
role GGE::ShowContents {
method contents() {
self.ast;
}
}
# RAKUDO: Could name this one GGE::Exp::CUT or something, if enums
# with '::' in them worked, which they don't. [perl #71460]
enum CUT (
CUT_GROUP => -1,
CUT_RULE => -2,
CUT_MATCH => -3,
);
enum GGE_BACKTRACK <
GREEDY
EAGER
NONE
>;
class GGE::Exp is GGE::Match {
my $group;
method structure($indent = 0) {
# RAKUDO: The below was originally written as a map, but there's
# a bug somewhere in &map and lexical pads. The workaround
# is to write it as a for loop.
my $inside = '';
if self.llist {
for self.llist {
$inside ~= "\n" ~ $_.structure($indent + 1);
}
$inside = "[$inside\n" ~ ' ' x $indent ~ ']';
}
my $contents = '';
if defined self.?contents {
$contents = " ('{self.contents}') ";
}
$contents ~= $inside;
' ' x $indent ~ self.WHAT.perl.subst(/^.*':'/, '') ~ $contents;
}
method compile(:$debug, :$grammar, :$name, :$target = 'routine') {
my $source = self.root-p6(:$debug, :$grammar, :$name);
if $debug {
say $source;
say '';
}
if $target eq 'P6' {
return $source;
}
else {
my $binary = EVAL $source
or die ~$!;
return $binary;
}
}
method reduce() {
self;
}
method root-p6(:$debug, :$grammar, :$name = '') {
my $code = CodeString.new();
$code.unique(); # XXX: Remove this one when we do other real calls
my $MATCH = 'GGE::Match';
if $grammar {
$code.emit( q[[class %0 is also { ]], $grammar );
$MATCH = $grammar;
}
if $name {
$code.emit( q[[ method %0(:$debug, :$stepwise) {
my $m = self;
]], $name );
}
else {
$code.emit( q[[ sub ($m, :$debug, :$stepwise) { ]] );
}
$code.emit( q[[
my $mob = %1.new($m);
my $target = $mob.target;
my $iscont = $mob.iscont;
my $mfrom;
my $cpos = $mob.startpos max 0;
my $pos;
my $rep;
my $lastpos = $target.chars;
my $cutmark;
my @gpad; # TODO: PGE generates this one only when needed
my @ustack; # TODO: PGE generates this one only when needed
my $captscope = $mob; # TODO: PGE generates this one only when needed
my $captob; # TODO: PGE generates this one only when needed
my @cstack = 'try_match';
my &goto = -> $label { @cstack[*-1] = $label };
my &local-branch = -> $label {
@cstack[*-1] ~= '_cont';
@cstack.push($label)
};
my &local-return = -> { @cstack.pop };
my &stepwise-say = -> *@_ {
prompt @_.join ~ ' ' ~ '.' x (58 - @_.join.chars) ~ ' '
if $stepwise;
};
stepwise-say "Calling rule '$name'";
loop {
given @cstack[*-1] {
when 'try_match' {
if $cpos > $lastpos { goto('fail_rule'); break; }
$mfrom = $pos = $cpos;
$cutmark = 0;
local-branch('R');
}
when 'try_match_cont' {
if $cutmark <= %0 { goto('fail_cut'); break; }
++$cpos;
if $iscont {
stepwise-say
"Backtrack. Resetting rule '$name' to position $cpos";
goto('try_match'); break;
}
goto('fail_rule');
}
when 'fail_rule' {
stepwise-say "Rule '$name' failed";
# $cutmark = %0 # XXX: Not needed yet
goto('fail_cut');
}
when 'fail_cut' {
$mob.from = 0;
$mob.to = -2;
return $mob;
}
when 'succeed' {
stepwise-say "Rule '$name' succeeded";
$mob.from = $mfrom;
$mob.to = $pos;
return $mob;
}
when 'fail' {
local-return();
} ]], CUT_RULE, $MATCH);
my $explabel = 'R';
$GGE::Exp::group = self;
my $exp = self.reduce;
if $debug {
say $exp.structure;
say '';
}
$exp.p6($code, $explabel, 'succeed');
$code.emit( q[[
default {
die "No such label: {@cstack[*-1]}";
}
}
}
} ]], $name);
if $grammar {
$code.emit( q[[ } ]] ); # close off the grammar class
}
~$code;
}
method getargs($label, $next, %hash?) {
%hash<L S> = $label, $next;
if %hash.exists('quant') {
my $quant = %hash<quant>;
%hash<m> = $quant.hash-access('min');
%hash<M> = %hash<m> == 0 ?? '### ' !! '';
%hash<n> = $quant.hash-access('max');
%hash<N> = %hash<n> == Inf ?? '### ' !! '';
my $bt = ($quant.hash-access('backtrack') // GREEDY).name.lc;
%hash<Q> = sprintf '%s..%s (%s)', %hash<m>, %hash<n>, $bt;
}
return %hash;
}
method gencapture($label) {
my $cname = self.hash-access('cname') // '';
my $captgen = CodeString.new;
my $captsave = CodeString.new;
my $captback = CodeString.new;
my $indexing = $cname.substr(0, 1) eq q[']
?? "\$captscope.hash-access($cname)"
!! "\$captscope[$cname]";
if self.hash-access('iscapture') {
if self.hash-access('isarray') {
$captsave.emit('%0.push($captob);', $indexing);
$captback.emit('%0.pop();', $indexing);
$captgen.emit( q[[if defined %0 {
goto('%1_cgen');
break;
}
%0 = [];
local-branch('%1_cgen');
}
when '%1_cont' {
%0 = undef;
goto('fail');
}
when '%1_cgen_cont' {
%0.pop();
goto('fail');
}
when '%1_cgen' { ]], $indexing, $label);
}
else {
$captsave.emit('%0 = $captob;', $indexing);
if $cname.substr(0, 1) eq q['] {
$captback.emit('$captscope.delete(%0);', $cname);
}
else {
$captback.emit('%0 = undef;', $indexing);
}
}
}
# RAKUDO: Cannot do multiple returns yet.
return ($captgen, $captsave, $captback);
}
}
class GGE::Exp::Literal is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
my %args = self.getargs($label, $next);
my $literal = self.ast;
my $litlen = $literal.chars;
%args<I> = '';
if self.hash-access('ignorecase') {
%args<I> = '.lc';
$literal .= lc;
}
$literal = $code.escape($literal);
$code.emit( q[
when '%L' {
if $pos + %0 > $lastpos
|| $target.substr($pos, %0)%I ne %1 {
goto('fail');
break;
}
$pos += %0;
goto('%S');
} ], $litlen, $literal, |%args);
}
}
class GGE::Exp::Quant is GGE::Exp {
method contents() {
my ($min, $max, $bt) = map { self.hash-access($_) },
<min max backtrack>;
$bt //= GREEDY;
"{$bt.name.lc} $min..$max"
}
method p6($code, $label, $next) {
my %args = self.getargs($label, $next, { quant => self });
my $replabel = $label ~ '_repeat';
my $explabel = $code.unique('R');
my $nextlabel = $explabel;
my $seplabel;
if self.hash-access('sep') {
$seplabel = $code.unique('R');
$nextlabel = $label ~ '_sep';
}
%args<c C> = 0, '### ';
given self.hash-access('backtrack') {
when EAGER {
$code.emit( q[[
when '%L' { # quant %Q eager
push @gpad, 0;
local-branch('%0');
}
when '%L_cont' {
pop @gpad;
goto('fail');
}
when '%0' {
$rep = @gpad[*-1];
%Mif $rep < %m { goto('%L_1'); break; }
pop @gpad;
push @ustack, $pos;
push @ustack, $rep;
local-branch('%S');
}
when '%0_cont' {
$rep = pop @ustack;
$pos = pop @ustack;
push @gpad, $rep;
goto('%L_1');
}
when '%L_1' {
%Nif $rep >= %n { goto('fail'); break; }
++$rep;
@gpad[*-1] = $rep;
goto('%1');
} ]], $replabel, $nextlabel, |%args);
}
when NONE {
%args<c C> = $code.unique(), '';
if self.hash-access('min') != 0
|| self.hash-access('max') != Inf {
continue;
}
$code.emit( q[[
when '%L' { # quant 0..Inf none
local-branch('%0');
}
when '%L_cont' {
if $cutmark != %c { goto('fail'); break; }
$cutmark = 0;
goto('fail');
}
when '%0' {
push @ustack, $pos;
local-branch('%1');
}
when '%0_cont' {
$pos = pop @ustack;
if $cutmark != 0 { goto('fail'); break; }
local-branch('%S');
}
when '%0_cont_cont' {
if $cutmark != 0 { goto('fail'); break; }
$cutmark = %c;
goto('fail');
} ]], $replabel, $nextlabel, |%args);
}
default {
$code.emit( q[[
when '%L' { # quant %Q greedy/none
push @gpad, 0;
local-branch('%0');
}
when '%L_cont' {
pop @gpad;
%Cif $cutmark != %c { goto('fail'); break; }
%C$cutmark = 0;
goto('fail');
}
when '%0' {
$rep = @gpad[*-1];
%Nif $rep >= %n { goto('%L_1'); break; }
++$rep;
@gpad[*-1] = $rep;
push @ustack, $pos;
push @ustack, $rep;
local-branch('%1');
}
when '%0_cont' {
$rep = pop @ustack;
$pos = pop @ustack;
if $cutmark != 0 { goto('fail'); break; }
--$rep;
goto('%L_1');
}
when '%L_1' {
%Mif $rep < %m { goto('fail'); break; }
pop @gpad;
push @ustack, $rep;
local-branch('%S');
}
when '%L_1_cont' {
$rep = pop @ustack;
push @gpad, $rep;
if $cutmark != 0 { goto('fail'); break; }
%C$cutmark = %c;
goto('fail');
} ]], $replabel, $nextlabel, |%args);
}
}
if self.hash-access('sep') -> $sep {
$code.emit( q[[
when '%0' {
if $rep == 1 { goto('%1'); break; }
goto('%2');
} ]], $nextlabel, $explabel, $seplabel);
$sep.p6($code, $seplabel, $explabel);
}
self[0].p6($code, $explabel, $replabel);
}
}
class GGE::Exp::CCShortcut is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
my $failcond = self.ast eq '.'
?? 'False'
!! sprintf '$target.substr($pos, 1) !~~ /%s/', self.ast;
$code.emit( q[
when '%0' { # ccshortcut %1
if $pos >= $lastpos || %2 {
goto('fail');
break;
}
++$pos;
goto('%3');
} ], $label, self.ast, $failcond, $next );
}
}
class GGE::Exp::Newline is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
$code.emit( q[
when '%0' { # newline
unless $target.substr($pos, 1) eq "\n"|"\r" {
goto('fail');
break;
}
my $twochars = $target.substr($pos, 2);
++$pos;
if $twochars eq "\r\n" {
++$pos;
}
goto('%1');
} ], $label, $next);
}
}
class GGE::Exp::Anchor is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
$code.emit( q[
when '%0' { # anchor %1 ], $label, self.ast );
given self.ast {
when '^' {
$code.emit( q[
if $pos == 0 { goto('%0'); break; }
goto('fail'); ], $next );
}
when '$' {
$code.emit( q[
if $pos == $lastpos { goto('%0'); break; }
goto('fail'); ], $next );
}
when '<<' {
$code.emit( q[
if $target.substr($pos, 1) ~~ /\w/
&& ($pos == 0 || $target.substr($pos - 1, 1) !~~ /\w/) {
goto('%0');
break;
}
goto('fail'); ], $next );
}
when '>>' {
$code.emit( q[
if $pos > 0 && $target.substr($pos - 1, 1) ~~ /\w/
&& ($pos == $lastpos || $target.substr($pos, 1) !~~ /\w/) {
goto('%0');
break;
}
goto('fail'); ], $next );
}
when '^^' {
$code.emit( q[
if $pos == 0 || $pos < $lastpos
&& $target.substr($pos - 1, 1) eq "\n" {
goto('%0');
break;
}
goto('fail'); ], $next );
}
when '$$' {
$code.emit( q[
if $target.substr($pos, 1) eq "\n"
|| $pos == $lastpos
&& ($pos < 1 || $target.substr($pos - 1, 1) ne "\n") {
goto('%0');
break;
}
goto('fail'); ], $next );
}
when '<?>' {
$code.emit( q[
goto('%0'); ], $next );
}
when '<!>' {
$code.emit( q[
goto('fail'); ], $next );
}
default {
die "Unknown anchor: $_";
}
}
$code.emit( q[
} ]);
}
}
class GGE::Exp::Concat is GGE::Exp {
method reduce() {
my $n = self.elems;
my @old-children = self.llist;
self.clear;
for @old-children -> $old-child {
my $new-child = $old-child.reduce();
self.push($new-child);
}
return self.llist == 1 ?? self[0] !! self;
}
method p6($code, $label, $next) {
$code.emit( q[
# concat ]);
my $cl = $label;
my $nl;
my $end = self.llist.elems - 1;
for self.llist.kv -> $i, $child {
$nl = $i == $end ?? $next !! $code.unique('R');
$child.p6($code, $cl, $nl);
$cl = $nl;
}
}
}
class GGE::Exp::Modifier is GGE::Exp does GGE::ShowContents {
method contents() {
self.hash-access('key');
}
method start($, $, %) { DESCEND }
}
class GGE::Exp::EnumCharList is GGE::Exp does GGE::ShowContents {
method contents() {
my $prefix = '';
if self.hash-access('isnegated') {
$prefix = '-';
if self.hash-access('iszerowidth') {
$prefix = '!';
}
}
my $list = self.ast;
qq[<$prefix\[$list\]>]
}
method p6($code, $label, $next) {
my $test = self.hash-access('isnegated') ?? 'defined' !! '!defined';
my $charlist = $code.escape(self.ast);
$code.emit( q[
when '%0' {
if $pos >= $lastpos
|| %1 %2.index($target.substr($pos, 1)) {
goto('fail');
break;
}
++$pos;
goto('%3');
} ], $label, $test, $charlist, $next);
}
}
class GGE::Exp::Alt is GGE::Exp {
method reduce() {
self[0] .= reduce;
self[1] .= reduce;
return self;
}
method p6($code, $label, $next) {
my $exp0label = $code.unique('R');
my $exp1label = $code.unique('R');
$code.emit( q[
when '%0' { # alt %1, %2
push @ustack, $pos;
local-branch('%1');
}
when '%0_cont' {
$pos = pop @ustack;
if $cutmark != 0 { goto('fail'); break; }
goto('%2');
} ], $label, $exp0label, $exp1label);
self[0].p6($code, $exp0label, $next);
self[1].p6($code, $exp1label, $next);
}
}
class GGE::Exp::Conj is GGE::Exp {
method reduce() {
self[0] .= reduce;
self[1] .= reduce;
return self;
}
method p6($code, $label, $next) {
my $exp0label = $code.unique('R');
my $exp1label = $code.unique('R');
my $chk0label = $label ~ '_chk0';
my $chk1label = $label ~ '_chk1';
$code.emit( q[[
when '%0' { # conj %1, %2
push @gpad, $pos, $pos;
local-branch('%1');
}
when '%0_cont' {
pop @gpad;
pop @gpad;
goto('fail');
}
when '%3' {
@gpad[*-1] = $pos;
$pos = @gpad[*-2];
goto('%2');
}
when '%4' {
if $pos != @gpad[*-1] {
goto('fail');
break;
}
my $p1 = pop @gpad;
my $p2 = pop @gpad;
push @ustack, $p2, $p1;
local-branch('%5');
}
when '%4_cont' {
my $p1 = pop @ustack;
my $p2 = pop @ustack;
push @gpad, $p2, $p1;
goto('fail');
} ]], $label, $exp0label, $exp1label, $chk0label, $chk1label,
$next);
self[0].p6($code, $exp0label, $chk0label);
self[1].p6($code, $exp1label, $chk1label);
}
}
class GGE::Exp::Group is GGE::Exp {
method reduce() {
my $group = $GGE::Exp::group;
$GGE::Exp::group = self;
self[0] .= reduce;
$GGE::Exp::group = $group;
return self.exists('cutmark') && self.hash-access('cutmark') > 0
|| self.exists('iscapture') && self.hash-access('iscapture') != 0
?? self
!! self[0];
}
method p6($code, $label, $next) {
self[0].p6($code, $label, $next);
}
}
class GGE::Exp::CGroup is GGE::Exp::Group {
method p6($code, $label, $next) {
my $explabel = $code.unique('R');
my $expnext = $label ~ '_close';
my %args = self.getargs($label, $next);
my ($captgen, $captsave, $captback) = self.gencapture($label);
%args<c C> = self.hash-access('cutmark'), '### ';
%args<X> = self.hash-access('isscope') ?? '' !! '### ';
$code.emit( q[[
when '%L' { # capture
%0
goto('%L_1');
}
when '%L_1' {
$captob = $captscope.new($captscope);
$captob.from = $pos; # XXX: PGE uses .pos here somehow.
push @gpad, $captscope;
push @gpad, $captob;
%X$captscope = $captob;
local-branch('%E');
}
when '%L_1_cont' {
$captob = pop @gpad;
$captscope = pop @gpad;
%Cif $cutmark != %c { goto('fail'); break; }
%C$cutmark = 0;
goto('fail');
}
when '%L_close' {
push @ustack, $captscope;
$captob = pop @gpad;
$captscope = pop @gpad;
$captob.to = $pos;
%1
push @ustack, $captob;
local-branch('%S');
}
when '%L_close_cont' {
$captob = pop @ustack;
%2
push @gpad, $captscope;
push @gpad, $captob;
$captscope = pop @ustack;
goto('fail');
} ]], $captgen, $captsave, $captback, :E($explabel), |%args);
self[0].p6($code, $explabel, $expnext);
}
}
class GGE::Exp::Cut is GGE::Exp {
method reduce() {
if self.hash-access('cutmark') > CUT_RULE {
my $group = $GGE::Exp::group;
if !$group.hash-access('cutmark') {
$group.hash-access('cutmark') = CodeString.unique();
}
self.hash-access('cutmark') = $group.hash-access('cutmark');
}
return self;
}
method p6($code, $label, $next) {
my $cutmark = self.hash-access('cutmark') // 'NO_CUTMARK';
$code.emit( q[
when '%0' { # cut %2
local-branch('%1');
}
when '%0_cont' {
$cutmark = %2;
goto('fail');
} ], $label, $next, $cutmark);
}
}
class GGE::Exp::Scalar is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
my $cname = self.hash-access('cname');
my $C = $cname.substr(0, 1) eq q[']
?? '$mob.hash-access(' ~ $cname ~ ')'
!! '$mob[' ~ $cname ~ ']';
$code.emit( q[[
when '%0' { # scalar %2
my $capture = %C;
if $capture ~~ Array {
$capture = $capture[*-1];
}
my $length = $capture.chars;
if $pos + $length > $lastpos
|| $target.substr($pos, $length) ne $capture {
goto('fail');
break;
}
$pos += $length;
goto('%1');
} ]], $label, $next, $cname, :$C);
return;
}
}
class GGE::Exp::Alias is GGE::Exp {
method contents() {
self.hash-access('cname');
}
}
class GGE::Exp::Subrule is GGE::Exp does GGE::ShowContents {
method p6($code, $label, $next) {
my %args = self.getargs($label, $next);
my $subname = self.hash-access('subname');
my ($captgen, $captsave, $captback) = self.gencapture($label);
my $subarg = self.hash-access('arg') // ''
?? $code.escape(self.hash-access('arg'))
!! '';
$code.emit( q[[
when '%L' { # grammar subrule %0
$captob = $captscope;
$captob.to = $pos;
unless $mob.can('%0') {
die "Unable to find regex '%0'";
}
$captob = $captob.%0(:$stepwise, %1); ]], $subname, $subarg,
|%args);
if self.hash-access('iszerowidth') {
my $test = self.hash-access('isnegated') ?? 'unless' !! 'if';
$code.emit( q[[
# XXX: fail match
%1 $captob.to < 0 { goto('fail'); break; }
$captob.from = $captob.to = $pos;
goto('%2');
} ]], "XXX: fail match", $test, $next);
}
else {
$code.emit( q[[
# XXX: fail match
if $captob.to < 0 { goto('fail'); break; }
%2
%3
$captob.from = $pos; # XXX: No corresponding line in PGE
$pos = $captob.to;
local-branch('%1'); # XXX: PGE does backtracking into subrules
}
when '%L_cont' {
%4
goto('fail');
} ]], CUT_MATCH, $next, $captgen, $captsave, $captback, |%args);
}
}
}
| masak/gge | lib/GGE/Exp.pm | Perl | artistic-2.0 | 25,424 |
//#import <UIKit/UIKit.h>
#import "ZMBaseViewController.h"
#import "JHPopoverViewController.h"
#import "UIExpandingTextView.h"
@interface ZMMdlBbsVCtrl : ZMBaseViewController<UITableViewDataSource,UITableViewDelegate,UITextViewDelegate>
{
UIExpandingTextView * TV_Draft_Content ;
UIScrollView * forumTitleScrollView;
//datasource
//NSMutableArray * Course_Arr;
NSMutableArray * Forum_Arr_User;
NSMutableArray * Forum_Arr_Course;
NSMutableArray * Bbs_Arr;
UIPopoverController * popoverViewController;
//int selectCourseIndex;
int selectForumIndex;
int selectForumIndex2;
//BOOL isGetForumByCourse;
}
@property (nonatomic, strong)UIPanGestureRecognizer *panGestureRecognizer;
@property (nonatomic, strong)UIButton *panBtn;
@property (nonatomic, strong)UIButton *gousiBtn;
@property (nonatomic, strong)UIButton *luntanBtn;
@property (nonatomic, strong)UIButton *shijuanBtn;
@property (nonatomic, strong)UIButton *zuoyeBtn;
@property (nonatomic, strong)UIButton *toupiaoBtn;
@property (nonatomic, strong)UIButton *qiangdaBtn;
@property (nonatomic, strong)UIButton *hezuoBtn;
@end
| licongdashen/ZMducation | ZMEducation20140304-4/ZMEducation/ViewController/ZMMdlBbsVCtrl.h | C | artistic-2.0 | 1,158 |
#if !defined(AFX_PCXEXPORT_H__083C40D4_C400_4AAD_B145_5178DFACB86E__INCLUDED_)
#define AFX_PCXEXPORT_H__083C40D4_C400_4AAD_B145_5178DFACB86E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
/////////////////////////////////////////////////////////////////////////////
// CPCXExport wrapper class
class CPCXExport : public COleDispatchDriver
{
public:
CPCXExport() {} // Calls COleDispatchDriver default constructor
CPCXExport(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CPCXExport(const CPCXExport& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
long GetWidth();
void SetWidth(long nNewValue);
long GetHeight();
void SetHeight(long nNewValue);
void SaveToFile(LPCTSTR FileName);
VARIANT SaveToStream();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PCXEXPORT_H__083C40D4_C400_4AAD_B145_5178DFACB86E__INCLUDED_)
| ChIna-king-Arthur/MFC | cow2/TeeChartAPI/pcxexport.h | C | artistic-2.0 | 1,244 |
#!/usr/bin/env python
def run_test(n, m, power, bullet):
prev_dict = {}
cur_dict = {}
for i in xrange(n):
ri = n-1-i
for j in xrange(m):
if i == 0:
cur_dict[power[ri][j]] = power[ri][j]
else:
new_k = power[ri][j]
for k, v in prev_dict.items():
all_bullet = new_k + k - min(v, bullet[ri][j])
if cur_dict.has_key(all_bullet):
cur_dict[all_bullet] = min(new_k, cur_dict[all_bullet])
else:
cur_dict[all_bullet] = new_k
prev_dict = {}
for c, t in cur_dict.items():
small = True
for c1, t1 in cur_dict.items():
if c1 < c and t1 < t:
small = False
break
if small:
prev_dict[c] = t
# print "%s" % (prev_dict)
cur_dict = {}
smallest = None
for t in prev_dict.keys():
if smallest is None or t < smallest:
smallest = t
print smallest
return smallest
def mtest1():
n = 3
m = 3
power = [[1, 2, 3], [3, 2, 1], [3, 2, 1]]
bullet = [[1, 2, 3], [3, 2, 1], [1, 2, 3]]
run_test(n, m, power, bullet)
def mtest2():
n = 3
m = 2
power = [[1, 8], [6, 1], [4, 6]]
bullet = [[2, 1], [4, 1], [3, 1]]
run_test(n, m, power, bullet)
def mtest3():
n = 3
m = 3
power = [[3, 2, 5], [8, 9, 1], [4, 7, 6]]
bullet = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]
run_test(n, m, power, bullet)
def mtest3():
n = 3
m = 2
power = [[5, 10], [50, 60], [20, 25]]
bullet = [[5, 50], [5, 20], [1, 1]]
run_test(n, m, power, bullet)
def manual_test():
mtest1()
mtest2()
mtest3()
if __name__ == "__main__":
manual_test()
| SwordYoung/cutprob | hackerrank/contest/w13/a-super-hero/a.py | Python | artistic-2.0 | 1,849 |
# Makefile to build our databases
db: armour-db.tex
armour-db.tex: armour.db db2tex
./db2tex < $< > $@
| JohnL4/diaspora-srd | latex/db/Makefile | Makefile | artistic-2.0 | 108 |
Simple application to act as an OAuth2 server for testing. | sdeeg-pivotal/spring-polymer-demo | auth-server/README.md | Markdown | artistic-2.0 | 58 |
package Static::Issue;
use Pony::Object qw/Static::Base/;
protected 'title';
protected 'description';
protected static 'close_type_list' => {
'closed' => 1,
'resolved' => 2,
'won\'t fix' => 3,
};
protected 'close_type';
sub set_close_type : Public
{
my $this = shift;
my $type_name = shift;
if (exists $this->close_type_list->{$type_name}) {
$this->close_type = $this->close_type_list->{$type_name};
} else {
throw Pony::Object::Throwable('Wrong type');
}
}
sub get_close_type : Public
{
my $this = shift;
my @types = grep {$_ == $this->close_type} @{$this->close_type_list};
return shift @types if @types;
return undef;
}
1; | gitpan/Pony-Object | t/Static/Issue.pm | Perl | artistic-2.0 | 752 |
#region Math.NET Iridium (LGPL) by Ruegg
// Math.NET Iridium, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
//
// Copyright (c) 2002-2008, Christoph Rüegg, http://christoph.ruegg.name
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace MathNet.Numerics
{
/// <summary>
/// A generic vector of two values, useful e.g. to return two values
/// in a function without using out-parameters.
/// </summary>
public struct Tuple<TFirst, TSecond> : IEquatable<Tuple<TFirst, TSecond>>
where TFirst : IEquatable<TFirst>
where TSecond : IEquatable<TSecond>
{
private readonly TFirst _first;
private readonly TSecond _second;
/// <summary>
/// Construct a tuple
/// </summary>
/// <param name="first">The first tuple value</param>
/// <param name="second">The second tuple value</param>
public Tuple(TFirst first, TSecond second)
{
_first = first;
_second = second;
}
/// <summary>
/// The first tuple value
/// </summary>
public TFirst First
{
get { return _first; }
}
/// <summary>
/// The second tuple value
/// </summary>
public TSecond Second
{
get { return _second; }
}
/// <summary>
/// True if the the first values of both tuples match and the second valus of both tuples match.
/// </summary>
/// <param name="other">The other tuple to compare with.</param>
public bool Equals(Tuple<TFirst, TSecond> other)
{
return _first.Equals(other.First) && _second.Equals(other.Second);
}
}
}
| tylermenezes/Hunt-the-Wumpus-2010 | src/MathNet.Iridium-2008.8.16.470/Sources/Library/Tuple.cs | C# | artistic-2.0 | 2,577 |
# testgitflow
# testgitflow
# testgitflow
| Eisekson/testgitflow | README.md | Markdown | artistic-2.0 | 42 |
<?php
/**
* The template for displaying search form
*/
?>
<?php global $s; ?>
<form class="search" method="get" id="searchform" action="<?php echo home_url(); ?>">
<input type="text" value="<?php echo esc_html($s, 1); ?>" name="s" id="s" size="15" />
<div class="magn_glass">
<i class="icon-search"></i>
</div>
</form> | carlagiannina/cg | wp-content/themes/penandpaper_WP_1.0.1/searchform.php | PHP | artistic-2.0 | 362 |
FROM frolvlad/alpine-scala
LABEL maintainer="JJ Merelo <jjmerelo@GMail.com>"
WORKDIR /root
CMD ["/usr/local/bin/sbt"]
ARG SBT_VERSION=1.4.2
RUN apk update && apk upgrade && apk add curl \
&& curl -sL "https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz" -o /usr/local/sbt.tgz \
&& cd /usr/local && tar xvfz sbt.tgz \
&& mv /usr/local/sbt/bin/* /usr/local/bin \
&& apk del curl \
&& rm /usr/local/sbt.tgz
| JJ/CC | ejemplos/Scala/Dockerfile | Dockerfile | artistic-2.0 | 459 |
package Site::Pages::AJAJ::Logout;
use strictures 1;
use base qw/ Site::Pages::JSON /;
sub handle_POST {
my ( $self ) = @_;
my ( $uid ) = $self->unroll_session();
# just remove the key from the session DB
if (my $session = $self->schema->resultset('Session')->find({uid=>$uid})) {
$session->delete();
return $self->json_success;
} else {
return $self->json_failure;
}
}
| simcop2387/TDL | lib/Site/Pages/AJAJ/Logout.pm | Perl | artistic-2.0 | 397 |
# enum Bool declared in BOOTSTRAP
BEGIN {
Bool.^add_method('Bool', my proto method Bool(|) {*});
Bool.^add_method('gist', my proto method gist(|) {*});
Bool.^add_method('Numeric', my proto method Numeric(|) {*});
Bool.^add_method('Int', my proto method Int(|) {*});
Bool.^add_method('ACCEPTS', my proto method ACCEPTS(|) {*});
Bool.^add_method('pick', my proto method pick(|) {*});
Bool.^add_method('roll', my proto method roll(|) {*});
Bool.^add_method('perl', my proto method perl(|) {*});
}
BEGIN {
Bool.^add_multi_method('Bool', my multi method Bool(Bool:D:) { self });
Bool.^add_multi_method('gist', my multi method gist(Bool:D:) { self ?? 'True' !! 'False' });
Bool.^add_multi_method('Str', my multi method Str(Bool:D:) { self ?? 'True' !! 'False' });
Bool.^add_multi_method('Numeric', my multi method Numeric(Bool:D:) { self ?? 1 !! 0 });
Bool.^add_multi_method('Int', my multi method Int(Bool:D:) { self ?? 1 !! 0 });
Bool.^add_multi_method('Real', my multi method Real(Bool:D:) { self ?? 1 !! 0 });
Bool.^add_multi_method('ACCEPTS', my multi method ACCEPTS(Bool:D: Mu \topic ) { self });
Bool.^add_multi_method('perl', my multi method perl(Bool:D:) { self ?? 'Bool::True' !! 'Bool::False' });
Bool.^add_multi_method('pick', my multi method pick(Bool:U:) { nqp::p6bool(nqp::isge_n(nqp::rand_n(2e0), 1e0)) });
Bool.^add_multi_method('roll', my multi method roll(Bool:U:) { nqp::p6bool(nqp::isge_n(nqp::rand_n(2e0), 1e0)) });
}
BEGIN {
Bool.^add_multi_method('Bool', my multi method Bool(Bool:U:) { Bool::False });
Bool.^add_multi_method('ACCEPTS', my multi method ACCEPTS(Bool:U: \topic ) { nqp::istype(topic, Bool) });
Bool.^add_multi_method('gist', my multi method gist(Bool:U:) { '(Bool)' });
Bool.^add_multi_method('perl', my multi method perl(Bool:U:) { 'Bool' });
Bool.^add_multi_method('pick', my multi method pick(Bool:U: $n) { self.^enum_value_list.pick($n) });
Bool.^add_multi_method('roll', my multi method roll(Bool:U: $n) { self.^enum_value_list.roll($n) });
Bool.^add_method('pred', my method pred() { Bool::False });
Bool.^add_method('succ', my method succ() { Bool::True });
Bool.^add_method('enums', my method enums() { self.^enum_values.Map });
Bool.^compose;
}
multi sub prefix:<++>(Bool $a is rw) { $a = True; }
multi sub prefix:<-->(Bool $a is rw) { $a = False; }
multi sub postfix:<++>(Bool:U $a is rw --> False) { $a = True }
multi sub postfix:<-->(Bool:U $a is rw) { $a = False; }
multi sub postfix:<++>(Bool:D $a is rw) {
if $a {
True
}
else {
$a = True;
False
}
}
multi sub postfix:<-->(Bool:D $a is rw) {
if $a {
$a = False;
True
}
else {
False
}
}
proto sub prefix:<?>(Mu $) is pure {*}
multi sub prefix:<?>(Bool:D \a) { a }
multi sub prefix:<?>(Bool:U \a) { Bool::False }
multi sub prefix:<?>(Mu \a) { a.Bool }
proto sub prefix:<so>(Mu $) is pure {*}
multi sub prefix:<so>(Bool:D \a) { a }
multi sub prefix:<so>(Bool:U \a) { Bool::False }
multi sub prefix:<so>(Mu \a) { a.Bool }
proto sub prefix:<!>(Mu $) is pure {*}
multi sub prefix:<!>(Bool \a) { nqp::p6bool(nqp::not_i(nqp::istrue(a))) }
multi sub prefix:<!>(Mu \a) { nqp::p6bool(nqp::not_i(nqp::istrue(a))) }
proto sub prefix:<not>(Mu $) is pure {*}
multi sub prefix:<not>(Bool \a) { nqp::p6bool(nqp::not_i(nqp::istrue(a))) }
multi sub prefix:<not>(Mu \a) { nqp::p6bool(nqp::not_i(nqp::istrue(a))) }
proto sub prefix:<?^>(Mu $) is pure {*}
multi sub prefix:<?^>(Mu \a) { not a }
proto sub infix:<?&>(Mu $?, Mu $?) is pure {*}
multi sub infix:<?&>(Mu $x = Bool::True) { $x.Bool }
multi sub infix:<?&>(Mu \a, Mu \b) { a.Bool && b.Bool }
proto sub infix:<?|>(Mu $?, Mu $?) is pure {*}
multi sub infix:<?|>(Mu $x = Bool::False) { $x.Bool }
multi sub infix:<?|>(Mu \a, Mu \b) { a.Bool || b.Bool }
proto sub infix:<?^>(Mu $?, Mu $?) is pure {*}
multi sub infix:<?^>(Mu $x = Bool::False) { $x.Bool }
multi sub infix:<?^>(Mu \a, Mu \b) { nqp::p6bool(nqp::ifnull(nqp::xor(a.Bool,b.Bool), 0)) }
# These operators are normally handled as macros in the compiler;
# we define them here for use as arguments to functions.
proto sub infix:<&&>(|) {*}
multi sub infix:<&&>(Mu $x = Bool::True) { $x }
multi sub infix:<&&>(Mu \a, &b) { a && b() }
multi sub infix:<&&>(Mu \a, Mu \b) { a && b }
proto sub infix:<||>(|) {*}
multi sub infix:<||>(Mu $x = Bool::False) { $x }
multi sub infix:<||>(Mu \a, &b) { a || b() }
multi sub infix:<||>(Mu \a, Mu \b) { a || b }
proto sub infix:<^^>(|) {*}
multi sub infix:<^^>(Mu $x = Bool::False) { $x }
multi sub infix:<^^>(Mu \a, &b) { a ^^ b() }
multi sub infix:<^^>(Mu \a, Mu \b) { a ^^ b }
multi sub infix:<^^>(+@a) {
my Mu $a = shift @a;
while @a {
my Mu $b := shift @a;
$b := $b() if $b ~~ Callable;
next unless $b;
return Nil if $a;
$a := $b;
}
$a;
}
proto sub infix:<//>(|) {*}
multi sub infix:<//>(Mu $x = Any) { $x }
multi sub infix:<//>(Mu \a, &b) { a // b }
multi sub infix:<//>(Mu \a, Mu \b) { a // b }
proto sub infix:<and>(|) {*}
multi sub infix:<and>(Mu $x = Bool::True) { $x }
multi sub infix:<and>(Mu \a, &b) { a && b }
multi sub infix:<and>(Mu \a, Mu \b) { a && b }
proto sub infix:<or>(|) {*}
multi sub infix:<or>(Mu $x = Bool::False) { $x }
multi sub infix:<or>(Mu \a, &b) { a || b }
multi sub infix:<or>(Mu \a, Mu \b) { a || b }
proto sub infix:<xor>(|) {*}
multi sub infix:<xor>(Mu $x = Bool::False) { $x }
multi sub infix:<xor>(Mu \a, &b) { a ^^ b }
multi sub infix:<xor>(Mu \a, Mu \b) { a ^^ b }
multi sub infix:<xor>(|c) { &infix:<^^>(|c); }
# vim: ft=perl6 expandtab sw=4
| awwaiid/rakudo | src/core/Bool.pm | Perl | artistic-2.0 | 6,047 |
<?php
/**
* Unit Test File
*
* @license Artistic License 2.0
*
* This file is part of Round Eights.
*
* Round Eights is free software: you can redistribute it and/or modify
* it under the terms of the Artistic License as published by
* the Open Source Initiative, either version 2.0 of the License, or
* (at your option) any later version.
*
* Round Eights is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Artistic License for more details.
*
* You should have received a copy of the Artistic License
* along with Round Eights. If not, see <http://www.RoundEights.com/license.php>
* or <http://www.opensource.org/licenses/artistic-license-2.0.php>.
*
* @author James Frasca <James@RoundEights.com>
* @copyright Copyright 2009, James Frasca, All Rights Reserved
* @package UnitTests
*/
require_once rtrim( __DIR__, "/" ) ."/../../general.php";
/**
* Unit Tests
*/
class classes_CLI_Option extends PHPUnit_Framework_TestCase
{
/**
* Returns a test argument
*
* @return \r8\iface\CLI\Arg
*/
public function getTestArg ( $greedy = FALSE, $consume = array() )
{
$arg = $this->getMock('\r8\iface\CLI\Arg');
$arg->expects( $this->any() )->method( "isGreedy" )
->will( $this->returnValue( $greedy ) );
$arg->expects( $this->any() )->method( "consume" )
->will( $this->returnValue( $consume ) );
return $arg;
}
public function testDescribe ()
{
$opt = new \r8\CLI\Option("A", "Testing the description");
$this->assertSame(
" -A\n"
." Testing the description\n",
$opt->describe()
);
$opt->addFlag('b')->addFlag('long');
$this->assertSame(
" -A, -b, --long\n"
." Testing the description\n",
$opt->describe()
);
$opt->addArg( new \r8\CLI\Arg\One("Arg1") );
$opt->addArg( new \r8\CLI\Arg\Many("Arg2") );
$this->assertSame(
" -A, -b, --long [Arg1] [Arg2]...\n"
." Testing the description\n",
$opt->describe()
);
$opt = new \r8\CLI\Option(
'opt',
'A particularly long description of this command that will need '
.'to be wrapped because of its length'
);
$this->assertSame(
" --opt\n"
." A particularly long description of this command that will need to be\n"
." wrapped because of its length\n",
$opt->describe()
);
}
public function testNormalizeFlag ()
{
$this->assertSame( "a", \r8\CLI\Option::normalizeFlag("a") );
$this->assertSame( "A", \r8\CLI\Option::normalizeFlag("A") );
$this->assertSame( "test", \r8\CLI\Option::normalizeFlag("TesT") );
$this->assertSame( "with-spaces", \r8\CLI\Option::normalizeFlag("with spaces") );
$this->assertSame( "trim-this", \r8\CLI\Option::normalizeFlag("--trim-this--") );
try {
\r8\CLI\Option::normalizeFlag(" ");
$this->fail("An expected exception was not thrown");
}
catch ( \r8\Exception\Argument $err ) {}
$this->assertSame( "", \r8\CLI\Option::normalizeFlag(NULL, FALSE) );
}
public function testConstruct ()
{
$opt = new \r8\CLI\Option("a", "Test", TRUE);
$this->assertSame( "a", $opt->getPrimaryFlag() );
$this->assertSame( "Test", $opt->getDescription() );
$this->assertSame( array("a"), $opt->getFlags() );
$this->assertTrue( $opt->allowMany() );
}
public function testAddFlag ()
{
$opt = new \r8\CLI\Option("A", "Test");
$this->assertSame( array("A"), $opt->getFlags() );
$this->assertSame( $opt, $opt->addFlag("a") );
$this->assertSame( array("A", "a"), $opt->getFlags() );
$this->assertSame( $opt, $opt->addFlag("A") );
$this->assertSame( array("A", "a"), $opt->getFlags() );
$this->assertSame( $opt, $opt->addFlag("--o ") );
$this->assertSame( array("A", "a", "o"), $opt->getFlags() );
$this->assertSame( $opt, $opt->addFlag("-o ") );
$this->assertSame( array("A", "a", "o"), $opt->getFlags() );
$this->assertSame( $opt, $opt->addFlag("--Some Flag") );
$this->assertSame(
array("A", "a", "o", "some-flag"),
$opt->getFlags()
);
$this->assertSame( $opt, $opt->addFlag("--BAD!@#CHARS--") );
$this->assertSame(
array("A", "a", "o", "some-flag", "badchars"),
$opt->getFlags()
);
try {
$opt->addFlag(" ");
$this->fail("An expected exception was not thrown");
}
catch ( \r8\Exception\Argument $err ) {}
}
public function testHasFlag ()
{
$opt = new \r8\CLI\Option("A", "Test");
$opt->addFlag( "switch" );
$this->assertFalse( $opt->hasFlag(" ") );
$this->assertFalse( $opt->hasFlag("") );
$this->assertTrue( $opt->hasFlag("A") );
$this->assertFalse( $opt->hasFlag("B") );
$this->assertFalse( $opt->hasFlag("a") );
$this->assertTrue( $opt->hasFlag("switch") );
$this->assertTrue( $opt->hasFlag("Switch") );
}
public function testAddArg ()
{
$opt = new \r8\CLI\Option("A", "Test");
$this->assertSame( array(), $opt->getArgs() );
$arg1 = $this->getTestArg();
$this->assertSame( $opt, $opt->addArg($arg1) );
$this->assertSame( array($arg1), $opt->getArgs() );
$arg2 = $this->getTestArg();
$this->assertSame( $opt, $opt->addArg($arg2) );
$this->assertSame( array($arg1, $arg2), $opt->getArgs() );
}
public function testAddArg_Greedy ()
{
$opt = new \r8\CLI\Option("A", "Test");
// Add a greedy argument
$opt->addArg( $this->getTestArg(TRUE) );
try {
$opt->addArg( $this->getTestArg() );
$this->fail("An expected exception was not thrown");
}
catch ( \r8\Exception\Data $err ) {}
}
public function testConsume_NoArgs ()
{
$opt = new \r8\CLI\Option("A", "Test");
$this->assertSame(
array(),
$opt->consume( new \r8\CLI\Input(array('test.php')) )
);
}
public function testConsume_WithArgs ()
{
$input = new \r8\CLI\Input(array('test.php'));
$opt = new \r8\CLI\Option("A", "Test");
$arg1 = $this->getTestArg(FALSE, array( "one", "two" ));
$opt->addArg( $arg1 );
$arg2 = $this->getTestArg(FALSE, array());
$opt->addArg( $arg2 );
$arg3 = $this->getTestArg(FALSE, array( "three" ));
$opt->addArg( $arg3 );
$this->assertSame(
array( "one", "two", "three" ),
$opt->consume( $input )
);
}
}
| Nycto/Round-Eights | tests/classes/CLI/Option.php | PHP | artistic-2.0 | 7,081 |
-- Convert schema '/home/jjohnston/sites/Xqursion/share/migrations/_source/deploy/22/001-auto.yml' to '/home/jjohnston/sites/Xqursion/share/migrations/_source/deploy/21/001-auto.yml':;
;
-- No differences found;
| taskboy3000/Xqursion | share/migrations/SQLite/downgrade/22-21/001-auto.sql | SQL | artistic-2.0 | 214 |
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (16) on Fri Jul 02 03:26:51 UTC 2021 -->
<title>ConsoleMessages.Warn.Block (Glowstone 2021.7.1-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-07-02">
<meta name="description" content="declaration: package: net.glowstone.i18n, interface: ConsoleMessages, interface: Warn, interface: Block">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar.top">
<div class="skip-nav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar.top.firstrow" class="nav-list" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/ConsoleMessages.Warn.Block.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
<ul class="sub-nav-list">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<div class="nav-list-search"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip.navbar.top">
<!-- -->
</span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">net.glowstone.i18n</a></div>
<h1 title="Interface ConsoleMessages.Warn.Block" class="title">Interface ConsoleMessages.Warn.Block</h1>
</div>
<section class="description">
<dl class="notes">
<dt>Enclosing interface:</dt>
<dd><a href="ConsoleMessages.Warn.html" title="interface in net.glowstone.i18n">ConsoleMessages.Warn</a></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public static interface </span><span class="element-name type-name-label">ConsoleMessages.Warn.Block</span></div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested.class.summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Interface</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static interface </code></div>
<div class="col-second even-row-color"><code><span class="member-name-link"><a href="ConsoleMessages.Warn.Block.Chest.html" title="interface in net.glowstone.i18n">ConsoleMessages.Warn.Block.Chest</a></span></code></div>
<div class="col-last even-row-color"> </div>
<div class="col-first odd-row-color"><code>static interface </code></div>
<div class="col-second odd-row-color"><code><span class="member-name-link"><a href="ConsoleMessages.Warn.Block.DoubleSlab.html" title="interface in net.glowstone.i18n">ConsoleMessages.Warn.Block.DoubleSlab</a></span></code></div>
<div class="col-last odd-row-color"> </div>
</div>
</section>
</li>
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field.summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static <a href="LoggableLocalizedString.html" title="interface in net.glowstone.i18n">LoggableLocalizedString</a></code></div>
<div class="col-second even-row-color"><code><span class="member-name-link"><a href="#WRONG_BLOCK_DATA">WRONG_BLOCK_DATA</a></span></code></div>
<div class="col-last even-row-color"> </div>
<div class="col-first odd-row-color"><code>static <a href="LoggableLocalizedString.html" title="interface in net.glowstone.i18n">LoggableLocalizedString</a></code></div>
<div class="col-second odd-row-color"><code><span class="member-name-link"><a href="#WRONG_MATERIAL_DATA">WRONG_MATERIAL_DATA</a></span></code></div>
<div class="col-last odd-row-color"> </div>
</div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field.detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="WRONG_MATERIAL_DATA">
<h3>WRONG_MATERIAL_DATA</h3>
<div class="member-signature"><span class="modifiers">static final</span> <span class="return-type"><a href="LoggableLocalizedString.html" title="interface in net.glowstone.i18n">LoggableLocalizedString</a></span> <span class="element-name">WRONG_MATERIAL_DATA</span></div>
</section>
</li>
<li>
<section class="detail" id="WRONG_BLOCK_DATA">
<h3>WRONG_BLOCK_DATA</h3>
<div class="member-signature"><span class="modifiers">static final</span> <span class="return-type"><a href="LoggableLocalizedString.html" title="interface in net.glowstone.i18n">LoggableLocalizedString</a></span> <span class="element-name">WRONG_BLOCK_DATA</span></div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright © 2021. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>
| GlowstoneMC/glowstonemc.github.io | content/jd/glowstone/1.17/net/glowstone/i18n/ConsoleMessages.Warn.Block.html | HTML | artistic-2.0 | 7,186 |
package CDN::Edgecast::Client::auto::Administration::Element::CustomerOriginUpdateResponse;
BEGIN {
$CDN::Edgecast::Client::auto::Administration::Element::CustomerOriginUpdateResponse::VERSION = '0.01.00';
}
use strict;
use warnings;
{ # BLOCK to scope variables
sub get_xmlns { 'EC:WebServices' }
__PACKAGE__->__set_name('CustomerOriginUpdateResponse');
__PACKAGE__->__set_nillable();
__PACKAGE__->__set_minOccurs();
__PACKAGE__->__set_maxOccurs();
__PACKAGE__->__set_ref();
use base qw(
SOAP::WSDL::XSD::Typelib::Element
SOAP::WSDL::XSD::Typelib::ComplexType
);
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
}
use Class::Std::Fast::Storable constructor => 'none';
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
Class::Std::initialize();
{ # BLOCK to scope variables
my %CustomerOriginUpdateResult_of :ATTR(:get<CustomerOriginUpdateResult>);
__PACKAGE__->_factory(
[ qw( CustomerOriginUpdateResult
) ],
{
'CustomerOriginUpdateResult' => \%CustomerOriginUpdateResult_of,
},
{
'CustomerOriginUpdateResult' => 'CDN::Edgecast::Client::auto::Administration::Type::CustomerOriginInfo',
},
{
'CustomerOriginUpdateResult' => 'CustomerOriginUpdateResult',
}
);
} # end BLOCK
} # end of BLOCK
1;
=pod
=head1 NAME
CDN::Edgecast::Client::auto::Administration::Element::CustomerOriginUpdateResponse
=head1 VERSION
version 0.01.00
=head1 DESCRIPTION
Perl data type class for the XML Schema defined element
CustomerOriginUpdateResponse from the namespace EC:WebServices.
=head1 PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
=item * CustomerOriginUpdateResult
$element->set_CustomerOriginUpdateResult($data);
$element->get_CustomerOriginUpdateResult();
=back
=head1 METHODS
=head2 new
my $element = CDN::Edgecast::Client::auto::Administration::Element::CustomerOriginUpdateResponse->new($data);
Constructor. The following data structure may be passed to new():
{
CustomerOriginUpdateResult => { # CDN::Edgecast::Client::auto::Administration::Type::CustomerOriginInfo
Id => $some_value, # int
MediaTypeId => $some_value, # int
DirectoryName => $some_value, # string
HostHeader => $some_value, # string
UseOriginShield => $some_value, # boolean
HttpFullUrl => $some_value, # string
HttpsFullUrl => $some_value, # string
HttpLoadBalancing => $some_value, # string
HttpsLoadBalancing => $some_value, # string
HttpHostnames => { # CDN::Edgecast::Client::auto::Administration::Type::ArrayOfHostname
Hostname => { # CDN::Edgecast::Client::auto::Administration::Type::Hostname
Name => $some_value, # string
IsPrimary => $some_value, # boolean
Ordinal => $some_value, # int
},
},
HttpsHostnames => { # CDN::Edgecast::Client::auto::Administration::Type::ArrayOfHostname
Hostname => { # CDN::Edgecast::Client::auto::Administration::Type::Hostname
Name => $some_value, # string
IsPrimary => $some_value, # boolean
Ordinal => $some_value, # int
},
},
ShieldPOPs => { # CDN::Edgecast::Client::auto::Administration::Type::ArrayOfShieldPOP
ShieldPOP => { # CDN::Edgecast::Client::auto::Administration::Type::ShieldPOP
Name => $some_value, # string
POPCode => $some_value, # string
Region => $some_value, # string
},
},
},
},
=head1 AUTHOR
Generated by SOAP::WSDL
=cut | gitpan/CDN-Edgecast-Client | lib/CDN/Edgecast/Client/auto/Administration/Element/CustomerOriginUpdateResponse.pm | Perl | artistic-2.0 | 3,624 |
## Upgrade notes
### v6.0.0
#### Backwards incompatible changes
##### Usage of `map.forEachLayerAtPixel`
Due to performance considerations, the layers in a map will sometimes be rendered into one
single canvas instead of separate elements.
This means `map.forEachLayerAtPixel` will bring up false positives.
The easiest solution to avoid that is to assign different `className` properties to each layer like so:
```js
new Layer({
// ...
className: 'my-layer'
})
```
Please note that this may incur a significant performance loss when dealing with many layers and/or
targetting mobile devices.
##### Removal of `TOUCH` constant from `ol/has`
If you were previously using this constant, you can check if `'ontouchstart'` is defined in `window` instead.
```js
if ('ontouchstart' in window) {
// ...
}
```
##### Removal of `GEOLOCATION` constant from `ol/has`
If you were previously using this constant, you can check if `'geolocation'` is defined in `navigator` instead.
```js
if ('geolocation' in navigator) {
// ...
}
```
##### Removal of CSS print rules
The CSS media print rules were removed from the `ol.css` file. To get the previous behavior, use the following CSS:
```css
@media print {
.ol-control {
display: none;
}
}
```
##### Removal of optional this arguments
The optional this (i.e. opt_this) arguments were removed from the following methods.
Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
* `forEachCorner` in `ol/extent`
* `LRUCache#forEach`
* `RBush#forEach` and `RBush#forEachInExtent`
##### The `setCenter`, `setZoom`, `setResolution` and `setRotation` methods on `ol/View` do not bypass constraints anymore
Previously, these methods allowed setting values that were inconsistent with the given view constraints.
This is no longer the case and all changes to the view state now follow the same logic:
target values are provided and constraints are applied on these to determine the actual values to be used.
##### Removal of the `constrainResolution` option on `View.fit`, `PinchZoom`, `MouseWheelZoom` and `ol/interaction.js`
The `constrainResolution` option is now only supported by the `View` class. A `View.setConstrainResolution` method was added as well.
Generally, the responsibility of applying center/rotation/resolutions constraints was moved from interactions and controls to the `View` class.
##### The view `extent` option now applies to the whole viewport
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainCenterOnly` in the view options.
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
##### The view is constrained so only one world is visible
Previously, maps showed multiple worlds at low zoom levels. In addition, it used to be possible to pan off the north or south edge of the world. Now, the view is restricted to show only one world, and you cannot pan off the edge. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
##### Removal of deprecated methods
The `inherits` function that was used to inherit the prototype methods from one constructor into another has been removed.
The standard ECMAScript classes should be used instead.
The deprecated `getSnapToPixel` and `setSnapToPixel` functions from the `ImageStyle` class have been removed.
##### New internal tile coordinates
Previously, the internal tile coordinates used in the library had an unusual row order – the origin of the tile coordinate system was at the top left as expected, but the rows increased upwards. This meant that all tile coordinates within a tile grid's extent had negative `y` values.
Now, the internal tile coordinates used in the library have the same row order as standard (e.g. XYZ) tile coordinates. The origin is at the top left (as before), and rows or `y` values increase downward. So the top left tile of a tile grid is now `0, 0`, whereas it was `0, -1` before.
```
x, y values for tile coordinates
origin
*__________________________
| | | |
| 0, 0 | 1, 0 | 2, 0 |
|________|________|________|
| | | |
| 0, 1 | 1, 1 | 2, 1 |
|________|________|________|
| | | |
| 0, 2 | 1, 2 | 2, 2 |
|________|________|________|
```
This change should only affect you if you were using a custom `tileLoadFunction` or `tileUrlFunction`. For example, if you used to have a `tileUrlFunction` that looked like this:
```js
// before
function tileUrlFunction(tileCoord) {
const z = tileCoord[0];
const x = tileCoord[1];
const y = -tileCoord[2] - 1;
// do something with z, x, y
}
```
You would now do something like this:
```js
// after
function tileUrlFunction(tileCoord) {
const z = tileCoord[0];
const x = tileCoord[1];
const y = tileCoord[2];
// do something with z, x, y
}
```
In addition (this should be exceedingly rare), if you previously created a `ol/tilegrid/WMTS` by hand and you were providing an array of `sizes`, you no longer have to provide a negative height if your tile origin is the top-left corner (the common case). On the other hand, if you are providing a custom array of `sizes` and your origin is the bottom of the grid (this is uncommon), your height values must now be negative.
##### Removal of the "vector" render mode for vector tile layers
If you were previously using `VectorTile` layers with `renderMode: 'vector'`, you have to remove this configuration option. That mode was removed. `'hybrid'` (default) and `'image'` are still available.
##### Removal of the "renderMode" option for vector layers
If you were previously using `Vector` layers with `renderMode: 'image'`, you have to remove this configuration option. Instead, use the new `ol/layer/VectorImage` layer with your `ol/source/Vector`.
##### New declutter behavior
If a map has more than one layer with `declutter` set to true, decluttering now considers all `Vector` and `VectorTile` layers, instead of decluttering each layer separately. Only `VectorImage` layers continue to be decluttered separately. The higher the z-index of a layer, the higher the priority of its decluttered items.
Within a layer, the declutter order has changed. Previously, styles with a lower `zIndex` were prioritized over those with a higher `zIndex`. Now the opposite order is used.
On vector layers, even if decluttered images or texts have a lower z-Index than polygons or lines, they will now be rendered on top of the polygons or lines. For vector tile layers, this was the case already in previous releases.
##### New `prerender` and `postrender` layer events replace old `precompose`, `render` and `postcompose` events
If you were previously registering for `precompose` and `postcompose` events, you should now register for `prerender` and `postrender` events on layers. Instead of the previous `render` event, you should now listen for `postrender`. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.
##### New `getVectorContext` function provides access to the immediate vector rendering API
Previously, render events included a `vectorContext` property that allowed you to render features or geometries directly to the map. This is still possible, but you now have to explicitly create a vector context with the `getVectorContext` function. This change makes the immediate rendering API an explicit dependency if your application uses it. If you don't use this API, your application bundle will not include the vector rendering modules (as it did before).
Here is an abbreviated example of how to use the `getVectorContext` function:
```js
import {getVectorContext} from 'ol/render';
// construct your map and layers as usual
layer.on('postrender', function(event) {
const vectorContext = getVectorContext(event);
// use any of the drawing methods on the vector context
});
```
##### Layers can only be added to a single map
Previously, it was possible to render a single layer in two maps. Now, each layer can only belong to a single map (in the same way that a single DOM element can only have one parent).
##### The `OverviewMap` requires a list of layers.
Due to the constraint above (layers can only be added to a single map), the overview map needs to be constructed with a list of layers.
##### The `ol/Graticule` has been replaced by `ol/layer/Graticule`
Previously, a graticule was not a layer. Now it is. See the graticule example for details on how to add a graticule layer to your map.
##### `ol/format/Feature` API change
The `getLastExtent()` method, which was required for custom `tileLoadFunction`s in `ol/source/Vector`, has been removed because it is no longer needed (see below).
##### `ol/VectorTile` API changes
* Removal of the `getProjection()` and `setProjection()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
* Removal of the `getExtent()` and `setExtent()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
##### Custom tileLoadFunction on a VectorTile source needs changes
Previously, applications needed to call `setProjection()` and `setExtent()` on the tile in a custom `tileLoadFunction` on `ol/source/VectorTile`. The format's `getLastExtent()` method was used to get the extent. All this is no longer needed. Instead, the `extent` (first argument to the loader function) and `projection` (third argument to the loader function) are simply passed as `extent` and `featureProjection` options to the format's `readFeatures()` method.
Example for an old `tileLoadFunction`:
```js
function(tile, url) {
tile.setLoader(function() {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setProjection(format.readProjection(data));
tile.setFeatures(format.readFeatures(data, {
// featureProjection is not required for ol/format/MVT
featureProjection: map.getView().getProjection()
}));
tile.setExtent(format.getLastExtent());
})
})
}
});
```
This function needs to be changed to:
```js
function(tile, url) {
tile.setLoader(function(extent, resolution, projection) {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data, {
// extent is only required for ol/format/MVT
extent: extent,
featureProjection: projection
}));
})
})
}
});
```
##### Drop of support for the experimental WebGL renderer
The WebGL map and layers renderers are gone, replaced by a `WebGLHelper` function that provides a lightweight,
low-level access to the WebGL API. This is implemented in a new `WebGLPointsLayer` which does simple rendering of large number
of points with custom shaders.
This is now used in the `Heatmap` layer.
The removed classes and components are:
* `WebGLMap` and `WebGLMapRenderer`
* `WebGLLayerRenderer`
* `WebGLImageLayer` and `WebGLImageLayerRenderer`
* `WebGLTileLayer` and `WebGLTileLayerRenderer`
* `WebGLVectorLayer` and `WebGLVectorLayerRenderer`
* `WebGLReplay` and derived classes, along with associated shaders
* `WebGLReplayGroup`
* `WebGLImmediateRenderer`
* `WebGLMap`
* The shader build process using `mustache` and the `Makefile` at the root
##### Removal of the AtlasManager
Following the removal of the experimental WebGL renderer, the AtlasManager has been removed as well. The atlas was only used by this renderer.
The non API `getChecksum` functions of the style is also removed.
##### Change of the behavior of the vector source's clear() and refresh() methods
The `ol/source/Vector#clear()` method no longer triggers a reload of the data from the server. If you were previously using `clear()` to refetch from the server, you now have to use `refresh()`.
The `ol/source/Vector#refresh()` method now removes all features from the source and triggers a reload of the data from the server. If you were previously using the `refresh()` method to re-render a vector layer, you should instead call `ol/layer/Vector#changed()`.
##### Renaming of `getGetFeatureInfoUrl` to `getFeatureInfoUrl`
The `getGetFeatureInfoUrl` of `ol/source/ImageWMS` and `ol/source/TileWMS` is now called `getFeatureInfoUrl`.
##### `getFeaturesAtPixel` always returns an array
`getFeaturesAtPixel` now returns an empty array instead of null if no features were found.
##### Hit detection with unfilled styles
Hit detection over styled Circle geometry and Circle and RegularShape styles is now consistent with that for styled Polygon geometry. There is no hit detection over the interior of unfilled shapes. To get the previous behavior, specify a Fill style with transparent color.
#### Other changes
##### Allow declutter in image render mode
It is now possible to configure vector tile layers with `declutter: true` and `renderMode: 'image'`. However, note that decluttering will be done per tile, resulting in labels and point symbols getting cut off at tile boundaries.
Until now, using both options forced the render mode to be `hybrid`.
##### Always load tiles while animating or interacting
`ol/PluggableMap` and subclasses no longer support the `loadTilesWhileAnimating` and `loadTilesWhileInteracting` options. These options were used to enable tile loading during animations and interactions. With the new DOM composition render strategy, it is no longer necessary to postpone tile loading until after animations or interactions.
### v5.3.0
#### The `getUid` function returns string
The `getUid` function from the `ol/util` module now returns a string instead of a number.
#### Attributions are not collapsible for `ol/source/OSM`
When a map contains a layer from a `ol/source/OSM` source, the `ol/control/Attribution` control will be shown with the `collapsible: false` behavior.
To get the previous behavior, configure the `ol/control/Attribution` control with `collapsible: true`.
### v5.2.0
#### Removal of the `snapToPixel` option for `ol/style/Image` subclasses
The `snapToPixel` option has been removed, and the `getSnapToPixel` and `setSnapToPixel` methods are deprecated.
The renderer now snaps to integer pixels when no interaction or animation is running to get crisp rendering. During interaction or animation, it does not snap to integer pixels to avoid jitter.
When rendering with the Immediate API, symbols will no longer be snapped to integer pixels. To get crisp images, set `context.imageSmoothingEnabled = false` before rendering with the Immediate API, and `context.imageSmoothingEnabled = true` afterwards.
### v5.1.0
#### Geometry constructor and `setCoordinates` no longer accept `null` coordinates
Geometries (`ol/geom/*`) now need to be constructed with valid coordinates (center for `ol/geom/Circle`) as first constructor argument. The same applies to the `setCoordinates()` (`setCenter()` for `ol/geom/Circle`) method.
### v5.0.0
#### Renamed `ol/source/TileUTFGrid` to `ol/source/UTFGrid`
The module name is now `ol/source/UTFGrid` (`ol.source.UTFGrid` in the full build).
#### Renaming of the `defaultDataProjection` in the options and property of the `ol/format/Feature` class and its subclasses
The `defaultDataProjection` option is now named `dataProjection`. The protected property available on the class is also renamed.
#### `transition` option of `ol/source/VectorTile` is ignored
The `transition` option to get an opacity transition to fade in tiles has been disabled for `ol/source/VectorTile`. Vector tiles are now always rendered without an opacity transition.
#### `ol/style/Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from the top-left corner of the extent of the geometry being filled to 512 css pixel increments from map coordinate `[0, 0]`. This allows repeat patterns to be aligned properly with vector tiles. For seamless repeat patterns, width and height of the pattern image must be a factor of two (2, 4, 8, ..., 512).
#### Removal of the renderer option for maps
The `renderer` option has been removed from the `Map` constructor. The purpose of this change is to avoid bundling code in your application that you do not need. Previously, code for both the Canvas and WebGL renderers was included in all applications - even though most people only use one renderer. The `Map` constructor now gives you a Canvas (2D) based renderer. If you want to try the WebGL renderer, you can import the constructor from `ol/WebGLMap`.
Old code:
```js
import Map from 'ol/Map';
const canvasMap = new Map({
renderer: ['canvas']
// other options...
});
const webglMap = new Map({
renderer: ['webgl']
// other options...
});
```
New code:
```js
import Map from 'ol/Map';
import WebGLMap from 'ol/WebGLMap';
const canvasMap = new Map({
// options...
});
const webglMap = new WebGLMap({
// options...
});
```
#### Removal of ol.FeatureStyleFunction
The signature of the vector style function passed to the feature has changed. The function now always takes the `feature` and the `resolution` as arguments, the `feature` is no longer bound to `this`.
Old code:
```js
feature.setStyle(function(resolution) {
var text = this.get('name');
...
});
```
New code:
```js
feature.setStyle(function(feature, resolution) {
var text = feature.get('name');
...
});
```
#### Changed behavior of the `Draw` interaction
For better drawing experience, two changes were made to the behavior of the Draw interaction:
1. On long press, the current vertex can be dragged to its desired position.
2. On touch move (e.g. when panning the map on a mobile device), no draw cursor is shown, and the geometry being drawn is not updated. But because of 1., the draw cursor will appear on long press. Mouse moves are not affected by this change.
#### Changes in proj4 integration
Because relying on a globally available proj4 is not practical with ES modules, we have made a change to the way we integrate proj4:
* The `setProj4()` function from the `ol/proj` module was removed.
* A new `ol/proj/proj4` module with a `register()` function was added. Regardless of whether the application imports `proj4` or uses a global `proj4`, this function needs to be called with the proj4 instance as argument whenever projection definitions were added to proj4's registry with (`proj4.defs`).
It is also recommended to no longer use a global `proj4`. Instead,
npm install proj4
and import it:
```js
import proj4 from 'proj4';
```
Applications can be updated by importing the `register` function from the `ol/proj/proj4` module
```js
import {register} from 'ol/proj/proj4'
```
and calling it before using projections, and any time the proj4 registry was changed by `proj4.defs()` calls:
```js
register(proj4);
```
#### Removal of logos
The map and sources no longer accept a `logo` option. Instead, if you wish to append a logo to your map, add the desired markup directly in your HTML. In addition, you can use the `attributions` property of a source to display arbitrary markup per-source with the attribution control.
#### Replacement of `ol/Sphere` constructor with `ol/sphere` functions
The `ol/Sphere` constructor has been removed. If you were using the `getGeodesicArea` method, use the `getArea` function instead. If you were using the `haversineDistance` method, use the `getDistance` function instead.
Examples before:
```js
// using ol@4
import Sphere from 'ol/sphere';
var sphere = new Sphere(Sphere.DEFAULT_RADIUS);
var area = sphere.getGeodesicArea(polygon);
var distance = sphere.haversineDistance(g1, g2);
```
Examples after:
```js
// using ol@5
import {circular as circularPolygon} from 'ol/geom/Polygon';
import {getArea, getDistance} from 'ol/sphere';
var area = getArea(polygon);
var distance = getDistance(g1, g2);
var circle = circularPolygon(center, radius);
```
#### New signature for the `circular` function for creating polygons
The `circular` function exported from `ol/geom/Polygon` no longer requires a `Sphere` as the first argument.
Example before:
```js
// using ol@4
import Polygon from 'ol/geom/polygon';
import Sphere from 'ol/sphere';
var poly = Polygon.circular(new Sphere(Sphere.DEFAULT_RADIUS), center, radius);
```
Example after:
```js
// using ol@5
import {circular as circularPolygon} from 'ol/geom/Polygon';
var poly = circularPolygon(center, radius);
```
#### Removal of optional this arguments.
The optional this (i.e. opt_this) arguments were removed from the following methods. Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
* Collection#forEach
* geom/LineString#forEachSegment
* Observable#on, #once, #un
* Map#forEachLayerAtPixel
* source/TileUTFGrid#forDataAtCoordinateAndResolution
* source/Vector#forEachFeature, #forEachFeatureInExtent, #forEachFeatureIntersectingExtent
#### `Map#forEachLayerAtPixel` parameters have changed
If you are using the layer filter, please note that you now have to pass in the layer filter via an `AtPixelOptions` object. If you are not using the layer filter the usage has not changed.
Old syntax:
```
map.forEachLayerAtPixel(pixel, callback, callbackThis, layerFilterFn, layerFilterThis);
```
New syntax:
```
map.forEachLayerAtPixel(pixel, callback, {
layerFilter: layerFilterFn
});
```
To bind a function to a this, please use the bind method of the function (See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
This change is due to the introduction of the `hitTolerance` parameter which can be passed in via this `AtPixelOptions` object, too.
### v4.6.0
#### Renamed `exceedLength` option of `ol.style.Text` to `overflow`
To update your applications, simply replace `exceedLength` with `overflow`.
#### Deprecation of `ol.source.ImageVector`
Rendering vector sources as image is now directly supported by `ol.layer.Vector` with the new `renderMode: 'image'` configuration option. Change code like this:
```js
new ol.layer.Image({
source: new ol.source.ImageVector({
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
})
});
```
to:
```js
new ol.layer.Vector({
renderMode: 'image',
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
});
```
### v4.5.0
#### Removed GeoJSON crs workaround for GeoServer
Previous version of GeoServer returned invalid crs in GeoJSON output. The workaround in `ol.format.GeoJSON` used to read this crs code is now removed.
#### Deprecation of `ol.Attribution`
`ol.Attribution` is deprecated and will be removed in the next major version. Instead, you can construct a source with a string attribution or an array of strings. For dynamic attributions, you can provide a function that gets called with the current frame state.
Before:
```js
var source = new ol.source.XYZ({
attributions: [
new ol.Attribution({html: 'some attribution'})
]
});
```
After:
```js
var source = new ol.source.XYZ({
attributions: 'some attribution'
});
```
In addition to passing a string or an array of strings for the `attributions` option, you can also pass a function that will get called with the current frame state.
```js
var source = new ol.source.XYZ({
attributions: function(frameState) {
// inspect the frame state and return attributions
return 'some attribution'; // or ['multiple', 'attributions'] or null
}
});
```
### v4.4.0
#### Behavior change for polygon labels
Polygon labels are now only rendered when the label does not exceed the polygon at the label position. To get the old behavior, configure your `ol.style.Text` with `exceedLength: true`.
#### Minor change for custom `tileLoadFunction` with `ol.source.VectorTile`
It is no longer necessary to set the projection on the tile. Instead, the `readFeatures` method must be called with the tile's extent as `extent` option and the view's projection as `featureProjection`.
Before:
```js
tile.setLoader(function() {
var data = // ... fetch data
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data));
tile.setProjection(format.readProjection(data));
// uncomment the line below for ol.format.MVT only
//tile.setExtent(format.getLastExtent());
});
```
After:
```js
tile.setLoader(function() {
var data = // ... fetch data
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data, {
featureProjection: map.getView().getProjection(),
// uncomment the line below for ol.format.MVT only
//extent: tile.getExtent()
}));
);
```
#### Deprecation of `ol.DeviceOrientation`
`ol.DeviceOrientation` is deprecated and will be removed in the next major version.
The device-orientation example has been updated to use the (gyronorm.js)[https://github.com/dorukeker/gyronorm.js] library.
### v4.3.0
#### `ol.source.VectorTile` no longer requires a `tileGrid` option
By default, the `ol.source.VectorTile` constructor creates an XYZ tile grid (in Web Mercator) for 512 pixel tiles and assumes a max zoom level of 22. If you were creating a vector tile source with an explicit `tileGrid` option, you can now remove this.
Before:
```js
var source = new ol.source.VectorTile({
tileGrid: ol.tilegrid.createXYZ({tileSize: 512, maxZoom: 22}),
url: url
});
```
After:
```js
var source = new ol.source.VectorTile({
url: url
});
```
If you need to change the max zoom level, you can pass the source a `maxZoom` option. If you need to change the tile size, you can pass the source a `tileSize` option. If you need a completely custom tile grid, you can still pass the source a `tileGrid` option.
#### `ol.interaction.Modify` deletes with `alt` key only
To delete features with the modify interaction, press the `alt` key while clicking on an existing vertex. If you want to configure the modify interaction with a different delete condition, use the `deleteCondition` option. For example, to allow deletion on a single click with no modifier keys, configure the interaction like this:
```js
var interaction = new ol.interaction.Modify({
source: source,
deleteCondition: function(event) {
return ol.events.condition.noModifierKeys(event) && ol.events.condition.singleClick(event);
}
});
```
The motivation for this change is to make the modify, draw, and snap interactions all work well together. Previously, the use of these interactions with the default configuration would make it so you couldn't reliably add new vertices (click with no modifier) and delete existing vertices (click with no modifier).
#### `ol.source.VectorTile` no longer has a `tilePixelRatio` option
The `tilePixelRatio` option was only used for tiles in projections with `tile-pixels` as units. For tiles read with `ol.format.MVT` and the default tile loader, or tiles with the default pixel size of 4096 pixels, no changes are necessary. For the very rare cases that do not fall under these categories, a custom `tileLoadFunction` now needs to be configured on the `ol.source.VectorTile`. In addition to calling `tile.setFeatures()` and `tile.setProjection()`, it also needs to contain code like the following:
```js
var extent = tile.getFormat() instanceof ol.format.MVT ?
tile.getLastExtent() :
[0, 0, tilePixelRatio * tileSize, tilePixelRatio * tileSize];
tile.setExtent(extent);
```
#### `ol.animate` now takes the shortest arc for rotation animation
Usually rotation animations should animate along the shortest arc. There are rare occasions where a spinning animation effect is desired. So if you previously had something like
```js
map.getView().animate({
rotation: 2 * Math.PI,
duration: 2000
});
```
we recommend to split the animation into two parts and use different easing functions. The code below results in the same effect as the snippet above did with previous versions:
```js
map.getView().animate({
rotation: Math.PI,
easing: ol.easing.easeIn
}, {
rotation: 2 * Math.PI,
easing: ol.easing.easeOut
});
```
### v4.2.0
#### Return values of two `ol.style.RegularShape` getters have changed
To provide a more consistent behaviour the following getters now return the same value that was given to constructor:
`ol.style.RegularShape#getPoints` does not return the double amount of points anymore if a radius2 is set.
`ol.style.RegularShape#getRadius2` will return `undefined` if no radius2 is set.
### v4.1.0
#### Adding duplicate layers to a map throws
Previously, you could do this:
```js
map.addLayer(layer);
map.addLayer(layer);
```
However, after adding a duplicate layer, things failed if you tried to remove that layer.
Now, `map.addLayer()` throws if you try adding a layer that has already been added to the map.
#### Simpler `constrainResolution` configuration
The `constrainResolution` configuration for `ol.interaction.PinchZoom` and `ol.interaction.MouseWheelZoom`
can now be set directly with an option in `ol.interaction.defaults`:
```js
ol.interaction.defaults({
constrainResolution: true
});
```
### v4.0.0
#### Simpler `ol.source.Zoomify` `url` configuration
Instead specifying a base url, the `url` for the `ol.source.Zoomify` source can now be a template. The `{TileGroup}`, `{x}`, `{y}`, `{z}` and placeholders must be included in the `url` in this case. the `url` can now also include subdomain placeholders:
```js
new ol.source.Zoomify({
url: 'https://{a-f}.example.com/cgi-bin/iipsrv.fcgi?zoomify=/a/b/{TileGroup}/{z}-{x}-{y}.jpg'
});
```
#### Removal of deprecated methods
The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead.
The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead.
```js
var key = map.on('moveend', function() { ...});
map.unByKey(key);
```
New code:
```js
var key = map.on('moveend', function() { ...});
ol.Observable.unByKey(key);
```
#### Simplified `ol.View#fit()` API
In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd).
Most common use case - old API:
```js
map.getView().fit(extent, map.getSize());
```
Most common use case - new API:
```js
map.getView().fit(extent);
```
Advanced use - old API:
```js
map.getView().fit(extent, [200, 100], {padding: 10});
```
Advanced use - new API:
```js
map.getView().fit(extent, {size: [200, 100], padding 10});
```
#### Removed build flags (`@define`)
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources.
### v3.20.0
#### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions
The `map.beforeRender()` and `ol.animation` functions have been deprecated in favor of a new `view.animate()` function. Use of the deprecated functions will result in a warning during development. These functions are subject to removal in an upcoming release.
For details on the `view.animate()` method, see the API docs and the view animation example. Upgrading should be relatively straightforward. For example, if you wanted to have an animated pan, zoom, and rotation previously, you might have done this:
```js
var zoom = ol.animation.zoom({
resolution: view.getResolution()
});
var pan = ol.animation.pan({
source: view.getCenter()
});
var rotate = ol.animation.rotate({
rotation: view.getRotation()
});
map.beforeRender(zoom, pan, rotate);
map.setZoom(1);
map.setCenter([0, 0]);
map.setRotation(Math.PI);
```
Now, the same can be accomplished with this:
```js
view.animate({
zoom: 1,
center: [0, 0],
rotation: Math.PI
});
```
#### `ol.Map#forEachFeatureAtPixel` and `ol.Map#hasFeatureAtPixel` parameters have changed
If you are using the layer filter of one of these methods, please note that you now have to pass in the layer filter via an `ol.AtPixelOptions` object. If you are not using the layer filter the usage has not changed.
Old syntax:
```js
map.forEachFeatureAtPixel(pixel, callback, callbackThis, layerFilterFn, layerFilterThis);
map.hasFeatureAtPixel(pixel, layerFilterFn, layerFilterThis);
```
New syntax:
```js
map.forEachFeatureAtPixel(pixel, callback.bind(callbackThis), {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
map.hasFeatureAtPixel(pixel, {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
```
This change is due to the introduction of the `hitTolerance` parameter which can be passed in via this `ol.AtPixelOptions` object, too.
#### Use `ol.proj.getPointResolution()` instead of `projection.getPointResolution()`
The experimental `getPointResolution` method has been removed from `ol.Projection` instances. Since the implementation of this method required an inverse transform (function for transforming projected coordinates to geographic coordinates) and `ol.Projection` instances are not constructed with forward or inverse transforms, it does not make sense that a projection instance can always calculate the point resolution.
As a substitute for the `projection.getPointResolution()` function, a `ol.proj.getPointResolution()` function has been added. To upgrade, you will need to change things like this:
```js
projection.getPointResolution(resolution, point);
```
into this:
```js
ol.proj.getPointResolution(projection, resolution, point);
```
Note that if you were previously creating a projection with a `getPointResolution` function in the constructor (or calling `projection.setGetPointResolution()` after construction), this function will be used by `ol.proj.getPointResolution()`.
#### `ol.interaction.PinchZoom` no longer zooms to a whole-number zoom level after the gesture ends
The old behavior of `ol.interaction.PinchZoom` was to zoom to the next integer zoom level after the user ends the gesture.
Now the pinch zoom keeps the user selected zoom level even if it is a fractional zoom.
To get the old behavior set the new `constrainResolution` parameter to `true` like this:
```js
new ol.interaction.PinchZoom({constrainResolution: true})
```
See the new `pinch-zoom` example for a complete implementation.
### v3.19.1
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from `[0, 0]` to the top-left
corner of the extent of the geometry being filled.
### v3.19.0
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
Previously, gradients and patterns were aligned with the canvas, so they did not
move and rotate with the map. This was changed to a more expected behavior by anchoring the fill to the map origin (usually at map coordinate `[0, 0]`).
#### `goog.DEBUG` define was renamed to `ol.DEBUG`
As last step in the removal of the dependency on Google Closure Library, the `goog.DEBUG` compiler define was renamed to `ol.DEBUG`. Please change accordingly in your custom build configuration json files.
#### `ol.format.ogc.filter` namespace was renamed to `ol.format.filter`
`ol.format.ogc.filter` was simplified to `ol.format.filter`; to upgrade your code, simply remove the `ogc` string from the name.
For example: `ol.format.ogc.filter.and` to `ol.format.filter.and`.
#### Changes only relevant to those who compile their applications together with the Closure Compiler
A number of internal types have been renamed. This will not affect those who use the API provided by the library, but if you are compiling your application together with OpenLayers and using type names, you'll need to do the following:
* rename `ol.CollectionProperty` to `ol.Collection.Property`
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
* rename `ol.DragBoxEvent` to `ol.interaction.DragBox.Event`
* rename `ol.DragBoxEventType` to `ol.interaction.DragBox.EventType`
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
* rename `ol.OverlayPositioning` to `ol.Overlay.Positioning`
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
* rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property`
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
* rename `ol.interaction.InteractionProperty` to `ol.interaction.Interaction.Property`
* rename `ol.interaction.DrawMode` to `ol.interaction.Draw.Mode`
* rename `ol.interaction.DrawEvent` to `ol.interaction.Draw.Event`
* rename `ol.interaction.DrawEventType` to `ol.interaction.Draw.EventType`
* rename `ol.interaction.ExtentEvent` to `ol.interaction.Extent.Event`
* rename `ol.interaction.ExtentEventType` to `ol.interaction.Extent.EventType`
* rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event`
* rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType`
* rename `ol.interaction.ModifyEvent` to `ol.interaction.Modify.Event`
* rename `ol.interaction.SelectEvent` to `ol.interaction.Select.Event`
* rename `ol.interaction.SelectEventType` to `ol.interaction.Select.EventType`
* rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event`
* rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType`
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
* rename `ol.layer.HeatmapLayerProperty` to `ol.layer.Heatmap.Property`
* rename `ol.layer.TileProperty` to `ol.layer.Tile.Property`
* rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType`
* rename `ol.MapEventType` to `ol.MapEvent.Type`
* rename `ol.MapProperty` to `ol.Map.Property`
* rename `ol.ModifyEventType` to `ol.interaction.Modify.EventType`
* rename `ol.RendererType` to `ol.renderer.Type`
* rename `ol.render.EventType` to `ol.render.Event.Type`
* rename `ol.source.ImageEvent` to `ol.source.Image.Event`
* rename `ol.source.ImageEventType` to `ol.source.Image.EventType`
* rename `ol.source.RasterEvent` to `ol.source.Raster.Event`
* rename `ol.source.RasterEventType` to `ol.source.Raster.EventType`
* rename `ol.source.TileEvent` to `ol.source.Tile.Event`
* rename `ol.source.TileEventType` to `ol.source.Tile.EventType`
* rename `ol.source.VectorEvent` to `ol.source.Vector.Event`
* rename `ol.source.VectorEventType` to `ol.source.Vector.EventType`
* rename `ol.source.wms.ServerType` to `ol.source.WMSServerType`
* rename `ol.source.WMTSRequestEncoding` to `ol.source.WMTS.RequestEncoding`
* rename `ol.style.IconAnchorUnits` to `ol.style.Icon.AnchorUnits`
* rename `ol.style.IconOrigin` to `ol.style.Icon.Origin`
### v3.18.0
#### Removal of the DOM renderer
The DOM renderer has been removed. Instead, the Canvas renderer should be used. If you were previously constructing a map with `'dom'` as the `renderer` option, you will see an error message in the console in debug mode and the Canvas renderer will be used instead. To remove the warning, remove the `renderer` option from your map constructor.
#### Changes in the way assertions are handled
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on https://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
#### Removal of `ol.ENABLE_NAMED_COLORS`
This option was previously needed to use named colors with the WebGL renderer but is no longer needed.
#### KML format now uses URL()
The URL constructor is supported by all modern browsers, but not by older ones, such as IE. To use the KML format in such older browsers, a URL polyfill will have to be loaded before use.
#### Changes only relevant to those who compile their applications together with the Closure Compiler
A number of internal types have been renamed. This will not affect those who use the API provided by the library, but if you are compiling your application together with OpenLayers and using type names, you'll need to do the following:
* rename `ol.CollectionEventType` to `ol.Collection.EventType`
* rename `ol.CollectionEvent` to `ol.Collection.Event`
* rename `ol.ViewHint` to `ol.View.Hint`
* rename `ol.ViewProperty` to `ol.View.Property`
* rename `ol.render.webgl.imagereplay.shader.Default.Locations` to `ol.render.webgl.imagereplay.defaultshader.Locations`
* rename `ol.render.webgl.imagereplay.shader.DefaultFragment` to `ol.render.webgl.imagereplay.defaultshader.Fragment`
* rename `ol.render.webgl.imagereplay.shader.DefaultVertex` to `ol.render.webgl.imagereplay.defaultshader.Vertex`
* rename `ol.renderer.webgl.map.shader.Default.Locations` to `ol.renderer.webgl.defaultmapshader.Locations`
* rename `ol.renderer.webgl.map.shader.Default.Locations` to `ol.renderer.webgl.defaultmapshader.Locations`
* rename `ol.renderer.webgl.map.shader.DefaultFragment` to `ol.renderer.webgl.defaultmapshader.Fragment`
* rename `ol.renderer.webgl.map.shader.DefaultVertex` to `ol.renderer.webgl.defaultmapshader.Vertex`
* rename `ol.renderer.webgl.tilelayer.shader.Fragment` to `ol.renderer.webgl.tilelayershader.Fragment`
* rename `ol.renderer.webgl.tilelayer.shader.Locations` to `ol.renderer.webgl.tilelayershader.Locations`
* rename `ol.renderer.webgl.tilelayer.shader.Vertex` to `ol.renderer.webgl.tilelayershader.Vertex`
* rename `ol.webgl.WebGLContextEventType` to `ol.webgl.ContextEventType`
* rename `ol.webgl.shader.Fragment` to `ol.webgl.Fragment`
* rename `ol.webgl.shader.Vertex` to `ol.webgl.Vertex`
### v3.17.0
#### `ol.source.MapQuest` removal
Because of changes at MapQuest (see: https://lists.openstreetmap.org/pipermail/talk/2016-June/076106.html) we had to remove the MapQuest source for now (see https://github.com/openlayers/openlayers/issues/5484 for details).
#### `ol.interaction.ModifyEvent` changes
The event object previously had a `mapBrowserPointerEvent` property, which has been renamed to `mapBrowserEvent`.
#### Removal of ol.raster namespace
Users compiling their code with the library and using types in the `ol.raster` namespace should note that this has now been removed. `ol.raster.Pixel` has been deleted, and the other types have been renamed as follows, and your code may need changing if you use these:
* `ol.raster.Operation` to `ol.RasterOperation`
* `ol.raster.OperationType` to `ol.RasterOperationType`
#### All typedefs now in ol namespace
Users compiling their code with the library should note that the following typedefs have been renamed; your code may need changing if you use these:
* ol.events.ConditionType to ol.EventsConditionType
* ol.events.EventTargetLike to ol.EventTargetLike
* ol.events.Key to ol.EventsKey
* ol.events.ListenerFunctionType to ol.EventsListenerFunctionType
* ol.interaction.DragBoxEndConditionType to ol.DragBoxEndConditionType
* ol.interaction.DrawGeometryFunctionType to ol.DrawGeometryFunctionType
* ol.interaction.SegmentDataType to ol.ModifySegmentDataType
* ol.interaction.SelectFilterFunction to ol.SelectFilterFunction
* ol.interaction.SnapResultType to ol.SnapResultType
* ol.interaction.SnapSegmentDataType to ol.SnapSegmentDataType
* ol.proj.ProjectionLike to ol.ProjectionLike
* ol.style.AtlasBlock to ol.AtlasBlock
* ol.style.AtlasInfo to ol.AtlasInfo
* ol.style.AtlasManagerInfo to ol.AtlasManagerInfo
* ol.style.CircleRenderOptions to ol.CircleRenderOptions
* ol.style.ImageOptions to ol.StyleImageOptions
* ol.style.GeometryFunction to ol.StyleGeometryFunction
* ol.style.RegularShapeRenderOptions to ol.RegularShapeRenderOptions
* ol.style.StyleFunction to ol.StyleFunction
### v3.16.0
#### Rendering change for tile sources
Previously, if you called `source.setUrl()` on a tile source, all currently rendered tiles would be cleared before new tiles were loaded and rendered. This clearing of the map is undesirable if you are trying to smoothly update the tiles used by a source. This behavior has now changed, and calling `source.setUrl()` (or `source.setUrls()`) will *not* clear currently rendered tiles before loading and rendering new tiles. Instead, previously rendered tiles remain rendered until new tiles have loaded and can replace them. If you want to achieve the old behavior (render a blank map before loading new tiles), you can call `source.refresh()` or you can replace the old source with a new one (using `layer.setSource()`).
#### Move of typedefs out of code and into separate file
This change should not affect the great majority of application developers, but it's possible there are edge cases when compiling application code together with the library which cause compiler errors or warnings. In this case, please raise a GitHub issue. `goog.require`s for typedefs should not be necessary.
Users compiling their code with the library should note that the following API `@typedef`s have been renamed; your code may need changing if you use these:
* `ol.format.WFS.FeatureCollectionMetadata` to `ol.WFSFeatureCollectionMetadata`
* `ol.format.WFS.TransactionResponse` to `ol.WFSTransactionResponse`
#### Removal of `opaque` option for `ol.source.VectorTile`
This option is no longer needed, so it was removed from the API.
#### XHR loading for `ol.source.TileUTFGrid`
The `ol.source.TileUTFGrid` now uses XMLHttpRequest to load UTFGrid tiles by default. This works out of the box with the v4 Mapbox API. To work with the v3 API, you must use the new `jsonp` option on the source. See the examples below for detail.
```js
// To work with the v4 API
var v4source = new ol.source.TileUTFGrid({
url: 'https://api.tiles.mapbox.com/v4/example.json?access_token=' + YOUR_KEY_HERE
});
// To work with the v3 API
var v3source = new ol.source.TileUTFGrid({
jsonp: true, // <--- this is required for v3
url: 'http://api.tiles.mapbox.com/v3/example.json'
});
```
### v3.15.0
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `classList` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features#Element_prototype_classList.
#### Immediate rendering API
Listeners for `precompose`, `render`, and `postcompose` receive an event with a `vectorContext` property with methods for immediate vector rendering. The previous geometry drawing methods have been replaced with a single `vectorContext.drawGeometry(geometry)` method. If you were using any of the following experimental methods on the vector context, replace them with `drawGeometry`:
* Removed experimental geometry drawing methods: `drawPointGeometry`, `drawLineStringGeometry`, `drawPolygonGeometry`, `drawMultiPointGeometry`, `drawMultiLineStringGeometry`, `drawMultiPolygonGeometry`, and `drawCircleGeometry` (all have been replaced with `drawGeometry`).
In addition, the previous methods for setting style parts have been replaced with a single `vectorContext.setStyle(style)` method. If you were using any of the following experimental methods on the vector context, replace them with `setStyle`:
* Removed experimental style setting methods: `setFillStrokeStyle`, `setImageStyle`, `setTextStyle` (all have been replaced with `setStyle`).
Below is an example of how the vector context might have been used in the past:
```js
// OLD WAY, NO LONGER SUPPORTED
map.on('postcompose', function(event) {
event.vectorContext.setFillStrokeStyle(style.getFill(), style.getStroke());
event.vectorContext.drawPointGeometry(geometry);
});
```
Here is an example of how you could accomplish the same with the new methods:
```js
// NEW WAY, USE THIS INSTEAD OF THE CODE ABOVE
map.on('postcompose', function(event) {
event.vectorContext.setStyle(style);
event.vectorContext.drawGeometry(geometry);
});
```
A final change to the immediate rendering API is that `vectorContext.drawFeature()` calls are now "immediate" as well. The drawing now occurs synchronously. This means that any `zIndex` in a style passed to `drawFeature()` will be ignored. To achieve `zIndex` ordering, order your calls to `drawFeature()` instead.
#### Removal of `ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK`
The `ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK` define has been removed. The size of the cache can now be defined on every tile based `ol.source`:
```js
new ol.layer.Tile({
source: new ol.source.OSM({
cacheSize: 128
})
})
```
The default cache size is `2048`.
### v3.14.0
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
#### Layer pre-/postcompose event changes
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
Old code:
```js
layer.on('precompose', function(e) {
// rely on canvas dimensions to move coordinate origin to center
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// rely on the canvas having a null transform
e.context.setTransform(1, 0, 0, 1, 0, 0);
});
```
New code:
```js
layer.on('precompose', function(e) {
// use map size and pixel ratio to move coordinate origin to center
var size = map.getSize();
var pixelRatio = e.frameState.pixelRatio;
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// undo all transforms
e.context.scale(1 / 3, 1 / 3);
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
});
```
### v3.13.0
#### `proj4js` integration
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
```js
import ol from 'openlayers';
import proj4 from 'proj4';
ol.proj.setProj4(proj4);
```
#### `ol.source.TileJSON` changes
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
```js
new ol.source.TileJSON({
url: 'http://serverwithoutcors.com/tilejson.json',
jsonp: true
})
```
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
### v3.12.0
#### `ol.Map#forEachFeatureAtPixel` changes
The optional `layerFilter` function is now also called for unmanaged layers. To get the same behaviour as before, wrap your layer filter code in an if block like this:
```js
function layerFilter(layer) {
if (map.getLayers().getArray().indexOf(layer) !== -1) {
// existing layer filter code
}
}
```
### v3.11.0
#### `ol.format.KML` changes
KML icons are scaled 50% so that the rendering better matches Google Earth rendering.
If a KML placemark has a name and is a point, an `ol.style.Text` is created with the name displayed to the right of the icon (if there is an icon).
This can be controlled with the showPointNames option which defaults to true.
To disable rendering of the point names for placemarks, use the option:
new ol.format.KML({ showPointNames: false });
#### `ol.interaction.DragBox` and `ol.interaction.DragZoom` changes
Styling is no longer done with `ol.Style`, but with pure CSS. The `style` constructor option is no longer required, and no longer available. Instead, there is a `className` option for the CSS selector. The default for `ol.interaction.DragBox` is `ol-dragbox`, and `ol.interaction.DragZoom` uses `ol-dragzoom`. If you previously had
```js
new ol.interaction.DragZoom({
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 3
}),
fill: new ol.style.Fill({
color: [255, 255, 255, 0.4]
})
})
});
```
you'll now just need
```js
new ol.interaction.DragZoom();
```
but with additional css:
```css
.ol-dragzoom {
border-color: red;
border-width: 3px;
background-color: rgba(255,255,255,0.4);
}
```
#### Removal of `ol.source.TileVector`
With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`.
#### `ol.Map#forEachFeatureAtPixel` changes for unmanaged layers
`ol.Map#forEachFeatureAtPixel` will still be called for unmanaged layers, but the 2nd argument to the callback function will be `null` instead of a reference to the unmanaged layer. This brings back the behavior of the abandoned `ol.FeatureOverlay` that was replaced by unmanaged layers.
If you are affected by this change, please change your unmanaged layer to a regular layer by using e.g. `ol.Map#addLayer` instead of `ol.layer.Layer#setMap`.
### v3.10.0
#### `ol.layer.Layer` changes
The experimental `setHue`, `setContrast`, `setBrightness`, `setSaturation`, and the corresponding getter methods have been removed. These properties only worked with the WebGL renderer. If are interested in applying color transforms, look for the `postcompose` event in the API docs. In addition, the `ol.source.Raster` source provides a way to create new raster data based on arbitrary transforms run on any number of input sources.
### v3.9.0
#### `ol.style.Circle` changes
The experimental `getAnchor`, `getOrigin`, and `getSize` methods have been removed. The anchor and origin of a circle symbolizer are not modifiable, so these properties should not need to be accessed. The radius and stroke width can be used to calculate the rendered size of a circle symbolizer if needed:
```js
// calculate rendered size of a circle symbolizer
var width = 2 * circle.getRadius();
if (circle.getStroke()) {
width += circle.getStroke().getWidth() + 1;
}
```
### v3.8.0
There should be nothing special required when upgrading from v3.7.0 to v3.8.0.
### v3.7.0
#### Removal of `ol.FeatureOverlay`
Instead of an `ol.FeatureOverlay`, we now use an `ol.layer.Vector` with an
`ol.source.Vector`. If you previously had:
```js
var featureOverlay = new ol.FeatureOverlay({
map: map,
style: overlayStyle
});
featureOverlay.addFeature(feature);
featureOverlay.removeFeature(feature);
var collection = featureOverlay.getFeatures();
```
you will have to change this to:
```js
var collection = new ol.Collection();
var featureOverlay = new ol.layer.Vector({
map: map,
source: new ol.source.Vector({
features: collection,
useSpatialIndex: false // optional, might improve performance
}),
style: overlayStyle,
updateWhileAnimating: true, // optional, for instant visual feedback
updateWhileInteracting: true // optional, for instant visual feedback
});
featureOverlay.getSource().addFeature(feature);
featureOverlay.getSource().removeFeature(feature);
```
With the removal of `ol.FeatureOverlay`, `zIndex` symbolizer properties of overlays are no longer stacked per map, but per layer/overlay. If you previously had multiple feature overlays where you controlled the rendering order of features by using `zIndex` symbolizer properties, you can now achieve the same rendering order only if all overlay features are on the same layer.
Note that `ol.FeatureOverlay#getFeatures()` returned an `{ol.Collection.<ol.Feature>}`, whereas `ol.source.Vector#getFeatures()` returns an `{Array.<ol.Feature>}`.
#### `ol.TileCoord` changes
Until now, the API exposed two different types of `ol.TileCoord` tile coordinates: internal ones that increase left to right and upward, and transformed ones that may increase downward, as defined by a transform function on the tile grid. With this change, the API now only exposes tile coordinates that increase left to right and upward.
Previously, tile grids created by OpenLayers either had their origin at the top-left or at the bottom-left corner of the extent. To make it easier for application developers to transform tile coordinates to the common XYZ tiling scheme, all tile grids that OpenLayers creates internally have their origin now at the top-left corner of the extent.
This change affects applications that configure a custom `tileUrlFunction` for an `ol.source.Tile`. Previously, the `tileUrlFunction` was called with rather unpredictable tile coordinates, depending on whether a tile coordinate transform took place before calling the `tileUrlFunction`. Now it is always called with OpenLayers tile coordinates. To transform these into the common XYZ tiling scheme, a custom `tileUrlFunction` has to change the `y` value (tile row) of the `ol.TileCoord`:
```js
function tileUrlFunction = function(tileCoord, pixelRatio, projection) {
var urlTemplate = '{z}/{x}/{y}';
return urlTemplate
.replace('{z}', tileCoord[0].toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
}
```
The `ol.tilegrid.TileGrid#createTileCoordTransform()` function which could be used to get the tile grid's tile coordinate transform function has been removed. This function was confusing and should no longer be needed now that application developers get tile coordinates in a known layout.
The code snippets below show how your application code needs to be changed:
Old application code (with `ol.tilegrid.TileGrid#createTileCoordTransform()`):
```js
var transform = source.getTileGrid().createTileCoordTransform();
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
tileCoord = transform(tileCoord, projection);
return 'http://mytiles.com/' +
tileCoord[0] + '/' + tileCoord[1] + '/' + tileCoord[2] + '.png';
};
```
Old application code (with custom `y` transform):
```js
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
var z = tileCoord[0];
var yFromBottom = tileCoord[2];
var resolution = tileGrid.getResolution(z);
var tileHeight = ol.size.toSize(tileSize)[1];
var matrixHeight =
Math.floor(ol.extent.getHeight(extent) / tileHeight / resolution);
return 'http://mytiles.com/' +
tileCoord[0] + '/' + tileCoord[1] + '/' +
(matrixHeight - yFromBottom - 1) + '.png';
};
```
New application code (simple -y - 1 transform):
```js
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
return 'http://mytiles.com/' +
tileCoord[0] + '/' + tileCoord[1] + '/' + (-tileCoord[2] - 1) + '.png';
};
```
#### Removal of `ol.tilegrid.Zoomify`
The replacement of `ol.tilegrid.Zoomify` is a plain `ol.tilegrid.TileGrid`, configured with `extent`, `origin` and `resolutions`. If the `size` passed to the `ol.source.Zoomify` source is `[width, height]`, then the extent for the tile grid will be `[0, -height, width, 0]`, and the origin will be `[0, 0]`.
#### Replace `ol.View.fitExtent()` and `ol.View.fitGeometry()` with `ol.View.fit()`
* This combines two previously distinct functions into one more flexible call which takes either a geometry or an extent.
* Rename all calls to `fitExtent` and `fitGeometry` to `fit`.
#### Change to `ol.interaction.Modify`
When single clicking a line or boundary within the `pixelTolerance`, a vertex is now created.
### v3.6.0
#### `ol.interaction.Draw` changes
* The `minPointsPerRing` config option has been renamed to `minPoints`. It is now also available for linestring drawing, not only for polygons.
* The `ol.DrawEvent` and `ol.DrawEventType` types were renamed to `ol.interaction.DrawEvent` and `ol.interaction.DrawEventType`. This has an impact on your code only if your code is compiled together with OpenLayers.
#### `ol.tilegrid` changes
* The `ol.tilegrid.XYZ` constructor has been replaced by a static `ol.tilegrid.createXYZ()` function. The `ol.tilegrid.createXYZ()` function takes the same arguments as the previous `ol.tilegrid.XYZ` constructor, but returns an `ol.tilegrid.TileGrid` instance.
* The internal tile coordinate scheme for XYZ sources has been changed. Previously, the `y` of tile coordinates was transformed to the coordinates used by sources by calculating `-y-1`. Now, it is transformed by calculating `height-y-1`, where height is the number of rows of the tile grid at the zoom level of the tile coordinate.
* The `widths` constructor option of `ol.tilegrid.TileGrid` and subclasses is no longer available, and it is no longer necessary to get proper wrapping at the 180° meridian. However, for `ol.tilegrid.WMTS`, there is a new option `sizes`, where each entry is an `ol.Size` with the `width` ('TileMatrixWidth' in WMTS capabilities) as first and the `height` ('TileMatrixHeight') as second entry of the array. For other tile grids, users can
now specify an `extent` instead of `widths`. These settings are used to restrict the range of tiles that sources will request.
* For `ol.source.TileWMS`, the default value of `warpX` used to be `undefined`, meaning that WMS requests with out-of-extent tile BBOXes would be sent. Now `wrapX` can only be `true` or `false`, and the new default is `true`. No application code changes should be required, but the resulting WMS requests for out-of-extent tiles will no longer use out-of-extent BBOXes, but ones that are shifted to real-world coordinates.
### v3.5.0
#### `ol.Object` and `bindTo`
* The following experimental methods have been removed from `ol.Object`: `bindTo`, `unbind`, and `unbindAll`. If you want to get notification about `ol.Object` property changes, you can listen for the `'propertychange'` event (e.g. `object.on('propertychange', listener)`). Two-way binding can be set up at the application level using property change listeners. See [#3472](https://github.com/openlayers/openlayers/pull/3472) for details on the change.
* The experimental `ol.dom.Input` component has been removed. If you need to synchronize the state of a dom Input element with an `ol.Object`, this can be accomplished using listeners for change events. For example, you might bind the state of a checkbox type input with a layer's visibility like this:
```js
var layer = new ol.layer.Tile();
var checkbox = document.querySelector('#checkbox');
checkbox.addEventListener('change', function() {
var checked = this.checked;
if (checked !== layer.getVisible()) {
layer.setVisible(checked);
}
});
layer.on('change:visible', function() {
var visible = this.getVisible();
if (visible !== checkbox.checked) {
checkbox.checked = visible;
}
});
```
#### New Vector API
* The following experimental vector classes have been removed: `ol.source.GeoJSON`, `ol.source.GML`, `ol.source.GPX`, `ol.source.IGC`, `ol.source.KML`, `ol.source.OSMXML`, and `ol.source.TopoJSON`. You now will use `ol.source.Vector` instead.
For example, if you used `ol.source.GeoJSON` as follows:
```js
var source = new ol.source.GeoJSON({
url: 'features.json',
projection: 'EPSG:3857'
});
```
you will need to change your code to:
```js
var source = new ol.source.Vector({
url: 'features.json',
format: new ol.format.GeoJSON()
});
```
See https://openlayers.org/en/master/examples/vector-layer.html for a real example.
Note that you no longer need to set a `projection` on the source!
Previously the vector data was loaded at source construction time, and, if the data projection and the source projection were not the same, the vector data was transformed to the source projection before being inserted (as features) into the source.
The vector data is now loaded at render time, when the view projection is known. And the vector data is transformed to the view projection if the data projection and the source projection are not the same.
If you still want to "eagerly" load the source you will use something like this:
```js
var source = new ol.source.Vector();
$.ajax('features.json').then(function(response) {
var geojsonFormat = new ol.format.GeoJSON();
var features = geojsonFormat.readFeatures(response,
{featureProjection: 'EPSG:3857'});
source.addFeatures(features);
});
```
The above code uses jQuery to send an Ajax request, but you can obviously use any Ajax library.
See https://openlayers.org/en/master/examples/igc.html for a real example.
* Note about KML
If you used `ol.source.KML`'s `extractStyles` or `defaultStyle` options, you will now have to set these options on `ol.format.KML` instead. For example, if you used:
```js
var source = new ol.source.KML({
url: 'features.kml',
extractStyles: false,
projection: 'EPSG:3857'
});
```
you will now use:
```js
var source = new ol.source.Vector({
url: 'features.kml',
format: new ol.format.KML({
extractStyles: false
})
});
```
* The `ol.source.ServerVector` class has been removed. If you used it, for example as follows:
```js
var source = new ol.source.ServerVector({
format: new ol.format.GeoJSON(),
loader: function(extent, resolution, projection) {
var url = …;
$.ajax(url).then(function(response) {
source.addFeatures(source.readFeatures(response));
});
},
strategy: ol.loadingstrategy.bbox,
projection: 'EPSG:3857'
});
```
you will need to change your code to:
```js
var source = new ol.source.Vector({
loader: function(extent, resolution, projection) {
var url = …;
$.ajax(url).then(function(response) {
var format = new ol.format.GeoJSON();
var features = format.readFeatures(response,
{featureProjection: projection});
source.addFeatures(features);
});
},
strategy: ol.loadingstrategy.bbox
});
```
See https://openlayers.org/en/master/examples/vector-osm.html for a real example.
* The experimental `ol.loadingstrategy.createTile` function has been renamed to `ol.loadingstrategy.tile`. The signature of the function hasn't changed. See https://openlayers.org/en/master/examples/vector-osm.html for an example.
#### Change to `ol.style.Icon`
* When manually loading an image for `ol.style.Icon`, the image size should now be set
with the `imgSize` option and not with `size`. `size` is supposed to be used for the
size of a sub-rectangle in an image sprite.
#### Support for non-square tiles
The return value of `ol.tilegrid.TileGrid#getTileSize()` will now be an `ol.Size` array instead of a number if non-square tiles (i.e. an `ol.Size` array instead of a number as `tilsSize`) are used. To always get an `ol.Size`, the new `ol.size.toSize()` was added.
#### Change to `ol.interaction.Draw`
When finishing a draw, the `drawend` event is now dispatched before the feature is inserted to either the source or the collection. This change allows application code to finish setting up the feature.
#### Misc.
If you compile your application together with the library and use the `ol.feature.FeatureStyleFunction` type annotation (this should be extremely rare), the type is now named `ol.FeatureStyleFunction`.
### v3.4.0
There should be nothing special required when upgrading from v3.3.0 to v3.4.0.
### v3.3.0
* The `ol.events.condition.mouseMove` function was replaced by `ol.events.condition.pointerMove` (see [#3281](https://github.com/openlayers/openlayers/pull/3281)). For example, if you use `ol.events.condition.mouseMove` as the condition in a `Select` interaction then you now need to use `ol.events.condition.pointerMove`:
```js
var selectInteraction = new ol.interaction.Select({
condition: ol.events.condition.pointerMove
// …
});
```
| bjornharrtell/ol3 | changelog/upgrade-notes.md | Markdown | bsd-2-clause | 69,452 |
import ptypes, pecoff
from ptypes import *
from . import error, ldrtypes, rtltypes, umtypes, ketypes, Ntddk, heaptypes, sdkddkver
from .datatypes import *
class PEB_FREE_BLOCK(pstruct.type): pass
class PPEB_FREE_BLOCK(P(PEB_FREE_BLOCK)): pass
PEB_FREE_BLOCK._fields_ = [(PPEB_FREE_BLOCK, 'Next'), (ULONG, 'Size')]
class _Win32kCallbackTable(pstruct.type, versioned):
_fields_ = [
(PVOID, 'fnCOPYDATA'),
(PVOID, 'fnCOPYGLOBALDATA'),
(PVOID, 'fnDWORD'),
(PVOID, 'fnNCDESTROY'),
(PVOID, 'fnDWORDOPTINLPMSG'),
(PVOID, 'fnINOUTDRAG'),
(PVOID, 'fnGETTEXTLENGTHS'),
(PVOID, 'fnINCNTOUTSTRING'),
(PVOID, 'fnPOUTLPINT'),
(PVOID, 'fnINLPCOMPAREITEMSTRUCT'),
(PVOID, 'fnINLPCREATESTRUCT'),
(PVOID, 'fnINLPDELETEITEMSTRUCT'),
(PVOID, 'fnINLPDRAWITEMSTRUCT'),
(PVOID, 'fnPOPTINLPUINT'),
(PVOID, 'fnPOPTINLPUINT2'),
(PVOID, 'fnINLPMDICREATESTRUCT'),
(PVOID, 'fnINOUTLPMEASUREITEMSTRUCT'),
(PVOID, 'fnINLPWINDOWPOS'),
(PVOID, 'fnINOUTLPPOINT5'),
(PVOID, 'fnINOUTLPSCROLLINFO'),
(PVOID, 'fnINOUTLPRECT'),
(PVOID, 'fnINOUTNCCALCSIZE'),
(PVOID, 'fnINOUTLPPOINT5_'),
(PVOID, 'fnINPAINTCLIPBRD'),
(PVOID, 'fnINSIZECLIPBRD'),
(PVOID, 'fnINDESTROYCLIPBRD'),
(PVOID, 'fnINSTRING'),
(PVOID, 'fnINSTRINGNULL'),
(PVOID, 'fnINDEVICECHANGE'),
(PVOID, 'fnPOWERBROADCAST'),
(PVOID, 'fnINLPUAHDRAWMENU'),
(PVOID, 'fnOPTOUTLPDWORDOPTOUTLPDWORD'),
(PVOID, 'fnOPTOUTLPDWORDOPTOUTLPDWORD_'),
(PVOID, 'fnOUTDWORDINDWORD'),
(PVOID, 'fnOUTLPRECT'),
(PVOID, 'fnOUTSTRING'),
(PVOID, 'fnPOPTINLPUINT3'),
(PVOID, 'fnPOUTLPINT2'),
(PVOID, 'fnSENTDDEMSG'),
(PVOID, 'fnINOUTSTYLECHANGE'),
(PVOID, 'fnHkINDWORD'),
(PVOID, 'fnHkINLPCBTACTIVATESTRUCT'),
(PVOID, 'fnHkINLPCBTCREATESTRUCT'),
(PVOID, 'fnHkINLPDEBUGHOOKSTRUCT'),
(PVOID, 'fnHkINLPMOUSEHOOKSTRUCTEX'),
(PVOID, 'fnHkINLPKBDLLHOOKSTRUCT'),
(PVOID, 'fnHkINLPMSLLHOOKSTRUCT'),
(PVOID, 'fnHkINLPMSG'),
(PVOID, 'fnHkINLPRECT'),
(PVOID, 'fnHkOPTINLPEVENTMSG'),
(PVOID, 'xxxClientCallDelegateThread'),
(PVOID, 'ClientCallDummyCallback'),
(PVOID, 'fnKEYBOARDCORRECTIONCALLOUT'),
(PVOID, 'fnOUTLPCOMBOBOXINFO'),
(PVOID, 'fnINLPCOMPAREITEMSTRUCT2'),
(PVOID, 'xxxClientCallDevCallbackCapture'),
(PVOID, 'xxxClientCallDitThread'),
(PVOID, 'xxxClientEnableMMCSS'),
(PVOID, 'xxxClientUpdateDpi'),
(PVOID, 'xxxClientExpandStringW'),
(PVOID, 'ClientCopyDDEIn1'),
(PVOID, 'ClientCopyDDEIn2'),
(PVOID, 'ClientCopyDDEOut1'),
(PVOID, 'ClientCopyDDEOut2'),
(PVOID, 'ClientCopyImage'),
(PVOID, 'ClientEventCallback'),
(PVOID, 'ClientFindMnemChar'),
(PVOID, 'ClientFreeDDEHandle'),
(PVOID, 'ClientFreeLibrary'),
(PVOID, 'ClientGetCharsetInfo'),
(PVOID, 'ClientGetDDEFlags'),
(PVOID, 'ClientGetDDEHookData'),
(PVOID, 'ClientGetListboxString'),
(PVOID, 'ClientGetMessageMPH'),
(PVOID, 'ClientLoadImage'),
(PVOID, 'ClientLoadLibrary'),
(PVOID, 'ClientLoadMenu'),
(PVOID, 'ClientLoadLocalT1Fonts'),
(PVOID, 'ClientPSMTextOut'),
(PVOID, 'ClientLpkDrawTextEx'),
(PVOID, 'ClientExtTextOutW'),
(PVOID, 'ClientGetTextExtentPointW'),
(PVOID, 'ClientCharToWchar'),
(PVOID, 'ClientAddFontResourceW'),
(PVOID, 'ClientThreadSetup'),
(PVOID, 'ClientDeliverUserApc'),
(PVOID, 'ClientNoMemoryPopup'),
(PVOID, 'ClientMonitorEnumProc'),
(PVOID, 'ClientCallWinEventProc'),
(PVOID, 'ClientWaitMessageExMPH'),
(PVOID, 'ClientWOWGetProcModule'),
(PVOID, 'ClientWOWTask16SchedNotify'),
(PVOID, 'ClientImmLoadLayout'),
(PVOID, 'ClientImmProcessKey'),
(PVOID, 'fnIMECONTROL'),
(PVOID, 'fnINWPARAMDBCSCHAR'),
(PVOID, 'fnGETTEXTLENGTHS2'),
(PVOID, 'fnINLPKDRAWSWITCHWND'),
(PVOID, 'ClientLoadStringW'),
(PVOID, 'ClientLoadOLE'),
(PVOID, 'ClientRegisterDragDrop'),
(PVOID, 'ClientRevokeDragDrop'),
(PVOID, 'fnINOUTMENUGETOBJECT'),
(PVOID, 'ClientPrinterThunk'),
(PVOID, 'fnOUTLPCOMBOBOXINFO2'),
(PVOID, 'fnOUTLPSCROLLBARINFO'),
(PVOID, 'fnINLPUAHDRAWMENU2'),
(PVOID, 'fnINLPUAHDRAWMENUITEM'),
(PVOID, 'fnINLPUAHDRAWMENU3'),
(PVOID, 'fnINOUTLPUAHMEASUREMENUITEM'),
(PVOID, 'fnINLPUAHDRAWMENU4'),
(PVOID, 'fnOUTLPTITLEBARINFOEX'),
(PVOID, 'fnTOUCH'),
(PVOID, 'fnGESTURE'),
(PVOID, 'fnPOPTINLPUINT4'),
(PVOID, 'fnPOPTINLPUINT5'),
(PVOID, 'xxxClientCallDefaultInputHandler'),
(PVOID, 'fnEMPTY'),
(PVOID, 'ClientRimDevCallback'),
(PVOID, 'xxxClientCallMinTouchHitTestingCallback'),
(PVOID, 'ClientCallLocalMouseHooks'),
(PVOID, 'xxxClientBroadcastThemeChange'),
(PVOID, 'xxxClientCallDevCallbackSimple'),
(PVOID, 'xxxClientAllocWindowClassExtraBytes'),
(PVOID, 'xxxClientFreeWindowClassExtraBytes'),
(PVOID, 'fnGETWINDOWDATA'),
(PVOID, 'fnINOUTSTYLECHANGE2'),
(PVOID, 'fnHkINLPMOUSEHOOKSTRUCTEX2'),
]
class PEB(pstruct.type, versioned):
'''
0x0098 NT 3.51
0x0150 NT 4.0
0x01E8 Win2k
0x020C XP
0x0230 WS03
0x0238 Vista
0x0240 Win7_BETA
0x0248 Win6
0x0250 Win8
0x045C Win10
'''
class BitField(pbinary.flags):
_fields_ = [
(1, 'ImageUsesLargePages'),
(1, 'IsProtectedProcess'),
(1, 'IsLegacyProcess'),
(1, 'IsImageDynamicallyRelocated'),
(1, 'SkipPatchingUser32Forwarders'),
(1, 'SpareBits'),
]
class CrossProcessFlags(pbinary.flags):
_fields_ = [
(1, 'ProcessInJob'),
(1, 'ProcessInitializing'),
(1, 'ProcessUsingVEH'),
(1, 'ProcessUsingVCH'),
(1, 'ProcessUsingFTH'),
(27, 'ReservedBits0'),
]
class NtGlobalFlag(pbinary.flags):
def __init__(self, **attrs):
super(PEB.NtGlobalFlag, self).__init__(**attrs)
f = []
f.extend([
(1, 'FLG_STOP_ON_EXCEPTION'), # 0x00000001
(1, 'FLG_SHOW_LDR_SNAPS'), # 0x00000002
(1, 'FLG_DEBUG_INITIAL_COMMAND'), # 0x00000004
(1, 'FLG_STOP_ON_HUNG_GUI'), # 0x00000008
(1, 'FLG_HEAP_ENABLE_TAIL_CHECK'), # 0x00000010
(1, 'FLG_HEAP_ENABLE_FREE_CHECK'), # 0x00000020
(1, 'FLG_HEAP_VALIDATE_PARAMETERS'), # 0x00000040
(1, 'FLG_HEAP_VALIDATE_ALL'), # 0x00000080
(1, 'FLG_POOL_ENABLE_TAIL_CHECK'), # 0x00000100
(1, 'FLG_POOL_ENABLE_FREE_CHECK'), # 0x00000200
(1, 'FLG_POOL_ENABLE_TAGGING'), # 0x00000400
(1, 'FLG_HEAP_ENABLE_TAGGING'), # 0x00000800
(1, 'FLG_USER_STACK_TRACE_DB'), # 0x00001000
(1, 'FLG_KERNEL_STACK_TRACE_DB'), # 0x00002000
(1, 'FLG_MAINTAIN_OBJECT_TYPELIST'), # 0x00004000
(1, 'FLG_HEAP_ENABLE_TAG_BY_DLL'), # 0x00008000
(1, 'FLG_IGNORE_DEBUG_PRIV'), # 0x00010000
(1, 'FLG_ENABLE_CSRDEBUG'), # 0x00020000
(1, 'FLG_ENABLE_KDEBUG_SYMBOL_LOAD'), # 0x00040000
(1, 'FLG_DISABLE_PAGE_KERNEL_STACKS'), # 0x00080000
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_WINXP:
f.append((1, 'FLG_HEAP_ENABLE_CALL_TRACING')) #0x00100000
else:
f.append((1, 'FLG_ENABLE_SYSTEM_CRIT_BREAKS')) #0x00100000
f.extend([
(1, 'FLG_HEAP_DISABLE_COALESCING'), # 0x00200000
(1, 'FLG_ENABLE_CLOSE_EXCEPTIONS'), # 0x00400000
(1, 'FLG_ENABLE_EXCEPTION_LOGGING'), # 0x00800000
(1, 'FLG_ENABLE_HANDLE_TYPE_TAGGING'), # 0x01000000
(1, 'FLG_HEAP_PAGE_ALLOCS'), # 0x02000000
(1, 'FLG_DEBUG_INITIAL_COMMAND_EX'), # 0x04000000
])
f.append((1+1+1+1+1, 'FLG_RESERVED'))
self._fields_ = list(reversed(f))
def __repr__(self):
ofs = '[{:x}]'.format(self.getoffset())
names = '|'.join((k for k, v in self.items() if v))
return ' '.join([ofs, self.name(), names, '{!r}'.format(self.serialize())])
class TracingFlags(pbinary.flags):
_fields_ = [
(1, 'HeapTracingEnabled'),
(1, 'CritSecTracingEnabled'),
(1, 'LibLoaderTracingEnabled'),
(29, 'SpareTracingBits'),
]
def __init__(self, **attrs):
super(PEB, self).__init__(**attrs)
self._fields_ = f = []
aligned = dyn.align(8 if getattr(self, 'WIN64', False) else 4)
f.extend([
(UCHAR, 'InheritedAddressSpace'),
(UCHAR, 'ReadImageFileExecOptions'),
(UCHAR, 'BeingDebugged'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.append( (pbinary.littleendian(PEB.BitField), 'BitField') )
else:
raise error.NdkUnsupportedVersion(self)
f.append( (BOOLEAN, 'SpareBool') )
f.extend([
(aligned, 'align(Mutant)'),
(HANDLE, 'Mutant'),
(P(pecoff.Executable.File), 'ImageBaseAddress'),
(ldrtypes.PPEB_LDR_DATA, 'Ldr'),
(P(rtltypes.RTL_USER_PROCESS_PARAMETERS), 'ProcessParameters'),
(PVOID, 'SubSystemData'),
(P(heaptypes.HEAP), 'ProcessHeap'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN7:
f.extend([
(P(rtltypes.RTL_CRITICAL_SECTION), 'FastPebLock'),
(PVOID, 'AltThunkSListPtr'),
(PVOID, 'IFEOKey'),
(pbinary.littleendian(PEB.CrossProcessFlags), 'CrossProcessFlags'),
(aligned, 'align(UserSharedInfoPtr)'),
(P(_Win32kCallbackTable), 'UserSharedInfoPtr'),
(ULONG, 'SystemReserved'),
(ULONG, 'AtlThunkSListPtr32') if getattr(self, 'WIN64', False) else (ULONG, 'SpareUlong'),
(P(API_SET_MAP), 'ApiSetMap'),
])
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
raise error.NdkUnsupportedVersion(self)
f.extend([
(P(rtltypes.RTL_CRITICAL_SECTION), 'FastPebLock'),
(PVOID, 'AltThunkSListPtr'),
(PVOID, 'IFEOKey'),
(ULONG, 'CrossProcessFlags'),
(P(_Win32kCallbackTable), 'UserSharedInfoPtr'),
(ULONG, 'SystemReserved'),
(ULONG, 'SpareUlong'),
(PVOID, 'SparePebPtr0'),
])
else:
raise error.NdkUnsupportedVersion(self)
f.extend([
(P(rtltypes.RTL_CRITICAL_SECTION), 'FastPebLock'),
(PVOID, 'FastPebLockRoutine'),
(PVOID, 'FastPebUnlockRoutine'),
(ULONG, 'EnvironmentUpdateCount'),
(P(_Win32kCallbackTable), 'KernelCallbackTable'),
(PVOID, 'EventLogSection'),
(PVOID, 'EventLog'),
(PPEB_FREE_BLOCK, 'FreeList'),
])
f.extend([
(ULONG, 'TlsExpansionCounter'),
(aligned, 'align(TlsBitmap)'),
(PVOID, 'TlsBitmap'), # FIXME: Does TlsBitmapBits represent the number of bytes that are in use?
(dyn.clone(BitmapBitsUlong, _object_=ULONG, length=2), 'TlsBitmapBits'),
(PVOID, 'ReadOnlySharedMemoryBase'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.append((PVOID, 'HotpatchInformation'))
else:
f.append((PVOID, 'ReadOnlySharedMemoryHeap'))
f.extend([
(P(PVOID), 'ReadOnlyStaticServerData'),
(PVOID, 'AnsiCodePageData'),
(PVOID, 'OemCodePageData'),
(PVOID, 'UnicodeCaseTableData'),
(ULONG, 'NumberOfProcessors'),
(pbinary.littleendian(PEB.NtGlobalFlag), 'NtGlobalFlag'),
(dyn.align(8), 'Reserved'),
(LARGE_INTEGER, 'CriticalSectionTimeout'),
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'HeapSegmentReserve'),
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'HeapSegmentCommit'),
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'HeapDeCommitTotalFreeThreshold'),
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'HeapDeCommitFreeBlockThreshold'),
(ULONG, 'NumberOfHeaps'),
(ULONG, 'MaximumNumberOfHeaps'),
(lambda s: P(dyn.clone(heaptypes.ProcessHeapEntries, length=s['NumberOfHeaps'].li.int())), 'ProcessHeaps'),
# (P(win32k.GDI_HANDLE_TABLE), 'GdiSharedHandleTable'),
(PVOID, 'GdiSharedHandleTable'),
(PVOID, 'ProcessStarterHelper'),
(ULONG, 'GdiDCAttributeList'),
])
f.extend([
(aligned, 'align(LoaderLock)'),
(P(rtltypes.RTL_CRITICAL_SECTION), 'LoaderLock')
])
f.extend([
(ULONG, 'OSMajorVersion'),
(ULONG, 'OSMinorVersion'),
(USHORT, 'OSBuildNumber'),
(USHORT, 'OSCSDVersion'),
(ULONG, 'OSPlatformId'),
(ULONG, 'ImageSubSystem'),
(ULONG, 'ImageSubSystemMajorVersion'),
(ULONG, 'ImageSubSystemMinorVersion'),
(aligned, 'align(ActiveProcessAffinityMask)'),
(ULONG, 'ActiveProcessAffinityMask'),
(aligned, 'align(GdiHandleBuffer)'),
(dyn.array(ULONG, 0x3c if getattr(self, 'WIN64', False) else 0x22), 'GdiHandleBuffer'),
(PVOID, 'PostProcessInitRoutine'),
(PVOID, 'TlsExpansionBitmap'),
(dyn.clone(BitmapBitsUlong, _object_=ULONG, length=0x20), 'TlsExpansionBitmapBits'),
(ULONG, 'SessionId'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WINBLUE:
f.extend([
(dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'Padding5'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WINXP:
f.extend([
(aligned, 'align(AppCompatFlags)'),
(ULARGE_INTEGER, 'AppCompatFlags'),
(ULARGE_INTEGER, 'AppCompatFlagsUser'),
(PVOID, 'pShimData'),
(PVOID, 'AppCompatInfo'),
(umtypes.UNICODE_STRING, 'CSDVersion'),
(PVOID, 'ActivationContextData'), # FIXME: P(_ACTIVATION_CONTEXT_DATA)
(PVOID, 'ProcessAssemblyStorageMap'), # FIXME: P(_ASSEMBLY_STORAGE_MAP)
(PVOID, 'SystemDefaultActivationContextData'), # FIXME: P(_ACTIVATION_CONTEXT_DATA)
(PVOID, 'SystemAssemblyStorageMap'), # FIXME: P(_ASSEMBLY_STORAGE_MAP)
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'MinimumStackCommit'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WS03:
f.extend([
(PVOID, 'FlsCallback'), # FIXME: P(_FLS_CALLBACK_INFO)
(LIST_ENTRY, 'FlsListHead'),
(PVOID, 'FlsBitmap'),
(dyn.clone(BitmapBitsUlong, _object_=ULONG, length=4), 'FlsBitmapBits'),
(ULONG, 'FlsHighIndex'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.extend([
(aligned, 'align(WerRegistrationData)'),
(PVOID, 'WerRegistrationData'),
(PVOID, 'WerShipAssertPtr'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN7:
f.extend([
(PVOID, 'pContextData'),
(PVOID, 'pImageHeaderHash'),
(pbinary.littleendian(PEB.TracingFlags), 'TracingFlags')
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WINBLUE:
f.extend([
(dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'Padding6'),
(ULONGLONG, 'CsrServerReadOnlySharedMemoryBase')
])
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN8:
f.extend([
(ULONGLONG, 'CsrServerReadOnlySharedMemoryBase')
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN10_TH2:
f.extend([
(ULONG, 'TppWorkerpListLock'),
(LIST_ENTRY, 'TppWorkerpList'),
(dyn.array(PVOID, 128), 'WaitOnAddressHashTable'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN10_RS3:
f.extend([
(PVOID, 'TelemetryCoverageHeader'),
(ULONG, 'CloudFileFlags'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN10_RS4:
f.extend([
(ULONG, 'CloudFileDiagFlags'),
(CHAR, 'PlaceHolderCompatibilityMode'),
(dyn.block(7), 'PlaceHolderCompatibilityModeReserved'),
])
# FIXME: Some fields added for windows 10 RS5
# See https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/index.htm
return
def getmodulebyname(self, name):
ldr = self['Ldr'].d.l
for m in ldr.walk():
if m['BaseDllName'].str() == name:
return m
continue
raise KeyError(name)
def getmodulebyaddress(self, address):
ldr = self['Ldr'].d.l
for m in ldr.walk():
start, size = m['DllBase'].int(), m['SizeOfImage'].int()
left, right = start, start+size
if address >= left and address <= right:
return m
continue
raise KeyError(name)
def getmodulebyfullname(self, name):
ldr = self['Ldr'].d.l
name = name.lower().replace('\\', '/')
for m in ldr.walk():
if m['FullDllName'].str().lower().replace('\\', '/') == name:
return m
continue
raise KeyError(name)
class TEB_ACTIVE_FRAME_CONTEXT(pstruct.type):
_fields_ = [
(ULONG, 'Flags'),
(P(umtypes.PSTR), 'FrameName'),
]
class TEB_ACTIVE_FRAME(pstruct.type):
_fields_ = [
(ULONG, 'Flags'),
(lambda s: P(TEB_ACTIVE_FRAME), 'Previous'),
(P(TEB_ACTIVE_FRAME_CONTEXT), 'Context'),
]
class PTEB_ACTIVE_FRAME(P(TEB_ACTIVE_FRAME)): pass
class GDI_TEB_BATCH(pstruct.type):
_fields_ = [
(ULONG, 'Offset'),
(HANDLE, 'HDC'),
(dyn.array(ULONG, 0x136), 'Buffer'),
]
class TEB(pstruct.type, versioned):
'''
0x0F28 NT 3.51
0x0F88 NT 4.0
0x0FA4 Win2k
0x0FB4 prior to XP SP2
0x0FB8 XP SP2/WS03+
0x0FBC WS03 SP1+
0x0FF8 Vista/WS08
0x0FE4 Win7/WS08 R2
0x0FE8 Win8-Win8.1/WS12
0x1000 Win10
'''
@pbinary.littleendian
class _SameTebFlags(pbinary.flags):
_fields_ = [
(1, 'SafeThunkCall'),
(1, 'InDebugPrint'),
(1, 'HasFiberData'),
(1, 'SkipThreadAttach'),
(1, 'WerInShipAssertCode'),
(1, 'RanProcessInit'),
(1, 'ClonedThread'),
(1, 'SuppressDebugMsg'),
(1, 'DisableUserStackWalk'),
(1, 'RtlExceptionAttached'),
(1, 'InitialThread'),
(1, 'SessionAware'),
(1, 'LoadOwner'),
(1, 'LoaderWorker'),
(2, 'SpareSameTebBits'),
]
def __init__(self, **attrs):
super(TEB, self).__init__(**attrs)
self._fields_ = f = []
aligned = dyn.align(8 if getattr(self, 'WIN64', False) else 4)
f.extend([
(NT_TIB, 'Tib'),
(PVOID, 'EnvironmentPointer'),
(umtypes.CLIENT_ID, 'ClientId'),
(PVOID, 'ActiveRpcHandle'),
(PVOID, 'ThreadLocalStoragePointer'),
(P(PEB), 'ProcessEnvironmentBlock'),
(ULONG, 'LastErrorValue'),
(ULONG, 'CountOfOwnedCriticalSections'),
(PVOID, 'CsrClientThread'),
(P(Ntddk.W32THREAD), 'Win32ThreadInfo'),
(dyn.array(ULONG, 0x1a), 'User32Reserved'),
(dyn.array(ULONG, 5), 'UserReserved'),
(aligned, 'align(WOW32Reserved)'),
(PVOID, 'WOW32Reserved'),
(LCID, 'CurrentLocale'),
(ULONG, 'FpSoftwareStatusRegister'),
(dyn.array(PVOID, 0x36), 'SystemReserved1'),
(LONG, 'ExceptionCode'),
(aligned, 'align(ActivationContextStackPointer)'),
(P(Ntddk.ACTIVATION_CONTEXT_STACK), 'ActivationContextStackPointer'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_WS03:
f.append((dyn.block(28 if getattr(self, 'WIN64', False) else 24), 'SpareBytes1'))
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) == sdkddkver.NTDDI_WS03:
f.append((dyn.block(28 if getattr(self, 'WIN64', False) else 0x28), 'SpareBytes1'))
else:
f.append((dyn.block(24 if getattr(self, 'WIN64', False) else 0x24), 'SpareBytes1'))
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.append((ULONG, 'TxFsContext'))
f.extend([
(aligned, 'align(GdiTebBatch)'),
(GDI_TEB_BATCH, 'GdiTebBatch'),
(aligned, 'align(RealClientId)'),
(umtypes.CLIENT_ID, 'RealClientId'),
(PVOID, 'GdiCachedProcessHandle'),
(ULONG, 'GdiClientPID'),
(ULONG, 'GdiClientTID'),
(PVOID, 'GdiThreadLocalInfo'),
(dyn.array(PVOID, 62), 'Win32ClientInfo'),
(dyn.array(PVOID, 0xe9), 'glDispatchTable'),
(dyn.array(PVOID, 0x1d), 'glReserved1'),
(PVOID, 'glReserved2'),
(PVOID, 'glSectionInfo'),
(PVOID, 'glSection'),
(PVOID, 'glTable'),
(PVOID, 'glCurrentRC'),
(PVOID, 'glContext'),
(aligned, 'align(LastStatusValue)'),
(umtypes.NTSTATUS, 'LastStatusValue'),
(aligned, 'align(StaticUnicodeString)'),
(umtypes.UNICODE_STRING, 'StaticUnicodeString'),
(dyn.clone(pstr.wstring, length=0x106), 'StaticUnicodeBuffer'),
(aligned, 'align(DeallocationStack)'),
(PVOID, 'DeallocationStack'),
(dyn.array(PVOID, 0x40), 'TlsSlots'),
(LIST_ENTRY, 'TlsLinks'),
(PVOID, 'Vdm'),
(PVOID, 'ReservedForNtRpc'),
(dyn.array(PVOID, 0x2), 'DbgSsReserved'),
(ULONG, 'HardErrorMode'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_VISTA:
f.extend([
(aligned, 'align(Instrumentation)'),
(dyn.array(PVOID, 14 if getattr(self, 'WIN64', False) else 16), 'Instrumentation')
])
else:
f.extend([
(aligned, 'align(Instrumentation)'),
(dyn.array(PVOID, 11 if getattr(self, 'WIN64', False) else 9), 'Instrumentation')
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) <= sdkddkver.NTDDI_WS03:
f.extend([
(PVOID, 'SubProcessTag'),
(PVOID, 'EtwTraceData'),
])
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.extend([
(GUID, 'ActivityId'),
(PVOID, 'SubProcessTag'),
(PVOID, 'EtwLocalData'),
(PVOID, 'EtwTraceData'),
])
f.extend([
(PVOID, 'WinSockData'),
(ULONG, 'GdiBatchCount'),
])
f.extend([
(UCHAR, 'InDbgPrint'),
(UCHAR, 'FreeStackOnTermination'),
(UCHAR, 'HasFiberData'),
(UCHAR, 'IdealProcessor'),
])
f.extend([
(ULONG, 'GuaranteedStackBytes'),
(aligned, 'align(ReservedForPerf)'),
(PVOID, 'ReservedForPerf'),
(aligned, 'align(ReservedForOle)'),
(PVOID, 'ReservedForOle'),
(ULONG, 'WaitingOnLoaderLock'),
(dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'padding(WaitingOnLoaderLock)'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) <= sdkddkver.NTDDI_WS03:
f.extend([
(ULONGLONG, 'SparePointer1'),
(ULONGLONG, 'SoftPatchPtr1'),
(ULONGLONG, 'SoftPatchPtr2'),
])
else:
f.extend([
(aligned, 'align(SavedPriorityState)'),
(PVOID, 'SavedPriorityState'),
(ULONGLONG if getattr(self, 'WIN64', False) else ULONG, 'SoftPatchPtr1'),
(PVOID, 'ThreadPoolData'),
])
f.extend([
(PVOID, 'TlsExpansionSlots'),
])
if getattr(self, 'WIN64', False):
f.extend([
(PVOID, 'DeallocationBStore'),
(PVOID, 'BStoreLimit'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_WIN7:
f.append((ULONG, 'ImpersonationLocale'))
else:
f.append((ULONG, 'MuiGeneration'))
f.extend([
(ULONG, 'IsImpersonating'),
(PVOID, 'NlsCache'),
(PVOID, 'pShimData'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) <= sdkddkver.NTDDI_WIN7:
f.append((ULONG, 'HeapVirtualAffinity'))
else:
f.extend([
(USHORT, 'HeapVirtualAffinity'),
(USHORT, 'LowFragHeapDataSlot'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WINBLUE:
f.extend([
(dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'Padding7'),
])
f.extend([
(aligned, 'align(CurrentTransactionHandle)'),
(PVOID, 'CurrentTransactionHandle'),
(PTEB_ACTIVE_FRAME, 'ActiveFrame'),
(PVOID, 'FlsData'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) <= sdkddkver.NTDDI_WS03:
f.extend([
(UCHAR, 'SafeThunkCall'),
(dyn.array(UCHAR, 3), 'BooleanSpare'),
])
return
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_VISTA:
f.extend([
(PVOID, 'PreferredLangauges'),
(PVOID, 'UserPrefLanguages'),
(PVOID, 'MergedPrefLanguages'),
(ULONG, 'MuiImpersonation'),
(USHORT, 'CrossTebFlags'),
(TEB._SameTebFlags, 'SameTebFlags'),
(PVOID, 'TxnScopeEnterCallback'),
(PVOID, 'TxnScopeExitCallback'),
(PVOID, 'TxnScopeContext'),
(ULONG, 'LockCount'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) <= sdkddkver.NTDDI_VISTA:
f.extend([
(ULONG, 'ProcessRundown'),
(ULONGLONG, 'LastSwitchTime'),
(ULONGLONG, 'TotalSwitchOutTime'),
(LARGE_INTEGER, 'WaitReasonBitmap'),
])
return
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_WIN10:
f.extend([
(ULONG, 'SpareUlong0'),
(PVOID, 'ResourceRetValue'),
])
else:
f.extend([
(ULONG, 'WowTebOffset'),
(PVOID, 'ResourceRetValue'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN8:
f.extend([
(PVOID, 'ReservedForWdf'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN10:
f.extend([
(ULONGLONG, 'ReservedForCrt'),
(GUID, 'EffectiveContainerId'),
])
return
class THREAD_INFORMATION_CLASS(pint.enum):
_values_ = [(name, value) for value, name in [
(0, 'ThreadBasicInformation'),
(1, 'ThreadTimes'),
(2, 'ThreadPriority'),
(3, 'ThreadBasePriority'),
(4, 'ThreadAffinityMask'),
(5, 'ThreadImpersonationToken'),
(6, 'ThreadDescriptorTableEntry'),
(7, 'ThreadEnableAlignmentFaultFixup'),
(8, 'ThreadEventPair'),
(9, 'ThreadQuerySetWin32StartAddress'),
(10, 'ThreadZeroTlsCell'),
(11, 'ThreadPerformanceCount'),
(12, 'ThreadAmILastThread'),
(13, 'ThreadIdealProcessor'),
(14, 'ThreadPriorityBoost'),
(15, 'ThreadSetTlsArrayAddress'),
(16, 'ThreadIsIoPending'),
(17, 'ThreadHideFromDebugger'),
(18, 'ThreadBreakOnTermination'),
(19, 'ThreadSwitchLegacyState'),
(20, 'ThreadIsTerminated'),
(21, 'ThreadLastSystemCall'),
(22, 'ThreadIoPriority'),
(23, 'ThreadCycleTime'),
(24, 'ThreadPagePriority'),
(25, 'ThreadActualBasePriority'),
(26, 'ThreadTebInformation'),
(27, 'ThreadCSwitchMon'),
(28, 'ThreadCSwitchPmu'),
(29, 'ThreadWow64Context'),
(30, 'ThreadGroupInformation'),
(31, 'ThreadUmsInformation'),
(32, 'ThreadCounterProfiling'),
(33, 'ThreadIdealProcessorEx'),
(34, 'ThreadCpuAccountingInformation'),
(35, 'ThreadSuspendCount'),
(36, 'ThreadHeterogeneousCpuPolicy'),
(37, 'ThreadContainerId'),
(38, 'ThreadNameInformation'),
(39, 'ThreadProperty'),
]]
class THREAD_BASIC_INFORMATION(pstruct.type, versioned):
type = THREAD_INFORMATION_CLASS.byname('ThreadBasicInformation')
def __init__(self, **attrs):
super(THREAD_BASIC_INFORMATION, self).__init__(**attrs)
self._fields_ = [
(umtypes.NTSTATUS, 'ExitStatus'),
(PVOID, 'TebBaseAddress'),
(umtypes.CLIENT_ID, 'ClientId'),
(umtypes.KAFFINITY, 'AffinityMask'),
(umtypes.KPRIORITY, 'Priority'),
(umtypes.KPRIORITY, 'BasePriority'),
]
class THREAD_PROPERTY_INFORMATION(pstruct.type):
type = THREAD_INFORMATION_CLASS.byname('ThreadProperty')
_fields_ = [
(ULONGLONG, 'Key'),
(PVOID, 'Object'),
(PVOID, 'Thread'),
(ULONG, 'Flags'),
]
class PROCESS_INFORMATION_CLASS(pint.enum):
_values_ = [(name, value) for value, name in [
(0, 'ProcessBasicInformation'),
(1, 'ProcessQuotaLimits'),
(2, 'ProcessIoCounters'),
(3, 'ProcessVmCounters'),
(4, 'ProcessTimes'),
(5, 'ProcessBasePriority'),
(6, 'ProcessRaisePriority'),
(7, 'ProcessDebugPort'),
(8, 'ProcessExceptionPort'),
(9, 'ProcessAccessToken'),
(10, 'ProcessLdtInformation'),
(11, 'ProcessLdtSize'),
(12, 'ProcessDefaultHardErrorMode'),
(13, 'ProcessIoPortHandlers'),
(14, 'ProcessPooledUsageAndLimits'),
(15, 'ProcessWorkingSetWatch'),
(16, 'ProcessUserModeIOPL'),
(17, 'ProcessEnableAlignmentFaultFixup'),
(18, 'ProcessPriorityClass'),
(19, 'ProcessWx86Information'),
(20, 'ProcessHandleCount'),
(21, 'ProcessAffinityMask'),
(22, 'ProcessPriorityBoost'),
(23, 'ProcessDeviceMap'),
(24, 'ProcessSessionInformation'),
(25, 'ProcessForegroundInformation'),
(26, 'ProcessWow64Information'),
(27, 'ProcessImageFileName'),
(28, 'ProcessLUIDDeviceMapsEnabled'),
(29, 'ProcessBreakOnTermination'),
(30, 'ProcessDebugObjectHandle'),
(31, 'ProcessDebugFlags'),
(32, 'ProcessHandleTracing'),
(33, 'ProcessIoPriority'),
(34, 'ProcessExecuteFlags'),
(35, 'ProcessResourceManagement'),
(36, 'ProcessCookie'),
(37, 'ProcessImageInformation'),
(38, 'ProcessCycleTime'),
(39, 'ProcessPagePriority'),
(40, 'ProcessInstrumentationCallback'),
(41, 'ProcessThreadStackAllocation'),
(42, 'ProcessWorkingSetWatchEx'),
(43, 'ProcessImageFileNameWin32'),
(44, 'ProcessImageFileMapping'),
(45, 'ProcessAffinityUpdateMode'),
(46, 'ProcessMemoryAllocationMode'),
(47, 'ProcessGroupInformation'),
(48, 'ProcessTokenVirtualizationEnabled'),
(49, 'ProcessConsoleHostProcess'),
(50, 'ProcessWindowInformation'),
(51, 'ProcessHandleInformation'),
(52, 'ProcessMitigationPolicy'),
(53, 'ProcessDynamicFunctionTableInformation'),
(54, 'ProcessHandleCheckingMode'),
(55, 'ProcessKeepAliveCount'),
(56, 'ProcessRevokeFileHandles'),
(57, 'ProcessWorkingSetControl'),
(58, 'ProcessHandleTable'),
(59, 'ProcessCheckStackExtentsMode'),
(60, 'ProcessCommandLineInformation'),
(61, 'ProcessProtectionInformation'),
(62, 'ProcessMemoryExhaustion'),
(63, 'ProcessFaultInformation'),
(64, 'ProcessTelemetryIdInformation'),
(65, 'ProcessCommitReleaseInformation'),
(66, 'ProcessDefaultCpuSetsInformation'),
(67, 'ProcessAllowedCpuSetsInformation'),
(68, 'ProcessSubsystemProcess'),
(69, 'ProcessJobMemoryInformation'),
(70, 'ProcessInPrivate'),
(71, 'ProcessRaiseUMExceptionOnInvalidHandleClose'),
(72, 'ProcessIumChallengeResponse'),
(73, 'ProcessChildProcessInformation'),
(74, 'ProcessHighGraphicsPriorityInformation'),
(75, 'ProcessSubsystemInformation'),
(76, 'ProcessEnergyValues'),
(77, 'ProcessActivityThrottleState'),
(78, 'ProcessActivityThrottlePolicy'),
(79, 'ProcessWin32kSyscallFilterInformation'),
(80, 'ProcessDisableSystemAllowedCpuSets'),
(81, 'ProcessWakeInformation'),
(82, 'ProcessEnergyTrackingState'),
(83, 'ProcessManageWritesToExecutableMemory'),
(84, 'ProcessCaptureTrustletLiveDump'),
(85, 'ProcessTelemetryCoverage'),
(86, 'ProcessEnclaveInformation'),
(87, 'ProcessEnableReadWriteVmLogging'),
(88, 'ProcessUptimeInformation'),
(89, 'ProcessImageSection'),
(90, 'ProcessDebugAuthInformation'),
(91, 'ProcessSystemResourceManagement'),
(92, 'ProcessSequenceNumber'),
(93, 'ProcessLoaderDetour'),
(94, 'ProcessSecurityDomainInformation'),
(95, 'ProcessCombineSecurityDomainsInformation'),
(96, 'ProcessEnableLogging'),
(97, 'ProcessLeapSecondInformation'),
(98, 'ProcessFiberShadowStackAllocation'),
(99, 'ProcessFreeFiberShadowStackAllocation'),
]]
class PROCESS_BASIC_INFORMATION(pstruct.type, versioned):
# XXX: there's 2 versions of this structure on server 2016
# 32-bit -> 24, 32
# 64-bit -> 48, 64
_fields_ = [
(umtypes.NTSTATUS, 'ExitStatus'),
(lambda self: dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'padding(ExitStatus)'),
(P(PEB), 'PebBaseAddress'),
(ULONG_PTR, 'AffinityMask'),
(umtypes.KPRIORITY, 'BasePriority'),
(lambda self: dyn.block(4 if getattr(self, 'WIN64', False) else 0), 'padding(BasePriority)'),
(HANDLE, 'UniqueProcessId'),
(HANDLE, 'InheritedFromUniqueProcessId'),
]
class PROCESS_MEMORY_EXHAUSTION_TYPE(pint.enum, ULONG):
_values_ = [(n, v) for v, n in [
(0, 'PMETypeFaultFastOnCommitFailure'),
]]
class PROCESS_MEMORY_EXHAUSTION_INFO(pstruct.type):
type = PROCESS_INFORMATION_CLASS.byname('ProcessMemoryExhaustion')
_fields_ = [
(USHORT, 'Version'),
(USHORT, 'Reserved'),
(PROCESS_MEMORY_EXHAUSTION_TYPE, 'Value'),
(ULONGLONG, 'Value'),
]
class PROCESS_FAULT_INFORMATION(pstruct.type):
type = PROCESS_INFORMATION_CLASS.byname('ProcessFaultInformation')
_fields_ = [
(ULONG, 'FaultFlags'),
(ULONG, 'AdditionalInfo'),
]
class PROCESS_TELEMETRY_ID_INFORMATION(pstruct.type):
type = PROCESS_INFORMATION_CLASS.byname('ProcessTelemetryIdInformation')
_fields_ = [
(ULONG, 'HeaderSize'),
(ULONG, 'ProcessId'),
(ULONGLONG, 'ProcessStartKey'),
(ULONGLONG, 'CreateTime'),
(ULONGLONG, 'CreateInterruptTime'),
(ULONGLONG, 'ProcessSequenceNumber'),
(ULONGLONG, 'SessionCreateTime'),
(ULONG, 'SessionId'),
(ULONG, 'BootId'),
(ULONG, 'ImageChecksum'),
(ULONG, 'ImageTimeDateStamp'),
(ULONG, 'UserIdOffset'),
(ULONG, 'ImagePathOffset'),
(ULONG, 'PackageNameOffset'),
(ULONG, 'RelativeAppNameOffset'),
(ULONG, 'CommandLineOffset'),
]
@pbinary.littleendian
class API_SET_SCHEMA_FLAGS_(pbinary.flags):
_fields_ = [
(30, 'unused'),
(1, 'HOST_EXTENSION'),
(1, 'SEALED'),
]
class API_SET_HEADER(pstruct.type):
def __init__(self, **attrs):
super(API_SET_HEADER, self).__init__(**attrs)
self._fields_ = f = []
# https://www.geoffchappell.com/studies/windows/win32/apisetschema/index.htm
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) < sdkddkver.NTDDI_WIN8:
f.extend([
(ULONG, 'Version'),
(ULONG, 'Count'),
])
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) >= sdkddkver.NTDDI_WIN8:
f.extend([
(ULONG, 'Version'),
(ULONG, 'Size'),
(API_SET_SCHEMA_FLAGS_, 'Flags'),
(ULONG, 'Count'),
])
else:
raise error.NdkUnsupportedVersion(self)
return
def summary(self):
res = []
for fld in self:
res.append("{:s}={:s}".format(fld, "{:#x}".format(self[fld].int()) if isinstance(self[fld], pint.type) else self[fld].summary()))
return ' '.join(res)
class API_SET_VALUE_ENTRY(pstruct.type):
class _Value(rpointer_t):
_value_ = ULONG
def summary(self):
res = super(API_SET_VALUE_ENTRY._Value, self).summary()
return '{:s} -> {!r}'.format(res, self.d.l.str())
class _object_(pstr.wstring):
def blocksize(self):
try:
parent = self.getparent(API_SET_VALUE_ENTRY)
result = parent['Size'].li.int()
except (ptypes.error.ItemNotFoundError, ptypes.error.InitializationError):
result = 0
return result
def __Value(self):
def _object_(self, parent=self):
parent = self.getparent(API_SET_VALUE_ENTRY)
res = parent['Size'].li.int()
return dyn.clone(pstr.wstring, blocksize=lambda s, sz=res: sz)
return dyn.clone(API_SET_VALUE_ENTRY._Value, _baseobject_=self._baseobject_, _object_=_object_)
_fields_ = [
(lambda s: dyn.clone(s._Value, _baseobject_=s._baseobject_), 'Value'),
(ULONG, 'Size'),
]
class API_SET_VALUE(pstruct.type):
_fields_ = [
(ULONG, 'Count'),
(ULONG, 'EndOfEntriesOffset'),
(ULONG, 'Hash'),
(lambda s: API_SET_VALUE_ENTRY if s['Count'].li.int() > 1 else ptype.undefined, 'OriginalRedirect'),
(lambda s: dyn.array(API_SET_VALUE_ENTRY, s['Count'].li.int()), 'Entry'),
]
class API_SET_ENTRY(pstruct.type):
_baseobject_ = None
class _NameOffset(rpointer_t):
_value_ = ULONG
def summary(self):
res = super(API_SET_ENTRY._NameOffset, self).summary()
return '{:s} -> {!r}'.format(res, self.d.li.str())
class _object_(pstr.wstring):
def blocksize(self):
try:
parent = self.getparent(API_SET_ENTRY)
result = parent['NameLength'].li.int()
except (ptypes.error.ItemNotFoundError, ptypes.error.InitializationError):
result = 0
return result
class _ValueOffset(rpointer_t):
_value_ = ULONG
_object_ = API_SET_VALUE
_fields_ = [
(lambda s: dyn.clone(s._NameOffset, _baseobject_=s._baseobject_), 'NameOffset'),
(ULONG, 'NameLength'),
(lambda s: dyn.clone(s._ValueOffset, _baseobject_=s._baseobject_), 'ValueOffset'),
]
class API_SET_MAP(pstruct.type, versioned):
def __Entry(self):
res = self['Header'].li
return dyn.array(API_SET_ENTRY, res['Count'].int(), recurse={'_baseobject_':self})
_fields_ = [
(API_SET_HEADER, 'Header'),
(__Entry, 'Entry'),
]
class KSYSTEM_TIME(pstruct.type):
_fields_ = [
(ULONG, 'LowPart'),
(LONG, 'High1Time'),
(LONG, 'High2Time'),
]
def summary(self):
return "LowPart={:#x} High1Time={:#x} High2Time={:#x}".format(self['LowPart'].int(), self['High1Time'].int(), self['High2Time'].int())
class WOW64_SHARED_INFORMATION(pint.enum):
_values_ = [
('SharedNtdll32LdrInitializeThunk', 0),
('SharedNtdll32KiUserExceptionDispatcher', 1),
('SharedNtdll32KiUserApcDispatcher', 2),
('SharedNtdll32KiUserCallbackDispatcher', 3),
('SharedNtdll32LdrHotPatchRoutine', 4),
('SharedNtdll32ExpInterlockedPopEntrySListFault', 5),
('SharedNtdll32ExpInterlockedPopEntrySListResume', 6),
('SharedNtdll32ExpInterlockedPopEntrySListEnd', 7),
('SharedNtdll32RtlUserThreadStart', 8),
('SharedNtdll32pQueryProcessDebugInformationRemote', 9),
('SharedNtdll32EtwpNotificationThread', 10),
('SharedNtdll32BaseAddress', 11),
('Wow64SharedPageEntriesCount', 12),
]
class NT_PRODUCT_TYPE(pint.enum, ULONG):
_values_ = [
('NtProductWinNt', 1),
('NtProductLanManNt', 2),
('NtProductServer', 3),
]
class ALTERNATIVE_ARCHITECTURE_TYPE(pint.enum, ULONG):
_values_ = [
('StandardDesign', 0),
('NEC98x86', 1),
('EndAlternatives', 2),
]
class XSTATE_CONFIGURATION(pstruct.type):
class FEATURE(pstruct.type):
_fields_ = [(ULONG, 'Offset'), (ULONG, 'Size')]
_fields_ = [
(ULONGLONG, 'EnabledFeatures'),
(ULONG, 'Size'),
(ULONG, 'OptimizedSave'),
(dyn.array(FEATURE, 64), 'Features'),
]
class SHARED_GLOBAL_FLAGS_(pbinary.flags):
_fields_ = [
(21, 'SpareBits'),
(1, 'STATE_SEPARATION_ENABLED'), # 0x00000400
(1, 'MULTIUSERS_IN_SESSION_SKU'), # 0x00000200
(1, 'MULTI_SESSION_SKU'), # 0x00000100
(1, 'SECURE_BOOT_ENABLED'), # 0x00000080
(1, 'CONSOLE_BROKER_ENABLED'), # 0x00000040
# (1, 'SEH_VALIDATION_ENABLED'), # 0x00000040 (W7)
(1, 'DYNAMIC_PROC_ENABLED'), # 0x00000020
(1, 'LKG_ENABLED'), # 0x00000010
# (1, 'SPARE'), # 0x00000010 (W7)
(1, 'INSTALLER_DETECT_ENABLED'), # 0x00000008
(1, 'VIRT_ENABLED'), # 0x00000004
(1, 'ELEVATION_ENABLED'), # 0x00000002
(1, 'ERROR_PORT'), # 0x00000001
]
PROCESSOR_MAX_FEATURES = 64
class PF_(parray.type):
_object_, length = BOOLEAN, PROCESSOR_MAX_FEATURES
_aliases_ = [
('FLOATING_POINT_PRECISION_ERRATA', 0), # 4.0 and higher (x86)
('FLOATING_POINT_EMULATED', 1), # 4.0 and higher (x86)
('COMPARE_EXCHANGE_DOUBLE', 2), # 4.0 and higher
('MMX_INSTRUCTIONS_AVAILABLE', 3), # 4.0 and higher
('PPC_MOVEMEM_64BIT_OK', 4), # none
('ALPHA_BYTE_INSTRUCTIONS', 5), # none
('XMMI_INSTRUCTIONS_AVAILABLE', 6), # 5.0 and higher
('3DNOW_INSTRUCTIONS_AVAILABLE', 7), # 5.0 and higher
('RDTSC_INSTRUCTION_AVAILABLE', 8), # 5.0 and higher
('PAE_ENABLED', 9), # 5.0 and higher
('XMMI64_INSTRUCTIONS_AVAILABLE', 10), # 5.1 and higher
('SSE_DAZ_MODE_AVAILABLE', 11), # none
('NX_ENABLED', 12), # late 5.1; late 5.2 and higher
('SSE3_INSTRUCTIONS_AVAILABLE', 13), # 6.0 and higher
('COMPARE_EXCHANGE128', 14), # 6.0 and higher (x64)
('COMPARE64_EXCHANGE128', 15), # none
('CHANNELS_ENABLED', 16), # 6.0 only
('XSAVE_ENABLED', 17), # 6.1 and higher
('ARM_VFP_32_REGISTERS_AVAILABLE', 18), # none
('ARM_NEON_INSTRUCTIONS_AVAILABLE', 19), # none
('SECOND_LEVEL_ADDRESS_TRANSLATION', 20), # 6.2 and higher
('VIRT_FIRMWARE_ENABLED', 21), # 6.2 and higher
('RDWRFSGSBASE_AVAILABLE', 22), # 6.2 and higher (x64)
('FASTFAIL_AVAILABLE', 23), # 6.2 and higher
('ARM_DIVIDE_INSTRUCTION_AVAILABLE', 24), # none
('ARM_64BIT_LOADSTORE_ATOMIC', 25), # none
('ARM_EXTERNAL_CACHE_AVAILABLE', 26), # none
('ARM_FMAC_INSTRUCTIONS_AVAILABLE', 27), # none
('RDRAND_INSTRUCTION_AVAILABLE', 28), # 6.3 and higher
('ARM_V8_INSTRUCTIONS_AVAILABLE', 29), # none
('ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE', 30), # none
('ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE', 31), # none
('RDTSCP_INSTRUCTION_AVAILABLE', 32), # 10.0 and higher
]
class KUSER_SHARED_DATA(pstruct.type, versioned):
# FIXME: https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm
class TscQpc(pbinary.struct):
_fields_ = [
(16, 'Pad'),
(6, 'Shift'),
(1, 'SpareFlag'),
(1, 'Enabled'),
]
class SharedDataFlags(pbinary.flags):
_fields_ = [
(25, 'SpareBits'),
(0, 'DbgStateSeparationEnabled'), # 1709
(0, 'DbgMultiUsersInSessionSKU'), # 1607
(0, 'DbgMultiSessionSKU'), # 10.0
(0, 'DbgSecureBootEnabled'), # 6.2
(1, 'DbgSEHValidationEnabled'), # 6.1
(0, 'DbgConsoleBrokerEnabled'), # 6.2
(1, 'DbgDynProcessorEnabled'), # 6.1
(1, 'DbgSystemDllRelocated'), # 6.0
(0, 'DbgLkgEnabled'), # 6.2
(1, 'DbgInstallerDetectEnabled'), # 6.0
(1, 'DbgVirtEnabled'), # 6.0
(1, 'DbgElevationEnabled'), # 6.0
(1, 'DbgErrorPortPresent'), # 6.0
]
def __init__(self, **attrs):
super(KUSER_SHARED_DATA, self).__init__(**attrs)
self._fields_ = f = []
PROCESSOR_MAX_FEATURES = 64
f.extend([
(ULONG, 'TickCountLowDeprecated'),
(ULONG, 'TickCountMultiplier'),
(KSYSTEM_TIME, 'InterruptTime'),
(KSYSTEM_TIME, 'SystemTime'),
(KSYSTEM_TIME, 'TimeZoneBias'),
(USHORT, 'ImageNumberLow'),
(USHORT, 'ImageNumberHigh'),
(dyn.clone(pstr.wstring, length=260), 'NtSystemRoot'),
(ULONG, 'MaxStackTraceDepth'),
(ULONG, 'CryptoExponent'),
(ULONG, 'TimeZoneId'),
(ULONG, 'LargePageMinimum'),
(dyn.array(ULONG, 7), 'Reserved2'),
(NT_PRODUCT_TYPE, 'NtProductType'),
(BOOLEAN, 'ProductTypeIsValid'),
(dyn.align(4), 'ProductTypeIsValidAlignment'),
(ULONG, 'NtMajorVersion'),
(ULONG, 'NtMinorVersion'),
(dyn.array(BOOLEAN, PROCESSOR_MAX_FEATURES), 'ProcessorFeatures'), # PF_
(ULONG, 'Reserved1'),
(ULONG, 'Reserved3'),
(ULONG, 'TimeSlip'),
(ALTERNATIVE_ARCHITECTURE_TYPE, 'AlternativeArchitecture'),
(ULONG, 'AltArchitecturePad'),
(LARGE_INTEGER, 'SystemExpirationDate'),
(ULONG, 'SuiteMask'),
(BOOLEAN, 'KdDebuggerEnabled'),
(UCHAR, 'NXSupportPolicy'),
(dyn.align(4), 'ActiveConsoleAlignment'),
(ULONG, 'ActiveConsoleId'),
(ULONG, 'DismountCount'),
(ULONG, 'ComPlusPackage'),
(ULONG, 'LastSystemRITEventTickCount'),
(ULONG, 'NumberOfPhysicalPages'),
(BOOLEAN, 'SafeBootMode'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) == sdkddkver.NTDDI_WIN7:
f.append((self.TscQpc, 'TscQpc'))
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) > sdkddkver.NTDDI_WIN7:
f.append((dyn.array(pint.uint8_t, 4), 'Reserved12'))
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) == sdkddkver.NTDDI_WINXP:
f.append((ULONG, 'TraceLogging'))
elif sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) == sdkddkver.NTDDI_WIN7:
f.extend([
(self.SharedDataFlags, 'SharedDataFlags'),
(dyn.array(ULONG, 1), 'DataFlagsPad'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) in {sdkddkver.NTDDI_WINXP, sdkddkver.NTDDI_WIN7}:
f.extend([
(ULONGLONG, 'TestRetInstruction'),
(ULONG, 'SystemCall'),
(ULONG, 'SystemCallReturn'),
(dyn.array(ULONGLONG, 3), 'SystemCallPad'),
])
f.extend([
(KSYSTEM_TIME, 'TickCount'),
(dyn.array(LONG, 1), 'TickCountPad'),
(ULONG, 'Cookie'),
])
if sdkddkver.NTDDI_MAJOR(self.NTDDI_VERSION) == sdkddkver.NTDDI_WIN7:
f.extend([
(dyn.array(ULONG, 1), 'CookiePad'), # pad to what, a ULONGLONG?
(LONGLONG, 'ConsoleSessionForegroundProcessId'),
(dyn.array(ULONG, 16), 'Wow64SharedInformation'),
(dyn.array(USHORT, 16), 'UserModeGlobalLogger'),
(ULONG, 'ImageFileExecutionOptions'),
(ULONG, 'LangGenerationCount'),
(ULONGLONG, 'Reserved5'),
(ULONGLONG, 'InterruptTimeBias'),
(ULONGLONG, 'TscQpcBias'),
(ULONG, 'ActiveProcessorCount'),
(USHORT, 'ActiveGroupCount'),
(USHORT, 'Reserved4'),
(ULONG, 'AitSamplingValue'),
(ULONG, 'AppCompatFlag'),
(ULONGLONG, 'SystemDllNativeRelocation'),
(ULONGLONG, 'SystemDllWowRelocation'),
# (dyn.array(LONG, 1), 'XStatePad'),
# (dyn.align(0x10), 'XStatePad'), # ???
(XSTATE_CONFIGURATION, 'XState'),
])
return
class ETHREAD(pstruct.type, versioned):
_fields_ = [
(ketypes.KTHREAD, 'Tcb'),
(LARGE_INTEGER, 'CreateTime'),
(LIST_ENTRY, 'KeyedWaitChain'), # XXX: union
(LONG, 'ExitStatus'), # XXX: union
(LIST_ENTRY, 'PostBlockList'), # XXX: union
(PVOID, 'KeyedWaitValue'), # XXX: union
(ULONG, 'ActiveTimerListLock'),
(LIST_ENTRY, 'ActiveTimerListHead'),
(umtypes.CLIENT_ID, 'Cid'),
(ketypes.KSEMAPHORE, 'KeyedWaitSemaphore'), # XXX: union
# (PS_CLIENT_SECURITY_CONTEXT, 'ClientSecurity'),
(dyn.block(4), 'ClientSecurity'),
(LIST_ENTRY, 'IrpList'),
(ULONG, 'TopLevelIrp'),
# (PDEVICE_OBJECT, 'DeviceToVerify'),
(P(dyn.block(0xb8)), 'DeviceToVerify'),
# (_PSP_RATE_APC *, 'RateControlApc'),
(dyn.block(4), 'RateControlApc'),
(PVOID, 'Win32StartAddress'),
(PVOID, 'SparePtr0'),
(LIST_ENTRY, 'ThreadListEntry'),
# (EX_RUNDOWN_REF, 'RundownProtect'),
# (EX_PUSH_LOCK, 'ThreadLock'),
(dyn.block(4), 'RundownProtect'),
(dyn.block(4), 'ThreadLock'),
(ULONG, 'ReadClusterSize'),
(LONG, 'MmLockOrdering'),
(ULONG, 'CrossThreadFlags'), # XXX: union
(ULONG, 'SameThreadPassiveFlags'), # XXX: union
(ULONG, 'SameThreadApcFlags'), # XXX
(UCHAR, 'CacheManagerActive'),
(UCHAR, 'DisablePageFaultClustering'),
(UCHAR, 'ActiveFaultCount'),
(ULONG, 'AlpcMessageId'),
(PVOID, 'AlpcMessage'), # XXX: union
(LIST_ENTRY, 'AlpcWaitListEntry'),
(ULONG, 'CacheManagerCount'),
]
class PROCESS_BASIC_INFORMATION(pstruct.type):
_fields_ = [
(NTSTATUS, 'ExitStatus'),
(P(PEB), 'PebBaseAddress'),
(ULONG_PTR, 'AffinityMask'),
(umtypes.KPRIORITY, 'BasePriority'),
(ULONG_PTR, 'UniqueProcessId'),
(ULONG_PTR, 'InheritedFromUniqueProcessId'),
]
class PROCESS_EXTENDED_BASIC_INFORMATION(pstruct.type):
@pbinary.littleendian
class _Flags(pbinary.flags):
'ULONG'
_fields_ = [
(28, 'SpareBits'),
(1, 'IsCrossSectionCreate'),
(1, 'IsProcessDeleting'),
(1, 'IsWow64Process'),
(1, 'IsProtectedProcess'),
]
_fields_ = [
(SIZE_T, 'Size'),
(PROCESS_BASIC_INFORMATION, 'BasicInfo'),
(_Flags, 'Flags'),
(ptype.undefined, 'undefined'),
]
def alloc(self, **fields):
res = super(PROCESS_EXTENDED_BASIC_INFORMATION, self).alloc(**fields)
return res if 'Size' in fields else res.set(Size=res.size())
class COPYDATASTRUCT(pstruct.type):
_fields_ = [
(ULONG_PTR, 'dwData'),
(DWORD, 'cbData'),
(lambda self: P(dyn.block(self['cbData'].li.int())), 'lpData'),
]
def alloc(self, **fields):
res = super(COPYDATASTRUCT, self).alloc(**fields)
if res['lpData'].d.initializedQ():
return res if 'cbData' in fields else res.set(cbData=res['lpData'].d.size())
return res
class STARTUPINFO(pstruct.type):
_fields_ = [
(DWORD, 'cb'),
(lambda self: getattr(self, '__string__', umtypes.PSTR), 'lpReserved'),
(lambda self: getattr(self, '__string__', umtypes.PSTR), 'lpDesktop'),
(lambda self: getattr(self, '__string__', umtypes.PSTR), 'lpTitle'),
(DWORD, 'dwX'),
(DWORD, 'dwY'),
(DWORD, 'dwXSize'),
(DWORD, 'dwYSize'),
(DWORD, 'dwXCountChars'),
(DWORD, 'dwYCountChars'),
(DWORD, 'dwFillAttribute'),
(DWORD, 'dwFlags'),
(WORD, 'wShowWindow'),
(WORD, 'cbReserved2'),
(lambda self: P(dyn.block(self['cbReserved2'].li.int())), 'lpReserved2'),
(HANDLE, 'hStdInput'),
(HANDLE, 'hStdOutput'),
(HANDLE, 'hStdError'),
(ptype.undefined, 'undefined'),
]
def alloc(self, **fields):
res = super(STARTUPINFO, self).alloc(**fields)
return res if 'cb' in fields else res.set(cb=res.size())
class STARTUPINFOA(STARTUPINFO):
pass
class STARTUPINFOW(STARTUPINFO):
__string__ = umtypes.PWSTR
if __name__ == '__main__':
import ctypes
def openprocess (pid):
k32 = ctypes.WinDLL('kernel32.dll')
res = k32.OpenProcess(0x30 | 0x0400, False, pid)
return res
def getcurrentprocess ():
k32 = ctypes.WinDLL('kernel32.dll')
return k32.GetCurrentProcess()
def getPBIObj (handle):
nt = ctypes.WinDLL('ntdll.dll')
class ProcessBasicInformation(ctypes.Structure):
_fields_ = [('Reserved1', ctypes.c_uint32),
('PebBaseAddress', ctypes.c_uint32),
('Reserved2', ctypes.c_uint32 * 2),
('UniqueProcessId', ctypes.c_uint32),
('Reserved3', ctypes.c_uint32)]
pbi = ProcessBasicInformation()
res = nt.NtQueryInformationProcess(handle, 0, ctypes.byref(pbi), ctypes.sizeof(pbi), None)
return pbi
handle = getcurrentprocess()
pebaddress = getPBIObj(handle).PebBaseAddress
import ptypes, pstypes
Peb = pstypes.PEB()
Peb.setoffset(pebaddress)
Peb.load()
Ldr = Peb['Ldr'].d.l
for x in Ldr['InLoadOrderModuleList'].walk():
print(x['BaseDllName'].str(), x['FullDllName'].str())
print(hex(x['DllBase'].int()), hex(x['SizeOfImage'].int()))
| arizvisa/syringe | lib/ndk/pstypes.py | Python | bsd-2-clause | 57,087 |
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision: 5572 $</version>
// </file>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Xml;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// Manages a list of syntax highlighting definitions.
/// </summary>
/// <remarks>
/// All memers on this class (including instance members) are thread-safe.
/// </remarks>
public class HighlightingManager : IHighlightingDefinitionReferenceResolver
{
sealed class DelayLoadedHighlightingDefinition : IHighlightingDefinition
{
readonly object lockObj = new object();
readonly string name;
Func<IHighlightingDefinition> lazyLoadingFunction;
IHighlightingDefinition definition;
Exception storedException;
public DelayLoadedHighlightingDefinition(string name, Func<IHighlightingDefinition> lazyLoadingFunction)
{
this.name = name;
this.lazyLoadingFunction = lazyLoadingFunction;
}
public string Name {
get {
if (name != null)
return name;
else
return GetDefinition().Name;
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "The exception will be rethrown")]
IHighlightingDefinition GetDefinition()
{
Func<IHighlightingDefinition> func;
lock (lockObj) {
if (this.definition != null)
return this.definition;
func = this.lazyLoadingFunction;
}
Exception exception = null;
IHighlightingDefinition def = null;
try {
using (var busyLock = BusyManager.Enter(this)) {
if (!busyLock.Success)
throw new InvalidOperationException("Tried to create delay-loaded highlighting definition recursively. Make sure the are no cyclic references between the highlighting definitions.");
def = func();
}
if (def == null)
throw new InvalidOperationException("Function for delay-loading highlighting definition returned null");
} catch (Exception ex) {
exception = ex;
}
lock (lockObj) {
this.lazyLoadingFunction = null;
if (this.definition == null && this.storedException == null) {
this.definition = def;
this.storedException = exception;
}
if (this.storedException != null)
throw new HighlightingDefinitionInvalidException("Error delay-loading highlighting definition", this.storedException);
return this.definition;
}
}
public HighlightingRuleSet MainRuleSet {
get {
return GetDefinition().MainRuleSet;
}
}
public HighlightingRuleSet GetNamedRuleSet(string name)
{
return GetDefinition().GetNamedRuleSet(name);
}
public HighlightingColor GetNamedColor(string name)
{
return GetDefinition().GetNamedColor(name);
}
public IEnumerable<HighlightingColor> NamedHighlightingColors {
get {
return GetDefinition().NamedHighlightingColors;
}
}
public override string ToString()
{
return this.Name;
}
}
readonly object lockObj = new object();
Dictionary<string, IHighlightingDefinition> highlightingsByName = new Dictionary<string, IHighlightingDefinition>();
Dictionary<string, IHighlightingDefinition> highlightingsByExtension = new Dictionary<string, IHighlightingDefinition>(StringComparer.OrdinalIgnoreCase);
List<IHighlightingDefinition> allHighlightings = new List<IHighlightingDefinition>();
/// <summary>
/// Gets a highlighting definition by name.
/// Returns null if the definition is not found.
/// </summary>
public IHighlightingDefinition GetDefinition(string name)
{
lock (lockObj) {
IHighlightingDefinition rh;
if (highlightingsByName.TryGetValue(name, out rh))
return rh;
else
return null;
}
}
/// <summary>
/// Gets a copy of all highlightings.
/// </summary>
public ReadOnlyCollection<IHighlightingDefinition> HighlightingDefinitions {
get {
lock (lockObj) {
return Array.AsReadOnly(allHighlightings.ToArray());
}
}
}
/// <summary>
/// Gets the names of the registered highlightings.
/// </summary>
[ObsoleteAttribute("Use the HighlightingDefinitions property instead.")]
public IEnumerable<string> HighlightingNames {
get {
lock (lockObj) {
return new List<string>(highlightingsByName.Keys);
}
}
}
/// <summary>
/// Gets a highlighting definition by extension.
/// Returns null if the definition is not found.
/// </summary>
public IHighlightingDefinition GetDefinitionByExtension(string extension)
{
lock (lockObj) {
IHighlightingDefinition rh;
if (highlightingsByExtension.TryGetValue(extension, out rh))
return rh;
else
return null;
}
}
/// <summary>
/// Registers a highlighting definition.
/// </summary>
/// <param name="name">The name to register the definition with.</param>
/// <param name="extensions">The file extensions to register the definition for.</param>
/// <param name="highlighting">The highlighting definition.</param>
public void RegisterHighlighting(string name, string[] extensions, IHighlightingDefinition highlighting)
{
if (highlighting == null)
throw new ArgumentNullException("highlighting");
lock (lockObj) {
allHighlightings.Add(highlighting);
if (name != null) {
highlightingsByName[name] = highlighting;
}
if (extensions != null) {
foreach (string ext in extensions) {
highlightingsByExtension[ext] = highlighting;
}
}
}
}
/// <summary>
/// Registers a highlighting definition.
/// </summary>
/// <param name="name">The name to register the definition with.</param>
/// <param name="extensions">The file extensions to register the definition for.</param>
/// <param name="lazyLoadedHighlighting">A function that loads the highlighting definition.</param>
public void RegisterHighlighting(string name, string[] extensions, Func<IHighlightingDefinition> lazyLoadedHighlighting)
{
if (lazyLoadedHighlighting == null)
throw new ArgumentNullException("lazyLoadedHighlighting");
RegisterHighlighting(name, extensions, new DelayLoadedHighlightingDefinition(name, lazyLoadedHighlighting));
}
/// <summary>
/// Gets the default HighlightingManager instance.
/// The default HighlightingManager comes with built-in highlightings.
/// </summary>
public static HighlightingManager Instance {
get {
return DefaultHighlightingManager.Instance;
}
}
internal sealed class DefaultHighlightingManager : HighlightingManager
{
public new static readonly DefaultHighlightingManager Instance = new DefaultHighlightingManager();
public DefaultHighlightingManager()
{
Resources.RegisterBuiltInHighlightings(this);
}
// Registering a built-in highlighting
internal void RegisterHighlighting(string name, string[] extensions, string resourceName)
{
try {
#if DEBUG
// don't use lazy-loading in debug builds, show errors immediately
Xshd.XshdSyntaxDefinition xshd;
using (Stream s = Resources.OpenStream(resourceName)) {
using (XmlTextReader reader = new XmlTextReader(s)) {
xshd = Xshd.HighlightingLoader.LoadXshd(reader, false);
}
}
Debug.Assert(name == xshd.Name);
if (extensions != null)
Debug.Assert(System.Linq.Enumerable.SequenceEqual(extensions, xshd.Extensions));
else
Debug.Assert(xshd.Extensions.Count == 0);
// round-trip xshd:
// string resourceFileName = Path.Combine(Path.GetTempPath(), resourceName);
// using (XmlTextWriter writer = new XmlTextWriter(resourceFileName, System.Text.Encoding.UTF8)) {
// writer.Formatting = Formatting.Indented;
// new Xshd.SaveXshdVisitor(writer).WriteDefinition(xshd);
// }
// using (FileStream fs = File.Create(resourceFileName + ".bin")) {
// new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(fs, xshd);
// }
// using (FileStream fs = File.Create(resourceFileName + ".compiled")) {
// new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(fs, Xshd.HighlightingLoader.Load(xshd, this));
// }
RegisterHighlighting(name, extensions, Xshd.HighlightingLoader.Load(xshd, this));
#else
RegisterHighlighting(name, extensions, LoadHighlighting(resourceName));
#endif
} catch (HighlightingDefinitionInvalidException ex) {
throw new InvalidOperationException("The built-in highlighting '" + name + "' is invalid.", ex);
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode",
Justification = "LoadHighlighting is used only in release builds")]
Func<IHighlightingDefinition> LoadHighlighting(string resourceName)
{
Func<IHighlightingDefinition> func = delegate {
Xshd.XshdSyntaxDefinition xshd;
using (Stream s = Resources.OpenStream(resourceName)) {
using (XmlTextReader reader = new XmlTextReader(s)) {
// in release builds, skip validating the built-in highlightings
xshd = Xshd.HighlightingLoader.LoadXshd(reader, true);
}
}
return Xshd.HighlightingLoader.Load(xshd, this);
};
return func;
}
}
}
}
| tltjr/Wish | ICSharpCode.AvalonEdit/Highlighting/HighlightingManager.cs | C# | bsd-2-clause | 9,909 |
package main
import (
"flag"
"io"
"log"
"os"
"os/signal"
"syscall"
)
func init() {
log.SetFlags(0)
log.SetOutput(os.Stderr)
}
func main() {
var (
flags int = (os.O_WRONLY | os.O_CREATE)
exitval int
files []io.Writer = []io.Writer{os.Stdout}
)
appendFlag := flag.Bool("a", false, "Append the output to the files rather than overwriting them.")
interruptFlag := flag.Bool("i", false, "Ignore the SIGINT signal.")
flag.Usage = usage
flag.Parse()
if *interruptFlag {
signal.Ignore(syscall.SIGINT)
}
if *appendFlag {
flags |= os.O_APPEND
} else {
flags |= os.O_TRUNC
}
for _, arg := range flag.Args() {
if arg == "-" {
continue
}
if f, err := os.OpenFile(arg, flags, os.ModePerm); err != nil {
log.Printf("%s - %v", arg, err)
exitval = 1
} else {
defer f.Close()
files = append(files, f)
}
}
if _, err := io.Copy(io.MultiWriter(files...), os.Stdin); err != nil {
log.Printf("%v", err)
exitval = 1
}
os.Exit(exitval)
}
func usage() {
log.Fatalln("usage: tee [-ai] [file ...]")
}
| sternix/commands | tee.go | GO | bsd-2-clause | 1,055 |
Rails.application.routes.draw do
get 'currents/labels' => 'currents#labels', as: :labels
resources :currents
resources :art_pieces
resources :art_pieces
resources :artists
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'currents#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
| colin-gerety/art | config/routes.rb | Ruby | bsd-2-clause | 1,749 |
/* newmail, version 1.0 ©2006 Robert Lillack, burningsoda.com */
#include <dirent.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_NAMLEN
#define NAMLEN(x) x->d_namlen
#else
#define NAMLEN(x) strlen(x->d_name)
#endif
struct dirnode {
char *name;
int unreadmails;
};
int compare_dirnodes(const void *n1, const void *n2) {
return strcmp((*(struct dirnode**)n1)->name, (*(struct dirnode**)n2)->name);
}
int is_maildir(const char *pathname) {
DIR *dir;
struct dirent *e;
struct stat sb;
int found = 0;
dir = opendir(pathname);
if (!dir) return 0;
while ((e = readdir(dir)) != NULL) {
if (NAMLEN(e) == 3 &&
((strncmp(e->d_name, "cur", 3) == 0) ||
(strncmp(e->d_name, "new", 3) == 0) ||
(strncmp(e->d_name, "tmp", 3) == 0))) {
char subdir[MAXPATHLEN + 1];
snprintf(subdir, sizeof(subdir), "%s/%s", pathname, e->d_name);
if ((stat(subdir, &sb) == 0) && S_ISDIR(sb.st_mode)) found++;
}
}
closedir(dir);
if (found == 3) return 1;
else return 0;
}
int get_file_count(char *pathname, int checkflags) {
DIR *dir;
struct dirent *entry;
int found = 0;
char *comma;
dir = opendir(pathname);
if (!dir) return -1;
while ((entry = readdir(dir)) != NULL) {
/* since we don't want to stat() here, we loose
* the ability to check for d_type == DT_DIR
* to stay ANSI conform. */
if (NAMLEN(entry) < 10) continue;
if (checkflags) {
/* make sure the SEEN flag is not there */
comma = rindex(entry->d_name, ',');
if (comma && strchr(comma, 'S') == NULL)
found++;
} else {
found++;
}
}
closedir(dir);
return found;
}
void error_quit(char *message) {
if (message) {
fprintf(stderr, "%s\n", message);
} else {
fprintf(stderr, "Unable to allocate more memory. Exiting...\n");
}
exit(1);
}
int main(int argc, char **argv) {
DIR* maildir;
struct dirent *entry;
struct dirnode *dp = NULL;
struct dirnode **dirlist = NULL;
int dirlist_count = 0;
char maildirname[MAXPATHLEN + 1] = "";
int showonlynew = 0;
int muttmode = 0;
int showtotal = 0;
int showall = 0;
int i, j;
static struct option long_options[] = {
{"all", 0, 0, 'a'},
{"mutt", 0, 0, 'm'},
{"total", 0, 0, 't'},
{"no-unseen", 0, 0, 'n'},
{0, 0, 0, 0}
};
while ((i = getopt_long(argc, argv, "amnt", long_options, NULL)) != -1) {
switch (i) {
case 'a': showall = 1; break;
case 'm': muttmode = 1; break;
case 'n': showonlynew = 1; break;
case 't': showtotal = 1; break;
default: break;
}
}
if (optind < argc) {
if (optind + 1 < argc) {
fprintf(stderr, "%s: Only one directory structure allowed. "
"Using: %s\n", argv[0], argv[optind]);
}
snprintf(maildirname, sizeof(maildirname), argv[optind]);
} else {
if (!getenv("HOME")) error_quit("Unable to determine $HOME directory");
snprintf(maildirname, sizeof(maildirname), "%s/Maildir", getenv("HOME"));
}
if (!is_maildir(maildirname) && !muttmode) {
fprintf(stderr, "warning: %s itself is not a Maildir."
" Continuing anyway...\n",
maildirname);
}
maildir = opendir(maildirname);
if (!maildir) {
fprintf(stderr, "Directory %s does not exist.\n", maildirname);
return -1;
}
/* step through the directory and find subdirs which are Maildirs */
while ((entry = readdir(maildir)) != NULL) {
if (!entry->d_name) continue;
if (NAMLEN(entry) == 2 && strncmp(entry->d_name, "..", 2) == 0) continue;
char fullname[MAXPATHLEN + 1];
snprintf(fullname, sizeof(fullname), "%s/%s", maildirname, entry->d_name);
if (is_maildir(fullname)) {
int mailcount = 0;
int pnamelen = strlen(fullname);
if (pnamelen + 4 >= sizeof(fullname)) {
fprintf(stderr, "Path name too long to access subdirs: %s\n", fullname);
exit(-1);
}
strncpy(fullname + pnamelen, "/new", 4);
fullname[pnamelen + 4] = '\0';
mailcount = get_file_count(fullname, 0);
if (showall || (!showall && !showonlynew)) {
strncpy(fullname + pnamelen, "/cur", 4);
fullname[pnamelen + 4] = '\0';
mailcount += get_file_count(fullname, 1 - showall);
}
if (!mailcount) continue;
/* put the results into a dirnode structure... */
dp = (struct dirnode*) malloc(sizeof(struct dirnode));
if (!dp) error_quit(NULL);
dp->name = (char*) malloc((NAMLEN(entry) + 1) * sizeof(char));
if (!dp->name) error_quit(NULL);
strncpy(dp->name, entry->d_name, NAMLEN(entry));
dp->name[NAMLEN(entry)] = '\0';
dp->unreadmails = mailcount;
/* ...and add it to our list. */
dirlist = (struct dirnode**) realloc(dirlist,
(dirlist_count + 1) *
sizeof(struct dirnode*));
if (!dirlist) error_quit(NULL);
dirlist[dirlist_count] = dp;
dirlist_count++;
}
}
closedir(maildir);
if (showtotal) {
j = 0;
for (i = 0; i < dirlist_count; i++) {
j += dirlist[i]->unreadmails;
free(dirlist[i]->name);
free(dirlist[i]);
}
free(dirlist);
printf("%i\n", j);
exit(EXIT_SUCCESS);
}
qsort(dirlist, dirlist_count, sizeof(struct dirnode*), compare_dirnodes);
for (i = 0; i < dirlist_count; i++) {
dp = dirlist[i];
/* convert dots to slashes */
if (!muttmode) {
for(j = 0; j < strlen(dp->name); j++)
if (dp->name[j] == '.')
dp->name[j] = '/';
}
if (muttmode) {
printf("\"=%s\" ", dp->name);
} else {
printf("%6i %s\n", dp->unreadmails,
(strlen(dp->name) == 1 && dp->name[0] == '/')
? "[ INBOX ]" : dp->name);
}
free(dp->name);
free(dp);
}
free(dirlist);
exit(EXIT_SUCCESS);
}
| roblillack/newmail | newmail.c | C | bsd-2-clause | 6,035 |
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_RUNTIMEFIELDHANDLE_H
#define __MONO_NATIVE_MSCORLIB_SYSTEM_RUNTIMEFIELDHANDLE_H
#include <mscorlib/System/mscorlib_System_ValueType.h>
#include <mscorlib/System/Runtime/Serialization/mscorlib_System_Runtime_Serialization_ISerializable.h>
#include <mscorlib/System/mscorlib_System_Object.h>
namespace mscorlib
{
namespace System
{
namespace Runtime
{
namespace Serialization
{
class SerializationInfo;
class StreamingContext;
}
}
}
}
namespace mscorlib
{
namespace System
{
class String;
class Type;
}
}
namespace mscorlib
{
namespace System
{
class RuntimeFieldHandle
: public mscorlib::System::ValueType
, public virtual mscorlib::System::Runtime::Serialization::ISerializable
{
public:
RuntimeFieldHandle(mscorlib::NativeTypeInfo *nativeTypeInfo)
: mscorlib::System::ValueType(nativeTypeInfo)
, mscorlib::System::Runtime::Serialization::ISerializable(NULL)
{
};
RuntimeFieldHandle(MonoObject *nativeObject)
: mscorlib::System::ValueType(nativeObject)
, mscorlib::System::Runtime::Serialization::ISerializable(nativeObject)
{
};
~RuntimeFieldHandle()
{
};
RuntimeFieldHandle & operator=(RuntimeFieldHandle &value) { __native_object__ = value.GetNativeObject(); return value; };
bool operator==(RuntimeFieldHandle &value) { return mscorlib::System::Object::Equals(value); };
operator MonoObject*() { return __native_object__; };
MonoObject* operator=(MonoObject* value) { return __native_object__ = value; };
virtual void GetObjectData(mscorlib::System::Runtime::Serialization::SerializationInfo info, mscorlib::System::Runtime::Serialization::StreamingContext context);
virtual mscorlib::System::Boolean Equals(mscorlib::System::Object obj) override;
mscorlib::System::Boolean Equals(mscorlib::System::RuntimeFieldHandle handle);
virtual mscorlib::System::Int32 GetHashCode() override;
virtual MonoObject* GetNativeObject() override { return __native_object__; };
//Public Properties
__declspec(property(get=get_Value)) mscorlib::System::IntPtr Value;
//Get Set Properties Methods
// Get:Value
mscorlib::System::IntPtr get_Value() const;
protected:
private:
};
}
}
#endif
| brunolauze/MonoNative | MonoNative/mscorlib/System/mscorlib_System_RuntimeFieldHandle.h | C | bsd-2-clause | 2,295 |
import ConfigParser
from .settings import SECTIONS, CONFIG
config = ConfigParser.ConfigParser()
config.read(CONFIG)
if not config.has_section(SECTIONS['INCREMENTS']):
config.add_section(SECTIONS['INCREMENTS'])
with open(CONFIG, 'w') as f:
config.write(f)
def read_since_ids(users):
"""
Read max ids of the last downloads
:param users: A list of users
Return a dictionary mapping users to ids
"""
since_ids = {}
for user in users:
if config.has_option(SECTIONS['INCREMENTS'], user):
since_ids[user] = config.getint(SECTIONS['INCREMENTS'], user) + 1
return since_ids
def set_max_ids(max_ids):
"""
Set max ids of the current downloads
:param max_ids: A dictionary mapping users to ids
"""
config.read(CONFIG)
for user, max_id in max_ids.items():
config.set(SECTIONS['INCREMENTS'], user, str(max_id))
with open(CONFIG, 'w') as f:
config.write(f)
def remove_since_id(user):
if config.has_option(SECTIONS['INCREMENTS'], user):
config.remove_option(SECTIONS['INCREMENTS'], user)
with open(CONFIG, 'w') as f:
config.write(f)
| wenli810620/twitter-photos | twphotos/increment.py | Python | bsd-2-clause | 1,165 |
using System;
using System.IO;
using System.Reflection;
using System.Diagnostics;
namespace TeamNote
{
class Debug
{
private static StreamWriter m_sLogWriter = null;
public static void Setup(string filename = "")
{
m_sLogWriter = new StreamWriter(filename, true);
WriteLog("S", "Starting application log.");
}
[Conditional("DEBUG")]
public static void Log(string format, params object[] args)
{
WriteLog("D", format, args);
}
public static void Notice(string format, params object[] args)
{
WriteLog("N", format, args);
}
public static void Warn(string format, params object[] args)
{
WriteLog("W", format, args);
}
public static void Error(string format, params object[] args)
{
WriteLog("E", format, args);
}
public static void Exception(Exception ex)
{
WriteLog("P", "{0}{1}{2}.", ex.Message, Environment.NewLine, ex.StackTrace);
}
private static void WriteLog(string type, string format, params object[] args)
{
StackFrame currentFrame = new StackFrame(2);
MethodBase methodBase = currentFrame.GetMethod();
if (methodBase == null)
return;
m_sLogWriter?.WriteLine("{0} {1} [{2} {3}] {4}", type, DateTime.Now.ToLongTimeString(), methodBase.DeclaringType, methodBase.Name, string.Format(format, args));
m_sLogWriter?.Flush();
Console.WriteLine("{0} {1} [{2}] {3}", type, DateTime.Now.ToLongTimeString(), methodBase.Name, string.Format(format, args));
}
}
}
| TomiCode/TeamNote | TeamNote_Server/Debug.cs | C# | bsd-2-clause | 1,556 |
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <dirent.h>
#include <cstdint>
#include <math.h>
#include <map>
#include <queue>
#include <set>
#include <limits>
#include <unistd.h>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <list>
#include <array>
#ifndef MKPARTITION_UTILS_H
#define MKPARTITION_UTILS_H
typedef std::unordered_set<u_int> my_set;
typedef std::unordered_map<u_long,u_long> my_map;
typedef std::vector<u_int> my_vect;
typedef std::list<u_long> my_ll;
struct timing_data {
pid_t pid;
u_long index;
short syscall;
u_int ut; //should I not include this as it is only used to calculate dtiming?
u_int fft; //the timing from our ff data
bool can_attach;
short blocking_syscall; //the syscall number that is forcing this to be unattachable
pid_t blocking_pid; //the syscall number that is forcing this to be unattachable
pid_t forked_pid; //the pid of the forked process (if applicable).
bool should_track; //should I track this rp_timing?
u_long call_clock; //the clock value of the most recent sync operation before this syscall is called.
u_long start_clock; //when the syscall starts
u_long stop_clock; //when the syscall is done running
u_long aindex;
//used to estimate dift time
double dtiming;
double ftiming;; //the timing from our ff data
uint64_t cache_misses;
u_long taint_in; //the amount of taint that we've gotten in at this point
u_long taint_out; //the amount of taint that we've output at this point
my_vect sampled_insts;
// my_set pin_traces; //traces from a previously produced round
// my_ll pin_traces;
my_vect pin_traces; //gathered from a first query with pin
u_long num_merges; //gathered from a first query with pin
u_long num_saved; //gathered from a first query with pin
u_long imisses;
};
struct partition {
pid_t pid; //the pid for this partition
u_long start_clock; //start clock for this parititon
u_long stop_clock; //stop clock for this parititon
char start_level[8];
char stop_level[8];
int start_i; //the start index (within timing_data array) of the begin of this part. If this is user level,
//this refers to the start of the user level splits
int stop_i; //the stop index (within timing_data array) of the begin of this part. If this is user level,
//this refers to the stop of the user level splits
};
//used simply for the read from the file system
struct replay_timing {
pid_t pid;
u_long index;
short syscall;
u_int ut;
uint64_t cache_misses;
};
struct ckpt_data {
u_long proc_count;
unsigned long long rg_id;
int clock;
};
struct ckpt_proc_data {
pid_t record_pid;
long retval;
loff_t logpos;
u_long outptr;
u_long consumed;
u_long expclock;
};
struct pin_trace_iter {
char* dir; //the directory where the trace files are located
u_int epochs; //the number of epochs
u_int curr_epoch; //the number of epochs
int fd; //the fd that is currently opened for the trace file
u_long *log; //the pointer to our buffer
u_long filedone; //the size of our file
u_long mapsize; //the size that we mapped, used to munmap when we need
u_long fileoffset; //the offset within the file
u_long bufstart; //the start of the current region (to figure out how far we've gone)
u_long num_merges; //running total of the number of merges across all files
//////
//all the data for the current item
//////
u_long cpid; //the current item's pid
u_long cclock; //the current item's clock
u_long csysnum; //the current item's sysnum
u_long cnmerges;//the current item's num_merges
u_long *ctraces; //the traces in the current item
};
#define MAX_CKPT_CNT 1024
struct ckpt {
char name[20];
u_long index;
u_long rp_clock;
};
int generate_timings(std::vector<struct timing_data> td, u_int num_parts, char *fork_flags,char *pin_dir, int pin_epochs);
int parse_klogs(std::vector<struct timing_data> &td, const u_long stop_clock, const char* dir, const char* fork_flags, const std::unordered_set<pid_t> procs);
int parse_ulogs(std::vector<struct timing_data> &td, const char* dir);
int parse_timing_data(std::vector<struct timing_data> &td);
int adjust_for_ckpts(std::vector<struct timing_data> &td, struct ckpt *ckpts, int ckpt_cnt);
int parse_instructions(std::vector<struct timing_data> &td, FILE *file);
int parse_pin_instructions(my_map &ninsts, char* dir, u_int epochs);
int parse_pin_traces(std::vector<struct timing_data> &td,char* dir, u_int epochs);
int parse_pin_traces_saved(std::vector<struct timing_data> &td,char* dir, u_int epochs);
u_long pin_trace_iter_next( struct pin_trace_iter &pti);
int init_pin_trace_iter(struct pin_trace_iter &pti, char *dir, u_int epochs);
int destroy_pin_trace_iter(struct pin_trace_iter &pti);
#endif /* MKPARTITION_UTILS_H*/
| endplay/omniplay | test/mkpartition_utils.h | C | bsd-2-clause | 5,216 |
/*
* Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holders nor the names of
* 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.
*
* For additional information see http://www.ethernut.de/
*
*/
/*
* $Log$
* Revision 1.2 2009/01/17 15:37:52 haraldkipp
* Added some NUTASSERT macros to check function parameters.
*
* Revision 1.1.1.1 2003/05/09 14:40:33 haraldkipp
* Initial using 3.2.1
*
* Revision 1.1 2003/02/04 17:49:09 harald
* *** empty log message ***
*
*/
#include "nut_io.h"
#include <sys/nutdebug.h>
/*!
* \addtogroup xgCrtStdio
*/
/*@{*/
/*!
* \brief Write formatted data to a string.
*
* \param buffer Pointer to a buffer that receives the output string.
* \param fmt Format string containing conversion specifications.
*
* \return The number of characters written or a negative value to
* indicate an error.
*/
int sprintf(char *buffer, const char *fmt, ...)
{
int rc;
va_list ap;
NUTASSERT(fmt != NULL);
va_start(ap, fmt);
rc = vsprintf(buffer, fmt, ap);
va_end(ap);
return rc;
}
/*@}*/
| Astralix/ethernut32 | nut/crt/sprintf.c | C | bsd-2-clause | 2,538 |
/* jshint indent:4 */
/*
* Copyright 2011-2013 Jiří Janoušek <janousek.jiri@gmail.com>
* Copyright 2014 Jan Vlnas <pgp@jan.vlnas.cz>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.
*/
/* Anonymous function is used not to pollute environment */
(function(Nuvola) {
if (Nuvola.checkFlash)
Nuvola.checkFlash();
/**
* Generate element selection function
*/
var elementSelector = function() {
var ELEM_IDS = {
prev: 'backwards',
next: 'forwards',
song: 'track-title',
artist: 'artist-name',
play: 'playPause',
thumbsUp: 'controlLike',
playAll: 'playAllJams'
};
return function(type) {
return document.getElementById(ELEM_IDS[type]);
};
};
var getElement = elementSelector();
/**
* Returns {prev: bool, next: bool}
**/
var getPlaylistState = function() {
var ret = {};
['prev', 'next'].forEach(function(type) {
ret[type] = !getElement(type).hasAttribute('disabled');
});
return ret;
};
/**
* Return an URL of the image of (hopefully) currently playing track
* TODO: store the first found album art with the currently playing track,
* so the visiting the profile page does not replace a correct album art
* - OTOH, if I am playing a playlist and I am on the profile page, the incorrect
* art will be loaded and stored
**/
var getArtLocation = function() {
var img = null;
// On Playlist page, things are easy
img = document.querySelector('.blackHole.playing img');
if (img) {
return img.getAttribute('data-thumb');
}
// Let's try profile page
img = document.querySelector('#jamHolder img');
if (img) {
return img.src;
}
// No can do
return null;
};
/**
* Return state depending on the play button
*/
var getState = function() {
var el = getElement('play');
if (!el) {
return Nuvola.STATE_NONE;
}
if (el.className.match(/playing$/)) {
return Nuvola.STATE_PLAYING;
}
else if (el.className.match(/paused$/)) {
return Nuvola.STATE_PAUSED;
}
return Nuvola.STATE_NONE;
};
var doPlay = function() {
var play = getElement('play');
if (play && (getState() != Nuvola.STATE_NONE)) {
Nuvola.clickOnElement(play);
return true;
}
var playAll = getElement('playAll');
if (playAll) {
Nuvola.clickOnElement(playAll);
return true;
}
return false;
};
/**
* Creates integration bound to Nuvola JS API
*/
var Integration = function() {
/* Overwrite default commnad function */
Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);
/* For debug output */
this.name = "thisismyjam";
/* Let's run */
this.state = Nuvola.STATE_NONE;
this.can_thumbs_up = null;
this.can_thumbs_down = null;
this.can_prev = null;
this.can_next = null;
this.update();
};
/**
* Updates current playback state
*/
Integration.prototype.update = function() {
// Default values
var state = Nuvola.STATE_NONE;
var can_prev = false;
var can_next = false;
var can_thumbs_up = false;
var can_thumbs_down = false;
var album_art = null;
var song = null;
var artist = null;
try {
state = getState();
song = getElement('song').textContent;
artist = getElement('artist').textContent;
album_art = getArtLocation();
can_thumbs_up = (state !== Nuvola.STATE_NONE);
var playlist = getPlaylistState();
can_prev = playlist.prev;
can_next = playlist.next;
// can_thumbs_down = false;
}
catch (x) {
song = artist = null;
}
// Save state
this.state = state;
// Submit data to Nuvola backend
Nuvola.updateSong(song, artist, null, album_art, state);
// Update actions
if (this.can_prev !== can_prev) {
this.can_prev = can_prev;
Nuvola.updateAction(Nuvola.ACTION_PREV_SONG, can_prev);
}
if (this.can_next !== can_next) {
this.can_next = can_next;
Nuvola.updateAction(Nuvola.ACTION_NEXT_SONG, can_next);
}
if (this.can_thumbs_up !== can_thumbs_up) {
this.can_thumbs_up = can_thumbs_up;
Nuvola.updateAction(Nuvola.ACTION_THUMBS_UP, can_thumbs_up);
}
if (this.can_thumbs_down !== can_thumbs_down) {
this.can_thumbs_down = can_thumbs_down;
Nuvola.updateAction(Nuvola.ACTION_THUMBS_DOWN, can_thumbs_down);
}
// Schedule update
setTimeout(Nuvola.bind(this, this.update), 500);
};
/**
* Message handler
* @param cmd command to execute
*/
Integration.prototype.messageHandler = function(cmd) {
/* Respond to user actions */
try {
switch (cmd) {
case Nuvola.ACTION_PLAY:
if (this.state != Nuvola.STATE_PLAYING)
doPlay();
break;
case Nuvola.ACTION_PAUSE:
if (this.state == Nuvola.STATE_PLAYING)
Nuvola.clickOnElement(getElement('play'));
break;
case Nuvola.ACTION_TOGGLE_PLAY:
doPlay();
break;
case Nuvola.ACTION_PREV_SONG:
Nuvola.clickOnElement(getElement('prev'));
break;
case Nuvola.ACTION_NEXT_SONG:
Nuvola.clickOnElement(getElement('next'));
break;
case Nuvola.ACTION_THUMBS_UP:
Nuvola.clickOnElement(getElement('thumbsUp'));
break;
/*case Nuvola.ACTION_THUMBS_DOWN:
break;*/
default:
// Other commands are not supported
throw {
"message": "Not supported."
};
}
console.log(this.name + ": comand '" + cmd + "' executed.");
}
catch (e) {
// Older API expected exception to be a string.
throw (this.name + ": " + e.message);
}
};
/* Store reference */
Nuvola.integration = new Integration(); // Singleton
// Immediately call the anonymous function with Nuvola JS API main object as an argument.
// Note that "this" is set to the Nuvola JS API main object.
})(this);
| jnv/nuvolaplayer-thisismyjam | integration.js | JavaScript | bsd-2-clause | 6,875 |
package org.mapfish.print.config.access;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
/**
* Class for marshalling and unmarshalling AccessAssertionObjects to and from JSON.
*/
public final class AccessAssertionPersister {
private static final String JSON_CLASS_NAME = "className";
@Autowired
private ApplicationContext applicationContext;
/**
* Load assertion from the provided json or throw exception if not possible.
*
* @param encodedAssertion the assertion as it was encoded in JSON.
*/
public AccessAssertion unmarshal(final JSONObject encodedAssertion) {
final String className;
try {
className = encodedAssertion.getString(JSON_CLASS_NAME);
final Class<?> assertionClass = Thread.currentThread().getContextClassLoader().loadClass(className);
final AccessAssertion assertion = (AccessAssertion) this.applicationContext.getBean(assertionClass);
assertion.unmarshal(encodedAssertion);
return assertion;
} catch (JSONException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
/**
* Marshal the assertion as a JSON object.
*
* @param assertion the assertion to marshal
*/
public JSONObject marshal(final AccessAssertion assertion) {
final JSONObject jsonObject = assertion.marshal();
if (jsonObject.has(JSON_CLASS_NAME)) {
throw new AssertionError("The toJson method in AccessAssertion: '" + assertion.getClass() +
"' defined a JSON field " + JSON_CLASS_NAME +
" which is a reserved keyword and is not permitted to be used in toJSON method");
}
try {
jsonObject.put(JSON_CLASS_NAME, assertion.getClass().getName());
} catch (JSONException e) {
throw new RuntimeException(e);
}
return jsonObject;
}
}
| Galigeo/mapfish-print | core/src/main/java/org/mapfish/print/config/access/AccessAssertionPersister.java | Java | bsd-2-clause | 2,159 |
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
* Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "config.h"
#include "RenderListMarker.h"
#include "Document.h"
#include "FontCascade.h"
#include "GraphicsContext.h"
#include "InlineElementBox.h"
#include "RenderLayer.h"
#include "RenderListItem.h"
#include "RenderView.h"
#include <wtf/StackStats.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/unicode/CharacterNames.h>
using namespace WTF;
using namespace Unicode;
namespace WebCore {
const int cMarkerPadding = 7;
enum SequenceType { NumericSequence, AlphabeticSequence };
static NEVER_INLINE void toRoman(StringBuilder& builder, int number, bool upper)
{
// FIXME: CSS3 describes how to make this work for much larger numbers,
// using overbars and special characters. It also specifies the characters
// in the range U+2160 to U+217F instead of standard ASCII ones.
ASSERT(number >= 1 && number <= 3999);
// Big enough to store largest roman number less than 3999 which
// is 3888 (MMMDCCCLXXXVIII)
const int lettersSize = 15;
LChar letters[lettersSize];
int length = 0;
const LChar ldigits[] = { 'i', 'v', 'x', 'l', 'c', 'd', 'm' };
const LChar udigits[] = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };
const LChar* digits = upper ? udigits : ldigits;
int d = 0;
do {
int num = number % 10;
if (num % 5 < 4)
for (int i = num % 5; i > 0; i--)
letters[lettersSize - ++length] = digits[d];
if (num >= 4 && num <= 8)
letters[lettersSize - ++length] = digits[d + 1];
if (num == 9)
letters[lettersSize - ++length] = digits[d + 2];
if (num % 5 == 4)
letters[lettersSize - ++length] = digits[d];
number /= 10;
d += 2;
} while (number);
ASSERT(length <= lettersSize);
builder.append(&letters[lettersSize - length], length);
}
template <typename CharacterType>
static inline void toAlphabeticOrNumeric(StringBuilder& builder, int number, const CharacterType* sequence, unsigned sequenceSize, SequenceType type)
{
ASSERT(sequenceSize >= 2);
// Taking sizeof(number) in the expression below doesn't work with some compilers.
const int lettersSize = sizeof(int) * 8 + 1; // Binary is the worst case; requires one character per bit plus a minus sign.
CharacterType letters[lettersSize];
bool isNegativeNumber = false;
unsigned numberShadow = number;
if (type == AlphabeticSequence) {
ASSERT(number > 0);
--numberShadow;
} else if (number < 0) {
numberShadow = -number;
isNegativeNumber = true;
}
letters[lettersSize - 1] = sequence[numberShadow % sequenceSize];
int length = 1;
if (type == AlphabeticSequence) {
while ((numberShadow /= sequenceSize) > 0) {
--numberShadow;
letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize];
}
} else {
while ((numberShadow /= sequenceSize) > 0)
letters[lettersSize - ++length] = sequence[numberShadow % sequenceSize];
}
if (isNegativeNumber)
letters[lettersSize - ++length] = hyphenMinus;
ASSERT(length <= lettersSize);
builder.append(&letters[lettersSize - length], length);
}
template <typename CharacterType>
static NEVER_INLINE void toSymbolic(StringBuilder& builder, int number, const CharacterType* symbols, unsigned symbolsSize)
{
ASSERT(number > 0);
ASSERT(symbolsSize >= 1);
unsigned numberShadow = number;
--numberShadow;
// The asterisks list-style-type is the worst case; we show |numberShadow| asterisks.
builder.append(symbols[numberShadow % symbolsSize]);
unsigned numSymbols = numberShadow / symbolsSize;
while (numSymbols--)
builder.append(symbols[numberShadow % symbolsSize]);
}
template <typename CharacterType>
static NEVER_INLINE void toAlphabetic(StringBuilder& builder, int number, const CharacterType* alphabet, unsigned alphabetSize)
{
toAlphabeticOrNumeric(builder, number, alphabet, alphabetSize, AlphabeticSequence);
}
template <typename CharacterType>
static NEVER_INLINE void toNumeric(StringBuilder& builder, int number, const CharacterType* numerals, unsigned numeralsSize)
{
toAlphabeticOrNumeric(builder, number, numerals, numeralsSize, NumericSequence);
}
template <typename CharacterType, size_t size>
static inline void toAlphabetic(StringBuilder& builder, int number, const CharacterType(&alphabet)[size])
{
toAlphabetic(builder, number, alphabet, size);
}
template <typename CharacterType, size_t size>
static inline void toNumeric(StringBuilder& builder, int number, const CharacterType(&alphabet)[size])
{
toNumeric(builder, number, alphabet, size);
}
template <typename CharacterType, size_t size>
static inline void toSymbolic(StringBuilder& builder, int number, const CharacterType(&alphabet)[size])
{
toSymbolic(builder, number, alphabet, size);
}
static NEVER_INLINE int toHebrewUnder1000(int number, UChar letters[5])
{
// FIXME: CSS3 mentions various refinements not implemented here.
// FIXME: Should take a look at Mozilla's HebrewToText function (in nsBulletFrame).
ASSERT(number >= 0 && number < 1000);
int length = 0;
int fourHundreds = number / 400;
for (int i = 0; i < fourHundreds; i++)
letters[length++] = 1511 + 3;
number %= 400;
if (number / 100)
letters[length++] = 1511 + (number / 100) - 1;
number %= 100;
if (number == 15 || number == 16) {
letters[length++] = 1487 + 9;
letters[length++] = 1487 + number - 9;
} else {
if (int tens = number / 10) {
static const UChar hebrewTens[9] = { 1497, 1499, 1500, 1502, 1504, 1505, 1506, 1508, 1510 };
letters[length++] = hebrewTens[tens - 1];
}
if (int ones = number % 10)
letters[length++] = 1487 + ones;
}
ASSERT(length <= 5);
return length;
}
static NEVER_INLINE void toHebrew(StringBuilder& builder, int number)
{
// FIXME: CSS3 mentions ways to make this work for much larger numbers.
ASSERT(number >= 0 && number <= 999999);
if (number == 0) {
static const UChar hebrewZero[3] = { 0x05D0, 0x05E4, 0x05E1 };
builder.append(hebrewZero, 3);
return;
}
const int lettersSize = 11; // big enough for two 5-digit sequences plus a quote mark between
UChar letters[lettersSize];
int length;
if (number < 1000)
length = 0;
else {
length = toHebrewUnder1000(number / 1000, letters);
letters[length++] = '\'';
number = number % 1000;
}
length += toHebrewUnder1000(number, letters + length);
ASSERT(length <= lettersSize);
builder.append(letters, length);
}
static NEVER_INLINE int toArmenianUnder10000(int number, bool upper, bool addCircumflex, UChar letters[9])
{
ASSERT(number >= 0 && number < 10000);
int length = 0;
int lowerOffset = upper ? 0 : 0x0030;
if (int thousands = number / 1000) {
if (thousands == 7) {
letters[length++] = 0x0552 + lowerOffset;
if (addCircumflex)
letters[length++] = 0x0302;
} else {
letters[length++] = (0x054C - 1 + lowerOffset) + thousands;
if (addCircumflex)
letters[length++] = 0x0302;
}
}
if (int hundreds = (number / 100) % 10) {
letters[length++] = (0x0543 - 1 + lowerOffset) + hundreds;
if (addCircumflex)
letters[length++] = 0x0302;
}
if (int tens = (number / 10) % 10) {
letters[length++] = (0x053A - 1 + lowerOffset) + tens;
if (addCircumflex)
letters[length++] = 0x0302;
}
if (int ones = number % 10) {
letters[length++] = (0x531 - 1 + lowerOffset) + ones;
if (addCircumflex)
letters[length++] = 0x0302;
}
return length;
}
static NEVER_INLINE void toArmenian(StringBuilder& builder, int number, bool upper)
{
ASSERT(number >= 1 && number <= 99999999);
const int lettersSize = 18; // twice what toArmenianUnder10000 needs
UChar letters[lettersSize];
int length = toArmenianUnder10000(number / 10000, upper, true, letters);
length += toArmenianUnder10000(number % 10000, upper, false, letters + length);
ASSERT(length <= lettersSize);
builder.append(letters, length);
}
static NEVER_INLINE void toGeorgian(StringBuilder& builder, int number)
{
ASSERT(number >= 1 && number <= 19999);
const int lettersSize = 5;
UChar letters[lettersSize];
int length = 0;
if (number > 9999)
letters[length++] = 0x10F5;
if (int thousands = (number / 1000) % 10) {
static const UChar georgianThousands[9] = {
0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4, 0x10EF, 0x10F0
};
letters[length++] = georgianThousands[thousands - 1];
}
if (int hundreds = (number / 100) % 10) {
static const UChar georgianHundreds[9] = {
0x10E0, 0x10E1, 0x10E2, 0x10F3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8
};
letters[length++] = georgianHundreds[hundreds - 1];
}
if (int tens = (number / 10) % 10) {
static const UChar georgianTens[9] = {
0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10F2, 0x10DD, 0x10DE, 0x10DF
};
letters[length++] = georgianTens[tens - 1];
}
if (int ones = number % 10) {
static const UChar georgianOnes[9] = {
0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10F1, 0x10D7
};
letters[length++] = georgianOnes[ones - 1];
}
ASSERT(length <= lettersSize);
builder.append(letters, length);
}
// The table uses the order from the CSS3 specification:
// first 3 group markers, then 3 digit markers, then ten digits.
static NEVER_INLINE void toCJKIdeographic(StringBuilder& builder, int number, const UChar table[16])
{
ASSERT(number >= 0);
enum AbstractCJKChar {
noChar,
secondGroupMarker, thirdGroupMarker, fourthGroupMarker,
secondDigitMarker, thirdDigitMarker, fourthDigitMarker,
digit0, digit1, digit2, digit3, digit4,
digit5, digit6, digit7, digit8, digit9
};
if (number == 0) {
builder.append(table[digit0 - 1]);
return;
}
const int groupLength = 8; // 4 digits, 3 digit markers, and a group marker
const int bufferLength = 4 * groupLength;
AbstractCJKChar buffer[bufferLength] = { noChar };
for (int i = 0; i < 4; ++i) {
int groupValue = number % 10000;
number /= 10000;
// Process least-significant group first, but put it in the buffer last.
AbstractCJKChar* group = &buffer[(3 - i) * groupLength];
if (groupValue && i)
group[7] = static_cast<AbstractCJKChar>(secondGroupMarker - 1 + i);
// Put in the four digits and digit markers for any non-zero digits.
group[6] = static_cast<AbstractCJKChar>(digit0 + (groupValue % 10));
if (number != 0 || groupValue > 9) {
int digitValue = ((groupValue / 10) % 10);
group[4] = static_cast<AbstractCJKChar>(digit0 + digitValue);
if (digitValue)
group[5] = secondDigitMarker;
}
if (number != 0 || groupValue > 99) {
int digitValue = ((groupValue / 100) % 10);
group[2] = static_cast<AbstractCJKChar>(digit0 + digitValue);
if (digitValue)
group[3] = thirdDigitMarker;
}
if (number != 0 || groupValue > 999) {
int digitValue = groupValue / 1000;
group[0] = static_cast<AbstractCJKChar>(digit0 + digitValue);
if (digitValue)
group[1] = fourthDigitMarker;
}
// Remove the tens digit, but leave the marker, for any group that has
// a value of less than 20.
if (groupValue < 20) {
ASSERT(group[4] == noChar || group[4] == digit0 || group[4] == digit1);
group[4] = noChar;
}
if (number == 0)
break;
}
// Convert into characters, omitting consecutive runs of digit0 and
// any trailing digit0.
int length = 0;
UChar characters[bufferLength];
AbstractCJKChar last = noChar;
for (int i = 0; i < bufferLength; ++i) {
AbstractCJKChar a = buffer[i];
if (a != noChar) {
if (a != digit0 || last != digit0)
characters[length++] = table[a - 1];
last = a;
}
}
if (last == digit0)
--length;
builder.append(characters, length);
}
static EListStyleType effectiveListMarkerType(EListStyleType type, int value)
{
// Note, the following switch statement has been explicitly grouped
// by list-style-type ordinal range.
switch (type) {
case ArabicIndic:
case Bengali:
case BinaryListStyle:
case Cambodian:
case Circle:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Disc:
case Gujarati:
case Gurmukhi:
case Kannada:
case Khmer:
case Lao:
case LowerHexadecimal:
case Malayalam:
case Mongolian:
case Myanmar:
case NoneListStyle:
case Octal:
case Oriya:
case Persian:
case Square:
case Telugu:
case Thai:
case Tibetan:
case UpperHexadecimal:
case Urdu:
return type; // Can represent all ordinals.
case Armenian:
return (value < 1 || value > 99999999) ? DecimalListStyle : type;
case CJKIdeographic:
return (value < 0) ? DecimalListStyle : type;
case Georgian:
return (value < 1 || value > 19999) ? DecimalListStyle : type;
case Hebrew:
return (value < 0 || value > 999999) ? DecimalListStyle : type;
case LowerRoman:
case UpperRoman:
return (value < 1 || value > 3999) ? DecimalListStyle : type;
case Afar:
case Amharic:
case AmharicAbegede:
case Asterisks:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Footnotes:
case Hangul:
case HangulConsonant:
case Hiragana:
case HiraganaIroha:
case Katakana:
case KatakanaIroha:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerLatin:
case LowerNorwegian:
case Oromo:
case Sidama:
case Somali:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperLatin:
case UpperNorwegian:
return (value < 1) ? DecimalListStyle : type;
}
ASSERT_NOT_REACHED();
return type;
}
static UChar listMarkerSuffix(EListStyleType type, int value)
{
// If the list-style-type cannot represent |value| because it's outside its
// ordinal range then we fall back to some list style that can represent |value|.
EListStyleType effectiveType = effectiveListMarkerType(type, value);
// Note, the following switch statement has been explicitly
// grouped by list-style-type suffix.
switch (effectiveType) {
case Asterisks:
case Circle:
case Disc:
case Footnotes:
case NoneListStyle:
case Square:
return ' ';
case Afar:
case Amharic:
case AmharicAbegede:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Oromo:
case Sidama:
case Somali:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
return ethiopicPrefaceColon;
case Armenian:
case ArabicIndic:
case Bengali:
case BinaryListStyle:
case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Georgian:
case Gujarati:
case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
case Katakana:
case KatakanaIroha:
case Khmer:
case Lao:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
case Octal:
case Oriya:
case Persian:
case Telugu:
case Thai:
case Tibetan:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
case Urdu:
return '.';
}
ASSERT_NOT_REACHED();
return '.';
}
String listMarkerText(EListStyleType type, int value)
{
StringBuilder builder;
// If the list-style-type, say hebrew, cannot represent |value| because it's outside
// its ordinal range then we fallback to some list style that can represent |value|.
switch (effectiveListMarkerType(type, value)) {
case NoneListStyle:
return emptyString();
case Asterisks: {
static const LChar asterisksSymbols[1] = { 0x2A };
toSymbolic(builder, value, asterisksSymbols);
break;
}
// We use the same characters for text security.
// See RenderText::setInternalString.
case Circle:
builder.append(whiteBullet);
break;
case Disc:
builder.append(bullet);
break;
case Footnotes: {
static const UChar footnotesSymbols[4] = { 0x002A, 0x2051, 0x2020, 0x2021 };
toSymbolic(builder, value, footnotesSymbols);
break;
}
case Square:
// The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE
// instead, but I think this looks better.
builder.append(blackSquare);
break;
case DecimalListStyle:
builder.appendNumber(value);
break;
case DecimalLeadingZero:
if (value < -9 || value > 9) {
builder.appendNumber(value);
break;
}
if (value < 0) {
builder.appendLiteral("-0");
builder.appendNumber(-value); // -01 to -09
break;
}
builder.append('0');
builder.appendNumber(value); // 00 to 09
break;
case ArabicIndic: {
static const UChar arabicIndicNumerals[10] = {
0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669
};
toNumeric(builder, value, arabicIndicNumerals);
break;
}
case BinaryListStyle: {
static const LChar binaryNumerals[2] = { '0', '1' };
toNumeric(builder, value, binaryNumerals);
break;
}
case Bengali: {
static const UChar bengaliNumerals[10] = {
0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09EE, 0x09EF
};
toNumeric(builder, value, bengaliNumerals);
break;
}
case Cambodian:
case Khmer: {
static const UChar khmerNumerals[10] = {
0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17E8, 0x17E9
};
toNumeric(builder, value, khmerNumerals);
break;
}
case Devanagari: {
static const UChar devanagariNumerals[10] = {
0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F
};
toNumeric(builder, value, devanagariNumerals);
break;
}
case Gujarati: {
static const UChar gujaratiNumerals[10] = {
0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0AEE, 0x0AEF
};
toNumeric(builder, value, gujaratiNumerals);
break;
}
case Gurmukhi: {
static const UChar gurmukhiNumerals[10] = {
0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A6E, 0x0A6F
};
toNumeric(builder, value, gurmukhiNumerals);
break;
}
case Kannada: {
static const UChar kannadaNumerals[10] = {
0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0CEE, 0x0CEF
};
toNumeric(builder, value, kannadaNumerals);
break;
}
case LowerHexadecimal: {
static const LChar lowerHexadecimalNumerals[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
toNumeric(builder, value, lowerHexadecimalNumerals);
break;
}
case Lao: {
static const UChar laoNumerals[10] = {
0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0ED8, 0x0ED9
};
toNumeric(builder, value, laoNumerals);
break;
}
case Malayalam: {
static const UChar malayalamNumerals[10] = {
0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6A, 0x0D6B, 0x0D6C, 0x0D6D, 0x0D6E, 0x0D6F
};
toNumeric(builder, value, malayalamNumerals);
break;
}
case Mongolian: {
static const UChar mongolianNumerals[10] = {
0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x1818, 0x1819
};
toNumeric(builder, value, mongolianNumerals);
break;
}
case Myanmar: {
static const UChar myanmarNumerals[10] = {
0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049
};
toNumeric(builder, value, myanmarNumerals);
break;
}
case Octal: {
static const LChar octalNumerals[8] = {
'0', '1', '2', '3', '4', '5', '6', '7'
};
toNumeric(builder, value, octalNumerals);
break;
}
case Oriya: {
static const UChar oriyaNumerals[10] = {
0x0B66, 0x0B67, 0x0B68, 0x0B69, 0x0B6A, 0x0B6B, 0x0B6C, 0x0B6D, 0x0B6E, 0x0B6F
};
toNumeric(builder, value, oriyaNumerals);
break;
}
case Persian:
case Urdu: {
static const UChar urduNumerals[10] = {
0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9
};
toNumeric(builder, value, urduNumerals);
break;
}
case Telugu: {
static const UChar teluguNumerals[10] = {
0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C6F
};
toNumeric(builder, value, teluguNumerals);
break;
}
case Tibetan: {
static const UChar tibetanNumerals[10] = {
0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29
};
toNumeric(builder, value, tibetanNumerals);
break;
}
case Thai: {
static const UChar thaiNumerals[10] = {
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59
};
toNumeric(builder, value, thaiNumerals);
break;
}
case UpperHexadecimal: {
static const LChar upperHexadecimalNumerals[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
toNumeric(builder, value, upperHexadecimalNumerals);
break;
}
case LowerAlpha:
case LowerLatin: {
static const LChar lowerLatinAlphabet[26] = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
};
toAlphabetic(builder, value, lowerLatinAlphabet);
break;
}
case UpperAlpha:
case UpperLatin: {
static const LChar upperLatinAlphabet[26] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};
toAlphabetic(builder, value, upperLatinAlphabet);
break;
}
case LowerGreek: {
static const UChar lowerGreekAlphabet[24] = {
0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0,
0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9
};
toAlphabetic(builder, value, lowerGreekAlphabet);
break;
}
case Hiragana: {
// FIXME: This table comes from the CSS3 draft, and is probably
// incorrect, given the comments in that draft.
static const UChar hiraganaAlphabet[48] = {
0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F,
0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F,
0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D,
0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E, 0x307F,
0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A,
0x308B, 0x308C, 0x308D, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093
};
toAlphabetic(builder, value, hiraganaAlphabet);
break;
}
case HiraganaIroha: {
// FIXME: This table comes from the CSS3 draft, and is probably
// incorrect, given the comments in that draft.
static const UChar hiraganaIrohaAlphabet[47] = {
0x3044, 0x308D, 0x306F, 0x306B, 0x307B, 0x3078, 0x3068, 0x3061,
0x308A, 0x306C, 0x308B, 0x3092, 0x308F, 0x304B, 0x3088, 0x305F,
0x308C, 0x305D, 0x3064, 0x306D, 0x306A, 0x3089, 0x3080, 0x3046,
0x3090, 0x306E, 0x304A, 0x304F, 0x3084, 0x307E, 0x3051, 0x3075,
0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304D, 0x3086, 0x3081,
0x307F, 0x3057, 0x3091, 0x3072, 0x3082, 0x305B, 0x3059
};
toAlphabetic(builder, value, hiraganaIrohaAlphabet);
break;
}
case Katakana: {
// FIXME: This table comes from the CSS3 draft, and is probably
// incorrect, given the comments in that draft.
static const UChar katakanaAlphabet[48] = {
0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF,
0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF,
0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD,
0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, 0x30DF,
0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EA,
0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3
};
toAlphabetic(builder, value, katakanaAlphabet);
break;
}
case KatakanaIroha: {
// FIXME: This table comes from the CSS3 draft, and is probably
// incorrect, given the comments in that draft.
static const UChar katakanaIrohaAlphabet[47] = {
0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, 0x30D8, 0x30C8, 0x30C1,
0x30EA, 0x30CC, 0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, 0x30BF,
0x30EC, 0x30BD, 0x30C4, 0x30CD, 0x30CA, 0x30E9, 0x30E0, 0x30A6,
0x30F0, 0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, 0x30B1, 0x30D5,
0x30B3, 0x30A8, 0x30C6, 0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1,
0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, 0x30BB, 0x30B9
};
toAlphabetic(builder, value, katakanaIrohaAlphabet);
break;
}
case Afar:
case EthiopicHalehameAaEt:
case EthiopicHalehameAaEr: {
static const UChar ethiopicHalehameAaErAlphabet[18] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1260, 0x1270, 0x1290,
0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12E8, 0x12F0, 0x1308, 0x1338, 0x1348
};
toAlphabetic(builder, value, ethiopicHalehameAaErAlphabet);
break;
}
case Amharic:
case EthiopicHalehameAmEt: {
static const UChar ethiopicHalehameAmEtAlphabet[33] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240,
0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8,
0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320,
0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
};
toAlphabetic(builder, value, ethiopicHalehameAmEtAlphabet);
break;
}
case AmharicAbegede:
case EthiopicAbegedeAmEt: {
static const UChar ethiopicAbegedeAmEtAlphabet[33] = {
0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0,
0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290,
0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1228, 0x1230, 0x1238,
0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350
};
toAlphabetic(builder, value, ethiopicAbegedeAmEtAlphabet);
break;
}
case CjkEarthlyBranch: {
static const UChar cjkEarthlyBranchAlphabet[12] = {
0x5B50, 0x4E11, 0x5BC5, 0x536F, 0x8FB0, 0x5DF3, 0x5348, 0x672A, 0x7533,
0x9149, 0x620C, 0x4EA5
};
toAlphabetic(builder, value, cjkEarthlyBranchAlphabet);
break;
}
case CjkHeavenlyStem: {
static const UChar cjkHeavenlyStemAlphabet[10] = {
0x7532, 0x4E59, 0x4E19, 0x4E01, 0x620A, 0x5DF1, 0x5E9A, 0x8F9B, 0x58EC,
0x7678
};
toAlphabetic(builder, value, cjkHeavenlyStemAlphabet);
break;
}
case Ethiopic:
case EthiopicHalehameGez: {
static const UChar ethiopicHalehameGezAlphabet[26] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1240, 0x1260,
0x1270, 0x1280, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12E8,
0x12F0, 0x1308, 0x1320, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
};
toAlphabetic(builder, value, ethiopicHalehameGezAlphabet);
break;
}
case EthiopicAbegede:
case EthiopicAbegedeGez: {
static const UChar ethiopicAbegedeGezAlphabet[26] = {
0x12A0, 0x1260, 0x1308, 0x12F0, 0x1200, 0x12C8, 0x12D8, 0x1210, 0x1320,
0x12E8, 0x12A8, 0x1208, 0x1218, 0x1290, 0x1220, 0x12D0, 0x1348, 0x1338,
0x1240, 0x1228, 0x1230, 0x1270, 0x1280, 0x1340, 0x1330, 0x1350
};
toAlphabetic(builder, value, ethiopicAbegedeGezAlphabet);
break;
}
case HangulConsonant: {
static const UChar hangulConsonantAlphabet[14] = {
0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x3148,
0x314A, 0x314B, 0x314C, 0x314D, 0x314E
};
toAlphabetic(builder, value, hangulConsonantAlphabet);
break;
}
case Hangul: {
static const UChar hangulAlphabet[14] = {
0xAC00, 0xB098, 0xB2E4, 0xB77C, 0xB9C8, 0xBC14, 0xC0AC, 0xC544, 0xC790,
0xCC28, 0xCE74, 0xD0C0, 0xD30C, 0xD558
};
toAlphabetic(builder, value, hangulAlphabet);
break;
}
case Oromo:
case EthiopicHalehameOmEt: {
static const UChar ethiopicHalehameOmEtAlphabet[25] = {
0x1200, 0x1208, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 0x1270,
0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12F0, 0x12F8,
0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348
};
toAlphabetic(builder, value, ethiopicHalehameOmEtAlphabet);
break;
}
case Sidama:
case EthiopicHalehameSidEt: {
static const UChar ethiopicHalehameSidEtAlphabet[26] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260,
0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12F0,
0x12F8, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348
};
toAlphabetic(builder, value, ethiopicHalehameSidEtAlphabet);
break;
}
case Somali:
case EthiopicHalehameSoEt: {
static const UChar ethiopicHalehameSoEtAlphabet[22] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260,
0x1270, 0x1290, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12E8, 0x12F0,
0x1300, 0x1308, 0x1338, 0x1348
};
toAlphabetic(builder, value, ethiopicHalehameSoEtAlphabet);
break;
}
case Tigre:
case EthiopicHalehameTig: {
static const UChar ethiopicHalehameTigAlphabet[27] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260,
0x1270, 0x1278, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12E8,
0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348, 0x1350
};
toAlphabetic(builder, value, ethiopicHalehameTigAlphabet);
break;
}
case TigrinyaEr:
case EthiopicHalehameTiEr: {
static const UChar ethiopicHalehameTiErAlphabet[31] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250,
0x1260, 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12C8,
0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328,
0x1330, 0x1338, 0x1348, 0x1350
};
toAlphabetic(builder, value, ethiopicHalehameTiErAlphabet);
break;
}
case TigrinyaErAbegede:
case EthiopicAbegedeTiEr: {
static const UChar ethiopicAbegedeTiErAlphabet[31] = {
0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0,
0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290,
0x1298, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x1230, 0x1238,
0x1270, 0x1278, 0x1330, 0x1350
};
toAlphabetic(builder, value, ethiopicAbegedeTiErAlphabet);
break;
}
case TigrinyaEt:
case EthiopicHalehameTiEt: {
static const UChar ethiopicHalehameTiEtAlphabet[34] = {
0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240,
0x1250, 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8,
0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308,
0x1320, 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
};
toAlphabetic(builder, value, ethiopicHalehameTiEtAlphabet);
break;
}
case TigrinyaEtAbegede:
case EthiopicAbegedeTiEt: {
static const UChar ethiopicAbegedeTiEtAlphabet[34] = {
0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0,
0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290,
0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x1230,
0x1238, 0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350
};
toAlphabetic(builder, value, ethiopicAbegedeTiEtAlphabet);
break;
}
case UpperGreek: {
static const UChar upperGreekAlphabet[24] = {
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399,
0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03A3,
0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9
};
toAlphabetic(builder, value, upperGreekAlphabet);
break;
}
case LowerNorwegian: {
static const LChar lowerNorwegianAlphabet[29] = {
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xE6,
0xF8, 0xE5
};
toAlphabetic(builder, value, lowerNorwegianAlphabet);
break;
}
case UpperNorwegian: {
static const LChar upperNorwegianAlphabet[29] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC6,
0xD8, 0xC5
};
toAlphabetic(builder, value, upperNorwegianAlphabet);
break;
}
case CJKIdeographic: {
static const UChar traditionalChineseInformalTable[16] = {
0x842C, 0x5104, 0x5146,
0x5341, 0x767E, 0x5343,
0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D
};
toCJKIdeographic(builder, value, traditionalChineseInformalTable);
break;
}
case LowerRoman:
toRoman(builder, value, false);
break;
case UpperRoman:
toRoman(builder, value, true);
break;
case Armenian:
case UpperArmenian:
// CSS3 says "armenian" means "lower-armenian".
// But the CSS2.1 test suite contains uppercase test results for "armenian",
// so we'll match the test suite.
toArmenian(builder, value, true);
break;
case LowerArmenian:
toArmenian(builder, value, false);
break;
case Georgian:
toGeorgian(builder, value);
break;
case Hebrew:
toHebrew(builder, value);
break;
}
return builder.toString();
}
RenderListMarker::RenderListMarker(RenderListItem& listItem, RenderStyle&& style)
: RenderBox(listItem.document(), WTFMove(style), 0)
, m_listItem(listItem)
{
// init RenderObject attributes
setInline(true); // our object is Inline
setReplaced(true); // pretend to be replaced
}
RenderListMarker::~RenderListMarker()
{
m_listItem.didDestroyListMarker();
if (m_image)
m_image->removeClient(this);
}
void RenderListMarker::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBox::styleDidChange(diff, oldStyle);
if (oldStyle && (style().listStylePosition() != oldStyle->listStylePosition() || style().listStyleType() != oldStyle->listStyleType()))
setNeedsLayoutAndPrefWidthsRecalc();
if (m_image != style().listStyleImage()) {
if (m_image)
m_image->removeClient(this);
m_image = style().listStyleImage();
if (m_image)
m_image->addClient(this);
}
}
std::unique_ptr<InlineElementBox> RenderListMarker::createInlineBox()
{
auto box = RenderBox::createInlineBox();
box->setBehavesLikeText(isText());
return box;
}
bool RenderListMarker::isImage() const
{
return m_image && !m_image->errorOccurred();
}
LayoutRect RenderListMarker::localSelectionRect()
{
InlineBox* box = inlineBoxWrapper();
if (!box)
return LayoutRect(LayoutPoint(), size());
const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
LayoutUnit newLogicalTop = rootBox.blockFlow().style().isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
if (rootBox.blockFlow().style().isHorizontalWritingMode())
return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
}
void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (paintInfo.phase != PaintPhaseForeground)
return;
if (style().visibility() != VISIBLE)
return;
LayoutPoint boxOrigin(paintOffset + location());
LayoutRect overflowRect(visualOverflowRect());
overflowRect.moveBy(boxOrigin);
if (!paintInfo.rect.intersects(overflowRect))
return;
LayoutRect box(boxOrigin, size());
FloatRect marker = getRelativeMarkerRect();
marker.moveBy(boxOrigin);
GraphicsContext& context = paintInfo.context();
if (isImage()) {
if (RefPtr<Image> markerImage = m_image->image(this, marker.size()))
context.drawImage(*markerImage, marker);
if (selectionState() != SelectionNone) {
LayoutRect selRect = localSelectionRect();
selRect.moveBy(boxOrigin);
context.fillRect(snappedIntRect(selRect), m_listItem.selectionBackgroundColor());
}
return;
}
if (selectionState() != SelectionNone) {
LayoutRect selRect = localSelectionRect();
selRect.moveBy(boxOrigin);
context.fillRect(snappedIntRect(selRect), m_listItem.selectionBackgroundColor());
}
const Color color(style().visitedDependentColor(CSSPropertyColor));
context.setStrokeColor(color);
context.setStrokeStyle(SolidStroke);
context.setStrokeThickness(1.0f);
context.setFillColor(color);
EListStyleType type = style().listStyleType();
switch (type) {
case Disc:
context.drawEllipse(marker);
return;
case Circle:
context.setFillColor(Color::transparent);
context.drawEllipse(marker);
return;
case Square:
context.drawRect(marker);
return;
case NoneListStyle:
return;
case Afar:
case Amharic:
case AmharicAbegede:
case ArabicIndic:
case Armenian:
case BinaryListStyle:
case Bengali:
case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
case Gujarati:
case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
case Katakana:
case KatakanaIroha:
case Khmer:
case Lao:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
case Octal:
case Oriya:
case Oromo:
case Persian:
case Sidama:
case Somali:
case Telugu:
case Thai:
case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
case Urdu:
case Asterisks:
case Footnotes:
break;
}
if (m_text.isEmpty())
return;
const FontCascade& font = style().fontCascade();
TextRun textRun = RenderBlock::constructTextRun(m_text, style());
GraphicsContextStateSaver stateSaver(context, false);
if (!style().isHorizontalWritingMode()) {
marker.moveBy(-boxOrigin);
marker = marker.transposedRect();
marker.moveBy(FloatPoint(box.x(), box.y() - logicalHeight()));
stateSaver.save();
context.translate(marker.x(), marker.maxY());
context.rotate(static_cast<float>(deg2rad(90.)));
context.translate(-marker.x(), -marker.maxY());
}
FloatPoint textOrigin = FloatPoint(marker.x(), marker.y() + style().fontMetrics().ascent());
textOrigin = roundPointToDevicePixels(LayoutPoint(textOrigin), document().deviceScaleFactor(), style().isLeftToRightDirection());
if (type == Asterisks || type == Footnotes)
context.drawText(font, textRun, textOrigin);
else {
const UChar suffix = listMarkerSuffix(type, m_listItem.value());
// Text is not arbitrary. We can judge whether it's RTL from the first character,
// and we only need to handle the direction U_RIGHT_TO_LEFT for now.
bool textNeedsReversing = u_charDirection(m_text[0]) == U_RIGHT_TO_LEFT;
String toDraw;
if (textNeedsReversing) {
unsigned length = m_text.length();
StringBuilder buffer;
buffer.reserveCapacity(length + 2);
if (!style().isLeftToRightDirection()) {
buffer.append(space);
buffer.append(suffix);
}
for (unsigned i = 0; i < length; ++i)
buffer.append(m_text[length - i - 1]);
if (style().isLeftToRightDirection()) {
buffer.append(suffix);
buffer.append(space);
}
toDraw = buffer.toString();
} else {
if (style().isLeftToRightDirection())
toDraw = m_text + String(&suffix, 1) + String(&space, 1);
else
toDraw = String(&space, 1) + String(&suffix, 1) + m_text;
}
textRun.setText(StringView(toDraw));
context.drawText(font, textRun, textOrigin);
}
}
void RenderListMarker::layout()
{
StackStats::LayoutCheckPoint layoutCheckPoint;
ASSERT(needsLayout());
if (isImage()) {
updateMarginsAndContent();
setWidth(m_image->imageSize(this, style().effectiveZoom()).width());
setHeight(m_image->imageSize(this, style().effectiveZoom()).height());
} else {
setLogicalWidth(minPreferredLogicalWidth());
setLogicalHeight(style().fontMetrics().height());
}
setMarginStart(0);
setMarginEnd(0);
Length startMargin = style().marginStart();
Length endMargin = style().marginEnd();
if (startMargin.isFixed())
setMarginStart(startMargin.value());
if (endMargin.isFixed())
setMarginEnd(endMargin.value());
clearNeedsLayout();
}
void RenderListMarker::imageChanged(WrappedImagePtr o, const IntRect*)
{
// A list marker can't have a background or border image, so no need to call the base class method.
if (o != m_image->data())
return;
if (width() != m_image->imageSize(this, style().effectiveZoom()).width() || height() != m_image->imageSize(this, style().effectiveZoom()).height() || m_image->errorOccurred())
setNeedsLayoutAndPrefWidthsRecalc();
else
repaint();
}
void RenderListMarker::updateMarginsAndContent()
{
updateContent();
updateMargins();
}
void RenderListMarker::updateContent()
{
// FIXME: This if-statement is just a performance optimization, but it's messy to use the preferredLogicalWidths dirty bit for this.
// It's unclear if this is a premature optimization.
if (!preferredLogicalWidthsDirty())
return;
m_text = emptyString();
if (isImage()) {
// FIXME: This is a somewhat arbitrary width. Generated images for markers really won't become particularly useful
// until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
LayoutUnit bulletWidth = style().fontMetrics().ascent() / LayoutUnit(2);
LayoutSize defaultBulletSize(bulletWidth, bulletWidth);
LayoutSize imageSize = calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom);
m_image->setContainerSizeForRenderer(this, imageSize, style().effectiveZoom());
return;
}
EListStyleType type = style().listStyleType();
switch (type) {
case NoneListStyle:
break;
case Circle:
case Disc:
case Square:
m_text = listMarkerText(type, 0); // value is ignored for these types
break;
case Asterisks:
case Footnotes:
case Afar:
case Amharic:
case AmharicAbegede:
case ArabicIndic:
case Armenian:
case BinaryListStyle:
case Bengali:
case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
case Gujarati:
case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
case Katakana:
case KatakanaIroha:
case Khmer:
case Lao:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
case Octal:
case Oriya:
case Oromo:
case Persian:
case Sidama:
case Somali:
case Telugu:
case Thai:
case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
case Urdu:
m_text = listMarkerText(type, m_listItem.value());
break;
}
}
void RenderListMarker::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty());
updateContent();
if (isImage()) {
LayoutSize imageSize = LayoutSize(m_image->imageSize(this, style().effectiveZoom()));
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style().isHorizontalWritingMode() ? imageSize.width() : imageSize.height();
setPreferredLogicalWidthsDirty(false);
updateMargins();
return;
}
const FontCascade& font = style().fontCascade();
LayoutUnit logicalWidth = 0;
EListStyleType type = style().listStyleType();
switch (type) {
case NoneListStyle:
break;
case Asterisks:
case Footnotes: {
TextRun run = RenderBlock::constructTextRun(m_text, style(), AllowTrailingExpansion | ForbidLeadingExpansion, DefaultTextRunFlags);
logicalWidth = font.width(run); // no suffix for these types
}
break;
case Circle:
case Disc:
case Square:
logicalWidth = (font.fontMetrics().ascent() * 2 / 3 + 1) / 2 + 2;
break;
case Afar:
case Amharic:
case AmharicAbegede:
case ArabicIndic:
case Armenian:
case BinaryListStyle:
case Bengali:
case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
case Gujarati:
case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
case Katakana:
case KatakanaIroha:
case Khmer:
case Lao:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
case Octal:
case Oriya:
case Oromo:
case Persian:
case Sidama:
case Somali:
case Telugu:
case Thai:
case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
case Urdu:
if (m_text.isEmpty())
logicalWidth = 0;
else {
TextRun run = RenderBlock::constructTextRun(m_text, style(), AllowTrailingExpansion | ForbidLeadingExpansion, DefaultTextRunFlags);
LayoutUnit itemWidth = font.width(run);
UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style()));
logicalWidth = itemWidth + suffixSpaceWidth;
}
break;
}
m_minPreferredLogicalWidth = logicalWidth;
m_maxPreferredLogicalWidth = logicalWidth;
setPreferredLogicalWidthsDirty(false);
updateMargins();
}
void RenderListMarker::updateMargins()
{
const FontMetrics& fontMetrics = style().fontMetrics();
LayoutUnit marginStart = 0;
LayoutUnit marginEnd = 0;
if (isInside()) {
if (isImage())
marginEnd = cMarkerPadding;
else switch (style().listStyleType()) {
case Disc:
case Circle:
case Square:
marginStart = -1;
marginEnd = fontMetrics.ascent() - minPreferredLogicalWidth() + 1;
break;
default:
break;
}
} else {
if (style().isLeftToRightDirection()) {
if (isImage())
marginStart = -minPreferredLogicalWidth() - cMarkerPadding;
else {
int offset = fontMetrics.ascent() * 2 / 3;
switch (style().listStyleType()) {
case Disc:
case Circle:
case Square:
marginStart = -offset - cMarkerPadding - 1;
break;
case NoneListStyle:
break;
default:
marginStart = m_text.isEmpty() ? LayoutUnit() : -minPreferredLogicalWidth() - offset / 2;
}
}
marginEnd = -marginStart - minPreferredLogicalWidth();
} else {
if (isImage())
marginEnd = cMarkerPadding;
else {
int offset = fontMetrics.ascent() * 2 / 3;
switch (style().listStyleType()) {
case Disc:
case Circle:
case Square:
marginEnd = offset + cMarkerPadding + 1 - minPreferredLogicalWidth();
break;
case NoneListStyle:
break;
default:
marginEnd = m_text.isEmpty() ? 0 : offset / 2;
}
}
marginStart = -marginEnd - minPreferredLogicalWidth();
}
}
mutableStyle().setMarginStart(Length(marginStart, Fixed));
mutableStyle().setMarginEnd(Length(marginEnd, Fixed));
}
LayoutUnit RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
if (!isImage())
return m_listItem.lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
}
int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
if (!isImage())
return m_listItem.baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
}
String RenderListMarker::suffix() const
{
EListStyleType type = style().listStyleType();
const UChar suffix = listMarkerSuffix(type, m_listItem.value());
if (suffix == ' ')
return String(" ");
// If the suffix is not ' ', an extra space is needed
UChar data[2];
if (style().isLeftToRightDirection()) {
data[0] = suffix;
data[1] = ' ';
} else {
data[0] = ' ';
data[1] = suffix;
}
return String(data, 2);
}
bool RenderListMarker::isInside() const
{
return m_listItem.notInList() || style().listStylePosition() == INSIDE;
}
FloatRect RenderListMarker::getRelativeMarkerRect()
{
if (isImage())
return FloatRect(0, 0, m_image->imageSize(this, style().effectiveZoom()).width(), m_image->imageSize(this, style().effectiveZoom()).height());
FloatRect relativeRect;
EListStyleType type = style().listStyleType();
switch (type) {
case Asterisks:
case Footnotes: {
const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(m_text, style(), AllowTrailingExpansion | ForbidLeadingExpansion, DefaultTextRunFlags);
relativeRect = FloatRect(0, 0, font.width(run), font.fontMetrics().height());
break;
}
case Disc:
case Circle:
case Square: {
// FIXME: Are these particular rounding rules necessary?
const FontMetrics& fontMetrics = style().fontMetrics();
int ascent = fontMetrics.ascent();
int bulletWidth = (ascent * 2 / 3 + 1) / 2;
relativeRect = FloatRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth, bulletWidth);
break;
}
case NoneListStyle:
return FloatRect();
case Afar:
case Amharic:
case AmharicAbegede:
case ArabicIndic:
case Armenian:
case BinaryListStyle:
case Bengali:
case Cambodian:
case CJKIdeographic:
case CjkEarthlyBranch:
case CjkHeavenlyStem:
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
case Ethiopic:
case EthiopicAbegede:
case EthiopicAbegedeAmEt:
case EthiopicAbegedeGez:
case EthiopicAbegedeTiEr:
case EthiopicAbegedeTiEt:
case EthiopicHalehameAaEr:
case EthiopicHalehameAaEt:
case EthiopicHalehameAmEt:
case EthiopicHalehameGez:
case EthiopicHalehameOmEt:
case EthiopicHalehameSidEt:
case EthiopicHalehameSoEt:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
case EthiopicHalehameTig:
case Georgian:
case Gujarati:
case Gurmukhi:
case Hangul:
case HangulConsonant:
case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
case Katakana:
case KatakanaIroha:
case Khmer:
case Lao:
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
case LowerHexadecimal:
case LowerLatin:
case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
case Octal:
case Oriya:
case Oromo:
case Persian:
case Sidama:
case Somali:
case Telugu:
case Thai:
case Tibetan:
case Tigre:
case TigrinyaEr:
case TigrinyaErAbegede:
case TigrinyaEt:
case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
case UpperGreek:
case UpperHexadecimal:
case UpperLatin:
case UpperNorwegian:
case UpperRoman:
case Urdu:
if (m_text.isEmpty())
return FloatRect();
const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(m_text, style(), AllowTrailingExpansion | ForbidLeadingExpansion, DefaultTextRunFlags);
float itemWidth = font.width(run);
UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
float suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style()));
relativeRect = FloatRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height());
}
if (!style().isHorizontalWritingMode()) {
relativeRect = relativeRect.transposedRect();
relativeRect.setX(width() - relativeRect.x() - relativeRect.width());
}
return relativeRect;
}
void RenderListMarker::setSelectionState(SelectionState state)
{
// The selection state for our containing block hierarchy is updated by the base class call.
RenderBox::setSelectionState(state);
if (m_inlineBoxWrapper && canUpdateSelectionOnRootLineBoxes())
m_inlineBoxWrapper->root().setHasSelectedChildren(state != SelectionNone);
}
LayoutRect RenderListMarker::selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent)
{
ASSERT(!needsLayout());
if (selectionState() == SelectionNone || !inlineBoxWrapper())
return LayoutRect();
RootInlineBox& rootBox = inlineBoxWrapper()->root();
LayoutRect rect(0, rootBox.selectionTop() - y(), width(), rootBox.selectionHeight());
if (clipToVisibleContent)
return computeRectForRepaint(rect, repaintContainer);
return localToContainerQuad(FloatRect(rect), repaintContainer).enclosingBoundingBox();
}
} // namespace WebCore
| applesrc/WebCore | rendering/RenderListMarker.cpp | C++ | bsd-2-clause | 65,800 |
import { helper } from '@ember/component/helper';
export function fooBar(params) {
if (params[0]) {
let penaltyMap = {
30: 'Repeating Substantial Portions of a Song',
32: 'Instrumental Accompaniment',
34: 'Chorus Exceeding 4-Part Texture',
36: 'Excessive Melody Not in Inner Part',
38: 'Lack of Characteristic Chord Progression',
39: 'Excessive Lyrics < 4 parts',
40: 'Primarily Patriotic/Religious Intent',
50: 'Sound Equipment or Electronic Enhancement',
}
return penaltyMap[params[0]];
}
}
export default helper(fooBar);
| barberscore/barberscore-web | app/helpers/map-penalty.js | JavaScript | bsd-2-clause | 590 |
/**
* pims-web org.pimslims.presentation LabBookEntryDAO.java
*
* @author Marc Savitsky
* @date 8 Sep 2008
*
* Protein Information Management System
* @version: 2.2
*
* Copyright (c) 2008 Marc Savitsky The copyright holder has licenced the STFC to redistribute this software
*/
package org.pimslims.presentation;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.pimslims.dao.ReadableVersion;
import org.pimslims.model.accessControl.User;
import org.pimslims.model.core.LabBookEntry;
import org.pimslims.search.Conditions;
/**
* LabBookEntryDAO
*
*/
public class LabBookEntryDAO {
public static Collection<LabBookEntry> getLabBookEntryList(final ReadableVersion version,
final Map criteria) {
assert criteria != null;
/*
for (final Iterator it = criteria.entrySet().iterator(); it.hasNext();) {
final Map.Entry e = (Map.Entry) it.next();
//final Object value = e.getValue();
//final StringBuffer s = new StringBuffer();
//System.out.println("LabBookEntryDAO.getLabBookEntryList criteria [" + e.getKey() + ":"
// + value.getClass().getSimpleName() + "," + value.toString() + "]");
} */
final Collection<LabBookEntry> labBookEntries = version.findAll(LabBookEntry.class, criteria);
return labBookEntries;
}
public static Collection<LabBookEntry> findLabBookEntries(final Calendar day, final Calendar nextDay,
final ReadableVersion version, final User user) {
final Map<String, Object> criteria = new HashMap<String, Object>();
criteria.put(LabBookEntry.PROP_CREATIONDATE, Conditions.between(day, nextDay));
if (null != user) {
criteria.put(LabBookEntry.PROP_CREATOR, user);
}
final Collection<LabBookEntry> labBookEntries =
getLabBookEntryList(version, criteria);
criteria.clear();
criteria.put(LabBookEntry.PROP_LASTEDITEDDATE, Conditions.between(day, nextDay));
if (null != user) {
criteria.put(LabBookEntry.PROP_LASTEDITOR, user);
}
labBookEntries.addAll(getLabBookEntryList(version, criteria));
return labBookEntries;
}
}
| homiak/pims-lims | src/presentation/org/pimslims/presentation/LabBookEntryDAO.java | Java | bsd-2-clause | 2,350 |
--- src/rpcserver.cpp.orig 2017-07-10 14:23:31 UTC
+++ src/rpcserver.cpp
@@ -469,8 +469,8 @@ private:
void ServiceConnection(AcceptedConnection *conn);
//! Forward declaration required for RPCListen
-template <typename Protocol, typename SocketAcceptorService>
-static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
+template <typename Protocol>
+static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
bool fUseSSL,
boost::shared_ptr< AcceptedConnection > conn,
@@ -479,8 +479,8 @@ static void RPCAcceptHandler(boost::shar
/**
* Sets up I/O resources to accept and handle a new connection.
*/
-template <typename Protocol, typename SocketAcceptorService>
-static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
+template <typename Protocol>
+static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
const bool fUseSSL)
{
@@ -490,7 +490,7 @@ static void RPCListen(boost::shared_ptr<
acceptor->async_accept(
conn->sslStream.lowest_layer(),
conn->peer,
- boost::bind(&RPCAcceptHandler<Protocol, SocketAcceptorService>,
+ boost::bind(&RPCAcceptHandler<Protocol>,
acceptor,
boost::ref(context),
fUseSSL,
@@ -502,8 +502,8 @@ static void RPCListen(boost::shared_ptr<
/**
* Accept and handle incoming connection.
*/
-template <typename Protocol, typename SocketAcceptorService>
-static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
+template <typename Protocol>
+static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
const bool fUseSSL,
boost::shared_ptr< AcceptedConnection > conn,
@@ -597,7 +597,7 @@ void StartRPCThreads()
assert(rpc_io_service == NULL);
rpc_io_service = new asio::io_service();
- rpc_ssl_context = new ssl::context(*rpc_io_service, ssl::context::sslv23);
+ rpc_ssl_context = new ssl::context(ssl::context::sslv23);
const bool fUseSSL = GetBoolArg("-rpcssl", false);
@@ -616,7 +616,7 @@ void StartRPCThreads()
else LogPrintf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string());
string strCiphers = GetArg("-rpcsslciphers", "TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH");
- SSL_CTX_set_cipher_list(rpc_ssl_context->impl(), strCiphers.c_str());
+ SSL_CTX_set_cipher_list(rpc_ssl_context->native_handle(), strCiphers.c_str());
}
std::vector<ip::tcp::endpoint> vEndpoints;
| tuaris/FreeBSD-Coin-Ports | net-p2p/unbreakablecoin/files/patch-src_rpcserver.cpp | C++ | bsd-2-clause | 2,990 |
use strict;
use warnings;
package Grace::Toolset;
use File::Spec;
use Carp;
use Grace::Util;
my %_drivers;
sub register ($$$) {
my ($drv, $chn, $new) = @_;
my $old;
if ($old = $_drivers{$drv}{toolchain}{$chn}) {
carp(__PACKAGE__.": Driver '$drv' already registered '$chn'");
carp(__PACKAGE__.": Old Rootdir: $old->{rootdir}");
carp(__PACKAGE__.": New Rootdir: $new->{rootdir}");
carp(__PACKAGE__.": Replacing toolchain '$chn'");
}
return ($_drivers{$drv}{toolchain}{$chn} = $new);
}
BEGIN {
my ($inc, $pth, $dir, $fil, %drv, $drv);
# Trace @INC to search for Grace::Toolchain drivers.
foreach $inc (@INC) {
$pth = $inc; # Copy to $pth, to avoid altering @INC.
if (! File::Spec->file_name_is_absolute($pth)) {
# Make an absolute path out of a relative one.
$pth = File::Spec->catdir(File::Spec->curdir(), $pth);
}
# Inspect Grace/Toolchain/*.
$pth = File::Spec->catdir($pth, 'Grace', 'Toolchain');
next if (! -d $pth);
if (! opendir($dir, $pth)) {
carp("Path '$pth': $!\n");
next;
}
# Pick up *.pm from Grace/Toolchain/...
foreach $drv (grep { m{^.*\.pm$}io } readdir($dir)) {
$fil = File::Spec->catdir($pth, $drv);
$drv =~ s{^(.*)\.pm$}{Grace::Toolchain::$1}io;
$drv{$drv} = $fil;
}
closedir($dir);
}
# Doctor found driver filenames into something loadable.
foreach $drv (keys(%drv)) {
eval "require $drv" or do {
carp("Could not load driver '$drv': $@\n");
next;
};
$_drivers{$drv}{drivermod} = $drv{$drv};
}
}
sub drivers () {
return keys(%_drivers);
}
sub toolchains (@) {
shift;
print(STDERR __PACKAGE__."->toolchains([@_])\n");
my @drv = @_;
my $drv;
my @chn;
if (! @drv) {
print(STDERR "->toolchains(): no drivers specified, probe all.\n");
@drv = keys(%_drivers);
print(STDERR "->toolchains(): probe [@drv]\n");
}
foreach $drv (@drv) {
map { push(@chn, "$drv/$_") } keys(%{$_drivers{$drv}{toolchain}});
}
return @chn;
}
sub toolchain ($) {
shift;
my $req = shift;
print(STDERR __PACKAGE__."->toolchain($req)\n");
my ($drv, $chn, $cfg, $err);
($drv, $chn) = split(m{/+}o, $req, 2);
if (defined($chn)) {
$cfg = $_drivers{$drv}{toolchain}{$chn};
} else {
$chn = $drv;
foreach $drv (keys(%_drivers)) {
if ($cfg = $_drivers{$drv}{toolchain}{$chn}) {
return $cfg;
}
}
}
return $cfg;
}
# Probe Grace/Toolchain/* for appropriate toolchain drivers.
# Attempt to load each toolchain driver, in turn.
# Each toolchain driver will attempt to auto-discover toolchains.
# Each toolchain driver may present multiple toolchains.
# Each individual toolchain is individually selectable.
1;
| coreybrenner/grace | Grace/Toolset.pm | Perl | bsd-2-clause | 2,965 |
namespace Core.Framework.Permissions.Models
{
public enum PermissionArea
{
Portal,
Applications,
ControlPanel,
Content,
Plugin
}
}
| coreframework/Core-Framework | Source/Core.Framework.Permissions/Models/PermissionArea.cs | C# | bsd-2-clause | 190 |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# Copyright (c) 2019 David Shah <dave@ds0.me>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import zcu104
from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import *
from litex.soc.cores.led import LedChaser
from litex.soc.cores.bitbang import I2CMaster
from litedram.modules import MTA4ATF51264HZ
from litedram.phy import usddrphy
# CRG ----------------------------------------------------------------------------------------------
class _CRG(Module):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_sys4x = ClockDomain(reset_less=True)
self.clock_domains.cd_pll4x = ClockDomain(reset_less=True)
self.clock_domains.cd_idelay = ClockDomain()
# # #
self.submodules.pll = pll = USMMCM(speedgrade=-2)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(platform.request("clk125"), 125e6)
pll.create_clkout(self.cd_pll4x, sys_clk_freq*4, buf=None, with_reset=False)
pll.create_clkout(self.cd_idelay, 500e6)
platform.add_false_path_constraints(self.cd_sys.clk, pll.clkin) # Ignore sys_clk to pll.clkin path created by SoC's rst.
self.specials += [
Instance("BUFGCE_DIV", name="main_bufgce_div",
p_BUFGCE_DIVIDE=4,
i_CE=1, i_I=self.cd_pll4x.clk, o_O=self.cd_sys.clk),
Instance("BUFGCE", name="main_bufgce",
i_CE=1, i_I=self.cd_pll4x.clk, o_O=self.cd_sys4x.clk),
]
self.submodules.idelayctrl = USIDELAYCTRL(cd_ref=self.cd_idelay, cd_sys=self.cd_sys)
# BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(125e6), with_led_chaser=True, **kwargs):
platform = zcu104.Platform()
# SoCCore ----------------------------------------------------------------------------------
SoCCore.__init__(self, platform, sys_clk_freq,
ident = "LiteX SoC on ZCU104",
**kwargs)
# CRG --------------------------------------------------------------------------------------
self.submodules.crg = _CRG(platform, sys_clk_freq)
# DDR4 SDRAM -------------------------------------------------------------------------------
if not self.integrated_main_ram_size:
self.submodules.ddrphy = usddrphy.USPDDRPHY(platform.request("ddram"),
memtype = "DDR4",
sys_clk_freq = sys_clk_freq,
iodelay_clk_freq = 500e6)
self.add_sdram("sdram",
phy = self.ddrphy,
module = MTA4ATF51264HZ(sys_clk_freq, "1:4"),
size = 0x40000000,
l2_cache_size = kwargs.get("l2_size", 8192)
)
# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.submodules.leds = LedChaser(
pads = platform.request_all("user_led"),
sys_clk_freq = sys_clk_freq)
# Build --------------------------------------------------------------------------------------------
def main():
parser = argparse.ArgumentParser(description="LiteX SoC on ZCU104")
parser.add_argument("--build", action="store_true", help="Build bitstream.")
parser.add_argument("--load", action="store_true", help="Load bitstream.")
parser.add_argument("--sys-clk-freq", default=125e6, help="System clock frequency.")
builder_args(parser)
soc_core_args(parser)
args = parser.parse_args()
soc = BaseSoC(
sys_clk_freq = int(float(args.sys_clk_freq)),
**soc_core_argdict(args)
)
builder = Builder(soc, **builder_argdict(args))
builder.build(run=args.build)
if args.load:
prog = soc.platform.create_programmer()
prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit"))
if __name__ == "__main__":
main()
| litex-hub/litex-boards | litex_boards/targets/xilinx_zcu104.py | Python | bsd-2-clause | 4,423 |
#!/bin/bash
set -e
export GOPWT_DEBUG=1
ORIGINAL_GOPATH=${GOPATH:-$HOME/go}
# dep is not working with _ prefiexed ( like a `_integrationtest` ) dir
workspace="/tmp/gopath-gopwt-integrationtest-$$/src"
mkdir -p "$workspace"
cp -r "$(cd "$(dirname "$0")"; pwd)"/* "$workspace/"
GOPATH=$(dirname $workspace):$GOPATH
export GOPATH
cleanup() {
retval=$?
rm -rf "$(dirname $workspace)"
exit $retval
}
trap cleanup INT QUIT TERM EXIT
go_test() {
echo "> go test $*"
go test "$@"
}
echo "workspace = $workspace"
cd "$workspace"
(
echo
echo "[test dont_parse_testdata]"
cd "$workspace/dont_parse_testdata"
go_test
)
# Regression tests
for issue in issue33 issue40 issue44
do
(
echo
echo "[test $issue]"
rm -rf "$HOME/.gopwtcache"
cd "$workspace/regression/$issue"
go_test
go_test
go_test
)
done
# test vendoring
(
GOPATH=$(dirname $workspace)
export GOPATH
echo
echo "[test issue36]"
rm -rf "$HOME/.gopwtcache"
cd "$workspace/regression/issue36"
dep ensure -v -vendor-only
rm -rf "vendor/github.com/ToQoz/gopwt"
cp -r "$ORIGINAL_GOPATH/src/github.com/ToQoz/gopwt" "vendor/github.com/ToQoz/"
# for go1.8-
find vendor -type f | grep '_test.go$' | xargs rm
go_test -v ./...
go_test -v ./...
go_test -v ./...
)
| ToQoz/gopwt | _integrationtest/test.sh | Shell | bsd-2-clause | 1,290 |
/*
Copyright (c) 2017, Palo Alto Research Center
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// The source file being tested
#include <LongBow/unit-test.h>
#include "../src/folio_LinkedList.c"
LONGBOW_TEST_RUNNER(folio_LinkedList)
{
LONGBOW_RUN_TEST_FIXTURE(Global);
}
LONGBOW_TEST_RUNNER_SETUP(folio_LinkedList)
{
return LONGBOW_STATUS_SUCCEEDED;
}
LONGBOW_TEST_RUNNER_TEARDOWN(folio_LinkedList)
{
return LONGBOW_STATUS_SUCCEEDED;
}
LONGBOW_TEST_FIXTURE(Global)
{
LONGBOW_RUN_TEST_CASE(Global, folioLinkedList_Create);
LONGBOW_RUN_TEST_CASE(Global, folioLinkedList_Append);
}
LONGBOW_TEST_FIXTURE_SETUP(Global)
{
return LONGBOW_STATUS_SUCCEEDED;
}
LONGBOW_TEST_FIXTURE_TEARDOWN(Global)
{
int status = LONGBOW_STATUS_SUCCEEDED;
if (!folio_TestRefCount(0, stdout, "Memory leak in %s\n", longBowTestCase_GetFullName(testCase))) {
folio_Report(stdout);
status = LONGBOW_STATUS_MEMORYLEAK;
}
return status;
}
LONGBOW_TEST_CASE(Global, folioLinkedList_Create)
{
FolioLinkedList *list = folioLinkedList_Create();
assertNotNull(list, "Got null from create");
folioLinkedList_Release(&list);
}
typedef struct integer_t {
int value;
} Integer;
LONGBOW_TEST_CASE(Global, folioLinkedList_Append)
{
FolioLinkedList *list = folioLinkedList_Create();
assertNotNull(list, "Got null from create");
const size_t count = 4;
Integer *truthArray[count];
for (unsigned i = 0; i < count; ++i) {
Integer *integer = folio_Allocate(sizeof(Integer));
integer->value = i;
truthArray[i] = integer;
folioLinkedList_Append(list, integer);
}
for (unsigned i = 0; i < count; ++i) {
Integer *truth = truthArray[i];
Integer *test = folioLinkedList_Remove(list);
assertTrue(truth->value == test->value, "Wrong element, expected %d actual %d",
truth->value, test->value);
folio_Release((void **) &truth);
folio_Release((void **) &test);
}
folioLinkedList_Release(&list);
}
/*****************************************************/
/*****************************************************/
int
main(int argc, char *argv[argc])
{
LongBowRunner *testRunner = LONGBOW_TEST_RUNNER_CREATE(folio_LinkedList);
int exitStatus = LONGBOW_TEST_MAIN(argc, argv, testRunner, NULL);
longBowTestRunner_Destroy(&testRunner);
exit(exitStatus);
}
| mmosko/Folio | test/test_folio_LinkedList.c | C | bsd-2-clause | 3,567 |
---
category: dashboards
parent_category: user-guide
helpscout_url: https://help.redash.io/article/61-creating-a-dashboard
title: Creating and Editing Dashboards
slug: dashboard-editing
toc: true
---
# Creating a Dashboard
A dashboard lets you combine visualizations and text boxes that provide context with your data.

You can create a new dashboard with the **Create** button from the main navigation menu:

After naming your dashboard, you can add widgets from existing query visualizations or by writing commentary with a text box. Start by clicking the **Add Widget** button.

Search existing queries or pick a recent one from the pre-populated list:

## Dashboard URLs
When you create a dashboard, Redash automatically assigns it an `id` number and a URL `slug`. The slug is based on the name of the dashboard. For example a dashboard named "Account Overview" could have this URL:
`https://redash.app/dashboards/251-account-overview`
If you change the dashboard name to "Account Over (Old)", the URL will update to:
`https://redash.app/dashboards/251-account-overview-old-`
The dashboard can also be reached using the `/dashboard` endpoint (notice this is singular), which accepts _either_ an ID or a slug:
- `https://redash.app/dashboard/251`
- `https://redash.app/dashboard/account-overview`
Dashboard ids are guaranteed to be unique. But multiple dashboards may use the same name (and therefore `slug`). If a user visits `/dashboard/account-overview` and more than one dashboard exists with that slug, they will be redirected to the earliest created dashboard with that slug.
# Picking Visualizations
By default, query results are shown in a table. At the moment it's not possible to create a new visualization from the "Add Widget" menu, so you'll need to open the query and add the visualization there beforehand ([instructions]({% link _kb/user-guide/visualizations/visualizations-how-to.md %})).
# Adding Text Boxes
Add a text box to your dashboard using the `Text Box` tab on the **Add Widget** dialog. You can style the text boxes in your dashboards using [Markdown](https://daringfireball.net/projects/markdown/syntax).
{% callout info %}
You can include static images on your dashboards within your markdown-formatted text boxes. Just use markdown image syntax:``
{% endcallout %}
# Dashboard Filters
When queries have filters you need to apply filters at the dashboard level as well. Setting your dashboard filters flag will cause the filter to be applied to all Queries.
1\. Open dashboard settings:
<img src="/assets/images/docs/gitbook/edit-dashboard.png" width="60%">
2\. Check the "Use Dashboard Level Filters" checkbox:

# Managing Dashboard Permissions
By default, dashboards can only be modified by the user who created them and members of the Admin group. But Redash includes experimental support to share edit permissions with non-Admin users. An Admin in your organization needs to enable it first. Open your organization settings and check the "Enable experimental multiple owners support"

Now the Dashboard options menu includes a `Manage Permissions` option. Clicking on it it will open a dialog where you can add other users as editors to your dashboard.

Please note that currently the users you add won't receive a notification, so you will need to notify them manually.
# Dashboard Refresh
Even large dashboards should load quickly because they fetch their data from a cache that renews whenever a query runs. But if you haven't run the queries recently, your dashboard might be stale. It could even mix old data with new if some queries ran more recently than others.
To force a refresh, click the Refresh button on the upper-right of the dashboard editor. This runs all the dashboard queries and updates its visualizations.
If you want this to happen periodically you can activate Automatic Dashboard Refresh from the UI by clicking the dropdown pictured below. Or you can pass a `refresh` query string variable with your dashboard URL. **The allowed refresh intervals are expressed in seconds**: 60, 300, 600, 1800, 3600, 43200, and 86400.

{% callout info %}
Automatic Dashboard Refresh occurs as part of the Redash frontend application. Your refresh schedule is only in-effect as long as a logged-in user has the dashboard open in their browser. To guarantee that your queries are executed regularly (which is important for alerts), you should use a [Scheduled Query]({% link _kb/user-guide/querying/scheduling-a-query.md %}) instead.
{% endcallout %}
On public dashboards there is no Refresh button. You can add `refresh` to the query string. And for dashboards with parameters you can trigger a refresh by changing a parameter value and clicking **Apply Changes**.

| getredash/website | src/pages/kb/user-guide/dashboards/dashboard-editing.md | Markdown | bsd-2-clause | 5,302 |
package org.javafunk.funk.predicates;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.javafunk.funk.functors.Predicate;
/**
* {@code InstanceOfPredicate} is a {@code Predicate} implementation that
* is constructed with a {@code Class} instance and when asked to evaluate
* an object will return {@code true} if that object is an instance of the
* supplied {@code Class} and {@code false} otherwise.
*
* @param <T> The type of object this {@code InstanceOfPredicate} can
* evaluate.
*/
public class InstanceOfPredicate<T> implements Predicate<T> {
private final Class<?> testClass;
/**
* Constructs an {@code InstanceOfPredicate} instance over the
* supplied {@code Class} instance.
*
* @param testClass The {@code Class} instance against which
* instances will be checked.
*/
public InstanceOfPredicate(Class<?> testClass) {
this.testClass = testClass;
}
/**
* Evaluates the supplied instance of type {@code T} against
* the {@code Class} instance associated with this
* {@code InstanceOfPredicate}.
*
* <p>If the supplied object is an instance of the
* {@code Class} instance associated with this
* {@code InstanceOfPredicate}, {@code true} is returned,
* otherwise {@code false} is returned.</p>
*
* @param instance An instance of type {@code T} to evaluate.
* @return {@code true} if the supplied object is an instance
* of the associated {@code Class}, {@code false}
* otherwise.
*/
@Override public boolean evaluate(T instance) {
return testClass.isInstance(instance);
}
/**
* Implements value equality for {@code InstanceOfPredicate} instances. Two
* {@code InstanceOfPredicate}s are considered equal if the {@code Class}
* instance supplied at construction is equal.
*
* <p>Due to type erasure,
* {@code new InstanceOfPredicate<X>(Some.class).equals(new InstanceOfPredicate<Y>(Some.class)}
* will be {@code true} for all types {@code X} and {@code Y}.</p>
*
* @param other The object to check for equality to this {@code InstanceOfPredicate}.
* @return {@code true} if the supplied object is also an {@code InstanceOfPredicate}
* over the same {@code Class} instance, otherwise {@code false}.
*/
@Override public boolean equals(Object other) {
return EqualsBuilder.reflectionEquals(this, other);
}
/**
* Two {@code InstanceOfPredicate} instances will have equal hash codes
* if they are constructed over the same {@code Class} instance.
*
* @return The hash code of this {@code InstanceOfPredicate}.
*/
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
}
| javafunk/funk | funk-core/src/main/java/org/javafunk/funk/predicates/InstanceOfPredicate.java | Java | bsd-2-clause | 2,911 |
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<link href="../css/help.css" rel="stylesheet" media="all">
<title>The Source Code</title>
<meta name="copyright" content="Copyright 2004, 2005, 2007 Henry Weiss">
<meta name="description" content="Get your hands on CocoaPad's source code.">
<meta name="keywords" content="source, code, developer, program, programming, open source, listing, Xcode, Project Builder, Interface Builder, Objective-C, Cocoa, Objective, C, Objective C, Developer Tools, building, executable, header, implementation, class, object, .m, .h, project">
</head>
<body>
<a name="opensource"></a>
<div id="mainbox">
<div id="caticon">
<img src="../images/CocoaPad_small.png" alt="CocoaPad Icon" height="32" width="32">
</div>
<div id="pagetitle">
<h1>The Source Code</h1>
</div>
<p>Since CocoaPad is open source, the source code is given away. The code, along with some other stuff, is located in the <code>/Extras/Source/</code> folder on your installer disk image. The actual Xcode project files and Objective-C source code are in the <code>/Extras/Source/Source Code/</code> folder.
<table width="100%"><tr><td align="left" width="32"><img src="../images/stop.png" align="left" hspace="5" vspace="5"></td><td align="left" valign="top"><div id="message">The project files require Mac OS X 10.3 Panther and Xcode Tools 1.0 or later (they are <code>.xcode</code> files). The source files (<code>.h</code> and <code>.m</code> files) can be viewed with any text editor.</div></td></tr></table>
<p>Be sure to read the README in the <code>Source/</code> folder, so you know which files are which, how to build, etc.
<p>Although CocoaPad is relatively simple, you might want to understand the code better. That's why we've included the <code>Developer Notes</code> file, which contains notes on the program, the files, etc. Developer Notes is located in <code>/Extras/Source/</code>.
<p>If you have problems, you can always contact me at <a href="mailto:betacheese@gmail.com">betacheese@gmail.com</a>.
<p>Have fun!
<hr><p><a href="../index.html">Table of Contents</a></p>
</div>
</body>
</html> | henrybw/CocoaPad | English.lproj/CocoaPad Help/about/opensource.html | HTML | bsd-2-clause | 2,162 |
from JumpScale import j
from GitFactory import GitFactory
j.base.loader.makeAvailable(j, 'clients')
j.clients.git = GitFactory()
| Jumpscale/jumpscale6_core | lib/JumpScale/baselib/git/__init__.py | Python | bsd-2-clause | 131 |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#if STATS
class FAsyncStatsWrite;
/**
* Magic numbers for stats streams, this is for the first version.
*/
enum EStatMagicNoHeader : uint32
{
MAGIC_NO_HEADER = 0x7E1B83C1,
MAGIC_NO_HEADER_SWAPPED = 0xC1831B7E,
NO_VERSION = 0,
};
/**
* Magic numbers for stats streams, this is for the second and later versions.
* Allows more advanced options.
*/
enum EStatMagicWithHeader : uint32
{
MAGIC = 0x10293847,
MAGIC_SWAPPED = 0x47382910,
VERSION_2 = 2,
VERSION_3 = 3,
/**
* Added support for compressing the stats data, now each frame is compressed.
* !!CAUTION!! Deprecated.
*/
VERSION_4 = 4,
HAS_COMPRESSED_DATA_VER = VERSION_4,
/**
* New low-level raw stats with memory profiler functionality.
* !!CAUTION!! Not backward compatible with version 4.
*/
VERSION_5 = 5,
/**
* Added realloc message to avoid sending alloc and free
* Should also reduce the amount of all messages
* !!CAUTION!! Not backward compatible with version 5.
*/
VERSION_6 = 6,
/** Latest version. */
VERSION_LATEST = VERSION_6,
};
struct EStatsFileConstants
{
enum
{
/**
* Maximum size of the data that can be compressed.
*/
MAX_COMPRESSED_SIZE = 1024 * 1024,
/** Header reserved for the compression internals. */
DUMMY_HEADER_SIZE = 1024,
/** Indicates the end of the compressed data. */
END_OF_COMPRESSED_DATA = 0xE0F0DA4A,
/** Indicates that the compression is disabled for the data. */
NO_COMPRESSION = 0,
};
};
/*-----------------------------------------------------------------------------
FCompressedStatsData
-----------------------------------------------------------------------------*/
/** Helper struct used to operate on the compressed data. */
struct CORE_API FCompressedStatsData
{
/**
* Initialization constructor
*
* @param SrcData - uncompressed data if saving, compressed data if loading
* @param DestData - compressed data if saving, uncompressed data if loading
*
*/
FCompressedStatsData( TArray<uint8>& InSrcData, TArray<uint8>& InDestData )
: SrcData( InSrcData )
, DestData( InDestData )
, bEndOfCompressedData( false )
{}
/**
* Writes a special data to mark the end of the compressed data.
*/
static void WriteEndOfCompressedData( FArchive& Writer )
{
int32 Marker = EStatsFileConstants::END_OF_COMPRESSED_DATA;
check( Writer.IsSaving() );
Writer << Marker << Marker;
}
protected:
/** Serialization operator. */
friend FArchive& operator << (FArchive& Ar, FCompressedStatsData& Data)
{
if( Ar.IsSaving() )
{
Data.WriteCompressed( Ar );
}
else if( Ar.IsLoading() )
{
Data.ReadCompressed( Ar );
}
else
{
check( 0 );
}
return Ar;
}
/** Compress the data and writes to the archive. */
void WriteCompressed( FArchive& Writer )
{
int32 UncompressedSize = SrcData.Num();
if( UncompressedSize > EStatsFileConstants::MAX_COMPRESSED_SIZE - EStatsFileConstants::DUMMY_HEADER_SIZE )
{
int32 DisabledCompressionSize = EStatsFileConstants::NO_COMPRESSION;
Writer << DisabledCompressionSize << UncompressedSize;
Writer.Serialize( SrcData.GetData(), UncompressedSize );
}
else
{
DestData.Reserve( EStatsFileConstants::MAX_COMPRESSED_SIZE );
int32 CompressedSize = DestData.GetAllocatedSize();
const bool bResult = FCompression::CompressMemory( COMPRESS_ZLIB, DestData.GetData(), CompressedSize, SrcData.GetData(), UncompressedSize );
check( bResult );
Writer << CompressedSize << UncompressedSize;
Writer.Serialize( DestData.GetData(), CompressedSize );
}
}
/** Reads the data and decompresses it. */
void ReadCompressed( FArchive& Reader )
{
int32 CompressedSize = 0;
int32 UncompressedSize = 0;
Reader << CompressedSize << UncompressedSize;
if( CompressedSize == EStatsFileConstants::END_OF_COMPRESSED_DATA && UncompressedSize == EStatsFileConstants::END_OF_COMPRESSED_DATA )
{
bEndOfCompressedData = true;
}
// This chunk is not compressed.
else if( CompressedSize == 0 )
{
DestData.Reset( UncompressedSize );
DestData.AddUninitialized( UncompressedSize );
Reader.Serialize( DestData.GetData(), UncompressedSize );
}
else
{
SrcData.Reset( CompressedSize );
DestData.Reset( UncompressedSize );
SrcData.AddUninitialized( CompressedSize );
DestData.AddUninitialized( UncompressedSize );
Reader.Serialize( SrcData.GetData(), CompressedSize );
const bool bResult = FCompression::UncompressMemory( COMPRESS_ZLIB, DestData.GetData(), UncompressedSize, SrcData.GetData(), CompressedSize );
check( bResult );
}
}
public:
/**
* @return true if we reached the end of the compressed data.
*/
const bool HasReachedEndOfCompressedData() const
{
return bEndOfCompressedData;
}
protected:
/** Reference to the source data. */
TArray<uint8>& SrcData;
/** Reference to the destination data. */
TArray<uint8>& DestData;
/** Set to true if we reached the end of the compressed data. */
bool bEndOfCompressedData;
};
/*-----------------------------------------------------------------------------
Stats file writing functionality
-----------------------------------------------------------------------------*/
/** Header for a stats file. */
struct FStatsStreamHeader
{
/** Default constructor. */
FStatsStreamHeader()
: Version( 0 )
, FrameTableOffset( 0 )
, FNameTableOffset( 0 )
, NumFNames( 0 )
, MetadataMessagesOffset( 0 )
, NumMetadataMessages( 0 )
, bRawStatsFile( false )
{}
/**
* Version number to detect version mismatches
* 1 - Initial version for supporting raw ue4 stats files
*/
uint32 Version;
/** Platform that this file was captured on. */
FString PlatformName;
/**
* Offset in the file for the frame table. Serialized as TArray<int64>
* For raw stats contains only one element which indicates the begin of the data. */
uint64 FrameTableOffset;
/** Offset in the file for the FName table. Serialized with WriteFName/ReadFName. */
uint64 FNameTableOffset;
/** Number of the FNames. */
uint64 NumFNames;
/** Offset in the file for the metadata messages. Serialized with WriteMessage/ReadMessage. */
uint64 MetadataMessagesOffset;
/** Number of the metadata messages. */
uint64 NumMetadataMessages;
/** Whether this stats file uses raw data, required for thread view/memory profiling/advanced profiling. */
bool bRawStatsFile;
/** Whether this stats file has all names stored at the end of file. */
bool IsFinalized() const
{
return NumMetadataMessages > 0 && MetadataMessagesOffset > 0 && FrameTableOffset > 0;
}
/** Whether this stats file contains compressed data and needs the special serializer to read that data. */
bool HasCompressedData() const
{
return Version >= EStatMagicWithHeader::HAS_COMPRESSED_DATA_VER;
}
/** Serialization operator. */
friend FArchive& operator << (FArchive& Ar, FStatsStreamHeader& Header)
{
Ar << Header.Version;
if( Ar.IsSaving() )
{
Header.PlatformName.SerializeAsANSICharArray( Ar, 255 );
}
else if( Ar.IsLoading() )
{
Ar << Header.PlatformName;
}
Ar << Header.FrameTableOffset;
Ar << Header.FNameTableOffset
<< Header.NumFNames;
Ar << Header.MetadataMessagesOffset
<< Header.NumMetadataMessages;
Ar << Header.bRawStatsFile;
return Ar;
}
};
/**
* Contains basic information about one frame of the stats.
* This data is used to generate ultra-fast preview of the stats history without the requirement of reading the whole file.
*/
struct FStatsFrameInfo
{
/** Empty constructor. */
FStatsFrameInfo()
: FrameFileOffset(0)
{}
/** Initialization constructor. */
FStatsFrameInfo( int64 InFrameFileOffset )
: FrameFileOffset(InFrameFileOffset)
{}
/** Initialization constructor. */
FStatsFrameInfo( int64 InFrameFileOffset, TMap<uint32, int64>& InThreadCycles )
: FrameFileOffset(InFrameFileOffset)
, ThreadCycles(InThreadCycles)
{}
/** Serialization operator. */
friend FArchive& operator << (FArchive& Ar, FStatsFrameInfo& Data)
{
Ar << Data.ThreadCycles << Data.FrameFileOffset;
return Ar;
}
/** Frame offset in the stats file. */
int64 FrameFileOffset;
/** Thread cycles for this frame. */
TMap<uint32, int64> ThreadCycles;
};
/** Interface for writing stats data. Can be only used in the stats thread. */
struct CORE_API IStatsWriteFile
{
friend class FAsyncStatsWrite;
protected:
/** Stats file archive. */
FArchive* File;
/** Filename of the archive that we are writing to. */
FString ArchiveFilename;
/** Stats stream header. */
FStatsStreamHeader Header;
/** Set of names already sent. */
TSet<int32> FNamesSent;
/** Async task used to offload saving the capture data. */
FAsyncTask<FAsyncStatsWrite>* AsyncTask;
/** Data to write through the async task. **/
TArray<uint8> OutData;
/** Buffer to store the compressed data, used by the FAsyncStatsWrite. */
TArray<uint8> CompressedData;
/**
* Array of stats frames info already captured.
* !!CAUTION!!
* Only modified in the async write thread through FinalizeSavingData method.
*/
TArray<FStatsFrameInfo> FramesInfo;
protected:
/** Default constructor. */
IStatsWriteFile();
public:
/** Destructor. */
virtual ~IStatsWriteFile()
{}
protected:
/** NewFrame delegate handle */
FDelegateHandle DataDelegateHandle;
public:
/** Creates a file writer and registers for the data delegate. */
void Start( const FString& InFilename );
/** Finalizes writing the stats data and unregisters the data delegate. */
void Stop();
protected:
/** Sets the data delegate used to receive a stats data. */
virtual void SetDataDelegate( bool bSet ) = 0;
/** Finalization code called after the compressed data has been saved. */
virtual void FinalizeSavingData( int64 FrameFileOffset )
{};
bool IsValid() const
{
return !!File;
}
public:
const TArray<uint8>& GetOutData() const
{
return OutData;
}
void ResetData()
{
OutData.Reset();
}
/** Writes magic value, dummy header and initial metadata. */
void WriteHeader();
protected:
/** Writes metadata messages into the stream. */
void WriteMetadata( FArchive& Ar );
/** Finalizes writing to the file. */
void Finalize();
/** Sends the data to the file via async task. */
void SendTask();
/** Sends an FName, and the string it represents if we have not sent that string before. **/
FORCEINLINE_STATS void WriteFName( FArchive& Ar, FStatNameAndInfo NameAndInfo )
{
FName RawName = NameAndInfo.GetRawName();
bool bSendFName = !FNamesSent.Contains( RawName.GetComparisonIndex() );
int32 Index = RawName.GetComparisonIndex();
Ar << Index;
int32 Number = NameAndInfo.GetRawNumber();
if( bSendFName )
{
FNamesSent.Add( RawName.GetComparisonIndex() );
Number |= EStatMetaFlags::SendingFName << (EStatMetaFlags::Shift + EStatAllFields::StartShift);
}
Ar << Number;
if( bSendFName )
{
FString Name = RawName.ToString();
Ar << Name;
}
}
/** Write a stat message. **/
FORCEINLINE_STATS void WriteMessage( FArchive& Ar, FStatMessage const& Item )
{
WriteFName( Ar, Item.NameAndInfo );
switch( Item.NameAndInfo.GetField<EStatDataType>() )
{
case EStatDataType::ST_int64:
{
int64 Payload = Item.GetValue_int64();
Ar << Payload;
break;
}
case EStatDataType::ST_double:
{
double Payload = Item.GetValue_double();
Ar << Payload;
break;
}
case EStatDataType::ST_FName:
{
WriteFName( Ar, FStatNameAndInfo( Item.GetValue_FName(), false ) );
break;
}
case EStatDataType::ST_Ptr:
{
uint64 Payload = Item.GetValue_Ptr();
Ar << Payload;
break;
}
}
}
};
/** Helper struct used to write regular stats to the file. */
struct CORE_API FStatsWriteFile : public IStatsWriteFile
{
friend class FAsyncStatsWrite;
protected:
/** Thread cycles for the last frame. */
TMap<uint32, int64> ThreadCycles;
public:
/** Default constructor, set bRawStatsFile to false. */
FStatsWriteFile()
{
Header.bRawStatsFile = false;
}
protected:
virtual void SetDataDelegate( bool bSet ) override;
virtual void FinalizeSavingData( int64 FrameFileOffset ) override;
public:
/**
* Grabs a frame from the local FStatsThreadState and writes it to the array.
* Only used by the ProfilerServiceManager.
*/
void WriteFrame( int64 TargetFrame, bool bNeedFullMetadata );
protected:
/**
* Grabs a frame from the local FStatsThreadState and adds it to the output.
* Called from the stats thread, but the data is saved using the the FAsyncStatsWrite.
*/
void WriteFrame( int64 TargetFrame )
{
WriteFrame( TargetFrame, false );
SendTask();
}
};
/** Helper struct used to write raw stats to the file. */
struct CORE_API FRawStatsWriteFile : public IStatsWriteFile
{
bool bWrittenOffsetToData;
public:
/** Default constructor, set bRawStatsFile to true. */
FRawStatsWriteFile()
: bWrittenOffsetToData(false)
{
Header.bRawStatsFile = true;
}
protected:
virtual void SetDataDelegate( bool bSet ) override;
void WriteRawStatPacket( const FStatPacket* StatPacket );
/** Write a stat packed into the specified archive. */
void WriteStatPacket( FArchive& Ar, FStatPacket& StatPacket );
};
/*-----------------------------------------------------------------------------
Stats file reading functionality
-----------------------------------------------------------------------------*/
/**
* Class for maintaining state of receiving a stream of stat messages
*/
struct CORE_API FStatsReadStream
{
public:
/** Stats stream header. */
FStatsStreamHeader Header;
/** FNames have a different index on each machine, so we translate via this map. **/
TMap<int32, int32> FNamesIndexMap;
/** Array of stats frame info. Empty for the raw stats. */
TArray<FStatsFrameInfo> FramesInfo;
/** Reads a stats stream header, returns true if the header is valid and we can continue reading. */
bool ReadHeader( FArchive& Ar )
{
bool bStatWithHeader = false;
uint32 Magic = 0;
Ar << Magic;
if( Magic == EStatMagicNoHeader::MAGIC_NO_HEADER )
{
}
else if( Magic == EStatMagicNoHeader::MAGIC_NO_HEADER_SWAPPED )
{
Ar.SetByteSwapping( true );
}
else if( Magic == EStatMagicWithHeader::MAGIC )
{
bStatWithHeader = true;
}
else if( Magic == EStatMagicWithHeader::MAGIC_SWAPPED )
{
bStatWithHeader = true;
Ar.SetByteSwapping( true );
}
else
{
return false;
}
// We detected a header for a stats file, read it.
if( bStatWithHeader )
{
Ar << Header;
}
return true;
}
/** Reads a stat packed from the specified archive. Only for raw stats files. */
void ReadStatPacket( FArchive& Ar, FStatPacket& StatPacked )
{
Ar << StatPacked.Frame;
Ar << StatPacked.ThreadId;
int32 MyThreadType = 0;
Ar << MyThreadType;
StatPacked.ThreadType = (EThreadType::Type)MyThreadType;
Ar << StatPacked.bBrokenCallstacks;
// We must handle stat messages in a different way.
int32 NumMessages = 0;
Ar << NumMessages;
StatPacked.StatMessages.Reserve( NumMessages );
for( int32 MessageIndex = 0; MessageIndex < NumMessages; ++MessageIndex )
{
new(StatPacked.StatMessages) FStatMessage( ReadMessage( Ar, true ) );
}
}
/** Read and translate or create an FName. **/
FORCEINLINE_STATS FStatNameAndInfo ReadFName( FArchive& Ar, bool bHasFNameMap )
{
// If we read the whole FNames translation map, we don't want to add the FName again.
// This is a bit tricky, even if we have the FName translation map, we still need to read the FString.
// CAUTION!! This is considered to be thread safe in this case.
int32 Index = 0;
Ar << Index;
int32 Number = 0;
Ar << Number;
FName TheFName;
if( !bHasFNameMap )
{
if( Number & (EStatMetaFlags::SendingFName << (EStatMetaFlags::Shift + EStatAllFields::StartShift)) )
{
FString Name;
Ar << Name;
TheFName = FName( *Name );
FNamesIndexMap.Add( Index, TheFName.GetComparisonIndex() );
Number &= ~(EStatMetaFlags::SendingFName << (EStatMetaFlags::Shift + EStatAllFields::StartShift));
}
else
{
if( FNamesIndexMap.Contains( Index ) )
{
int32 MyIndex = FNamesIndexMap.FindChecked( Index );
TheFName = FName( MyIndex, MyIndex, 0 );
}
else
{
TheFName = FName( TEXT( "Unknown FName" ) );
Number = 0;
UE_LOG( LogTemp, Warning, TEXT( "Missing FName Indexed: %d, %d" ), Index, Number );
}
}
}
else
{
if( Number & (EStatMetaFlags::SendingFName << (EStatMetaFlags::Shift + EStatAllFields::StartShift)) )
{
FString Name;
Ar << Name;
Number &= ~(EStatMetaFlags::SendingFName << (EStatMetaFlags::Shift + EStatAllFields::StartShift));
}
if( FNamesIndexMap.Contains( Index ) )
{
int32 MyIndex = FNamesIndexMap.FindChecked( Index );
TheFName = FName( MyIndex, MyIndex, 0 );
}
else
{
TheFName = FName( TEXT( "Unknown FName" ) );
Number = 0;
UE_LOG( LogTemp, Warning, TEXT( "Missing FName Indexed: %d, %d" ), Index, Number );
}
}
FStatNameAndInfo Result( TheFName, false );
Result.SetNumberDirect( Number );
return Result;
}
/** Read a stat message. **/
FORCEINLINE_STATS FStatMessage ReadMessage( FArchive& Ar, bool bHasFNameMap = false )
{
FStatMessage Result( ReadFName( Ar, bHasFNameMap ) );
Result.Clear();
switch( Result.NameAndInfo.GetField<EStatDataType>() )
{
case EStatDataType::ST_int64:
{
int64 Payload = 0;
Ar << Payload;
Result.GetValue_int64() = Payload;
break;
}
case EStatDataType::ST_double:
{
double Payload = 0;
Ar << Payload;
Result.GetValue_double() = Payload;
break;
}
case EStatDataType::ST_FName:
{
FStatNameAndInfo Payload( ReadFName( Ar, bHasFNameMap ) );
Result.GetValue_FMinimalName() = NameToMinimalName( Payload.GetRawName() );
break;
}
case EStatDataType::ST_Ptr:
{
uint64 Payload = 0;
Ar << Payload;
Result.GetValue_Ptr() = Payload;
break;
}
}
return Result;
}
/**
* Reads stats frames info from the specified archive, only valid for finalized stats files.
* Allows unordered file access and whole data mini-view.
*/
void ReadFramesOffsets( FArchive& Ar )
{
Ar.Seek( Header.FrameTableOffset );
Ar << FramesInfo;
}
/**
* Reads FNames and metadata messages from the specified archive, only valid for finalized stats files.
* Allow unordered file access.
*/
void ReadFNamesAndMetadataMessages( FArchive& Ar, TArray<FStatMessage>& out_MetadataMessages )
{
// Read FNames.
Ar.Seek( Header.FNameTableOffset );
out_MetadataMessages.Reserve( Header.NumFNames );
for( int32 Index = 0; Index < Header.NumFNames; Index++ )
{
ReadFName( Ar, false );
}
// Read metadata messages.
Ar.Seek( Header.MetadataMessagesOffset );
out_MetadataMessages.Reserve( Header.NumMetadataMessages );
for( int32 Index = 0; Index < Header.NumMetadataMessages; Index++ )
{
new(out_MetadataMessages)FStatMessage( ReadMessage( Ar, false ) );
}
}
};
/** Raw stats information. */
struct FRawStatsFileInfo
{
/** Default constructor. */
FRawStatsFileInfo()
: TotalPacketsSize( 0 )
, TotalStatMessagesNum( 0 )
, MaximumPacketSize( 0 )
, TotalPacketsNum( 0 )
{}
/** Size of all packets. */
int32 TotalPacketsSize;
/** Number of all stat messages. */
int32 TotalStatMessagesNum;
/** Maximum packet size. */
int32 MaximumPacketSize;
/** Number of all packets. */
int32 TotalPacketsNum;
};
/** Enumerates stats processing stages. */
enum class EStatsProcessingStage : int32
{
/** Started loading. */
SPS_Started = 0,
/** Read and combine packets. */
SPS_ReadStats,
/** Pre process stats, prepare. */
SPS_PreProcessStats,
/** Process combine history. */
SPS_ProcessStats,
/** Post process stats, finalize. */
SPS_PostProcessStats,
/** Finished processing. */
SPS_Finished,
/** Stopped processing. */
SPS_Stopped,
/** Last stage, at this moment all data is read and processed or process has been stopped, we can now remove the instance. */
SPS_Invalid,
};
struct FStatsReadFile;
/**
* Helper class used to read and process raw stats file on the async task.
*/
class FAsyncRawStatsFile
{
/** Pointer to FStatsReadFile to call for async work. */
FStatsReadFile* Owner;
public:
/** Initialization constructor. */
FAsyncRawStatsFile( FStatsReadFile* InOwner );
/** Call DoWork on the parent */
void DoWork();
TStatId GetStatId() const
{
return TStatId();
}
/** This task is abandonable. */
bool CanAbandon()
{
return true;
}
/** Abandon this task. */
void Abandon();
};
/*-----------------------------------------------------------------------------
Stats stack helpers
-----------------------------------------------------------------------------*/
/** Holds stats stack state, used to preserve continuity when the game frame has changed. For raw stats. */
struct FStackState
{
/** Default constructor. */
FStackState()
: bIsBrokenCallstack( false )
{}
/** Call stack. */
TArray<FName> Stack;
/** Current function name. */
FName Current;
/** Whether this callstack is marked as broken due to mismatched start and end scope cycles. */
bool bIsBrokenCallstack;
};
/*-----------------------------------------------------------------------------
FStatsReadFile
-----------------------------------------------------------------------------*/
template<typename T>
struct FCreateStatsReader
{
/** Creates a new reader for raw stats file. Will be nullptr for invalid files. */
static T* ForRawStats( const TCHAR* Filename )
{
T* StatsReadFile = new T( Filename );
const bool bValid = StatsReadFile->PrepareLoading();
if (!bValid)
{
delete StatsReadFile;
}
return bValid ? StatsReadFile : nullptr;
}
};
/** Struct used to read from ue4stats/ue4statsraw files, initializes all metadata and starts a process of reading the file asynchronously. */
struct CORE_API FStatsReadFile
{
friend class FAsyncRawStatsFile;
/** Number of seconds between updating the current stage. */
static const double NumSecondsBetweenUpdates;
/** Creates a new reader for regular stats file. Will be nullptr for invalid files. */
static FStatsReadFile* CreateReaderForRegularStats( const TCHAR* Filename );
public:
/** Reads and processes the file on the current thread. This is a blocking operation. */
void ReadAndProcessSynchronously();
/** Reads and processes the file using the async tasks on the pool thread. The read data is sent to the game thread using the task graph. This is a non-blocking operation. */
void ReadAndProcessAsynchronously();
protected:
/** Initialization constructor. */
FStatsReadFile( const TCHAR* InFilename, bool bInRawStatsFile );
public:
/** Destructor. */
virtual ~FStatsReadFile();
protected:
/**
* Prepares file to be loaded, makes sanity checks, reads and initializes metadata
* @return true, if the process was completed successfully
*/
bool PrepareLoading();
/** Reads stats from the file into combined history. */
void ReadStats();
/** Called before started processing combined history. */
virtual void PreProcessStats();
/** Processes combined history using the internal functionality and provided overloaded Process*Operation methods. */
void ProcessStats();
/** Called after finished processing combined history. */
virtual void PostProcessStats();
/** Processes special message for advancing the stats frame from the game thread. */
virtual void ProcessAdvanceFrameEventGameThreadOperation( const FStatMessage& Message, const FStackState& StackState )
{}
/** Processes special message for advancing the stats frame from the render thread. */
virtual void ProcessAdvanceFrameEventRenderThreadOperation( const FStatMessage& Message, const FStackState& StackState )
{}
/** ProcessesIndicates begin of the cycle scope. */
virtual void ProcessCycleScopeStartOperation( const FStatMessage& Message, const FStackState& StackState )
{}
/** Indicates end of the cycle scope. */
virtual void ProcessCycleScopeEndOperation( const FStatMessage& Message, const FStackState& StackState )
{}
/** Processes special message marker used determine that we encountered a special data in the stat file. */
virtual void ProcessSpecialMessageMarkerOperation( const FStatMessage& Message, const FStackState& StackState )
{}
// #YRX_Stats: 2015-07-13 Not implemented yet.
// /** Processes set operation. */
// virtual void ProcessSetOperation( const FStatMessage& Message, const FStackState& StackState )
// {}
//
// /** Processes clear operation. */
// virtual void ProcessClearOperation( const FStatMessage& Message, const FStackState& StackState )
// {}
//
// /** Processes add operation. */
// virtual void ProcessAddOperation( const FStatMessage& Message, const FStackState& StackState )
// {}
//
// /** Processes subtract operation. */
// virtual void ProcessSubtractOperation( const FStatMessage& Message, const FStackState& StackState )
// {}
/** Processes memory operation. @see EMemoryOperation. */
virtual void ProcessMemoryOperation( EMemoryOperation MemOp, uint64 Ptr, uint64 NewPtr, int64 Size, uint32 SequenceTag, const FStackState& StackState )
{}
/** Sets a new processing stage for this file. */
void SetProcessingStage( EStatsProcessingStage NewStage )
{
if (GetProcessingStage() != NewStage)
{
ProcessingStage.Set( int32( NewStage ) );
StageProgress.Set( 0 );
}
}
public:
/**
* @return current processing stage.
*/
const EStatsProcessingStage GetProcessingStage() const
{
return EStatsProcessingStage( ProcessingStage.GetValue() );
}
/**
* @return true, if a user stopped the processing, probably using the Cancel button in the UI.
*/
const bool IsProcessingStopped() const
{
return GetProcessingStage() == EStatsProcessingStage::SPS_Stopped;
}
/**
* @return current processing stage as string key.
*/
FString GetProcessingStageAsString() const
{
const EStatsProcessingStage Stage = GetProcessingStage();
FString Result;
if (Stage== EStatsProcessingStage::SPS_Started)
{
Result = TEXT( "SPS_Started" );
}
else if (Stage == EStatsProcessingStage::SPS_ReadStats)
{
Result = TEXT( "SPS_ReadStats" );
}
else if (Stage == EStatsProcessingStage::SPS_PreProcessStats)
{
Result = TEXT( "SPS_PreProcessStats" );
}
else if (Stage == EStatsProcessingStage::SPS_ProcessStats)
{
Result = TEXT( "SPS_ProcessStats" );
}
else if (Stage == EStatsProcessingStage::SPS_PostProcessStats)
{
Result = TEXT( "SPS_PostProcessStats" );
}
else if (Stage == EStatsProcessingStage::SPS_Finished)
{
Result = TEXT( "SPS_Finished" );
}
else if (Stage == EStatsProcessingStage::SPS_Stopped)
{
Result = TEXT( "SPS_Stopped" );
}
else if (Stage == EStatsProcessingStage::SPS_Invalid)
{
Result = TEXT( "SPS_Invalid" );
}
return Result;
}
/**
* @return current stage progress as percentage, between 0 and 100.
*/
int32 GetStageProgress() const
{
return StageProgress.GetValue();
}
/**
* @return true, if any asynchronous operation is being processed
*/
bool IsBusy()
{
return AsyncWork != nullptr ? !AsyncWork->IsDone() : false;
}
/** Requests stopping the processing of the data. May take a few seconds to finish. */
void RequestStop()
{
bShouldStopProcessing = true;
}
protected:
/**
* Updates read stage progress periodically, does debug logging if enabled.
*/
void UpdateReadStageProgress();
/** Dumps combined history stats. Only for raw stats. */
void UpdateCombinedHistoryStats();
/**
* Updates process stage progress periodically, does debug logging if enabled.
*/
void UpdateProcessStageProgress( const int32 CurrentStatMessageIndex, const int32 FrameIndex, const int32 PacketIndex );
protected:
/** Current state of the stats. Mostly for metadata. */
FStatsThreadState State;
/** Reading stream. */
FStatsReadStream Stream;
/** Reference to the stream's header. */
FStatsStreamHeader& Header;
/** File reader. */
FArchive* Reader;
/** Async task. */
FAsyncTask<FAsyncRawStatsFile>* AsyncWork;
/** Basic information about the stats file. */
FRawStatsFileInfo FileInfo;
/** Combined history for raw packets, indexed by a frame number. */
TMap<int32, FStatPacketArray> CombinedHistory;
/** Frames computed from the combined history. */
TArray<int32> Frames;
/** All raw names that contains a path to an UObject. */
TSet<FName> UObjectRawNames;
/** Current stage of processing. */
FThreadSafeCounter ProcessingStage;
/** Percentage progress of the current stage. */
FThreadSafeCounter StageProgress;
/** If true, we should break the processing loop. */
FThreadSafeBool bShouldStopProcessing;
/** Time of the last stage update. */
double LastUpdateTime;
/** Filename. */
const FString Filename;
/** Whether this stats file uses raw data. */
const bool bRawStatsFile;
};
/*-----------------------------------------------------------------------------
Commands functionality
-----------------------------------------------------------------------------*/
/** Implements 'Stat Start/StopFile' functionality. */
struct FCommandStatsFile
{
/** Access to the singleton. */
static CORE_API FCommandStatsFile& Get();
/** Default constructor. */
FCommandStatsFile()
: FirstFrame(-1)
, CurrentStatsFile(nullptr)
{}
/** Stat StartFile. */
void Start( const FString& Filename );
/** Stat StartFileRaw. */
void StartRaw( const FString& Filename );
/** Stat StopFile. */
void Stop();
bool IsStatFileActive()
{
return StatFileActiveCounter.GetValue() > 0;
}
/** Filename of the last saved stats file. */
FString LastFileSaved;
protected:
/** First frame. */
int64 FirstFrame;
/** Whether the 'stat startfile' command is active, can be accessed by other thread. */
FThreadSafeCounter StatFileActiveCounter;
/** Stats file that is currently being saved. */
IStatsWriteFile* CurrentStatsFile;
};
#endif // STATS | PopCap/GameIdea | Engine/Source/Runtime/Core/Public/Stats/StatsFile.h | C | bsd-2-clause | 29,968 |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ActorFactories/ActorFactory.h"
#include "ActorFactoryEmitter.generated.h"
UCLASS(MinimalAPI, config=Editor, collapsecategories, hidecategories=Object)
class UActorFactoryEmitter : public UActorFactory
{
GENERATED_UCLASS_BODY()
// Begin UActorFactory Interface
virtual void PostSpawnActor( UObject* Asset, AActor* NewActor ) override;
virtual void PostCreateBlueprint( UObject* Asset, AActor* CDO ) override;
virtual bool CanCreateActorFrom( const FAssetData& AssetData, FText& OutErrorMsg ) override;
virtual UObject* GetAssetFromActorInstance(AActor* ActorInstance) override;
// End UActorFactory Interface
};
| PopCap/GameIdea | Engine/Source/Editor/UnrealEd/Classes/ActorFactories/ActorFactoryEmitter.h | C | bsd-2-clause | 709 |
def fat(n):
result = 1
while n > 0:
result = result * n
n = n - 1
return result
# testes
print("Fatorial de 3: ", fat(3));
| Gigers/data-struct | algoritimos/Python/fatorial-while.py | Python | bsd-2-clause | 158 |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dae.prefabs.standard;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import dae.animation.rig.PrefabPlaceHolderCallback;
import dae.prefabs.Prefab;
/**
* This prefab is a place holder that can be used when the name of a prefab
* is known, but the prefab is not necessarily added to the scene.
*
* This placeholder will hold the place of the prefab until the prefab
* is added to the scene. When that happens a user defined action will
* occur.
*
* @author Koen Samyn
*/
public class PrefabPlaceHolder extends Prefab{
/**
* The task to execute when the actual prefab is found.
*/
private PrefabPlaceHolderCallback onPrefabFound;
/**
* The name of the prefab that we search.
*/
private String prefabName;
/**
* The top level node of the scene.
*/
private Node topLevelNode;
/**
* The interval to use for checking (in seconds)
*/
private float checkInterval = 0.5f;
private float time = 0;
/**
* Creates a new prefab placeholder. The onPrefabFound runnable
* will be executed when the actual prefab is found.
* @param prefabName
* @param onPrefabFound
* @param checkInterval the interval between checks (in milliseconds).
*/
public PrefabPlaceHolder(String prefabName, PrefabPlaceHolderCallback onPrefabFound, float checkInterval)
{
this.prefabName = prefabName;
this.onPrefabFound = onPrefabFound;
}
/**
* Check the scene for the prefab, when found the Runnable object
* will be activated.
* @param tpf
*/
@Override
public void updateLogicalState(float tpf) {
time += tpf;
if (time > checkInterval)
{
if (topLevelNode == null){
topLevelNode = this;
while( topLevelNode.getParent() != null){
topLevelNode = topLevelNode.getParent();
}
}
Spatial child = topLevelNode.getChild(prefabName);
if ( child != null && child instanceof Prefab)
{
onPrefabFound.prefabFound((Prefab)child, this);
}
time = 0;
}
}
/**
* Returns the name of the prefab we look for, for presentation
* reasons.
* @return the name of the prefab we search.
*/
@Override
public String toString(){
return prefabName;
}
}
| samynk/DArtE | src/dae/prefabs/standard/PrefabPlaceHolder.java | Java | bsd-2-clause | 2,572 |
class Pyqt < Formula
desc "Python bindings for v5 of Qt"
homepage "https://www.riverbankcomputing.com/software/pyqt/download5"
url "https://files.pythonhosted.org/packages/8c/90/82c62bbbadcca98e8c6fa84f1a638de1ed1c89e85368241e9cc43fcbc320/PyQt5-5.15.0.tar.gz"
sha256 "c6f75488ffd5365a65893bc64ea82a6957db126fbfe33654bcd43ae1c30c52f9"
license "GPL-3.0"
bottle do
cellar :any
sha256 "a17f79ba93b629d68857864a9b35130b4cd56c650f4c80226fb9c983d40ef199" => :catalina
sha256 "6bc5f85f905eb25f9bfc9e23da8af4d23ba77745ace301fe4d3e8b93ad9a27b7" => :mojave
sha256 "6a823bc3eedf914192f63d8d21d4fc66ee32399100cb9b79b044dfd60fa401bb" => :high_sierra
end
depends_on "python@3.8"
depends_on "qt"
depends_on "sip"
def install
version = Language::Python.major_minor_version Formula["python@3.8"].opt_bin/"python3"
args = ["--confirm-license",
"--bindir=#{bin}",
"--destdir=#{lib}/python#{version}/site-packages",
"--stubsdir=#{lib}/python#{version}/site-packages/PyQt5",
"--sipdir=#{share}/sip/Qt5",
# sip.h could not be found automatically
"--sip-incdir=#{Formula["sip"].opt_include}",
"--qmake=#{Formula["qt"].bin}/qmake",
# Force deployment target to avoid libc++ issues
"QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}",
"--designer-plugindir=#{pkgshare}/plugins",
"--qml-plugindir=#{pkgshare}/plugins",
"--pyuic5-interpreter=#{Formula["python@3.8"].opt_bin}/python3",
"--verbose"]
system Formula["python@3.8"].opt_bin/"python3", "configure.py", *args
system "make"
ENV.deparallelize { system "make", "install" }
end
test do
system "#{bin}/pyuic5", "--version"
system "#{bin}/pylupdate5", "-version"
system Formula["python@3.8"].opt_bin/"python3", "-c", "import PyQt5"
m = %w[
Gui
Location
Multimedia
Network
Quick
Svg
Widgets
Xml
]
m << "WebEngineWidgets" if OS.mac?
m.each { |mod| system Formula["python@3.8"].opt_bin/"python3", "-c", "import PyQt5.Qt#{mod}" }
end
end
| rwhogg/homebrew-core | Formula/pyqt.rb | Ruby | bsd-2-clause | 2,159 |
namespace SharpLang.CompilerServices
{
public sealed partial class Compiler
{
private bool charUsesUtf8 = false;
private bool stringSliceable = false;
/// <summary>
/// Gets or sets a value indicating whether char and string types uses UTF8 or UTF16.
/// </summary>
/// <value>
/// <c>true</c> if char and string types uses UTF8 or UTF16; otherwise, <c>false</c>.
/// </value>
public bool CharUsesUTF8
{
get { return charUsesUtf8; }
set { charUsesUtf8 = value; }
}
public bool StringSliceable
{
get { return stringSliceable; }
set { stringSliceable = value; }
}
}
} | xen2/SharpLang | src/SharpLang.Compiler/Compiler.Options.cs | C# | bsd-2-clause | 744 |
@page
@section FindFile Class
The @code{FindFile} class is designed to provide a portable means of
enumerating over the file names contained within a particular file
system directory. Currently, this class has only been ported to the DOS
and all Windows environments. There is no current support for Unix or
Macintosh environments.
@subsection FindFile Class Methods
The only class method used in this class is one to create instances of itself.
@deffn {NewFindFile} NewFindFile::FindFile
@sp 2
@example
@group
i = gNewFindFile(FindFile, name, attr);
char *name;
int attr;
object i;
@end group
@end example
This class method creates instances of the @code{FindFile} class. Each
such instance is initialized to enable the instance to enumerate through
all the file names which meet a particular set of parameters.
The @code{name} parameter is used to specify the pattern of the file name
to be searched for. This pattern may or may not contain a relative or
absolute directory path but @emph{must} contain some wildcard
characters (such as ``?'' and ``*'').
The @code{attr} parameter is used to narrow the search to file names
which contain certain attributes. The list of available attribute
type (which should be or'ed together) is as follows:
@example
@group
FF_FILE include regular files
FF_DIRECTORY include directories
FF_READWRITE include files or directories in which
you have read/write permission
FF_READONLY include files or directories in which
you only have read permission
FF_ARCHIVE_ONLY don't include files/directories which
don't have their archive bit set
FF_HIDDEN include hidden files
FF_SYSTEM include system files
@end group
@end example
The new instance is returned.
@example
@group
@exdent Example:
object ff;
char *file;
ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE);
while (file = gNextFile(ff)) @{
do something with file
@}
gDispose(ff);
@end group
@end example
@sp 1
See also: @code{NextFile::FindFile}
@end deffn
@subsection FindFile Instance Methods
The instance methods associated with this class provide a means for
sequentially enumerating through the selected file names and obtaining
some degree of information associated with each particular file.
@deffn {Attributes} Attributes::FindFile
@sp 2
@example
@group
attr = gAttributes(ff);
object ff;
unsigned attr;
@end group
@end example
This method is used to obtain attribute information relating to the last
selected file returned from @code{NextFile}. The attribute flags are those
defined under @code{NewFindFile}. If no valid file has been returned from
@code{NextFile} this function simply returns 0.
@example
@group
@exdent Example:
object ff;
char *file;
unsigned attr;
ff = gNewFindFile(FindFile, "*.*",
FF_FILE | FF_DIRECTORY | FF_READWRITE);
while (file = gNextFile(ff)) @{
attr = gAttributes(ff);
if (attr & FF_DIRECTORY)
handle a directory
else if (attr & FF_FILE)
handle a file
@}
gDispose(ff);
@end group
@end example
@sp 1
See also: @code{NewFindFile::FindFile, NextFile::FindFile,}
@iftex
@hfil @break @hglue .64in
@end iftex
@code{WriteTime::FindFile}
@end deffn
@deffn {Length} Length::FindFile
@sp 2
@example
@group
len = gLength(ff);
object ff;
long len;
@end group
@end example
This method is used to obtain the length or size (in bytes) of the file
relating to the last selected file returned from @code{NextFile}. If
no valid file has been returned from @code{NextFile} this function
simply returns -1.
@example
@group
@exdent Example:
object ff;
char *file;
long len;
ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE);
while (file = gNextFile(ff)) @{
len = gLength(ff);
@}
gDispose(ff);
@end group
@end example
@sp 1
See also: @code{Attributes::FindFile, NextFile::FindFile}
@end deffn
@deffn {Name} Name::FindFile
@sp 2
@example
@group
nam = gName(ff);
object ff;
char *nam;
@end group
@end example
This method is used to obtain the name of the last file found via
@code{NextFile}. It will be the same name as returned from
@code{NextFile}. If no valid file has been returned from
@code{NextFile} this function simply returns @code{NULL}.
@example
@group
@exdent Example:
object ff;
char *file;
ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE);
while (gNextFile(ff)) @{
file = gName(ff);
@}
gDispose(ff);
@end group
@end example
@sp 1
See also: @code{NextFile::FindFile}
@end deffn
@deffn {NextFile} NextFile::FindFile
@sp 2
@example
@group
nam = gNextFile(ff);
object ff;
char *nam;
@end group
@end example
This method is used to obtain the next file name in the sequential list
specified when using @code{NewFindFile}. It also changes the context
associated with the object @code{ff} such that all other methods
operated on @code{ff} will refer to the file returned in the last call
to this method. In spite of the name of this method, it is also used
to obtain the first file name in the list, therefore, this method must
be called prior to any other method on @code{ff} in order to obtain
the first file context.
This method returns the name of the file associated with the file
context this method establishes. If there is no first file or
additional files this method returns @code{NULL}.
@c @example
@c @group
@c @exdent Example:
@c
@c @end group
@c @end example
@sp 1
See also: @code{NewFindFirst::FindFile}
@end deffn
@deffn {WriteTime} WriteTime::FindFile
@sp 2
@example
@group
tim = gWriteTime(ff);
object ff;
long tim;
@end group
@end example
This method is used to obtain the date and time the file associated
with the @code{ff} context was last written to. The value returned
can be typecast to the common @code{time_t} type and represents the
number of seconds past some date like 1970. If no valid file
context was setup via @code{NextFile}, this method returns -1.
@c @example
@c @group
@c @exdent Example:
@c
@c @end group
@c @end example
@sp 1
See also: @code{Attributes::FindFile, NextFile::FindFile}
@end deffn
| blakemcbride/Dynace | manual/FindFile.tex | TeX | bsd-2-clause | 6,300 |
import Controller (withOR)
import System.IO (hPutStrLn, stderr)
import Network.Wai.Middleware.Debug (debug)
import Network.Wai.Handler.Warp (run)
main :: IO ()
main = do
let port = 3000
hPutStrLn stderr $ "Application launched, listening on port " ++ show port
withOR $ run port . debug
| snoyberg/orangeroster | test.hs | Haskell | bsd-2-clause | 300 |
#ifndef _TINYSRV_CONNECTION_H
#define _TINYSRV_CONNECTION_H
#include "project.h"
#include "config.h"
#include "http.h"
struct ts_connection {
const char *str;
int length;
int filefd;
ps_http_request_header_t *request;
ps_http_response_header_t *response;
};
typedef struct ts_connection ps_connection_t;
static const char content_noSSL[] =
"\x15" /* Alert (21) */
"\x03\x00" /* Version 3.0 */
"\x00\x02" /* length 02 */
"\x02" /* fatal */
"\x00" /* 0 close notify, 0x28 Handshake failure 40, 0x31 TLS access denied 49 */
"\x00"; /* string terminator (not part of actual response) */
static const char content_jsclose[] =
"<!DOCTYPE html><html><head><meta charset='utf-8'/>"
"<title></title><script type='text/javascript'>"
"var a=window,b=document,c=b.referrer,z='.',D=function(u){var d=u.indexOf('://')>-1?u.split('/')[2]:u.split('/')[0];return d.indexOf(z)>-1?d:d.split(z)[0]};"
"if(self==top){a.close();if(c&&c.length>0){var d=D(c),e=d.split(z).reverse();if(e.length>1){var f='u='+e.slice(0,2).reverse().join(z);b.cookie!=f&&(b.cookie=f,a.history.back())}}}"
"</script></head></html>";
int connection_new(ts_socket_t *, int);
#endif
| jaka/tinysrv | src/connection.h | C | bsd-2-clause | 1,175 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>BlockSnake: File Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">BlockSnake
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li class="current"><a href="globals_enum.html"><span>Enumerations</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- 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="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
 <ul>
<li>Axis
: <a class="el" href="_matrix4x4_8hpp.html#ae3996976d8ffb3e58d88f58227473f8e">Matrix4x4.hpp</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
| valvy/BlockSnake | doc/html/globals_enum.html | HTML | bsd-2-clause | 4,017 |
<html>
<body>
<p><b>The <i>ejbPostCreate()</i> method's <i>return</i> type must be <i>void</i>.</b></p>
<p>see REFERENCEs.</p>
<p><b>REFERENCE</b></p>
<p>"Enterprise JavaBeans Developer's Guide".<br>
http://java.sun.com/j2ee/j2sdkee/techdocs/guides/ejb/html/Entity.fm.html</p>
</body>
</html>
| kit-transue/software-emancipation-discover | Docs/QARules4Java/description/EJBRTPCV/EJBRTPCV.html | HTML | bsd-2-clause | 297 |
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_ModuleBuilder.h>
#include <mscorlib/System/mscorlib_System_String.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_FieldBuilder.h>
#include <mscorlib/System/mscorlib_System_Byte.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_MethodBuilder.h>
#include <mscorlib/System/mscorlib_System_Type.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_TypeBuilder.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_MethodInfo.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_EnumBuilder.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_CustomAttributeBuilder.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_ConstructorInfo.h>
#include <mscorlib/System/Diagnostics/SymbolStore/mscorlib_System_Diagnostics_SymbolStore_ISymbolWriter.h>
#include <mscorlib/System/Diagnostics/SymbolStore/mscorlib_System_Diagnostics_SymbolStore_ISymbolDocumentWriter.h>
#include <mscorlib/System/mscorlib_System_Guid.h>
#include <mscorlib/System/IO/mscorlib_System_IO_Stream.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_MethodToken.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_FieldToken.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_FieldInfo.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_SignatureToken.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_SignatureHelper.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_StringToken.h>
#include <mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_TypeToken.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_Assembly.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_MemberInfo.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_MethodBase.h>
#include <mscorlib/System/mscorlib_System_ModuleHandle.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_Binder.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_ParameterModifier.h>
#include <mscorlib/System/Runtime/Serialization/mscorlib_System_Runtime_Serialization_SerializationInfo.h>
#include <mscorlib/System/Runtime/Serialization/mscorlib_System_Runtime_Serialization_StreamingContext.h>
#include <mscorlib/System/Reflection/mscorlib_System_Reflection_CustomAttributeData.h>
#include <mscorlib/System/Security/Cryptography/X509Certificates/mscorlib_System_Security_Cryptography_X509Certificates_X509Certificate.h>
namespace mscorlib
{
namespace System
{
namespace Reflection
{
namespace Emit
{
//Public Methods
mscorlib::System::Boolean ModuleBuilder::IsTransient()
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "IsTransient", __native_object__, 0, NULL, NULL, NULL);
return *(mscorlib::System::Boolean*)mono_object_unbox(__result__);
}
void ModuleBuilder::CreateGlobalFunctions()
{
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "CreateGlobalFunctions", __native_object__, 0, NULL, NULL, NULL);
}
mscorlib::System::Reflection::Emit::FieldBuilder ModuleBuilder::DefineInitializedData(mscorlib::System::String name, std::vector<mscorlib::System::Byte*> data, mscorlib::System::Reflection::FieldAttributes::__ENUM__ attributes)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = Global::FromArray<mscorlib::System::Byte*>(data, typeid(mscorlib::System::Byte).name());
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineInitializedData", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::FieldBuilder(__result__);
}
mscorlib::System::Reflection::Emit::FieldBuilder ModuleBuilder::DefineInitializedData(const char *name, std::vector<mscorlib::System::Byte*> data, mscorlib::System::Reflection::FieldAttributes::__ENUM__ attributes)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = Global::FromArray<mscorlib::System::Byte*>(data, typeid(mscorlib::System::Byte).name());
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineInitializedData", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::FieldBuilder(__result__);
}
mscorlib::System::Reflection::Emit::FieldBuilder ModuleBuilder::DefineUninitializedData(mscorlib::System::String name, mscorlib::System::Int32 size, mscorlib::System::Reflection::FieldAttributes::__ENUM__ attributes)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(size).name());
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = &size;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineUninitializedData", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::FieldBuilder(__result__);
}
mscorlib::System::Reflection::Emit::FieldBuilder ModuleBuilder::DefineUninitializedData(const char *name, mscorlib::System::Int32 size, mscorlib::System::Reflection::FieldAttributes::__ENUM__ attributes)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(size).name());
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = &size;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineUninitializedData", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::FieldBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(mscorlib::System::String name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(returnType).name());
__parameter_types__[3] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
__parameters__[2] = (MonoObject*)returnType;
__parameters__[3] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(const char *name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(returnType).name());
__parameter_types__[3] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
__parameters__[2] = (MonoObject*)returnType;
__parameters__[3] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(mscorlib::System::String name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(const char *name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(mscorlib::System::String name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> requiredReturnTypeCustomModifiers, std::vector<mscorlib::System::Type*> optionalReturnTypeCustomModifiers, std::vector<mscorlib::System::Type*> parameterTypes, std::vector<mscorlib::System::Type**> requiredParameterTypeCustomModifiers, std::vector<mscorlib::System::Type**> optionalParameterTypeCustomModifiers)
{
MonoType *__parameter_types__[9];
void *__parameters__[9];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[5] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[6] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[7] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type[]")), 1));
__parameter_types__[8] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type[]")), 1));
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(requiredReturnTypeCustomModifiers, typeid(mscorlib::System::Type).name());
__parameters__[5] = Global::FromArray<mscorlib::System::Type*>(optionalReturnTypeCustomModifiers, typeid(mscorlib::System::Type).name());
__parameters__[6] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
__parameters__[7] = Global::FromArray<mscorlib::System::Type**>(requiredParameterTypeCustomModifiers, typeid(mscorlib::System::Type*).name());
__parameters__[8] = Global::FromArray<mscorlib::System::Type**>(optionalParameterTypeCustomModifiers, typeid(mscorlib::System::Type*).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 9, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefineGlobalMethod(const char *name, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> requiredReturnTypeCustomModifiers, std::vector<mscorlib::System::Type*> optionalReturnTypeCustomModifiers, std::vector<mscorlib::System::Type*> parameterTypes, std::vector<mscorlib::System::Type**> requiredParameterTypeCustomModifiers, std::vector<mscorlib::System::Type**> optionalParameterTypeCustomModifiers)
{
MonoType *__parameter_types__[9];
void *__parameters__[9];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attributes).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[5] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[6] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[7] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type[]")), 1));
__parameter_types__[8] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type[]")), 1));
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[1] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(requiredReturnTypeCustomModifiers, typeid(mscorlib::System::Type).name());
__parameters__[5] = Global::FromArray<mscorlib::System::Type*>(optionalReturnTypeCustomModifiers, typeid(mscorlib::System::Type).name());
__parameters__[6] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
__parameters__[7] = Global::FromArray<mscorlib::System::Type**>(requiredParameterTypeCustomModifiers, typeid(mscorlib::System::Type*).name());
__parameters__[8] = Global::FromArray<mscorlib::System::Type**>(optionalParameterTypeCustomModifiers, typeid(mscorlib::System::Type*).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineGlobalMethod", __native_object__, 9, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefinePInvokeMethod(mscorlib::System::String name, mscorlib::System::String dllName, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes, mscorlib::System::Runtime::InteropServices::CallingConvention::__ENUM__ nativeCallConv, mscorlib::System::Runtime::InteropServices::CharSet::__ENUM__ nativeCharSet)
{
MonoType *__parameter_types__[8];
void *__parameters__[8];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(dllName).name());
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameter_types__[3] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[4] = Global::GetType(typeid(returnType).name());
__parameter_types__[5] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[6] = Global::GetType(typeid(nativeCallConv).name());
__parameter_types__[7] = Global::GetType(typeid(nativeCharSet).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = (MonoObject*)dllName;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[3] = &__param_callingConvention__;
__parameters__[4] = (MonoObject*)returnType;
__parameters__[5] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
mscorlib::System::Int32 __param_nativeCallConv__ = nativeCallConv;
__parameters__[6] = &__param_nativeCallConv__;
mscorlib::System::Int32 __param_nativeCharSet__ = nativeCharSet;
__parameters__[7] = &__param_nativeCharSet__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefinePInvokeMethod", __native_object__, 8, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefinePInvokeMethod(const char *name, const char *dllName, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes, mscorlib::System::Runtime::InteropServices::CallingConvention::__ENUM__ nativeCallConv, mscorlib::System::Runtime::InteropServices::CharSet::__ENUM__ nativeCharSet)
{
MonoType *__parameter_types__[8];
void *__parameters__[8];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[2] = Global::GetType(typeid(attributes).name());
__parameter_types__[3] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[4] = Global::GetType(typeid(returnType).name());
__parameter_types__[5] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[6] = Global::GetType(typeid(nativeCallConv).name());
__parameter_types__[7] = Global::GetType(typeid(nativeCharSet).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = mono_string_new(Global::GetDomain(), dllName);
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[2] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[3] = &__param_callingConvention__;
__parameters__[4] = (MonoObject*)returnType;
__parameters__[5] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
mscorlib::System::Int32 __param_nativeCallConv__ = nativeCallConv;
__parameters__[6] = &__param_nativeCallConv__;
mscorlib::System::Int32 __param_nativeCharSet__ = nativeCharSet;
__parameters__[7] = &__param_nativeCharSet__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefinePInvokeMethod", __native_object__, 8, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefinePInvokeMethod(mscorlib::System::String name, mscorlib::System::String dllName, mscorlib::System::String entryName, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes, mscorlib::System::Runtime::InteropServices::CallingConvention::__ENUM__ nativeCallConv, mscorlib::System::Runtime::InteropServices::CharSet::__ENUM__ nativeCharSet)
{
MonoType *__parameter_types__[9];
void *__parameters__[9];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(dllName).name());
__parameter_types__[2] = Global::GetType(typeid(entryName).name());
__parameter_types__[3] = Global::GetType(typeid(attributes).name());
__parameter_types__[4] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[5] = Global::GetType(typeid(returnType).name());
__parameter_types__[6] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[7] = Global::GetType(typeid(nativeCallConv).name());
__parameter_types__[8] = Global::GetType(typeid(nativeCharSet).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = (MonoObject*)dllName;
__parameters__[2] = (MonoObject*)entryName;
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[3] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[4] = &__param_callingConvention__;
__parameters__[5] = (MonoObject*)returnType;
__parameters__[6] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
mscorlib::System::Int32 __param_nativeCallConv__ = nativeCallConv;
__parameters__[7] = &__param_nativeCallConv__;
mscorlib::System::Int32 __param_nativeCharSet__ = nativeCharSet;
__parameters__[8] = &__param_nativeCharSet__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefinePInvokeMethod", __native_object__, 9, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::MethodBuilder ModuleBuilder::DefinePInvokeMethod(const char *name, const char *dllName, const char *entryName, mscorlib::System::Reflection::MethodAttributes::__ENUM__ attributes, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes, mscorlib::System::Runtime::InteropServices::CallingConvention::__ENUM__ nativeCallConv, mscorlib::System::Runtime::InteropServices::CharSet::__ENUM__ nativeCharSet)
{
MonoType *__parameter_types__[9];
void *__parameters__[9];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[2] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[3] = Global::GetType(typeid(attributes).name());
__parameter_types__[4] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[5] = Global::GetType(typeid(returnType).name());
__parameter_types__[6] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[7] = Global::GetType(typeid(nativeCallConv).name());
__parameter_types__[8] = Global::GetType(typeid(nativeCharSet).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = mono_string_new(Global::GetDomain(), dllName);
__parameters__[2] = mono_string_new(Global::GetDomain(), entryName);
mscorlib::System::Int32 __param_attributes__ = attributes;
__parameters__[3] = &__param_attributes__;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[4] = &__param_callingConvention__;
__parameters__[5] = (MonoObject*)returnType;
__parameters__[6] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
mscorlib::System::Int32 __param_nativeCallConv__ = nativeCallConv;
__parameters__[7] = &__param_nativeCallConv__;
mscorlib::System::Int32 __param_nativeCharSet__ = nativeCharSet;
__parameters__[8] = &__param_nativeCharSet__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefinePInvokeMethod", __native_object__, 9, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameters__[0] = (MonoObject*)name;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, std::vector<mscorlib::System::Type*> interfaces)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
__parameters__[3] = Global::FromArray<mscorlib::System::Type*>(interfaces, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, std::vector<mscorlib::System::Type*> interfaces)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
__parameters__[3] = Global::FromArray<mscorlib::System::Type*>(interfaces, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Int32 typesize)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(typesize).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
__parameters__[3] = &typesize;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Int32 typesize)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(typesize).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
__parameters__[3] = &typesize;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Reflection::Emit::PackingSize::__ENUM__ packsize)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(packsize).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
mscorlib::System::Int32 __param_packsize__ = packsize;
__parameters__[3] = &__param_packsize__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Reflection::Emit::PackingSize::__ENUM__ packsize)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(packsize).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
mscorlib::System::Int32 __param_packsize__ = packsize;
__parameters__[3] = &__param_packsize__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Reflection::Emit::PackingSize::__ENUM__ packingSize, mscorlib::System::Int32 typesize)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(packingSize).name());
__parameter_types__[4] = Global::GetType(typeid(typesize).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
mscorlib::System::Int32 __param_packingSize__ = packingSize;
__parameters__[3] = &__param_packingSize__;
__parameters__[4] = &typesize;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::Emit::TypeBuilder ModuleBuilder::DefineType(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ attr, mscorlib::System::Type parent, mscorlib::System::Reflection::Emit::PackingSize::__ENUM__ packingSize, mscorlib::System::Int32 typesize)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(attr).name());
__parameter_types__[2] = Global::GetType(typeid(parent).name());
__parameter_types__[3] = Global::GetType(typeid(packingSize).name());
__parameter_types__[4] = Global::GetType(typeid(typesize).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_attr__ = attr;
__parameters__[1] = &__param_attr__;
__parameters__[2] = (MonoObject*)parent;
mscorlib::System::Int32 __param_packingSize__ = packingSize;
__parameters__[3] = &__param_packingSize__;
__parameters__[4] = &typesize;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineType", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeBuilder(__result__);
}
mscorlib::System::Reflection::MethodInfo ModuleBuilder::GetArrayMethod(mscorlib::System::Type arrayClass, mscorlib::System::String methodName, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(arrayClass).name());
__parameter_types__[1] = Global::GetType(typeid(methodName).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)arrayClass;
__parameters__[1] = (MonoObject*)methodName;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetArrayMethod", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::MethodInfo(__result__);
}
mscorlib::System::Reflection::MethodInfo ModuleBuilder::GetArrayMethod(mscorlib::System::Type arrayClass, const char *methodName, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(arrayClass).name());
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)arrayClass;
__parameters__[1] = mono_string_new(Global::GetDomain(), methodName);
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetArrayMethod", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::MethodInfo(__result__);
}
mscorlib::System::Reflection::Emit::EnumBuilder ModuleBuilder::DefineEnum(mscorlib::System::String name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ visibility, mscorlib::System::Type underlyingType)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(visibility).name());
__parameter_types__[2] = Global::GetType(typeid(underlyingType).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_visibility__ = visibility;
__parameters__[1] = &__param_visibility__;
__parameters__[2] = (MonoObject*)underlyingType;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineEnum", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::EnumBuilder(__result__);
}
mscorlib::System::Reflection::Emit::EnumBuilder ModuleBuilder::DefineEnum(const char *name, mscorlib::System::Reflection::TypeAttributes::__ENUM__ visibility, mscorlib::System::Type underlyingType)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(visibility).name());
__parameter_types__[2] = Global::GetType(typeid(underlyingType).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_visibility__ = visibility;
__parameters__[1] = &__param_visibility__;
__parameters__[2] = (MonoObject*)underlyingType;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineEnum", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::EnumBuilder(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(mscorlib::System::String className)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(className).name());
__parameters__[0] = (MonoObject*)className;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(const char *className)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), className);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(mscorlib::System::String className, mscorlib::System::Boolean ignoreCase)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(className).name());
__parameter_types__[1] = Global::GetType(typeid(ignoreCase).name());
__parameters__[0] = (MonoObject*)className;
__parameters__[1] = reinterpret_cast<void*>(ignoreCase);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(const char *className, mscorlib::System::Boolean ignoreCase)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(ignoreCase).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), className);
__parameters__[1] = reinterpret_cast<void*>(ignoreCase);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(mscorlib::System::String className, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(className).name());
__parameter_types__[1] = Global::GetType(typeid(throwOnError).name());
__parameter_types__[2] = Global::GetType(typeid(ignoreCase).name());
__parameters__[0] = (MonoObject*)className;
__parameters__[1] = reinterpret_cast<void*>(throwOnError);
__parameters__[2] = reinterpret_cast<void*>(ignoreCase);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Type ModuleBuilder::GetType(const char *className, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(throwOnError).name());
__parameter_types__[2] = Global::GetType(typeid(ignoreCase).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), className);
__parameters__[1] = reinterpret_cast<void*>(throwOnError);
__parameters__[2] = reinterpret_cast<void*>(ignoreCase);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetType", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
void ModuleBuilder::SetCustomAttribute(mscorlib::System::Reflection::Emit::CustomAttributeBuilder customBuilder)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(customBuilder).name());
__parameters__[0] = (MonoObject*)customBuilder;
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "SetCustomAttribute", __native_object__, 1, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::SetCustomAttribute(mscorlib::System::Reflection::ConstructorInfo con, std::vector<mscorlib::System::Byte*> binaryAttribute)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(con).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameters__[0] = (MonoObject*)con;
__parameters__[1] = Global::FromArray<mscorlib::System::Byte*>(binaryAttribute, typeid(mscorlib::System::Byte).name());
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "SetCustomAttribute", __native_object__, 2, __parameter_types__, __parameters__, NULL);
}
mscorlib::System::Diagnostics::SymbolStore::ISymbolWriter ModuleBuilder::GetSymWriter()
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetSymWriter", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::Diagnostics::SymbolStore::ISymbolWriter(__result__);
}
mscorlib::System::Diagnostics::SymbolStore::ISymbolDocumentWriter ModuleBuilder::DefineDocument(mscorlib::System::String url, mscorlib::System::Guid language, mscorlib::System::Guid languageVendor, mscorlib::System::Guid documentType)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType(typeid(url).name());
__parameter_types__[1] = Global::GetType(typeid(language).name());
__parameter_types__[2] = Global::GetType(typeid(languageVendor).name());
__parameter_types__[3] = Global::GetType(typeid(documentType).name());
__parameters__[0] = (MonoObject*)url;
__parameters__[1] = (MonoObject*)language;
__parameters__[2] = (MonoObject*)languageVendor;
__parameters__[3] = (MonoObject*)documentType;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineDocument", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Diagnostics::SymbolStore::ISymbolDocumentWriter(__result__);
}
mscorlib::System::Diagnostics::SymbolStore::ISymbolDocumentWriter ModuleBuilder::DefineDocument(const char *url, mscorlib::System::Guid language, mscorlib::System::Guid languageVendor, mscorlib::System::Guid documentType)
{
MonoType *__parameter_types__[4];
void *__parameters__[4];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(language).name());
__parameter_types__[2] = Global::GetType(typeid(languageVendor).name());
__parameter_types__[3] = Global::GetType(typeid(documentType).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), url);
__parameters__[1] = (MonoObject*)language;
__parameters__[2] = (MonoObject*)languageVendor;
__parameters__[3] = (MonoObject*)documentType;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineDocument", __native_object__, 4, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Diagnostics::SymbolStore::ISymbolDocumentWriter(__result__);
}
std::vector<mscorlib::System::Type*> ModuleBuilder::GetTypes()
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetTypes", __native_object__, 0, NULL, NULL, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Type*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Type (__array_item__));
}
return __array_result__;
}
mscorlib::System::Resources::IResourceWriter ModuleBuilder::DefineResource(mscorlib::System::String name, mscorlib::System::String description, mscorlib::System::Reflection::ResourceAttributes::__ENUM__ attribute)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(description).name());
__parameter_types__[2] = Global::GetType(typeid(attribute).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = (MonoObject*)description;
mscorlib::System::Int32 __param_attribute__ = attribute;
__parameters__[2] = &__param_attribute__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineResource", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Resources::IResourceWriter(__result__);
}
mscorlib::System::Resources::IResourceWriter ModuleBuilder::DefineResource(const char *name, const char *description, mscorlib::System::Reflection::ResourceAttributes::__ENUM__ attribute)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[2] = Global::GetType(typeid(attribute).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = mono_string_new(Global::GetDomain(), description);
mscorlib::System::Int32 __param_attribute__ = attribute;
__parameters__[2] = &__param_attribute__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineResource", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Resources::IResourceWriter(__result__);
}
mscorlib::System::Resources::IResourceWriter ModuleBuilder::DefineResource(mscorlib::System::String name, mscorlib::System::String description)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(description).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = (MonoObject*)description;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineResource", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Resources::IResourceWriter(__result__);
}
mscorlib::System::Resources::IResourceWriter ModuleBuilder::DefineResource(const char *name, const char *description)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = mono_string_new(Global::GetDomain(), description);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineResource", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Resources::IResourceWriter(__result__);
}
void ModuleBuilder::DefineUnmanagedResource(std::vector<mscorlib::System::Byte*> resource)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameters__[0] = Global::FromArray<mscorlib::System::Byte*>(resource, typeid(mscorlib::System::Byte).name());
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineUnmanagedResource", __native_object__, 1, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::DefineUnmanagedResource(mscorlib::System::String resourceFileName)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(resourceFileName).name());
__parameters__[0] = (MonoObject*)resourceFileName;
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineUnmanagedResource", __native_object__, 1, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::DefineUnmanagedResource(const char *resourceFileName)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), resourceFileName);
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineUnmanagedResource", __native_object__, 1, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::DefineManifestResource(mscorlib::System::String name, mscorlib::System::IO::Stream stream, mscorlib::System::Reflection::ResourceAttributes::__ENUM__ attribute)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(stream).name());
__parameter_types__[2] = Global::GetType(typeid(attribute).name());
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = (MonoObject*)stream;
mscorlib::System::Int32 __param_attribute__ = attribute;
__parameters__[2] = &__param_attribute__;
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineManifestResource", __native_object__, 3, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::DefineManifestResource(const char *name, mscorlib::System::IO::Stream stream, mscorlib::System::Reflection::ResourceAttributes::__ENUM__ attribute)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(stream).name());
__parameter_types__[2] = Global::GetType(typeid(attribute).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = (MonoObject*)stream;
mscorlib::System::Int32 __param_attribute__ = attribute;
__parameters__[2] = &__param_attribute__;
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "DefineManifestResource", __native_object__, 3, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::SetSymCustomAttribute(mscorlib::System::String name, std::vector<mscorlib::System::Byte*> data)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameters__[0] = (MonoObject*)name;
__parameters__[1] = Global::FromArray<mscorlib::System::Byte*>(data, typeid(mscorlib::System::Byte).name());
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "SetSymCustomAttribute", __native_object__, 2, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::SetSymCustomAttribute(const char *name, std::vector<mscorlib::System::Byte*> data)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
__parameters__[1] = Global::FromArray<mscorlib::System::Byte*>(data, typeid(mscorlib::System::Byte).name());
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "SetSymCustomAttribute", __native_object__, 2, __parameter_types__, __parameters__, NULL);
}
void ModuleBuilder::SetUserEntryPoint(mscorlib::System::Reflection::MethodInfo entryPoint)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(entryPoint).name());
__parameters__[0] = (MonoObject*)entryPoint;
Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "SetUserEntryPoint", __native_object__, 1, __parameter_types__, __parameters__, NULL);
}
mscorlib::System::Reflection::Emit::MethodToken ModuleBuilder::GetMethodToken(mscorlib::System::Reflection::MethodInfo method)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(method).name());
__parameters__[0] = (MonoObject*)method;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetMethodToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodToken(__result__);
}
mscorlib::System::Reflection::Emit::MethodToken ModuleBuilder::GetArrayMethodToken(mscorlib::System::Type arrayClass, mscorlib::System::String methodName, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(arrayClass).name());
__parameter_types__[1] = Global::GetType(typeid(methodName).name());
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)arrayClass;
__parameters__[1] = (MonoObject*)methodName;
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetArrayMethodToken", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodToken(__result__);
}
mscorlib::System::Reflection::Emit::MethodToken ModuleBuilder::GetArrayMethodToken(mscorlib::System::Type arrayClass, const char *methodName, mscorlib::System::Reflection::CallingConventions::__ENUM__ callingConvention, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> parameterTypes)
{
MonoType *__parameter_types__[5];
void *__parameters__[5];
__parameter_types__[0] = Global::GetType(typeid(arrayClass).name());
__parameter_types__[1] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[2] = Global::GetType(typeid(callingConvention).name());
__parameter_types__[3] = Global::GetType(typeid(returnType).name());
__parameter_types__[4] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = (MonoObject*)arrayClass;
__parameters__[1] = mono_string_new(Global::GetDomain(), methodName);
mscorlib::System::Int32 __param_callingConvention__ = callingConvention;
__parameters__[2] = &__param_callingConvention__;
__parameters__[3] = (MonoObject*)returnType;
__parameters__[4] = Global::FromArray<mscorlib::System::Type*>(parameterTypes, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetArrayMethodToken", __native_object__, 5, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodToken(__result__);
}
mscorlib::System::Reflection::Emit::MethodToken ModuleBuilder::GetConstructorToken(mscorlib::System::Reflection::ConstructorInfo con)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(con).name());
__parameters__[0] = (MonoObject*)con;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetConstructorToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::MethodToken(__result__);
}
mscorlib::System::Reflection::Emit::FieldToken ModuleBuilder::GetFieldToken(mscorlib::System::Reflection::FieldInfo field)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(field).name());
__parameters__[0] = (MonoObject*)field;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetFieldToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::FieldToken(__result__);
}
mscorlib::System::Reflection::Emit::SignatureToken ModuleBuilder::GetSignatureToken(std::vector<mscorlib::System::Byte*> sigBytes, mscorlib::System::Int32 sigLength)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
__parameter_types__[1] = Global::GetType(typeid(sigLength).name());
__parameters__[0] = Global::FromArray<mscorlib::System::Byte*>(sigBytes, typeid(mscorlib::System::Byte).name());
__parameters__[1] = &sigLength;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetSignatureToken", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::SignatureToken(__result__);
}
mscorlib::System::Reflection::Emit::SignatureToken ModuleBuilder::GetSignatureToken(mscorlib::System::Reflection::Emit::SignatureHelper sigHelper)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(sigHelper).name());
__parameters__[0] = (MonoObject*)sigHelper;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetSignatureToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::SignatureToken(__result__);
}
mscorlib::System::Reflection::Emit::StringToken ModuleBuilder::GetStringConstant(mscorlib::System::String str)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(str).name());
__parameters__[0] = (MonoObject*)str;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetStringConstant", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::StringToken(__result__);
}
mscorlib::System::Reflection::Emit::StringToken ModuleBuilder::GetStringConstant(const char *str)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), str);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetStringConstant", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::StringToken(__result__);
}
mscorlib::System::Reflection::Emit::TypeToken ModuleBuilder::GetTypeToken(mscorlib::System::Type type)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(type).name());
__parameters__[0] = (MonoObject*)type;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetTypeToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeToken(__result__);
}
mscorlib::System::Reflection::Emit::TypeToken ModuleBuilder::GetTypeToken(mscorlib::System::String name)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameters__[0] = (MonoObject*)name;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetTypeToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeToken(__result__);
}
mscorlib::System::Reflection::Emit::TypeToken ModuleBuilder::GetTypeToken(const char *name)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetTypeToken", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::Emit::TypeToken(__result__);
}
mscorlib::System::Boolean ModuleBuilder::IsResource()
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "IsResource", __native_object__, 0, NULL, NULL, NULL);
return *(mscorlib::System::Boolean*)mono_object_unbox(__result__);
}
mscorlib::System::Reflection::FieldInfo ModuleBuilder::ResolveField(mscorlib::System::Int32 metadataToken, std::vector<mscorlib::System::Type*> genericTypeArguments, std::vector<mscorlib::System::Type*> genericMethodArguments)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[2] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = &metadataToken;
__parameters__[1] = Global::FromArray<mscorlib::System::Type*>(genericTypeArguments, typeid(mscorlib::System::Type).name());
__parameters__[2] = Global::FromArray<mscorlib::System::Type*>(genericMethodArguments, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveField", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::FieldInfo(__result__);
}
mscorlib::System::Reflection::MemberInfo ModuleBuilder::ResolveMember(mscorlib::System::Int32 metadataToken, std::vector<mscorlib::System::Type*> genericTypeArguments, std::vector<mscorlib::System::Type*> genericMethodArguments)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[2] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = &metadataToken;
__parameters__[1] = Global::FromArray<mscorlib::System::Type*>(genericTypeArguments, typeid(mscorlib::System::Type).name());
__parameters__[2] = Global::FromArray<mscorlib::System::Type*>(genericMethodArguments, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveMember", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::MemberInfo(__result__);
}
mscorlib::System::Reflection::MethodBase ModuleBuilder::ResolveMethod(mscorlib::System::Int32 metadataToken, std::vector<mscorlib::System::Type*> genericTypeArguments, std::vector<mscorlib::System::Type*> genericMethodArguments)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[2] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = &metadataToken;
__parameters__[1] = Global::FromArray<mscorlib::System::Type*>(genericTypeArguments, typeid(mscorlib::System::Type).name());
__parameters__[2] = Global::FromArray<mscorlib::System::Type*>(genericMethodArguments, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveMethod", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::MethodBase(__result__);
}
mscorlib::System::String ModuleBuilder::ResolveString(mscorlib::System::Int32 metadataToken)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameters__[0] = &metadataToken;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveString", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return mscorlib::System::String(__result__);
}
std::vector<mscorlib::System::Byte*> ModuleBuilder::ResolveSignature(mscorlib::System::Int32 metadataToken)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameters__[0] = &metadataToken;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveSignature", __native_object__, 1, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Byte*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Byte (__array_item__));
}
return __array_result__;
}
mscorlib::System::Type ModuleBuilder::ResolveType(mscorlib::System::Int32 metadataToken, std::vector<mscorlib::System::Type*> genericTypeArguments, std::vector<mscorlib::System::Type*> genericMethodArguments)
{
MonoType *__parameter_types__[3];
void *__parameters__[3];
__parameter_types__[0] = Global::GetType(typeid(metadataToken).name());
__parameter_types__[1] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameter_types__[2] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Type")), 1));
__parameters__[0] = &metadataToken;
__parameters__[1] = Global::FromArray<mscorlib::System::Type*>(genericTypeArguments, typeid(mscorlib::System::Type).name());
__parameters__[2] = Global::FromArray<mscorlib::System::Type*>(genericMethodArguments, typeid(mscorlib::System::Type).name());
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "ResolveType", __native_object__, 3, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Type(__result__);
}
mscorlib::System::Boolean ModuleBuilder::Equals(mscorlib::System::Object obj)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(obj).name());
__parameters__[0] = (MonoObject*)obj;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "Equals", __native_object__, 1, __parameter_types__, __parameters__, NULL);
return *(mscorlib::System::Boolean*)mono_object_unbox(__result__);
}
mscorlib::System::Int32 ModuleBuilder::GetHashCode()
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetHashCode", __native_object__, 0, NULL, NULL, NULL);
return *(mscorlib::System::Int32*)mono_object_unbox(__result__);
}
mscorlib::System::Boolean ModuleBuilder::IsDefined(mscorlib::System::Type attributeType, mscorlib::System::Boolean inherit)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(attributeType).name());
__parameter_types__[1] = Global::GetType(typeid(inherit).name());
__parameters__[0] = (MonoObject*)attributeType;
__parameters__[1] = reinterpret_cast<void*>(inherit);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "IsDefined", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return *(mscorlib::System::Boolean*)mono_object_unbox(__result__);
}
std::vector<mscorlib::System::Object*> ModuleBuilder::GetCustomAttributes(mscorlib::System::Boolean inherit)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(inherit).name());
__parameters__[0] = reinterpret_cast<void*>(inherit);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetCustomAttributes", __native_object__, 1, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Object*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Object (__array_item__));
}
return __array_result__;
}
std::vector<mscorlib::System::Object*> ModuleBuilder::GetCustomAttributes(mscorlib::System::Type attributeType, mscorlib::System::Boolean inherit)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(attributeType).name());
__parameter_types__[1] = Global::GetType(typeid(inherit).name());
__parameters__[0] = (MonoObject*)attributeType;
__parameters__[1] = reinterpret_cast<void*>(inherit);
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetCustomAttributes", __native_object__, 2, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Object*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Object (__array_item__));
}
return __array_result__;
}
mscorlib::System::Reflection::FieldInfo ModuleBuilder::GetField(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType(typeid(name).name());
__parameter_types__[1] = Global::GetType(typeid(bindingAttr).name());
__parameters__[0] = (MonoObject*)name;
mscorlib::System::Int32 __param_bindingAttr__ = bindingAttr;
__parameters__[1] = &__param_bindingAttr__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetField", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::FieldInfo(__result__);
}
mscorlib::System::Reflection::FieldInfo ModuleBuilder::GetField(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr)
{
MonoType *__parameter_types__[2];
void *__parameters__[2];
__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
__parameter_types__[1] = Global::GetType(typeid(bindingAttr).name());
__parameters__[0] = mono_string_new(Global::GetDomain(), name);
mscorlib::System::Int32 __param_bindingAttr__ = bindingAttr;
__parameters__[1] = &__param_bindingAttr__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetField", __native_object__, 2, __parameter_types__, __parameters__, NULL);
return mscorlib::System::Reflection::FieldInfo(__result__);
}
std::vector<mscorlib::System::Reflection::FieldInfo*> ModuleBuilder::GetFields(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingFlags)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(bindingFlags).name());
mscorlib::System::Int32 __param_bindingFlags__ = bindingFlags;
__parameters__[0] = &__param_bindingFlags__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetFields", __native_object__, 1, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Reflection::FieldInfo*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Reflection::FieldInfo (__array_item__));
}
return __array_result__;
}
std::vector<mscorlib::System::Reflection::MethodInfo*> ModuleBuilder::GetMethods(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingFlags)
{
MonoType *__parameter_types__[1];
void *__parameters__[1];
__parameter_types__[0] = Global::GetType(typeid(bindingFlags).name());
mscorlib::System::Int32 __param_bindingFlags__ = bindingFlags;
__parameters__[0] = &__param_bindingFlags__;
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "GetMethods", __native_object__, 1, __parameter_types__, __parameters__, NULL);
MonoArray *__array_ptr__ = (MonoArray*)__result__;
uintptr_t __array_length__ = mono_array_length(__array_ptr__);
std::vector<mscorlib::System::Reflection::MethodInfo*> __array_result__(__array_length__);
for(uintptr_t __array_index__ = 0; __array_index__ < __array_length__; __array_index__++)
{
MonoObject *__array_item__ = mono_array_get(__array_ptr__,MonoObject*,__array_index__);
__array_result__.push_back(new mscorlib::System::Reflection::MethodInfo (__array_item__));
}
return __array_result__;
}
//Get Set Properties Methods
// Get:FullyQualifiedName
mscorlib::System::String ModuleBuilder::get_FullyQualifiedName() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_FullyQualifiedName", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::String(__result__);
}
// Get:Assembly
mscorlib::System::Reflection::Assembly ModuleBuilder::get_Assembly() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_Assembly", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::Reflection::Assembly(__result__);
}
// Get:Name
mscorlib::System::String ModuleBuilder::get_Name() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_Name", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::String(__result__);
}
// Get:ScopeName
mscorlib::System::String ModuleBuilder::get_ScopeName() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_ScopeName", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::String(__result__);
}
// Get:ModuleVersionId
mscorlib::System::Guid ModuleBuilder::get_ModuleVersionId() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_ModuleVersionId", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::Guid(__result__);
}
// Get:MetadataToken
mscorlib::System::Int32 ModuleBuilder::get_MetadataToken() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection.Emit", "ModuleBuilder", 0, NULL, "get_MetadataToken", __native_object__, 0, NULL, NULL, NULL);
return *(mscorlib::System::Int32*)mono_object_unbox(__result__);
}
// Get:ModuleHandle
mscorlib::System::ModuleHandle ModuleBuilder::get_ModuleHandle() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection", "Module", 0, NULL, "get_ModuleHandle", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::ModuleHandle(__result__);
}
// Get:MDStreamVersion
mscorlib::System::Int32 ModuleBuilder::get_MDStreamVersion() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection", "Module", 0, NULL, "get_MDStreamVersion", __native_object__, 0, NULL, NULL, NULL);
return *(mscorlib::System::Int32*)mono_object_unbox(__result__);
}
// Get:CustomAttributes
mscorlib::System::Collections::Generic::IEnumerable<mscorlib::System::Reflection::CustomAttributeData> ModuleBuilder::get_CustomAttributes() const
{
MonoObject *__result__ = Global::InvokeMethod("mscorlib", "System.Reflection", "Module", 0, NULL, "get_CustomAttributes", __native_object__, 0, NULL, NULL, NULL);
return mscorlib::System::Collections::Generic::IEnumerable<mscorlib::System::Reflection::CustomAttributeData>(__result__);
}
}
}
}
}
| brunolauze/MonoNative | MonoNative/mscorlib/System/Reflection/Emit/mscorlib_System_Reflection_Emit_ModuleBuilder.cpp | C++ | bsd-2-clause | 95,331 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_02) on Tue Apr 29 11:29:42 CEST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>PlatformConfigurableToolChain (Gradle API 1.12)</title>
<meta name="date" content="2014-04-29">
<link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="PlatformConfigurableToolChain (Gradle API 1.12)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/gradle/nativebinaries/toolchain/TargetPlatformConfiguration.html" title="interface in org.gradle.nativebinaries.toolchain"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html" target="_top">Frames</a></li>
<li><a href="PlatformConfigurableToolChain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.gradle.nativebinaries.toolchain</div>
<h2 title="Interface PlatformConfigurableToolChain" class="title">Interface PlatformConfigurableToolChain</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../../org/gradle/api/Named.html" title="interface in org.gradle.api">Named</a>, <a href="../../../../org/gradle/nativebinaries/toolchain/ToolChain.html" title="interface in org.gradle.nativebinaries.toolchain">ToolChain</a></dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../org/gradle/nativebinaries/toolchain/Clang.html" title="interface in org.gradle.nativebinaries.toolchain">Clang</a>, <a href="../../../../org/gradle/nativebinaries/toolchain/Gcc.html" title="interface in org.gradle.nativebinaries.toolchain">Gcc</a></dd>
</dl>
<hr>
<br>
<pre><a href="../../../../org/gradle/api/Incubating.html" title="annotation in org.gradle.api">@Incubating</a>
public interface <span class="strong">PlatformConfigurableToolChain</span>
extends <a href="../../../../org/gradle/nativebinaries/toolchain/ToolChain.html" title="interface in org.gradle.nativebinaries.toolchain">ToolChain</a></pre>
<div class="block">A ToolChain that can handle additional platforms simply by configuring the NativeBinary.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="nested_classes_inherited_from_class_org.gradle.api.Named">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface org.gradle.api.<a href="../../../../org/gradle/api/Named.html" title="interface in org.gradle.api">Named</a></h3>
<code><a href="../../../../org/gradle/api/Named.Namer.html" title="class in org.gradle.api">Named.Namer</a></code></li>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#addPlatformConfiguration(org.gradle.nativebinaries.toolchain.TargetPlatformConfiguration)">addPlatformConfiguration</a></strong>(<a href="../../../../org/gradle/nativebinaries/toolchain/TargetPlatformConfiguration.html" title="interface in org.gradle.nativebinaries.toolchain">TargetPlatformConfiguration</a> platformConfig)</code>
<div class="block">Add configuration for a target platform.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#getAssembler()">getAssembler</a></strong>()</code>
<div class="block">The assembler.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#getCCompiler()">getCCompiler</a></strong>()</code>
<div class="block">The C++ compiler.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#getCppCompiler()">getCppCompiler</a></strong>()</code>
<div class="block">The C compiler.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#getLinker()">getLinker</a></strong>()</code>
<div class="block">The linker.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html#getStaticLibArchiver()">getStaticLibArchiver</a></strong>()</code>
<div class="block">The static library archiver.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.gradle.nativebinaries.toolchain.ToolChain">
<!-- -->
</a>
<h3>Methods inherited from interface org.gradle.nativebinaries.toolchain.<a href="../../../../org/gradle/nativebinaries/toolchain/ToolChain.html" title="interface in org.gradle.nativebinaries.toolchain">ToolChain</a></h3>
<code><a href="../../../../org/gradle/nativebinaries/toolchain/ToolChain.html#getDisplayName()">getDisplayName</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.gradle.api.Named">
<!-- -->
</a>
<h3>Methods inherited from interface org.gradle.api.<a href="../../../../org/gradle/api/Named.html" title="interface in org.gradle.api">Named</a></h3>
<code><a href="../../../../org/gradle/api/Named.html#getName()">getName</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="addPlatformConfiguration(org.gradle.nativebinaries.toolchain.TargetPlatformConfiguration)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addPlatformConfiguration</h4>
<pre>void addPlatformConfiguration(<a href="../../../../org/gradle/nativebinaries/toolchain/TargetPlatformConfiguration.html" title="interface in org.gradle.nativebinaries.toolchain">TargetPlatformConfiguration</a> platformConfig)</pre>
<div class="block">Add configuration for a target platform.</div>
</li>
</ul>
<a name="getCCompiler()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCCompiler</h4>
<pre><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a> getCCompiler()</pre>
<div class="block">The C++ compiler.</div>
</li>
</ul>
<a name="getCppCompiler()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCppCompiler</h4>
<pre><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a> getCppCompiler()</pre>
<div class="block">The C compiler.</div>
</li>
</ul>
<a name="getAssembler()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAssembler</h4>
<pre><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a> getAssembler()</pre>
<div class="block">The assembler.</div>
</li>
</ul>
<a name="getLinker()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLinker</h4>
<pre><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a> getLinker()</pre>
<div class="block">The linker.</div>
</li>
</ul>
<a name="getStaticLibArchiver()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getStaticLibArchiver</h4>
<pre><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain">GccTool</a> getStaticLibArchiver()</pre>
<div class="block">The static library archiver.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/gradle/nativebinaries/toolchain/GccTool.html" title="interface in org.gradle.nativebinaries.toolchain"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/gradle/nativebinaries/toolchain/TargetPlatformConfiguration.html" title="interface in org.gradle.nativebinaries.toolchain"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html" target="_top">Frames</a></li>
<li><a href="PlatformConfigurableToolChain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| Pushjet/Pushjet-Android | gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/docs/javadoc/org/gradle/nativebinaries/toolchain/PlatformConfigurableToolChain.html | HTML | bsd-2-clause | 13,990 |
/**
* anothergltry - Another GL try
* Copyright (c) 2015, Matej Kormuth <http://www.github.com/dobrakmato>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package eu.matejkormuth.jge.scripting;
import eu.matejkormuth.jge.core.Engine;
import groovy.lang.Script;
public abstract class BaseScript extends Script {
public Object eval(String file) {
return evaluate(Engine.fileSystem.readText(file));
}
}
| dobrakmato/jge | src/main/java/eu/matejkormuth/jge/scripting/BaseScript.java | Java | bsd-2-clause | 1,696 |
import warnings
class DeprecatedCallableStr(str):
do_no_call_in_templates = True
def __new__(cls, value, *args, **kwargs):
return super(DeprecatedCallableStr, cls).__new__(cls, value)
def __init__(self, value, warning, warning_cls):
self.warning, self.warning_cls = warning, warning_cls
def __call__(self, *args, **kwargs):
warnings.warn(self.warning, self.warning_cls, stacklevel=2)
return str(self)
def __repr__(self):
super_repr = super(DeprecatedCallableStr, self).__repr__()
return '<DeprecatedCallableStr {}>'.format(super_repr)
| takeflight/wagtailnews | wagtailnews/deprecation.py | Python | bsd-2-clause | 609 |
var searchData=
[
['datetime',['datetime',['../structdatetime.html',1,'']]]
];
| bplainia/galaxyLightingSystem | doxygen/html/search/classes_2.js | JavaScript | bsd-2-clause | 81 |
<?php
/**
* 通用控制器基类
*/
class Controller_Base extends Controller_Abstract {
/**
* 提示信息类型:信息
*/
const MESSAGE_INFO = 1;
/**
* 提示信息类型:警告
*/
const MESSAGE_WARNING = 2;
/**
* 提示信息类型:错误
*/
const MESSAGE_ERROR = 3;
/**
* 提示信息类型:成功
*/
const MESSAGE_SUCCESS = 4;
/**
* ajax 状态码:成功
*/
const CODE_SUCCESS = 0;
/**
* ajax 状态码:参数错误
*/
const CODE_PARAM_ERROR = 1;
/**
* ajax 状态码:系统错误
*/
const CODE_SYSTEM_ERROR = 2;
/**
* ajax 状态码:需要登录而未登录的状态
*/
const CODE_NOT_LOGIN = 4;
/**
* 提示信息页主模板
* @var type
*/
protected $_msgTplMessage = 'message';
/**
* 提示信息页布局模板
* @var type
*/
protected $_msgTplLayout = 'layout';
/**
* 验证码 默认长度
*/
const CAPTCHA_DEFAULT_LENGTH = 4;
/**
* 验证码默认图片宽度
*/
const CAPTCHA_DEFAULT_WIDTH = 160;
/**
* 验证码默认图片高度
*/
const CAPTCHA_DEFAULT_HEIGHT = 64;
/**
* 验证码 cookie 名字
* @var type
*/
protected $_captchaName = 'captcha';
/**
* 当前用户
* @var type
*/
protected $_user = array();
/**
* before action
*/
protected function _beforeAction() {
if (false == parent::_beforeAction()) {
return false;
}
// 默认模板变量
$this->_view->assign('staticUrl', V::config('static_url'));
$this->_view->assign('controller', strtolower($this->_controllerName));
$this->_view->assign('action', strtolower($this->_actionName));
return true;
}
/**
* 信息提示页
* @param <type> $message
* @param <type> $msgType
* @param <type> $urlForwards
* @param <type> $redirectTime
* @return <type>
*/
protected function _showMessage($message = '', $msgType = self::MESSAGE_INFO, $urlForwards = array(), $redirectTime = -1) {
// 清空内容先
$this->_response->setBody('');
// 前往链接
if (!is_array($urlForwards) && $urlForwards) {
$urlForwards = array(
array('url' => $urlForwards, 'text' => '前进')
);
}
if (!$urlForwards) {
$urlForwards = array(
array('url' => urldecode($this->_request->referer()), 'text' => '返回')
);
}
$redirectUrl = $urlForwards[0]['url'];
if (0 == $redirectTime && !empty($redirectUrl)) {
return $this->_response->redirect($urlForwards[0]['url']);
}
// 提示框样式
$msgTypes = array(
self::MESSAGE_INFO => 'info',
self::MESSAGE_WARNING => 'warning',
self::MESSAGE_ERROR => 'error',
self::MESSAGE_SUCCESS => 'success',
);
if (!array_key_exists($msgType, $msgTypes)) {
$msgType = self::MESSAGE_INFO;
}
$this->_view->assign('title', '提示信息');
$this->_view->assign('message', $message);
$this->_view->assign('messageType', $msgTypes[$msgType]);
$this->_view->assign('urlForwards', $urlForwards);
$this->_view->assign('redirectUrl', $redirectUrl);
$this->_view->assign('redirectTime', $redirectTime > 0 ? intval($redirectTime) : 0);
return $this->_view->renderLayout($this->_msgTplMessage, $this->_msgTplLayout, array(), View::LAYOUT_REBUILD_RESOURCE);
}
/**
* ajax 返回
* @param <type> $code
* @param <type> $message
* @param <type> $result
* @param <type> $jsonp
* @return <type>
*/
protected function _ajaxMessage($code, $message, $result = '', $jsonp = false) {
$return = Str::jsonEncode(array(
'code' => intval($code),
'message' => $message,
'result' => $result,
));
if ($jsonp) {
// [TODO] check referer ?
$callback = $this->_request->get(is_string($jsonp) ? $jsonp : 'callback', '');
if (!preg_match('/^jsonp\d{10,15}$/', $callback)) {
$callback = '';
}
$return = $callback . '(' . $return . ')';
}
// 不缓存
$this->_response->setNoCache();
return $this->_response->setBody($return);
}
} | dingusxp/vframework | app-demo/src/Controller/Base.php | PHP | bsd-2-clause | 4,584 |
<script id="expinfo-template" type="x-template">
<div class="row">
<div class="col-lg-4 col-lg-push-4 text-center well">
<p>
<strong>{{ gettext("Experiment:") }}</strong> {{ experiment["name"] }}
</p>
<p>
<strong>{{ gettext("Category:") }}</strong> {{ experiment["category"] }}
</p>
</div>
</div>
</script>
| zstars/weblabdeusto | server/src/weblab/core/templates/webclient_web/apps/lab/expinfo/expinfo.template.html | HTML | bsd-2-clause | 412 |
#include "default_room.h"
#include "movable.h"
#include "illegal_move_exception.h"
namespace qungeon
{
default_room::default_room(const std::string &description)
: description{ description }
{}
void default_room::set_north(qungeon::room* room)
{
north_room = room;
}
void default_room::set_south(qungeon::room* room)
{
south_room = room;
}
void default_room::set_east(qungeon::room* room)
{
east_room = room;
}
void default_room::set_west(qungeon::room* room)
{
west_room = room;
}
bool default_room::has_north_exit() const
{
return north_room != nullptr;
}
bool default_room::has_south_exit() const
{
return south_room != nullptr;
}
bool default_room::has_east_exit() const
{
return east_room != nullptr;
}
bool default_room::has_west_exit() const
{
return west_room != nullptr;
}
void default_room::transit_to(qungeon::movable* movable, qungeon::room* room, const char* exception_what) const
{
if (room != nullptr)
{
movable->set_location(room);
}
else
{
throw qungeon::illegal_move_exception(exception_what);
}
}
void default_room::transit_north(qungeon::movable* movable_object) const
{
transit_to(movable_object, north_room, "No north room");
}
void default_room::transit_south(qungeon::movable* movable_object) const
{
transit_to(movable_object, south_room, "No south room");
}
void default_room::transit_east(qungeon::movable* movable_object) const
{
transit_to(movable_object, east_room, "No east room");
}
void default_room::transit_west(qungeon::movable* movable_object) const
{
transit_to(movable_object, west_room, "No west room");
}
void default_room::write_description(std::ostream &output) const
{
output << description << std::endl;
}
}
| quintalion/qungeon | src/qungeon/default_room.cpp | C++ | bsd-2-clause | 1,695 |
package tinker.net.dongliu.apk.parser.struct.resource;
/**
* used by resource Type.
*
* @author dongliu
*/
public class ResTableConfig {
private byte[] array;
// Number of bytes in this structure. uint32_t
private int size;
// Mobile country code (from SIM). 0 means "any". uint16_t
private short mcc;
// Mobile network code (from SIM). 0 means "any". uint16_t
private short mnc;
//uint32_t imsi;
// 0 means "any". Otherwise, en, fr, etc. char[2]
private String language;
// 0 means "any". Otherwise, US, CA, etc. char[2]
private String country;
// uint32_t locale;
// uint8_t
private short orientation;
// uint8_t
private short touchscreen;
// uint16_t
private int density;
// uint32_t screenType;
// uint8_t
private byte keyboard;
// uint8_t
private byte navigation;
// uint8_t
private byte inputFlags;
// uint8_t
private byte inputPad0;
// uint32_t input;
// uint16_t
private int screenWidth;
// uint16_t
private int screenHeight;
// uint32_t screenSize;
// uint16_t
private int sdkVersion;
// For now minorVersion must always be 0!!! Its meaning is currently undefined.
// uint16_t
private int minorVersion;
//uint32_t version;
// uint8_t
private byte screenLayout;
// uint8_t
private byte uiMode;
// uint8_t
private short screenConfigPad1;
// uint8_t
private short screenConfigPad2;
//uint32_t screenConfig;
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public short getMcc() {
return mcc;
}
public void setMcc(short mcc) {
this.mcc = mcc;
}
public short getMnc() {
return mnc;
}
public void setMnc(short mnc) {
this.mnc = mnc;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public short getOrientation() {
return orientation;
}
public void setOrientation(short orientation) {
this.orientation = orientation;
}
public short getTouchscreen() {
return touchscreen;
}
public void setTouchscreen(short touchscreen) {
this.touchscreen = touchscreen;
}
public int getDensity() {
return density;
}
public void setDensity(int density) {
this.density = density;
}
public short getKeyboard() {
return keyboard;
}
public void setKeyboard(byte keyboard) {
this.keyboard = keyboard;
}
public short getNavigation() {
return navigation;
}
public void setNavigation(byte navigation) {
this.navigation = navigation;
}
public short getInputFlags() {
return inputFlags;
}
public void setInputFlags(byte inputFlags) {
this.inputFlags = inputFlags;
}
public short getInputPad0() {
return inputPad0;
}
public void setInputPad0(byte inputPad0) {
this.inputPad0 = inputPad0;
}
public int getScreenWidth() {
return screenWidth;
}
public void setScreenWidth(int screenWidth) {
this.screenWidth = screenWidth;
}
public int getScreenHeight() {
return screenHeight;
}
public void setScreenHeight(int screenHeight) {
this.screenHeight = screenHeight;
}
public int getSdkVersion() {
return sdkVersion;
}
public void setSdkVersion(int sdkVersion) {
this.sdkVersion = sdkVersion;
}
public int getMinorVersion() {
return minorVersion;
}
public void setMinorVersion(int minorVersion) {
this.minorVersion = minorVersion;
}
public short getScreenLayout() {
return screenLayout;
}
public void setScreenLayout(byte screenLayout) {
this.screenLayout = screenLayout;
}
public short getUiMode() {
return uiMode;
}
public void setUiMode(byte uiMode) {
this.uiMode = uiMode;
}
public short getScreenConfigPad1() {
return screenConfigPad1;
}
public void setScreenConfigPad1(short screenConfigPad1) {
this.screenConfigPad1 = screenConfigPad1;
}
public short getScreenConfigPad2() {
return screenConfigPad2;
}
public void setScreenConfigPad2(short screenConfigPad2) {
this.screenConfigPad2 = screenConfigPad2;
}
public byte[] getArray() {
return array;
}
public void setArray(byte[] array) {
this.array = array;
}
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof ResTableConfig) {
ResTableConfig oldResConfig = (ResTableConfig) object;
if (size != oldResConfig.getSize()) {
return false;
}
byte[] oldArray = oldResConfig.getArray();
for (int i = 0; i < size; i++) {
if (array[i] != oldArray[i]) {
// System.out.println("i:"+ i + " config:" + array[i] + " old:" + oldArray[i]);
return false;
}
}
return true;
}
return false;
}
}
| shwenzhang/apk-parser | apk-parser-lib/src/main/java/tinker/net/dongliu/apk/parser/struct/resource/ResTableConfig.java | Java | bsd-2-clause | 5,544 |
<?php
namespace Ace\ProjectBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Ace\ProjectBundle\Entity\Project as Project;
use Doctrine\ORM\EntityManager;
use Ace\ProjectBundle\Controller\MongoFilesController;
class ProjectController extends Controller
{
protected $em;
protected $fc;
public function createprojectAction($user_id, $project_name, $code)
{
$response = $this->createAction($user_id, $project_name, "")->getContent();
$response=json_decode($response, true);
return new Response(json_encode($response));
}
public function listAction($owner)
{
$projects = $this->em->getRepository('AceProjectBundle:Project')->findByOwner($owner);
$list = array();
foreach($projects as $project)
{
$list[] = array("id"=> $project->getId(), "name"=>$project->getName(), "description"=>$project->getDescription(), "is_public"=>$project->getIsPublic());
}
return new Response(json_encode($list));
}
public function createAction($owner, $name, $description)
{
$validName = json_decode($this->nameIsValid($name), true);
if(!$validName["success"])
return new Response(json_encode($validName));
$project = new Project();
$user = $this->em->getRepository('AceUserBundle:User')->find($owner);
$project->setOwner($user);
$project->setName($name);
$project->setDescription($description);
$project->setIsPublic(true);
$project->setType($this->sl);
$response = json_decode($this->fc->createAction(), true);
if($response["success"])
{
$id = $response["id"];
$project->setProjectfilesId($id);
$em = $this->em;
$em->persist($project);
$em->flush();
return new Response(json_encode(array("success" => true, "id" => $project->getId())));
}
else
return new Response(json_encode(array("success" => false, "owner_id" => $user->getId(), "name" => $name)));
}
public function deleteAction($id)
{
$project = $this->getProjectById($id);
$deletion = json_decode($this->fc->deleteAction($project->getProjectfilesId()), true);
if($deletion["success"] == true)
{
$em = $this->em;
$em->remove($project);
$em->flush();
return new Response(json_encode(array("success" => true)));
}
else
{
return new Response(json_encode(array("success" => false, "id" => $project->getProjectfilesId())));
}
}
public function cloneAction($owner, $id)
{
$project = $this->getProjectById($id);
$new_name=$project->getName();
$nameExists = json_decode($this->nameExists($owner,$new_name), true);
while($nameExists["success"])
{
$new_name = $new_name." copy";
$nameExists = json_decode($this->nameExists($owner,$new_name), true);
}
$response = json_decode($this->createAction($owner,$new_name,$project->getDescription())->getContent(),true);
if($response["success"] == true)
{
$list = json_decode($this->listFilesAction($project->getId())->getContent(), true);
return new Response(json_encode(array("success" => true, "id" => $response["id"], "list" => $list["list"], "name" => $new_name)));
}
else
{
return new Response(json_encode(array("success" => false, "id" => $id)));
}
}
public function renameAction($id, $new_name)
{
$validName = json_decode($this->nameIsValid($new_name), true);
if($validName["success"])
{
$project = $this->getProjectById($id);
$list = json_decode($this->listFilesAction($project->getId())->getContent(), true);
return new Response(json_encode(array("success" => true, "list" => $list["list"])));
}
else
{
return new Response(json_encode($validName));
}
}
public function getNameAction($id)
{
$project = $this->getProjectById($id);
$name = $project->getName();
return new Response(json_encode(array("success" => true, "response" => $name)));
}
public function getParentAction($id)
{
$project = $this->getProjectById($id);
$parent = $project->getParent();
if($parent != NULL)
{
$exists = json_decode($this->checkExistsAction($id)->getContent(), true);
if ($exists["success"])
{
$parent = $this->getProjectById($parent);
$response = array("id" => $parent->getId(), "owner" => $project->getOwner()->getUsername(), "name" => $project->getName());
return new Response(json_encode(array("success" => true, "response" => $response)));
}
}
return new Response(json_encode(array("success" => false)));
}
public function getOwnerAction($id)
{
$project = $this->getProjectById($id);
$user = $project->getOwner();
$response = array("id" => $user->getId(), "username" => $user->getUsername(), "firstname" => $user->getFirstname(), "lastname" => $user->getLastname());
return new Response(json_encode(array("success" => true, "response" => $response)));
}
public function getDescriptionAction($id)
{
$project = $this->getProjectById($id);
$response = $project->getDescription();
return new Response(json_encode(array("success" => true, "response" => $response)));
}
public function setDescriptionAction($id, $description)
{
$project = $this->getProjectById($id);
$project->setDescription($description);
$em = $this->em;
$em->persist($project);
$em->flush();
return new Response(json_encode(array("success" => true)));
}
public function listFilesAction($id)
{
$project = $this->getProjectById($id);
$list = $this->fc->listFilesAction($project->getProjectfilesId());
return new Response($list);
}
public function createFileAction($id, $filename, $code)
{
$project = $this->getProjectById($id);
$canCreate = json_decode($this->canCreateFile($project->getId(), $filename), true);
if($canCreate["success"])
{
$create = $this->fc->createFileAction($project->getProjectfilesId(), $filename, $code);
$retval = $create;
}
else
{
$retval = json_encode($canCreate);
}
return new Response($retval);
}
public function getFileAction($id, $filename)
{
$project = $this->getProjectById($id);
$get = $this->fc->getFileAction($project->getProjectfilesId(), $filename);
return new Response($get);
}
public function setFileAction($id, $filename, $code)
{
$project = $this->getProjectById($id);
$set = $this->fc->setFileAction($project->getProjectfilesId(), $filename, $code);
return new Response($set);
}
public function deleteFileAction($id, $filename)
{
$project = $this->getProjectById($id);
$delete = $this->fc->deleteFileAction($project->getProjectfilesId(), $filename);
return new Response($delete);
}
public function renameFileAction($id, $filename, $new_filename)
{
$project = $this->getProjectById($id);
$delete = $this->fc->renameFileAction($project->getProjectfilesId(), $filename, $new_filename);
return new Response($delete);
}
public function searchAction($token)
{
$results_name = json_decode($this->searchNameAction($token)->getContent(), true);
$results_desc = json_decode($this->searchDescriptionAction($token)->getContent(), true);
$results = $results_name + $results_desc;
return new Response(json_encode($results));
}
public function searchNameAction($token)
{
$em = $this->em;
$repository = $this->em->getRepository('AceProjectBundle:Project');
$qb = $em->createQueryBuilder();
$projects = $repository->createQueryBuilder('p')->where('p.name LIKE :token')->setParameter('token', "%".$token."%")->getQuery()->getResult();
$result = array();
foreach($projects as $project)
{
$owner = json_decode($this->getOwnerAction($project->getId())->getContent(), true);
$owner = $owner["response"];
$proj = array("name" => $project->getName(), "description" => $project->getDescription(), "owner" => $owner);
$result[] = array($project->getId() => $proj);
}
return new Response(json_encode($result));
}
public function searchDescriptionAction($token)
{
$em = $this->em;
$repository = $this->em->getRepository('AceProjectBundle:Project');
$qb = $em->createQueryBuilder();
$projects = $repository->createQueryBuilder('p')->where('p.description LIKE :token')->setParameter('token', "%".$token."%")->getQuery()->getResult();
$result = array();
foreach($projects as $project)
{
$owner = json_decode($this->getOwnerAction($project->getId())->getContent(), true);
$owner = $owner["response"];
$proj = array("name" => $project->getName(), "description" => $project->getDescription(), "owner" => $owner);
$result[] = array($project->getId() => $proj);
}
return new Response(json_encode($result));
}
public function checkExistsAction($id)
{
$em = $this->em;
$project = $this->em->getRepository('AceProjectBundle:Project')->find($id);
if (!$project)
return new Response(json_encode(array("success" => false)));
return new Response(json_encode(array("success" => true)));
}
public function getProjectById($id)
{
$em = $this->em;
$project = $this->em->getRepository('AceProjectBundle:Project')->find($id);
if (!$project)
throw $this->createNotFoundException('No project found with id '.$id);
// return new Response(json_encode(array(false, "Could not find project with id: ".$id)));
return $project;
}
protected function canCreateFile($id, $filename)
{
return json_encode(array("success" => true));
}
protected function nameIsValid($name)
{
$project_name = str_replace(".", "", trim(basename(stripslashes($name)), ".\x00..\x20"));
if($project_name == $name)
return json_encode(array("success" => true));
else
return json_encode(array("success" => false, "error" => "Invalid Name. Please enter a new one."));
}
protected function nameExists($owner, $name)
{
$userProjects = json_decode($this->listAction($owner)->getContent(),true);
foreach($userProjects as $p)
{
if ($p["name"] == $name)
{
return json_encode(array("success" => true));
}
}
return json_encode(array("success" => false));
}
}
| abhshkrv/Wiselib-Online | Symfony/src/Ace/ProjectBundle/Controller/ProjectController.php | PHP | bsd-2-clause | 10,290 |
package fr.laas.fape.graph.core.impl
import fr.laas.fape.graph.core.{LabeledEdge, LabeledGraph, MultiGraph}
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
class MultiLabeledUndirectedAdjacencyList[V, EdgeLabel](mEdges : mutable.ArrayBuffer[List[LabeledEdge[V, EdgeLabel]]],
mIndexes : mutable.Map[V, Int],
mVertices : mutable.ArrayBuffer[V])
extends UndirectedAdjacencyList[V, EdgeLabel, LabeledEdge[V, EdgeLabel]](mEdges, mIndexes, mVertices)
with LabeledGraph[V, EdgeLabel]
with MultiGraph[V, EdgeLabel, LabeledEdge[V,EdgeLabel]]
{
def this() = this(new ArrayBuffer[List[LabeledEdge[V, EdgeLabel]]], mutable.Map[V,Int](), new ArrayBuffer[V])
def cc = { new MultiLabeledUndirectedAdjacencyList[V, EdgeLabel](mEdges.clone(), mIndexes.clone(), mVertices.clone()) }
}
| athy/fape | structures/src/main/scala/fr/laas/fape/graph/core/impl/ConcreteUndirectedAdjacencyLists.scala | Scala | bsd-2-clause | 922 |
`date`
======
{% raw %}
Converts an argument to a date to allow date comparison:
````twig
{% if date(user.created_at) < date('-2days') %}
{# do something #}
{% endif %}
````
You can pass a timezone as the second argument:
````twig
{% if date(user.created_at) < date('-2days', 'Europe/Paris') %}
{# do something #}
{% endif %}
````
If no argument is passed, the function returns the current date:
````twig
{% if date(user.created_at) < date() %}
{# always! #}
{% endif %}
````
Arguments
---------
* `date`: The date
* `timezone`: The timezone
{% endraw %}
[back]({{ site.baseurl }}{% link language-reference/functions/index.md %}) | ericmorand/twing | docs/language-reference/functions/date.md | Markdown | bsd-2-clause | 655 |
/*
* This file is part of the WebKit open source project.
* This file has been generated by generate-bindings.pl. DO NOT MODIFY!
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WebKitDOMInterfaceName.h"
#include "CSSImportRule.h"
#include "DOMObjectCache.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "ExceptionCodeDescription.h"
#include "JSMainThreadExecState.h"
#include "WebKitDOMInterfaceNamePrivate.h"
#include "WebKitDOMPrivate.h"
#include "gobject/ConvertToUTF8String.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
#define WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_INTERFACE_NAME, WebKitDOMInterfaceNamePrivate)
typedef struct _WebKitDOMInterfaceNamePrivate {
RefPtr<WebCore::InterfaceName> coreObject;
} WebKitDOMInterfaceNamePrivate;
namespace WebKit {
WebKitDOMInterfaceName* kit(WebCore::InterfaceName* obj)
{
if (!obj)
return 0;
if (gpointer ret = DOMObjectCache::get(obj))
return WEBKIT_DOM_INTERFACE_NAME(ret);
return wrapInterfaceName(obj);
}
WebCore::InterfaceName* core(WebKitDOMInterfaceName* request)
{
return request ? static_cast<WebCore::InterfaceName*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
}
WebKitDOMInterfaceName* wrapInterfaceName(WebCore::InterfaceName* coreObject)
{
ASSERT(coreObject);
return WEBKIT_DOM_INTERFACE_NAME(g_object_new(WEBKIT_DOM_TYPE_INTERFACE_NAME, "core-object", coreObject, nullptr));
}
} // namespace WebKit
G_DEFINE_TYPE(WebKitDOMInterfaceName, webkit_dom_interface_name, WEBKIT_DOM_TYPE_OBJECT)
static void webkit_dom_interface_name_finalize(GObject* object)
{
WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(object);
WebKit::DOMObjectCache::forget(priv->coreObject.get());
priv->~WebKitDOMInterfaceNamePrivate();
G_OBJECT_CLASS(webkit_dom_interface_name_parent_class)->finalize(object);
}
static GObject* webkit_dom_interface_name_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
{
GObject* object = G_OBJECT_CLASS(webkit_dom_interface_name_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(object);
priv->coreObject = static_cast<WebCore::InterfaceName*>(WEBKIT_DOM_OBJECT(object)->coreObject);
WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
return object;
}
static void webkit_dom_interface_name_class_init(WebKitDOMInterfaceNameClass* requestClass)
{
GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
g_type_class_add_private(gobjectClass, sizeof(WebKitDOMInterfaceNamePrivate));
gobjectClass->constructor = webkit_dom_interface_name_constructor;
gobjectClass->finalize = webkit_dom_interface_name_finalize;
}
static void webkit_dom_interface_name_init(WebKitDOMInterfaceName* request)
{
WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(request);
new (priv) WebKitDOMInterfaceNamePrivate();
}
| applesrc/WebCore | bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp | C++ | bsd-2-clause | 3,862 |
export default {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"range": [
0,
19
],
"body": [
{
"type": "ExportNamedDeclaration",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 19
}
},
"range": [
0,
19
],
"declaration": {
"type": "VariableDeclaration",
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 19
}
},
"range": [
7,
19
],
"declarations": [
{
"type": "VariableDeclarator",
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
11,
18
],
"id": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 14
}
},
"range": [
11,
14
],
"name": "foo"
},
"init": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
17,
18
],
"value": 2,
"raw": "2"
}
}
],
"kind": "let"
},
"specifiers": [],
"source": null
}
],
"sourceType": "module",
"tokens": [
{
"type": "Keyword",
"value": "export",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
]
},
{
"type": "Keyword",
"value": "let",
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 10
}
},
"range": [
7,
10
]
},
{
"type": "Identifier",
"value": "foo",
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 14
}
},
"range": [
11,
14
]
},
{
"type": "Punctuator",
"value": "=",
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
},
"range": [
15,
16
]
},
{
"type": "Numeric",
"value": "2",
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
17,
18
]
},
{
"type": "Punctuator",
"value": ";",
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
}
},
"range": [
18,
19
]
}
]
}; | eslint/espree | tests/fixtures/ecma-version/6/modules-and-blockBindings/export-let-number.result.js | JavaScript | bsd-2-clause | 5,832 |
# --------------------------------------------------------
# TensorFlow for Dragon
# Copyright(c) 2017 SeetaTech
# Written by Ting Pan
# -------------------------------------------------------- | neopenx/Dragon | Dragon/python/dragon/vm/tensorflow/training/__init__.py | Python | bsd-2-clause | 193 |
java-check-certs
================
This is a simple utility written in Java to check the validity and expiration dates of SSL certificates for a given host. Each certificate in the host's certificate chain is checked. By default, it will warn you if a certificate is going to expire within 30 days. Usage looks something like:
```
./CheckCerts example.com example.org example.net
```
You could probably get the same functionality out of a curl one-liner, but really, where's the fun in that?
License:
--------
```
Copyright (c) 2013, Ryan Rogers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.
```
| timewasted/java-check-certs | README.md | Markdown | bsd-2-clause | 1,824 |
package Tapper::Schema::TestrunDB::ResultSet::Precondition;
BEGIN {
$Tapper::Schema::TestrunDB::ResultSet::Precondition::AUTHORITY = 'cpan:TAPPER';
}
{
$Tapper::Schema::TestrunDB::ResultSet::Precondition::VERSION = '4.1.3';
}
use strict;
use warnings;
use parent 'DBIx::Class::ResultSet';
use YAML::Syck;
sub add {
my ($self, $preconditions) = @_;
my @precond_list = @$preconditions;
my @precond_ids;
foreach my $precond_data (@precond_list) {
# (XXX) decide how to handle empty preconditions
next if not (ref($precond_data) eq 'HASH');
my $shortname = $precond_data->{shortname} || '';
my $timeout = $precond_data->{timeout};
my $precondition = $self->result_source->schema->resultset('Precondition')->new
({
shortname => $shortname,
precondition => Dump($precond_data),
timeout => $timeout,
});
$precondition->insert;
push @precond_ids, $precondition->id;
}
return @precond_ids;
}
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Tapper::Schema::TestrunDB::ResultSet::Precondition
=head2 add
Create (add) a list of preconditions and return them with their now
associated db data (eg. ID).
=head1 AUTHOR
AMD OSRC Tapper Team <tapper@amd64.org>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Advanced Micro Devices, Inc..
This is free software, licensed under:
The (two-clause) FreeBSD License
=cut
| gitpan/Tapper-Schema | lib/Tapper/Schema/TestrunDB/ResultSet/Precondition.pm | Perl | bsd-2-clause | 1,625 |
package org.hisrc.jsonix.analysis;
import org.apache.commons.lang3.Validate;
import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo;
import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo;
import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef;
import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo;
import org.jvnet.jaxb2_commons.xml.bind.model.MID;
import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF;
import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS;
import org.jvnet.jaxb2_commons.xml.bind.model.MList;
import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo;
import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo;
import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor;
import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo;
public class TypeInfoGraphBuilder<T, C extends T> implements
MTypeInfoVisitor<T, C, TypeInfoVertex<T, C>> {
private final ModelInfoGraphBuilder<T, C> modelInfoGraphBuilder;
private final MPackageInfo packageInfo;
public TypeInfoGraphBuilder(
ModelInfoGraphBuilder<T, C> modelInfoGraphBuilder,
MPackageInfo packageInfo) {
Validate.notNull(modelInfoGraphBuilder);
Validate.notNull(packageInfo);
this.modelInfoGraphBuilder = modelInfoGraphBuilder;
this.packageInfo = packageInfo;
}
@Override
public TypeInfoVertex<T, C> visitBuiltinLeafInfo(MBuiltinLeafInfo<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(null,
info);
addInfoVertex(typeVertex);
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitWildcardTypeInfo(
MWildcardTypeInfo<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(null,
info);
addInfoVertex(typeVertex);
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitID(MID<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
null, info);
if (addInfoVertex(typeVertex)) {
final TypeInfoVertex<T, C> valueTypeVertex = modelInfoGraphBuilder
.typeInfo(packageInfo, info.getValueTypeInfo());
modelInfoGraphBuilder
.addHardDependency(typeVertex, valueTypeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitIDREF(MIDREF<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
null, info);
if (addInfoVertex(typeVertex)) {
final TypeInfoVertex<T, C> valueTypeVertex = modelInfoGraphBuilder
.typeInfo(packageInfo, info.getValueTypeInfo());
modelInfoGraphBuilder
.addHardDependency(typeVertex, valueTypeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitIDREFS(MIDREFS<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
null, info);
if (addInfoVertex(typeVertex)) {
final TypeInfoVertex<T, C> valueTypeVertex = modelInfoGraphBuilder
.typeInfo(packageInfo, info.getItemTypeInfo());
modelInfoGraphBuilder
.addHardDependency(typeVertex, valueTypeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitList(MList<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
null, info);
if (addInfoVertex(typeVertex)) {
final TypeInfoVertex<T, C> itemTypeVertex = modelInfoGraphBuilder
.typeInfo(packageInfo, info.getItemTypeInfo());
modelInfoGraphBuilder.addHardDependency(typeVertex, itemTypeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitEnumLeafInfo(MEnumLeafInfo<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
info.getPackageInfo(), info);
if (addInfoVertex(typeVertex)) {
if (info.getBaseTypeInfo() != null) {
final TypeInfoVertex<T, C> baseTypeVertex = modelInfoGraphBuilder
.typeInfo(info.getPackageInfo(), info.getBaseTypeInfo());
modelInfoGraphBuilder.addHardDependency(typeVertex,
baseTypeVertex);
}
final PackageInfoVertex<T, C> packageInfoVertex = modelInfoGraphBuilder
.packageInfo(info.getPackageInfo());
modelInfoGraphBuilder.addSoftDependency(packageInfoVertex,
typeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitClassRef(MClassRef<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
info.getPackageInfo(), info);
if (addInfoVertex(typeVertex)) {
final PackageInfoVertex<T, C> packageInfoVertex = modelInfoGraphBuilder
.packageInfo(info.getPackageInfo());
modelInfoGraphBuilder.addSoftDependency(packageInfoVertex,
typeVertex);
}
return typeVertex;
}
@Override
public TypeInfoVertex<T, C> visitClassInfo(MClassInfo<T, C> info) {
final TypeInfoVertex<T, C> typeVertex = new TypeInfoVertex<T, C>(
info.getPackageInfo(), info);
if (addInfoVertex(typeVertex)) {
if (info.getBaseTypeInfo() != null) {
final TypeInfoVertex<T, C> baseTypeVertex = modelInfoGraphBuilder
.typeInfo(info.getPackageInfo(), info.getBaseTypeInfo());
modelInfoGraphBuilder.addHardDependency(typeVertex,
baseTypeVertex);
}
for (MPropertyInfo<T, C> propertyInfo : info.getProperties()) {
final InfoVertex<T, C> propertyVertex = modelInfoGraphBuilder
.propertyInfo(propertyInfo);
modelInfoGraphBuilder.addSoftDependency(typeVertex,
propertyVertex);
}
final PackageInfoVertex<T, C> packageInfoVertex = modelInfoGraphBuilder
.packageInfo(info.getPackageInfo());
modelInfoGraphBuilder.addSoftDependency(packageInfoVertex,
typeVertex);
}
return typeVertex;
}
private boolean addInfoVertex(InfoVertex<T, C> vertex) {
return modelInfoGraphBuilder.addInfoVertex(vertex);
}
}
| highsource/jsonix-schema-compiler | compiler/src/main/java/org/hisrc/jsonix/analysis/TypeInfoGraphBuilder.java | Java | bsd-2-clause | 5,652 |
var readFile = require('graceful-fs').readFile
var resolve = require('path').resolve
var spawn = require('win-spawn')
module.exports = function () {
return {
getStatement: function getStatement (callback) {
readFile(
resolve(__dirname, './problem.txt'),
{encoding: 'utf-8'},
callback
)
},
verify: function verify (args, t) {
var filename = args[0]
if (!filename) {
t.fail('must include file to verify')
return t.end()
}
var server = spawn(
'node',
[resolve(__dirname, './server.js')],
{env: {'NODE_DEBUG': 'http', 'PATH': process.env.PATH}}
)
var out = ''
var err = ''
server.stdout.on('data', function (data) {
console.log(data.toString('utf8').trim())
out += data.toString('utf8')
if (out.match(/listening/)) {
var client = spawn('node', [resolve(process.cwd(), filename)])
var cout = ''
var cerr = ''
client.stdout.on('data', function (data) { cout += data.toString('utf8') })
client.stderr.on('data', function (data) { cerr += data.toString('utf8') })
client.on('close', function (code) {
t.equal(code, 0, 'exited without errors')
t.equal(cout, 'BODY: hello\n', 'got expected response from server')
t.equal(cerr, 'done!\n', 'process logged at end')
server.kill()
})
}
})
server.stderr.on('data', function (data) {
console.log(data.toString('utf8').trim())
err += data.toString('utf8')
})
server.on('close', function () {
t.notOk(
out.match(/parse error/) || err.match(/parse error/) || err.match(/EADDRINUSE/),
'request was made successfully'
)
t.end()
})
}
}
}
| othiym23/bug-clinic | problems/node-debug/index.js | JavaScript | bsd-2-clause | 1,860 |
cask 'font-material-icons' do
version '2.2.3'
sha256 'c68797889b285abe51898defa209d1a1bd1d959c9f20e5ef486c1d3f0e08eac2'
# github.com/google/material-design-icons was verified as official when first introduced to the cask
url "https://github.com/google/material-design-icons/archive/#{version}.zip"
appcast 'https://github.com/google/material-design-icons/releases.atom',
checkpoint: '904d2021b0453db73abe506f4756b53eb78aa372f0628d57c8226a132c97323d'
name 'Material Icons'
homepage 'http://google.github.io/material-design-icons/'
license :oss
font "material-design-icons-#{version}/iconfont/MaterialIcons-Regular.ttf"
end
| victorpopkov/homebrew-fonts | Casks/font-material-icons.rb | Ruby | bsd-2-clause | 652 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.