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
|
|---|---|---|---|---|---|
<?php
namespace wcf\data\option\category;
use wcf\data\AbstractDatabaseObjectAction;
/**
* Executes option category-related actions.
*
* @author Alexander Ebert
* @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Data\Option\Category
*
* @method OptionCategory create()
* @method OptionCategoryEditor[] getObjects()
* @method OptionCategoryEditor getSingleObject()
*/
class OptionCategoryAction extends AbstractDatabaseObjectAction {
/**
* @inheritDoc
*/
protected $className = OptionCategoryEditor::class;
/**
* @inheritDoc
*/
protected $permissionsCreate = ['admin.configuration.canEditOption'];
/**
* @inheritDoc
*/
protected $permissionsDelete = ['admin.configuration.canEditOption'];
/**
* @inheritDoc
*/
protected $permissionsUpdate = ['admin.configuration.canEditOption'];
/**
* @inheritDoc
*/
protected $requireACP = ['create', 'delete', 'update'];
}
|
0xLeon/WCF
|
wcfsetup/install/files/lib/data/option/category/OptionCategoryAction.class.php
|
PHP
|
lgpl-2.1
| 1,020
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.FlowAnalysis;
using ICSharpCode.Decompiler.ILAst;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace ICSharpCode.Decompiler.Disassembler
{
/// <summary>
/// Disassembles a method body.
/// </summary>
public sealed class MethodBodyDisassembler
{
readonly ITextOutput output;
readonly bool detectControlStructure;
readonly CancellationToken cancellationToken;
public MethodBodyDisassembler(ITextOutput output, bool detectControlStructure, CancellationToken cancellationToken)
{
if (output == null)
throw new ArgumentNullException("output");
this.output = output;
this.detectControlStructure = detectControlStructure;
this.cancellationToken = cancellationToken;
}
public void Disassemble(MethodBody body, MemberMapping methodMapping)
{
// start writing IL code
MethodDefinition method = body.Method;
output.WriteLine("// Method begins at RVA 0x{0:x4}", method.RVA);
if (method.HasOverrides)
foreach (var methodOverride in method.Overrides)
output.WriteLine(".override {0}::{1}", methodOverride.DeclaringType.FullName, methodOverride.Name);
output.WriteLine("// Code size {0} (0x{0:x})", body.CodeSize);
output.WriteLine(".maxstack {0}", body.MaxStackSize);
if (method.DeclaringType.Module.Assembly.EntryPoint == method)
output.WriteLine (".entrypoint");
if (method.Body.HasVariables) {
output.Write(".locals ");
if (method.Body.InitLocals)
output.Write("init ");
output.WriteLine("(");
output.Indent();
foreach (var v in method.Body.Variables) {
output.WriteDefinition("[" + v.Index + "] ", v);
v.VariableType.WriteTo(output);
output.Write(' ');
output.Write(DisassemblerHelpers.Escape(v.Name));
output.WriteLine();
}
output.Unindent();
output.WriteLine(")");
}
output.WriteLine();
if (detectControlStructure && body.Instructions.Count > 0) {
Instruction inst = body.Instructions[0];
WriteStructureBody(new ILStructure(body), ref inst, methodMapping, method.Body.CodeSize);
} else {
foreach (var inst in method.Body.Instructions) {
inst.WriteTo(output);
// add IL code mappings - used in debugger
methodMapping.MemberCodeMappings.Add(
new SourceCodeMapping() {
SourceCodeLine = output.CurrentLine,
ILInstructionOffset = new ILRange { From = inst.Offset, To = inst.Next == null ? method.Body.CodeSize : inst.Next.Offset },
MemberMapping = methodMapping
});
output.WriteLine();
}
output.WriteLine();
foreach (var eh in method.Body.ExceptionHandlers) {
eh.WriteTo(output);
output.WriteLine();
}
}
}
void WriteStructureHeader(ILStructure s)
{
switch (s.Type) {
case ILStructureType.Loop:
output.Write("// loop start");
if (s.LoopEntryPoint != null) {
output.Write(" (head: ");
DisassemblerHelpers.WriteOffsetReference(output, s.LoopEntryPoint);
output.Write(')');
}
output.WriteLine();
break;
case ILStructureType.Try:
output.WriteLine(".try {");
break;
case ILStructureType.Handler:
switch (s.ExceptionHandler.HandlerType) {
case Mono.Cecil.Cil.ExceptionHandlerType.Catch:
case Mono.Cecil.Cil.ExceptionHandlerType.Filter:
output.Write("catch");
if (s.ExceptionHandler.CatchType != null) {
output.Write(' ');
s.ExceptionHandler.CatchType.WriteTo(output);
}
output.WriteLine(" {");
break;
case Mono.Cecil.Cil.ExceptionHandlerType.Finally:
output.WriteLine("finally {");
break;
case Mono.Cecil.Cil.ExceptionHandlerType.Fault:
output.WriteLine("fault {");
break;
default:
throw new NotSupportedException();
}
break;
case ILStructureType.Filter:
output.WriteLine("filter {");
break;
default:
throw new NotSupportedException();
}
output.Indent();
}
void WriteStructureBody(ILStructure s, ref Instruction inst, MemberMapping currentMethodMapping, int codeSize)
{
int childIndex = 0;
while (inst != null && inst.Offset < s.EndOffset) {
int offset = inst.Offset;
if (childIndex < s.Children.Count && s.Children[childIndex].StartOffset <= offset && offset < s.Children[childIndex].EndOffset) {
ILStructure child = s.Children[childIndex++];
WriteStructureHeader(child);
WriteStructureBody(child, ref inst, currentMethodMapping, codeSize);
WriteStructureFooter(child);
} else {
inst.WriteTo(output);
// add IL code mappings - used in debugger
if (currentMethodMapping != null) {
currentMethodMapping.MemberCodeMappings.Add(
new SourceCodeMapping() {
SourceCodeLine = output.CurrentLine,
ILInstructionOffset = new ILRange { From = inst.Offset, To = inst.Next == null ? codeSize : inst.Next.Offset },
MemberMapping = currentMethodMapping
});
}
output.WriteLine();
inst = inst.Next;
}
}
}
void WriteStructureFooter(ILStructure s)
{
output.Unindent();
switch (s.Type) {
case ILStructureType.Loop:
output.WriteLine("// end loop");
break;
case ILStructureType.Try:
output.WriteLine("} // end .try");
break;
case ILStructureType.Handler:
output.WriteLine("} // end handler");
break;
case ILStructureType.Filter:
output.WriteLine("} // end filter");
break;
default:
throw new NotSupportedException();
}
}
}
}
|
KarimLUCCIN/Cudafy
|
Cudafy.Translator/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
|
C#
|
lgpl-2.1
| 6,805
|
<?php
abstract class SearchModel extends FormModel
{
protected static $types = array('string', 'integer', 'decimal', 'date', 'datetime', 'time');
protected static $operators = array('select', 'containing', 'starting', 'ending', 'eq', 'neq', 'gt', 'goet', 'lt', 'loet');
protected $filters = array();
protected $filter;
protected $db;
protected $locale;
protected $messages;
public function __construct() {
parent::__construct();
$this->filters = $this->parseFilters();
$this->db = Db::instance();
$this->locale = Php2Go::app()->getLocale();
$this->messages = array(
'integer' => __(PHP2GO_LANG_DOMAIN, '{attribute} is not a valid integer number.'),
'decimal' => __(PHP2GO_LANG_DOMAIN, '{attribute} is not a valid decimal number.'),
'date' => __(PHP2GO_LANG_DOMAIN, '{attribute} is not a valid date.'),
'datetime' => __(PHP2GO_LANG_DOMAIN, '{attribute} is not a valid datetime.'),
'time' => __(PHP2GO_LANG_DOMAIN, '{attribute} is not a valid time.')
);
}
public function __get($name) {
if (preg_match('/^(\w+)\[(\w+)\]$/', $name, $matches))
list(, $name, $part) = $matches;
if (array_key_exists($name, $this->filters)) {
$value = $this->getAttribute($name);
if (isset($part) && is_array($value))
return (isset($value[$part]) ? $value[$part] : null);
return $value;
}
return parent::__get($name);
}
public function __set($name, $value) {
if (!$this->setAttribute($name, $value))
parent::__set($name, $value);
}
public function __isset($name) {
if (array_key_exists($name, $this->filters) && isset($this->filters[$name]['value']))
return true;
return parent::__isset($name);
}
public function __unset($name) {
if (array_key_exists($name, $this->filters))
$this->filters[$name]['value'] = null;
else
parent::__unset($name);
}
abstract public function filters();
public function getAttributeNames() {
return array_keys($this->filters);
}
public function hasAttribute($name) {
return (array_key_exists($name, $this->filters));
}
public function getAttribute($name) {
if (array_key_exists($name, $this->filters) && isset($this->filters[$name]['value']))
return $this->filters[$name]['value'];
return null;
}
public function getAttributeLabel($name, $fallback=null) {
if (preg_match('/^(\w+)\[(\w+)\]$/', $name, $matches)) {
list(, $name, $part) = $matches;
if ($part != 'val' && array_key_exists($name, $this->filters)) {
$key = $part . 'Label';
if (isset($this->filters[$name][$key]))
return $this->filters[$name][$key];
return parent::getAttributeLabel($name, $fallback) . ' (' . ucfirst($part) . ')';
}
}
return parent::getAttributeLabel($name, $fallback);
}
public function setAttribute($name, $value) {
if (array_key_exists($name, $this->filters)) {
$this->filters[$name]['value'] = $value;
return true;
}
return false;
}
public function hasErrors($attr=null) {
if ($attr !== null && array_key_exists($attr, $this->filters)) {
if ($this->filters[$attr]['operator'] == 'select')
return $this->hasErrors($attr . '[val]');
if ($this->filters[$attr]['interval'])
return ($this->hasErrors($attr . '[start]') || $this->hasErrors($attr . '[end]'));
}
return parent::hasErrors($attr);
}
public function isAttributeRequired($attr) {
if (array_key_exists($attr, $this->filters)) {
if ($this->filters[$attr]['operator'] == 'select')
return $this->isAttributeRequired($attr . '[val]');
if ($this->filters[$attr]['interval'])
return ($this->isAttributeRequired($attr . '[start]') || $this->isAttributeRequired($attr . '[end]'));
}
return parent::isAttributeRequired($attr);
}
public function import(array $attrs=array()) {
foreach ($attrs as $name => $value)
$this->setAttribute($name, $value);
$this->raiseEvent('onImport', new Event($this));
}
public function process() {
if ($this->validate())
return $this->buildFilter();
return null;
}
protected function parseFilters() {
$filters = $this->filters();
if (!is_array($filters))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Invalid filters specification.'));
foreach ($filters as $name => &$attrs) {
// validate attributes
if (!is_array($attrs))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Invalid filter specification.'));
// validate name
if (!isset($attrs['column']))
$attrs['column'] = $name;
// validate type
if (!isset($attrs['interval']))
$attrs['interval'] = false;
else
$attrs['interval'] = (bool)$attrs['interval'];
if (!isset($attrs['type'])) {
$attrs['type'] = 'string';
} else {
if (!in_array($attrs['type'], self::$types))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Invalid filter type: "%s".', array($attrs['type'])));
}
// validate operator
if (isset($attrs['operator'])) {
if ($attrs['interval'])
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Interval filters does not support "operator" option.'));
if (!in_array($attrs['operator'], self::$operators))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Invalid filter operator: "%s".', array($attrs['operator'])));
if ($attrs['type'] != 'string' && in_array($attrs['operator'], array('containing', 'starting', 'ending')))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'The "%s" search type does not support the "%s" operator.', array($attrs['type'], $attrs['operator'])));
}
if (!isset($attrs['operator'])) {
if ($attrs['interval']) {
$attrs['operator'] = 'between';
} else {
switch ($attrs['type']) {
case 'string' :
$attrs['operator'] = 'containing';
break;
default :
$attrs['operator'] = 'eq';
break;
}
}
}
// validate callbacks
foreach (array('callback', 'columnCallback', 'valueCallback') as $attr) {
if (isset($attrs[$attr]) && !is_callable($attrs[$attr]))
throw new Exception(__(PHP2GO_LANG_DOMAIN, 'Invalid callback on "%s" property of filter "%s".', array($attr, $name)));
}
}
return $filters;
}
protected function buildFilter() {
$filter = array();
$locale = Php2Go::app()->getLocale();
foreach ($this->filters as $name => $data) {
// skip non-query filters
if (isset($data['query']) && $data['query'] == false)
continue;
if (isset($data['value'])) {
$column = $data['column'];
if ($data['interval']) {
// interval filters
if (is_array($data['value'])) {
if (!isset($data['value']['start']) || !isset($data['value']['end']))
continue;
list($start, $end) = array_values($data['value']);
// format values
if (!Util::isEmpty($start)) {
try {
$start = $this->formatValue($data['type'], $start);
} catch (Exception $e) {
$this->addError($name, Util::buildMessage($this->messages[$data['type']], array('attribute' => $this->getAttributeLabel($name . '[start]'))));
continue;
}
}
if (!Util::isEmpty($end)) {
try {
$end = $this->formatValue($data['type'], $end, array('isEnd' => true));
} catch (Exception $e) {
$this->addError($name, Util::buildMessage($this->messages[$data['type']], array('attribute' => $this->getAttributeLabel($name . '[end]'))));
continue;
}
}
// skip empty
if (Util::isEmpty($start) || Util::isEmpty($end))
continue;
// build filter
if (isset($data['callback'])) {
$result = call_user_func_array($data['callback'], array($start, $end));
if (!Util::isEmpty($result))
$filter[] = $result;
} else {
$start = $this->resolveValueCallback($data, $start);
$end = $this->resolveValueCallback($data, $end);
if ($data['type'] != 'integer' && $data['type'] != 'decimal') {
$start = $this->db->quote($start);
$end = $this->db->quote($end);
}
$filter[] = $this->resolveColumnCallback($data, $column) . ' between ' . $start . ' and ' . $end;
}
}
} else {
// filters with operator selected by the user
if ($data['operator'] == 'select') {
if (!is_array($data['value']) || !isset($data['value']['op']) || !isset($data['value']['val']))
continue;
$operator = $data['value']['op'];
$value = $data['value']['val'];
} else {
$operator = $data['operator'];
$value = $data['value'];
}
// format value
if (!Util::isEmpty($value)) {
try {
$value = $this->formatValue($data['type'], $value);
} catch (Exception $e) {
$this->addError($name, Util::buildMessage($this->messages[$data['type']], array('attribute' => $this->getAttributeLabel($name))));
continue;
}
}
// skip empty values
if (Util::isEmpty($value))
continue;
// build filter
if (isset($data['callback'])) {
$result = call_user_func($data['callback'], $value, (isset($operator) ? $operator : null));
if (!Util::isEmpty($result))
$filter[] = $result;
} else {
$value = $this->resolveValueCallback($data, $value);
if ($operator == 'starting' || $operator == 'containing')
$value = '%' . $value;
if ($operator == 'ending' || $operator == 'containing')
$value .= '%';
if ($data['type'] != 'integer' && $data['type'] != 'decimal')
$value = $this->db->quote($value);
$filter[] = $this->resolveColumnCallback($data, $column) . $this->resolveOperator($operator) . $value;
}
}
}
}
return implode(' and ', $filter);
}
protected function formatValue($type, $value, array $options=array()) {
switch ($type) {
case 'integer' :
return LocaleNumber::getInteger($value);
break;
case 'decimal' :
return LocaleNumber::getNumber($value);
case 'date' :
return date('Y-m-d', DateTimeParser::parseIso($value, $this->locale->getDateInputFormat()));
case 'datetime' :
try {
return date('Y-m-d H:i:s', DateTimeParser::parseIso($value, $this->locale->getDateTimeInputFormat()));
}
// if datetime format fails, try date format appending the time
catch (DateTimeParserException $e) {
return date('Y-m-d', DateTimeParser::parseIso($value, $this->locale->getDateInputFormat())) . (isset($options['isEnd']) ? ' 23:59:59' : ' 00:00:00');
}
case 'time' :
return date('H:i:s', DateTimeParser::parseIso($value, $this->locale->getTimeInputFormat()));
default :
return $value;
}
}
protected function resolveColumnCallback(array $options, $name) {
if (isset($options['columnCallback']))
return call_user_func($options['columnCallback'], $name);
return $name;
}
protected function resolveOperator($operator) {
switch ($operator) {
case 'eq' :
case '=' :
return ' = ';
case 'neq' :
case '!=' :
return ' != ';
case 'gt' :
case '>' :
return ' > ';
case 'goet' :
case '>=' :
return ' >= ';
case 'lt' :
case '<' :
return ' < ';
case 'loet' :
case '<=' :
return ' <= ';
case 'starting' :
case 'ending' :
case 'containing' :
return ' like ';
}
}
protected function resolveValueCallback(array $options, $value) {
if (isset($options['valueCallback']))
return call_user_func($options['valueCallback'], $value);
return $value;
}
}
|
marcospont/php2go
|
php2go/search/SearchModel.php
|
PHP
|
lgpl-2.1
| 11,281
|
#!/usr/bin/python
from gi.repository import Gdk
from xml.etree.ElementTree import ElementTree, Element
import re
ESCAPE_PATTERN = re.compile(r'\\u\{([0-9A-Fa-f]+?)\}')
ISO_PATTERN = re.compile(r'[A-E]([0-9]+)')
def parse_single_key(value):
key = Element('key')
uc = 0
if hasattr(__builtins__, 'unichr'):
def unescape(m):
return chr(int(m.group(1), 16))
else:
def unescape(m):
return chr(int(m.group(1), 16))
value = ESCAPE_PATTERN.sub(unescape, value)
if len(value) > 1:
key.set('text', value)
uc = ord(value[0])
keyval = Gdk.unicode_to_keyval(uc)
name = Gdk.keyval_name(keyval)
key.set('name', name)
return key
def convert(source, tree):
root = Element('layout')
for index, keymap in enumerate(tree.iter('keyMap')):
level = Element('level')
rows = {}
root.append(level)
level.set('name', 'level%d' % (index+1))
# FIXME: heuristics here
modifiers = keymap.get('modifiers')
if not modifiers:
mode = 'default'
elif 'shift' in modifiers.split(' ') or 'lock' in modifiers.split(' '):
mode = 'latched'
else:
mode = 'locked'
level.set('mode', mode)
for _map in keymap.iter('map'):
value = _map.get('to')
key = parse_single_key(value)
iso = _map.get('iso')
if not ISO_PATTERN.match(iso):
sys.stderr.write('invalid ISO key name: %s\n' % iso)
continue
if not iso[0] in rows:
rows[iso[0]] = []
rows[iso[0]].append((int(iso[1:]), key))
# add attribute to certain keys
name = key.get('name')
if name == 'space':
key.set('align', 'center')
key.set('width', '6.0')
if name in ('space', 'BackSpace'):
key.set('repeatable', 'yes')
# add subkeys
longPress = _map.get('longPress')
if longPress:
for value in longPress.split(' '):
subkey = parse_single_key(value)
key.append(subkey)
for k, v in sorted(list(rows.items()), key=lambda x: x[0], reverse=True):
row = Element('row')
for key in sorted(v, key=lambda x: x):
row.append(key[1])
level.append(row)
return root
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("supply a CLDR keyboard file")
sys.exit(1)
source = sys.argv[-1]
itree = ElementTree()
itree.parse(source)
root = convert(source, itree)
indent(root)
otree = ElementTree(root)
if hasattr(sys.stdout, 'buffer'):
out = sys.stdout.buffer
else:
out = sys.stdout
otree.write(out, xml_declaration=True, encoding='UTF-8')
|
GNOME/caribou
|
tools/convert_cldr.py
|
Python
|
lgpl-2.1
| 3,381
|
/*
* This is software for administration and management of mobile equipment repair
*
* Copyright ( C ) 2015 , Pluscel
*
* This program is free software ; you can redistribute it and / or
* Modify it under the terms of the GNU General Public License
* As published by the Free Software Foundation ; either version 2
* Of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* But WITHOUT ANY WARRANTY; without even the implied warranty
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Boil
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* Along with this program ; if not, write to the Free Software
*
*
* Foundation , Inc. , 51 Franklin Street, Fifth Floor , Boston, MA 02110-1301 , USA .
*/
package domainapp.dom.app.homepage;
import domainapp.dom.modules.atencion.OrdenServicio;
import domainapp.dom.modules.atencion.OrdenServicioRepositorio;
import domainapp.dom.modules.atencion.Cliente;
import domainapp.dom.modules.atencion.ClienteRepositorio;
import org.apache.isis.applib.annotation.CollectionLayout;
import org.apache.isis.applib.annotation.MemberOrder;
import java.util.List;
import org.apache.isis.applib.annotation.RenderType;
import org.apache.isis.applib.annotation.ViewModel;
@ViewModel
public class HomePageViewModel {
//region > title
public String title() {
if (getEquiposSinReparar().size() > 1 ){
return getEquiposSinReparar().size() + " Ordenes de servicio sin reparación ";
}else if (getEquiposSinReparar().size() == 1) {
return getEquiposSinReparar().size() + " Orden de servicio sin reparación";
}else{
return "No hay ordenes de servicio sin reparación ";
}
}
//endregion
@MemberOrder(sequence = "1")
@CollectionLayout(
render = RenderType.EAGERLY
)
public List<OrdenServicio> getEquiposSinReparar() {
return OrdenServicioRepositorio.sinArreglo();
}
@MemberOrder(sequence = "2")
@CollectionLayout(
render = RenderType.EAGERLY
)
public List<OrdenServicio> getEquiposReparados() {
return OrdenServicioRepositorio.reparados();
}
@MemberOrder(sequence = "3")
@CollectionLayout(
render = RenderType.EAGERLY
)
public List<OrdenServicio> getEquiposSinRevisar() {
return OrdenServicioRepositorio.sinRevisar();
}
@MemberOrder(sequence = "4")
@CollectionLayout(
render = RenderType.EAGERLY
)
public List<Cliente> getUltimosClientes() {
return ClienteRepositorio.ultimosClientes();
}
@javax.inject.Inject
OrdenServicioRepositorio OrdenServicioRepositorio;
//ClienteRepositorio ClienteRepositorio;
//endregion
}
|
PlusCel/PlusCel
|
dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java
|
Java
|
lgpl-2.1
| 2,820
|
/*
* Copyright (C) 2014 Martin Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for
* more details.
*/
/**
* @addtogroup sys_net_ng_ipv6_netif
* @{
*
* @file
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#include <errno.h>
#include <string.h>
#include "kernel_types.h"
#include "mutex.h"
#include "net/eui64.h"
#include "net/ng_ipv6/addr.h"
#include "net/ng_ndp.h"
#include "net/ng_netapi.h"
#include "net/ng_netif.h"
#include "net/ng_netif/hdr.h"
#include "net/ng_sixlowpan/netif.h"
#include "net/ng_ipv6/netif.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
#if ENABLE_DEBUG
/* For PRIu16 etc. */
#include <inttypes.h>
#endif
static ng_ipv6_netif_t ipv6_ifs[NG_NETIF_NUMOF];
#if ENABLE_DEBUG
static char addr_str[NG_IPV6_ADDR_MAX_STR_LEN];
#endif
static ng_ipv6_addr_t *_add_addr_to_entry(ng_ipv6_netif_t *entry, const ng_ipv6_addr_t *addr,
uint8_t prefix_len, uint8_t flags)
{
ng_ipv6_netif_addr_t *tmp_addr = NULL;
for (int i = 0; i < NG_IPV6_NETIF_ADDR_NUMOF; i++) {
if (ng_ipv6_addr_equal(&(entry->addrs[i].addr), addr)) {
return &(entry->addrs[i].addr);
}
if (ng_ipv6_addr_is_unspecified(&(entry->addrs[i].addr)) && !tmp_addr) {
tmp_addr = &(entry->addrs[i]);
}
}
if (!tmp_addr) {
DEBUG("ipv6 netif: couldn't add %s/%" PRIu8 " to interface %" PRIkernel_pid "\n: No space left.",
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
prefix_len, entry->pid);
return NULL;
}
memcpy(&(tmp_addr->addr), addr, sizeof(ng_ipv6_addr_t));
DEBUG("ipv6 netif: Added %s/%" PRIu8 " to interface %" PRIkernel_pid "\n",
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
prefix_len, entry->pid);
tmp_addr->prefix_len = prefix_len;
tmp_addr->flags = flags;
if (ng_ipv6_addr_is_multicast(addr)) {
tmp_addr->flags |= NG_IPV6_NETIF_ADDR_FLAGS_NON_UNICAST;
}
else {
ng_ipv6_addr_t sol_node;
if (!ng_ipv6_addr_is_link_local(addr)) {
/* add also corresponding link-local address */
ng_ipv6_addr_t ll_addr;
ll_addr.u64[1] = addr->u64[1];
ng_ipv6_addr_set_link_local_prefix(&ll_addr);
_add_addr_to_entry(entry, &ll_addr, 64,
flags | NG_IPV6_NETIF_ADDR_FLAGS_NDP_ON_LINK);
}
else {
tmp_addr->flags |= NG_IPV6_NETIF_ADDR_FLAGS_NDP_ON_LINK;
}
ng_ipv6_addr_set_solicited_nodes(&sol_node, addr);
_add_addr_to_entry(entry, &sol_node, NG_IPV6_ADDR_BIT_LEN, 0);
}
return &(tmp_addr->addr);
}
static void _reset_addr_from_entry(ng_ipv6_netif_t *entry)
{
DEBUG("ipv6 netif: Reset IPv6 addresses on interface %" PRIkernel_pid "\n", entry->pid);
memset(entry->addrs, 0, sizeof(entry->addrs));
}
void ng_ipv6_netif_init(void)
{
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
mutex_init(&(ipv6_ifs[i].mutex));
mutex_lock(&(ipv6_ifs[i].mutex));
_reset_addr_from_entry(&ipv6_ifs[i]);
ipv6_ifs[i].pid = KERNEL_PID_UNDEF;
mutex_unlock(&(ipv6_ifs[i].mutex));
}
}
void ng_ipv6_netif_add(kernel_pid_t pid)
{
ng_ipv6_netif_t *free_entry = NULL;
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
if (ipv6_ifs[i].pid == pid) {
/* pid has already been added */
return;
}
else if ((ipv6_ifs[i].pid == KERNEL_PID_UNDEF) && !free_entry) {
/* found the first free entry */
free_entry = &ipv6_ifs[i];
}
}
if (!free_entry) {
DEBUG("ipv6 netif: Could not add %" PRIkernel_pid " to IPv6: No space left.\n", pid);
return;
}
/* Otherwise, fill the free entry */
ng_ipv6_addr_t addr = NG_IPV6_ADDR_ALL_NODES_LINK_LOCAL;
mutex_lock(&free_entry->mutex);
DEBUG("ipv6 netif: Add IPv6 interface %" PRIkernel_pid " (i = %d)\n", pid,
free_entry - ipv6_ifs);
free_entry->pid = pid;
free_entry->mtu = NG_IPV6_NETIF_DEFAULT_MTU;
free_entry->cur_hl = NG_IPV6_NETIF_DEFAULT_HL;
free_entry->flags = 0;
_add_addr_to_entry(free_entry, &addr, NG_IPV6_ADDR_BIT_LEN, 0);
mutex_unlock(&free_entry->mutex);
#ifdef MODULE_NG_NDP
ng_ndp_netif_add(free_entry);
#endif
DEBUG(" * pid = %" PRIkernel_pid " ", free_entry->pid);
DEBUG("cur_hl = %d ", free_entry->cur_hl);
DEBUG("mtu = %d ", free_entry->mtu);
DEBUG("flags = %04" PRIx16 "\n", free_entry->flags);
}
void ng_ipv6_netif_remove(kernel_pid_t pid)
{
ng_ipv6_netif_t *entry = ng_ipv6_netif_get(pid);
if (entry == NULL) {
return;
}
#ifdef MODULE_NG_NDP
ng_ndp_netif_remove(entry);
#endif
mutex_lock(&entry->mutex);
_reset_addr_from_entry(entry);
DEBUG("ipv6 netif: Remove IPv6 interface %" PRIkernel_pid "\n", pid);
entry->pid = KERNEL_PID_UNDEF;
entry->flags = 0;
mutex_unlock(&entry->mutex);
}
ng_ipv6_netif_t *ng_ipv6_netif_get(kernel_pid_t pid)
{
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
if (ipv6_ifs[i].pid == pid) {
DEBUG("ipv6 netif: Get IPv6 interface %" PRIkernel_pid " (%p, i = %d)\n", pid,
(void *)(&(ipv6_ifs[i])), i);
return &(ipv6_ifs[i]);
}
}
return NULL;
}
ng_ipv6_addr_t *ng_ipv6_netif_add_addr(kernel_pid_t pid, const ng_ipv6_addr_t *addr,
uint8_t prefix_len, uint8_t flags)
{
ng_ipv6_netif_t *entry = ng_ipv6_netif_get(pid);
ng_ipv6_addr_t *res;
if ((entry == NULL) || (addr == NULL) || (ng_ipv6_addr_is_unspecified(addr)) ||
((prefix_len - 1) > 127)) { /* prefix_len < 1 || prefix_len > 128 */
return NULL;
}
mutex_lock(&entry->mutex);
res = _add_addr_to_entry(entry, addr, prefix_len, flags);
mutex_unlock(&entry->mutex);
return res;
}
static void _remove_addr_from_entry(ng_ipv6_netif_t *entry, ng_ipv6_addr_t *addr)
{
mutex_lock(&entry->mutex);
for (int i = 0; i < NG_IPV6_NETIF_ADDR_NUMOF; i++) {
if (ng_ipv6_addr_equal(&(entry->addrs[i].addr), addr)) {
DEBUG("ipv6 netif: Remove %s to interface %" PRIkernel_pid "\n",
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)), entry->pid);
ng_ipv6_addr_set_unspecified(&(entry->addrs[i].addr));
entry->addrs[i].flags = 0;
mutex_unlock(&entry->mutex);
return;
}
}
mutex_unlock(&entry->mutex);
}
void ng_ipv6_netif_remove_addr(kernel_pid_t pid, ng_ipv6_addr_t *addr)
{
if (pid == KERNEL_PID_UNDEF) {
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
if (ipv6_ifs[i].pid == KERNEL_PID_UNDEF) {
continue;
}
_remove_addr_from_entry(ipv6_ifs + i, addr);
}
}
else {
ng_ipv6_netif_t *entry = ng_ipv6_netif_get(pid);
_remove_addr_from_entry(entry, addr);
}
}
void ng_ipv6_netif_reset_addr(kernel_pid_t pid)
{
ng_ipv6_netif_t *entry = ng_ipv6_netif_get(pid);
if (entry == NULL) {
return;
}
mutex_lock(&entry->mutex);
_reset_addr_from_entry(entry);
mutex_unlock(&entry->mutex);
}
kernel_pid_t ng_ipv6_netif_find_by_addr(ng_ipv6_addr_t **out, const ng_ipv6_addr_t *addr)
{
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
if (out != NULL) {
*out = ng_ipv6_netif_find_addr(ipv6_ifs[i].pid, addr);
if (*out != NULL) {
DEBUG("ipv6 netif: Found %s on interface %" PRIkernel_pid "\n",
ng_ipv6_addr_to_str(addr_str, *out, sizeof(addr_str)),
ipv6_ifs[i].pid);
return ipv6_ifs[i].pid;
}
}
else {
if (ng_ipv6_netif_find_addr(ipv6_ifs[i].pid, addr) != NULL) {
DEBUG("ipv6 netif: Found :: on interface %" PRIkernel_pid "\n",
ipv6_ifs[i].pid);
return ipv6_ifs[i].pid;
}
}
}
if (out != NULL) {
*out = NULL;
}
return KERNEL_PID_UNDEF;
}
ng_ipv6_addr_t *ng_ipv6_netif_find_addr(kernel_pid_t pid, const ng_ipv6_addr_t *addr)
{
ng_ipv6_netif_t *entry = ng_ipv6_netif_get(pid);
if (entry == NULL) {
return NULL;
}
mutex_lock(&entry->mutex);
for (int i = 0; i < NG_IPV6_NETIF_ADDR_NUMOF; i++) {
if (ng_ipv6_addr_equal(&(entry->addrs[i].addr), addr)) {
mutex_unlock(&entry->mutex);
DEBUG("ipv6 netif: Found %s on interface %" PRIkernel_pid "\n",
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
pid);
return &(entry->addrs[i].addr);
}
}
mutex_unlock(&entry->mutex);
return NULL;
}
static uint8_t _find_by_prefix_unsafe(ng_ipv6_addr_t **res, ng_ipv6_netif_t *iface,
const ng_ipv6_addr_t *addr, bool src_search)
{
uint8_t best_match = 0;
for (int i = 0; i < NG_IPV6_NETIF_ADDR_NUMOF; i++) {
uint8_t match;
if ((src_search &&
ng_ipv6_netif_addr_is_non_unicast(&(iface->addrs[i].addr))) ||
ng_ipv6_addr_is_unspecified(&(iface->addrs[i].addr))) {
continue;
}
match = ng_ipv6_addr_match_prefix(&(iface->addrs[i].addr), addr);
if (!src_search && !ng_ipv6_addr_is_multicast(addr) &&
(match < iface->addrs[i].prefix_len)) {
/* match but not of same subnet */
continue;
}
if (match > best_match) {
if (res != NULL) {
*res = &(iface->addrs[i].addr);
}
best_match = match;
}
}
#if ENABLE_DEBUG
if (*res != NULL) {
DEBUG("ipv6 netif: Found %s on interface %" PRIkernel_pid " matching ",
ng_ipv6_addr_to_str(addr_str, *res, sizeof(addr_str)),
iface->pid);
DEBUG("%s by %" PRIu8 " bits (used as source address = %s)\n",
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
best_match,
(src_search) ? "true" : "false");
}
else {
DEBUG("ipv6 netif: Did not found any address on interface %" PRIkernel_pid
" matching %s (used as source address = %s)\n",
iface->pid,
ng_ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
(src_search) ? "true" : "false");
}
#endif
return best_match;
}
kernel_pid_t ng_ipv6_netif_find_by_prefix(ng_ipv6_addr_t **out, const ng_ipv6_addr_t *prefix)
{
uint8_t best_match = 0;
ng_ipv6_addr_t *tmp_res = NULL;
kernel_pid_t res = KERNEL_PID_UNDEF;
for (int i = 0; i < NG_NETIF_NUMOF; i++) {
uint8_t match;
mutex_lock(&(ipv6_ifs[i].mutex));
match = _find_by_prefix_unsafe(&tmp_res, ipv6_ifs + i, prefix, false);
if (match > best_match) {
if (out != NULL) {
*out = tmp_res;
}
res = ipv6_ifs[i].pid;
best_match = match;
}
mutex_unlock(&(ipv6_ifs[i].mutex));
}
#if ENABLE_DEBUG
if (res != KERNEL_PID_UNDEF) {
DEBUG("ipv6 netif: Found %s on interface %" PRIkernel_pid " globally matching ",
ng_ipv6_addr_to_str(addr_str, *out, sizeof(addr_str)),
res);
DEBUG("%s by %" PRIu8 " bits\n",
ng_ipv6_addr_to_str(addr_str, prefix, sizeof(addr_str)),
best_match);
}
else {
DEBUG("ipv6 netif: Did not found any address globally matching %s\n",
ng_ipv6_addr_to_str(addr_str, prefix, sizeof(addr_str)));
}
#endif
return res;
}
static ng_ipv6_addr_t *_match_prefix(kernel_pid_t pid, const ng_ipv6_addr_t *addr,
bool src_search)
{
ng_ipv6_addr_t *res = NULL;
ng_ipv6_netif_t *iface = ng_ipv6_netif_get(pid);
mutex_lock(&(iface->mutex));
if (_find_by_prefix_unsafe(&res, iface, addr, src_search) > 0) {
mutex_unlock(&(iface->mutex));
return res;
}
mutex_unlock(&(iface->mutex));
return NULL;
}
ng_ipv6_addr_t *ng_ipv6_netif_match_prefix(kernel_pid_t pid,
const ng_ipv6_addr_t *prefix)
{
return _match_prefix(pid, prefix, false);
}
ng_ipv6_addr_t *ng_ipv6_netif_find_best_src_addr(kernel_pid_t pid, const ng_ipv6_addr_t *dest)
{
return _match_prefix(pid, dest, true);
}
void ng_ipv6_netif_init_by_dev(void)
{
kernel_pid_t ifs[NG_NETIF_NUMOF];
size_t ifnum = ng_netif_get(ifs);
for (size_t i = 0; i < ifnum; i++) {
ng_ipv6_addr_t addr;
eui64_t iid;
ng_ipv6_netif_t *ipv6_if = ng_ipv6_netif_get(ifs[i]);
if (ipv6_if == NULL) {
continue;
}
mutex_lock(&ipv6_if->mutex);
#ifdef MODULE_NG_SIXLOWPAN
ng_nettype_t if_type = NG_NETTYPE_UNDEF;
if ((ng_netapi_get(ifs[i], NETOPT_PROTO, 0, &if_type,
sizeof(if_type)) != -ENOTSUP) &&
(if_type == NG_NETTYPE_SIXLOWPAN)) {
uint16_t src_len = 8;
uint16_t max_frag_size = UINT16_MAX;
DEBUG("ipv6 netif: Set 6LoWPAN flag\n");
ipv6_ifs[i].flags |= NG_IPV6_NETIF_FLAGS_SIXLOWPAN;
/* use EUI-64 (8-byte address) for IID generation and for sending
* packets */
ng_netapi_set(ifs[i], NETOPT_SRC_LEN, 0, &src_len,
sizeof(src_len)); /* don't care for result */
if (ng_netapi_get(ifs[i], NETOPT_MAX_PACKET_SIZE,
0, &max_frag_size, sizeof(max_frag_size)) < 0) {
/* if error we assume it works */
DEBUG("ipv6 netif: Can not get max packet size from interface %"
PRIkernel_pid "\n", ifs[i]);
}
ng_sixlowpan_netif_add(ifs[i], max_frag_size);
}
#endif
if ((ng_netapi_get(ifs[i], NETOPT_IPV6_IID, 0, &iid,
sizeof(eui64_t)) < 0)) {
mutex_unlock(&ipv6_if->mutex);
continue;
}
ng_ipv6_addr_set_aiid(&addr, iid.uint8);
ng_ipv6_addr_set_link_local_prefix(&addr);
_add_addr_to_entry(ipv6_if, &addr, 64, 0);
mutex_unlock(&ipv6_if->mutex);
}
}
/**
* @}
*/
|
bartfaizoltan/RIOT
|
sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c
|
C
|
lgpl-2.1
| 14,519
|
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class RingsideAlbum extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('album');
$this->hasColumn('aid', 'integer', 8, array('alltypes' => array(0 => 'integer'), 'ntype' => 'bigint(20)', 'unsigned' => 0, 'values' => array(), 'primary' => true, 'notnull' => true, 'autoincrement' => true));
$this->hasColumn('cover_pid', 'integer', 2, array('alltypes' => array(0 => 'integer'), 'ntype' => 'smallint(1)', 'unsigned' => 0, 'values' => array(), 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
$this->hasColumn('owner', 'integer', 4, array('alltypes' => array(0 => 'integer'), 'ntype' => 'int(10) unsigned', 'unsigned' => 1, 'values' => array(), 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
$this->hasColumn('name', 'string', 100, array('alltypes' => array(0 => 'string'), 'ntype' => 'varchar(100)', 'fixed' => false, 'values' => array(), 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
$this->hasColumn('description', 'string', 100, array('alltypes' => array(0 => 'string'), 'ntype' => 'varchar(100)', 'fixed' => false, 'values' => array(), 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
$this->hasColumn('location', 'string', 100, array('alltypes' => array(0 => 'string'), 'ntype' => 'varchar(100)', 'fixed' => false, 'values' => array(), 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
$this->hasColumn('jason', 'string', 140, array('alltypes' => array(0 => 'string'), 'ntype' => 'varchar(100)', 'fixed' => false, 'values' => array(), 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
}
public function setUp()
{
parent::setUp();
$this->actAs('Timestampable', array('created' => array('name' => 'created', 'type' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'disabled' => false, 'options' => array()), 'updated' => array('name' => 'modified', 'type' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'disabled' => false, 'options' => array())));
}
}
|
jkinner/ringside
|
api/includes/ringside/api/dao/records/RingsideAlbum.php
|
PHP
|
lgpl-2.1
| 2,224
|
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This 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.1 of
* the License, or (at your option) any later version.
*
* This software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.rendering;
import org.xwiki.rendering.test.integration.junit5.RenderingTests;
import org.xwiki.test.annotation.AllComponents;
/**
* Run all tests found in {@code simple/*.test} files located in the classpath. These {@code *.test} files must follow
* the conventions described in {@link org.xwiki.rendering.test.integration.TestDataParser}.
*
* @version $Id$
* @since 3.0RC1
*/
@RenderingTests.Scope(value = "simple"/*, pattern = "macro35.test"*/)
@AllComponents
public class SimpleIntegrationTests implements RenderingTests
{
}
|
xwiki/xwiki-rendering
|
xwiki-rendering-integration-tests/src/test/java/org/xwiki/rendering/SimpleIntegrationTests.java
|
Java
|
lgpl-2.1
| 1,449
|
/**
* @file fsareasearchlistctrl.cpp
* @brief A area search-specific implementation of scrolllist
*
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (c) 2014 Ansariel Hiller
*
* This library 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;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "fsareasearchlistctrl.h"
#include "llscrolllistitem.h"
static LLDefaultChildRegistry::Register<FSAreaSearchListCtrl> r("area_search_list");
FSAreaSearchListCtrl::FSAreaSearchListCtrl(const Params& p)
: FSScrollListCtrl(p)
{
}
BOOL FSAreaSearchListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
if (mContextMenu)
{
std::vector<LLScrollListItem*> selected_items = getAllSelected();
if (selected_items.size() > 1)
{
uuid_vec_t selected_uuids;
for (std::vector<LLScrollListItem*>::iterator it = selected_items.begin(); it != selected_items.end(); ++it)
{
selected_uuids.push_back((*it)->getUUID());
}
mContextMenu->show(this, selected_uuids, x, y);
}
else
{
LLScrollListItem* hit_item = hitItem(x, y);
if (hit_item)
{
LLUUID val = hit_item->getValue();
selectByID(val);
uuid_vec_t selected_uuids;
selected_uuids.push_back(val);
mContextMenu->show(this, selected_uuids, x, y);
}
}
}
return handled;
}
|
gabeharms/firestorm
|
indra/newview/fsareasearchlistctrl.cpp
|
C++
|
lgpl-2.1
| 2,180
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
The AER convolution chips developed in the CAVIAR project.
</body>
</html>
|
viktorbahr/jaer
|
src/es/cnm/imse/jaer/chip/convolution/package.html
|
HTML
|
lgpl-2.1
| 199
|
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>pywurfl.ql.TypeBool</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://celljam.net/">pywurfl</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="pywurfl-module.html">Package pywurfl</a> ::
<a href="pywurfl.ql-module.html">Module ql</a> ::
Class TypeBool
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="pywurfl.ql.TypeBool-class.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class TypeBool</h1><p class="nomargin-top"><span class="codelink"><a href="pywurfl.ql-pysrc.html#TypeBool">source code</a></span></p>
<pre class="base-tree">
<a href="pywurfl.ql._Type-class.html" onclick="show_private();">_Type</a> --+
|
<strong class="uidshort">TypeBool</strong>
</pre>
<hr />
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Instance Methods</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-InstanceMethods"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="indent-wrapped-lines"><b>Inherited from <code><a href="pywurfl.ql._Type-class.html" onclick="show_private();">_Type</a></code></b>:
<code><a href="pywurfl.ql._Type-class.html#__getattr__">__getattr__</a></code>,
<code><a href="pywurfl.ql._Type-class.html#__init__">__init__</a></code>
</p>
</td>
</tr>
</table>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://celljam.net/">pywurfl</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Thu Jan 6 15:27:23 2011
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>
|
SamyStyle/pywurfl
|
doc/api/pywurfl.ql.TypeBool-class.html
|
HTML
|
lgpl-2.1
| 5,252
|
/**********************************************************************
* Copyright (c) 2013-2014, The Pennsylvania State University.
* All rights reserved.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
#include "prjspeciesimpl.h"
namespace prj
{
void SpeciesImpl::setDefaults()
{
m_nr = 0;
m_sflag = 0;
m_ntflag = 0;
m_molwt = RX7("0.0");
m_mdiam = RX7("0.0");
m_edens = RX7("0.0");
m_decay = RX7("0.0");
m_Dm = RX7("0.0");
m_ccdef = RX7("0.0");
m_Cp = RX7("0.0");
m_ucc = 0;
m_umd = 0;
m_ued = 0;
m_udm = 0;
m_ucp = 0;
}
SpeciesImpl::SpeciesImpl()
{
setDefaults();
}
SpeciesImpl::SpeciesImpl(int nr,int sflag,int ntflag,STRING molwt,STRING mdiam,STRING edens,STRING decay,
STRING Dm,STRING ccdef,STRING Cp,int ucc, int umd,int ued,int udm,int ucp,STRING name,
STRING desc)
{
setDefaults();
setNr(nr);
setSflag(sflag);
setNtflag(ntflag);
setMolwt(molwt);
setMdiam(mdiam);
setEdens(edens);
setDecay(decay);
setDm(Dm);
setCcdef(ccdef);
setCp(Cp);
setUcc(ucc);
setUmd(umd);
setUed(ued);
setUdm(udm);
setUcp(ucp);
setName(name);
setDesc(desc);
}
SpeciesImpl::SpeciesImpl(int nr,int sflag,int ntflag,double molwt,double mdiam,double edens,double decay,
double Dm,double ccdef,double Cp,int ucc,int umd,int ued,int udm,int ucp,STRING name,
STRING desc)
{
setDefaults();
setNr(nr);
setSflag(sflag);
setNtflag(ntflag);
setMolwt(molwt);
setMdiam(mdiam);
setEdens(edens);
setDecay(decay);
setDm(Dm);
setCcdef(ccdef);
setCp(Cp);
setUcc(ucc);
setUmd(umd);
setUed(ued);
setUdm(udm);
setUcp(ucp);
setName(name);
setDesc(desc);
}
void SpeciesImpl::read(Reader &input)
{
setNr(input.read<int>(FILELINE));
setSflag(input.read<int>(FILELINE));
setNtflag(input.read<int>(FILELINE));
setMolwt(input.read<STRING>(FILELINE));
setMdiam(input.read<STRING>(FILELINE));
setEdens(input.read<STRING>(FILELINE));
setDecay(input.read<STRING>(FILELINE));
setDm(input.read<STRING>(FILELINE));
setCcdef(input.read<STRING>(FILELINE));
setCp(input.read<STRING>(FILELINE));
setUcc(input.read<int>(FILELINE));
setUmd(input.read<int>(FILELINE));
setUed(input.read<int>(FILELINE));
setUdm(input.read<int>(FILELINE));
setUcp(input.read<int>(FILELINE));
setName(input.readString(FILELINE));
setDesc(input.readLine(FILELINE));
}
STRING SpeciesImpl::write()
{
STRING string;
string += TO_STRING(m_nr) + ' ' + TO_STRING(m_sflag) + ' ' + TO_STRING(m_ntflag) + ' ' + TO_STRING(m_molwt) + ' ' + TO_STRING(m_mdiam) + ' ' + TO_STRING(m_edens) + ' ' + TO_STRING(m_decay) + ' ' + TO_STRING(m_Dm) + ' ' + TO_STRING(m_ccdef) + ' ' + TO_STRING(m_Cp) + ' ' + TO_STRING(m_ucc) + ' ' + TO_STRING(m_umd) + ' ' + TO_STRING(m_ued) + ' ' + TO_STRING(m_udm) + ' ' + TO_STRING(m_ucp) + ' ' + m_name + '\n';
string += m_desc + '\n';
return string;
}
int SpeciesImpl::nr() const
{
return m_nr;
}
void SpeciesImpl::setNr(const int nr)
{
m_nr = nr;
}
int SpeciesImpl::sflag() const
{
return m_sflag;
}
void SpeciesImpl::setSflag(const int sflag)
{
m_sflag = sflag;
}
int SpeciesImpl::ntflag() const
{
return m_ntflag;
}
void SpeciesImpl::setNtflag(const int ntflag)
{
m_ntflag = ntflag;
}
double SpeciesImpl::molwt() const
{
return m_molwt.toDouble();
}
bool SpeciesImpl::setMolwt(const double molwt)
{
m_molwt = QString::number(molwt);
return true;
}
bool SpeciesImpl::setMolwt(const STRING &molwt)
{
bool ok;
FROM_STRING(molwt).toDouble(&ok);
if(ok)
{
m_molwt = FROM_STRING(molwt);
return true;
}
return false;
}
double SpeciesImpl::mdiam() const
{
return m_mdiam.toDouble();
}
bool SpeciesImpl::setMdiam(const double mdiam)
{
m_mdiam = QString::number(mdiam);
return true;
}
bool SpeciesImpl::setMdiam(const STRING &mdiam)
{
bool ok;
FROM_STRING(mdiam).toDouble(&ok);
if(ok)
{
m_mdiam = FROM_STRING(mdiam);
return true;
}
return false;
}
double SpeciesImpl::edens() const
{
return m_edens.toDouble();
}
bool SpeciesImpl::setEdens(const double edens)
{
m_edens = QString::number(edens);
return true;
}
bool SpeciesImpl::setEdens(const STRING &edens)
{
bool ok;
FROM_STRING(edens).toDouble(&ok);
if(ok)
{
m_edens = FROM_STRING(edens);
return true;
}
return false;
}
double SpeciesImpl::decay() const
{
return m_decay.toDouble();
}
bool SpeciesImpl::setDecay(const double decay)
{
m_decay = decay;
return true;
}
bool SpeciesImpl::setDecay(const STRING &decay)
{
bool ok;
FROM_STRING(decay).toDouble(&ok);
if(ok)
{
m_decay = FROM_STRING(decay);
return true;
}
return false;
}
double SpeciesImpl::Dm() const
{
return m_Dm.toDouble();
}
bool SpeciesImpl::setDm(const double Dm)
{
m_Dm = QString::number(Dm);
return true;
}
bool SpeciesImpl::setDm(const STRING &Dm)
{
bool ok;
FROM_STRING(Dm).toDouble(&ok);
if(ok)
{
m_Dm = FROM_STRING(Dm);
return true;
}
return false;
}
double SpeciesImpl::ccdef() const
{
return m_ccdef.toDouble();
}
bool SpeciesImpl::setCcdef(const double ccdef)
{
m_ccdef = QString::number(ccdef);
return true;
}
bool SpeciesImpl::setCcdef(const STRING &ccdef)
{
bool ok;
FROM_STRING(ccdef).toDouble(&ok);
if(ok)
{
m_ccdef = FROM_STRING(ccdef);
return true;
}
return false;
}
double SpeciesImpl::Cp() const
{
return m_Cp.toDouble();
}
bool SpeciesImpl::setCp(const double Cp)
{
m_Cp = Cp;
return true;
}
bool SpeciesImpl::setCp(const STRING &Cp)
{
bool ok;
FROM_STRING(Cp).toDouble(&ok);
if(ok)
{
m_Cp = FROM_STRING(Cp);
return true;
}
return false;
}
int SpeciesImpl::ucc() const
{
return m_ucc;
}
void SpeciesImpl::setUcc(const int ucc)
{
m_ucc = ucc;
}
int SpeciesImpl::umd() const
{
return m_umd;
}
void SpeciesImpl::setUmd(const int umd)
{
m_umd = umd;
}
int SpeciesImpl::ued() const
{
return m_ued;
}
void SpeciesImpl::setUed(const int ued)
{
m_ued = ued;
}
int SpeciesImpl::udm() const
{
return m_udm;
}
void SpeciesImpl::setUdm(const int udm)
{
m_udm = udm;
}
int SpeciesImpl::ucp() const
{
return m_ucp;
}
void SpeciesImpl::setUcp(const int ucp)
{
m_ucp = ucp;
}
STRING SpeciesImpl::name() const
{
return m_name;
}
void SpeciesImpl::setName(const STRING &name)
{
m_name = name;
}
STRING SpeciesImpl::desc() const
{
return m_desc;
}
void SpeciesImpl::setDesc(const STRING &desc)
{
m_desc = desc;
}
}
|
jasondegraw/rwPrj
|
src/prjspeciesimpl.cpp
|
C++
|
lgpl-2.1
| 7,632
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<link rel="stylesheet" href="media/banner.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="banner">
<div class="banner-title">dompdf</div>
<div class="banner-menu">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
<a href="ric_INSTALL.html" target="right">INSTALL</a>
| <a href="ric_README.html" target="right">README</a>
</td>
<td style="width: 2em"> </td>
<td style="text-align: right">
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
|
ivelre/EstacionamientoITC
|
doc/packages.html
|
HTML
|
lgpl-2.1
| 1,135
|
/*********************************************************
* Copyright (C) 2005 VMware, Inc. All rights reserved.
*
* 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 version 2.1 and no 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 Lesser GNU 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*********************************************************/
/*
* cryptoError.h --
*
* Error code for cryptographic infrastructure library.
*
* NOTE: This header file is within the FIPS crypto boundary and
* thus should not change in such a way as to break the interface
* to the vmcryptolib library. See bora/make/mk/README_FIPS for
* more information.
*/
#ifndef VMWARE_CRYPTOERROR_H
#define VMWARE_CRYPTOERROR_H 1
#define INCLUDE_ALLOW_USERLEVEL
#include "includeCheck.h"
#include "vmware.h"
typedef int CryptoError;
/*
* This set of errors should not be expanded beyond a maximum value of 15
* without also updating the code for AIOMgr errors, which allots only 4 bits
* for sub-error codes.
*
* Adding a lot of error codes to describe particular errors is a bad idea
* anyhow, because it can be a security hole in itself; see, for example, the
* SSL vulnerability described at <http://www.openssl.org/~bodo/tls-cbc.txt>.
* It is best to distinguish only those types of errors that the caller can
* legitimately use to figure out how to fix the problem and try again.
*/
#define CRYPTO_ERROR_SUCCESS ((CryptoError) 0)
#define CRYPTO_ERROR_OPERATION_FAILED ((CryptoError) 1)
#define CRYPTO_ERROR_UNKNOWN_ALGORITHM ((CryptoError) 2)
#define CRYPTO_ERROR_BAD_BUFFER_SIZE ((CryptoError) 3)
#define CRYPTO_ERROR_INVALID_OPERATION ((CryptoError) 4)
#define CRYPTO_ERROR_NOMEM ((CryptoError) 5)
#define CRYPTO_ERROR_NEED_PASSWORD ((CryptoError) 6)
#define CRYPTO_ERROR_BAD_PASSWORD ((CryptoError) 7)
#define CRYPTO_ERROR_IO_ERROR ((CryptoError) 8)
#define CRYPTO_ERROR_UNKNOWN_ERROR ((CryptoError) 9)
#define CRYPTO_ERROR_NAME_NOT_FOUND ((CryptoError) 10)
#define CRYPTO_ERROR_NO_CRYPTO ((CryptoError) 11)
#define CRYPTO_ERROR_FIPS_SELF_TEST ((CryptoError) 12)
#define CRYPTO_ERROR_FIPS_INTEGRITY ((CryptoError) 13)
#define CRYPTO_ERROR_FIPS_CRNGT_FAIL ((CryptoError) 14)
#define CRYPTO_ERROR_LOCK_FAILURE ((CryptoError) 15)
EXTERN const char *
CryptoError_ToString(CryptoError error);
EXTERN const char *
CryptoError_ToMsgString(CryptoError error);
static INLINE int
CryptoError_ToInteger(CryptoError error)
{
return (int) error;
}
static INLINE CryptoError
CryptoError_FromInteger(int index)
{
return (CryptoError) index;
}
static INLINE Bool
CryptoError_IsSuccess(CryptoError error)
{
return (CRYPTO_ERROR_SUCCESS == error);
}
static INLINE Bool
CryptoError_IsFailure(CryptoError error)
{
return (CRYPTO_ERROR_SUCCESS != error);
}
#endif /* cryptoError.h */
|
raphaeldias/vmware
|
lib/open-vm-tools/include/cryptoError.h
|
C
|
lgpl-2.1
| 3,428
|
/*---------------------------------------------------------------------------*\
* OpenSG *
* *
* *
* Copyright (C) 2000-2013 by the OpenSG Forum *
* *
* www.opensg.org *
* *
* contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
* *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
* License *
* *
* 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, version 2. *
* *
* 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; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
* Changes *
* *
* *
* *
* *
* *
* *
\*---------------------------------------------------------------------------*/
/*****************************************************************************\
*****************************************************************************
** **
** This file is automatically generated. **
** **
** Any changes made to this file WILL be lost when it is **
** regenerated, which can become necessary at any time. **
** **
*****************************************************************************
\*****************************************************************************/
#ifndef _OSGSTRINGATTRIBUTEMAPFIELDS_H_
#define _OSGSTRINGATTRIBUTEMAPFIELDS_H_
#ifdef __sgi
#pragma once
#endif
#include "OSGConfig.h"
#include "OSGSystemDef.h"
#include "OSGFieldContainerFields.h"
#include "OSGPointerSField.h"
#include "OSGPointerMField.h"
OSG_BEGIN_NAMESPACE
class StringAttributeMap;
OSG_GEN_CONTAINERPTR(StringAttributeMap);
/*! \ingroup GrpSystemFieldContainerFieldTraits
\ingroup GrpLibOSGSystem
*/
template <>
struct FieldTraits<StringAttributeMap *, nsOSG> :
public FieldTraitsFCPtrBase<StringAttributeMap *, nsOSG>
{
private:
static PointerType _type;
public:
typedef FieldTraits<StringAttributeMap *, nsOSG> Self;
enum { Convertible = NotConvertible };
static OSG_SYSTEM_DLLMAPPING DataType &getType(void);
template<typename RefCountPolicy> inline
static const Char8 *getSName (void);
};
template<> inline
const Char8 *FieldTraits<StringAttributeMap *, nsOSG>::getSName<RecordedRefCountPolicy>(void)
{
return "SFRecStringAttributeMapPtr";
}
template<> inline
const Char8 *FieldTraits<StringAttributeMap *, nsOSG>::getSName<UnrecordedRefCountPolicy>(void)
{
return "SFUnrecStringAttributeMapPtr";
}
template<> inline
const Char8 *FieldTraits<StringAttributeMap *, nsOSG>::getSName<WeakRefCountPolicy>(void)
{
return "SFWeakStringAttributeMapPtr";
}
template<> inline
const Char8 *FieldTraits<StringAttributeMap *, nsOSG>::getSName<NoRefCountPolicy>(void)
{
return "SFUnrefdStringAttributeMapPtr";
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/*! \ingroup GrpSystemFieldContainerFieldSFields */
typedef PointerSField<StringAttributeMap *,
RecordedRefCountPolicy, nsOSG > SFRecStringAttributeMapPtr;
/*! \ingroup GrpSystemFieldContainerFieldSFields */
typedef PointerSField<StringAttributeMap *,
UnrecordedRefCountPolicy, nsOSG> SFUnrecStringAttributeMapPtr;
/*! \ingroup GrpSystemFieldContainerFieldSFields */
typedef PointerSField<StringAttributeMap *,
WeakRefCountPolicy, nsOSG > SFWeakStringAttributeMapPtr;
/*! \ingroup GrpSystemFieldContainerFieldSFields */
typedef PointerSField<StringAttributeMap *,
NoRefCountPolicy, nsOSG > SFUncountedStringAttributeMapPtr;
#else // these are the doxygen hacks
/*! \ingroup GrpSystemFieldContainerFieldSFields \ingroup GrpLibOSGSystem */
struct SFRecStringAttributeMapPtr :
public PointerSField<StringAttributeMap *,
RecordedRefCountPolicy> {};
/*! \ingroup GrpSystemFieldContainerFieldSFields \ingroup GrpLibOSGSystem */
struct SFUnrecStringAttributeMapPtr :
public PointerSField<StringAttributeMap *,
UnrecordedRefCountPolicy> {};
/*! \ingroup GrpSystemFieldContainerFieldSFields \ingroup GrpLibOSGSystem */
struct SFWeakStringAttributeMapPtr :
public PointerSField<StringAttributeMap *,
WeakRefCountPolicy> {};
/*! \ingroup GrpSystemFieldContainerFieldSFields \ingroup GrpLibOSGSystem */
struct SFUncountedStringAttributeMapPtr :
public PointerSField<StringAttributeMap *,
NoRefCountPolicy> {};
#endif // these are the doxygen hacks
OSG_END_NAMESPACE
#endif /* _OSGSTRINGATTRIBUTEMAPFIELDS_H_ */
|
jondo2010/OpenSG
|
Source/System/FieldContainer/Attachments/OSGStringAttributeMapFields.h
|
C
|
lgpl-2.1
| 7,032
|
/*
* examples/modular-int.C
*
* Copyright (C) 2005, 2010 D. Saunders, Z. Wang
* ========LICENCE========
* This file is part of the library LinBox.
*
* LinBox 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*/
/** \file examples/fields/modular-int.C
\brief Example of arithmetic in the Givaro::Modular<int> finite field.
*/
//by Zhendong wan wan@udel.edu
#include <iostream>
/* the header file for modular<int>*/
#include "linbox/field/modular-int.h"
int main (int argc, char **argv)
{
/* construct the Z/101Z field */
Givaro::Modular<int> F(101);
/* declare local variable a, b, c, x, y*/
Givaro::Modular<int>::Element a, b, c, x, y;
// initializtion
F.init(a, 92);
F.init(b, 50);
F.init(c, 56);
F.init(x, 33);
F.init(y, 45);
/* +, -, *, / arithmetic operation */
//compute c <- a + b mod 101;
F.add(c,a,b);
//output value of a
F.write(std::cout,a);
std::cout << " + ";
//output value of b
F.write(std::cout,b);
std::cout << " = ";
//output value of c
F.write(std::cout,c);
std::cout << " mod 101" << "\n";
//compute c <- a - b mod 101;
F.sub(c,a,b);
//output value of a
F.write(std::cout,a);
std::cout << " - ";
//output value of b
F.write(std::cout,b);
std::cout << " = ";
//output value of c
F.write(std::cout,c);
std::cout << " mod 101" << "\n";
//compute c <- a * b mod 101;
F.mul(c,a,b);
//output value of a
F.write(std::cout,a);
std::cout << " * ";
//output value of b
F.write(std::cout,b);
std::cout << " = ";
//output value of c
F.write(std::cout,c);
std::cout << " mod 101" << "\n";
//compute c <- a / b mod 101;
F.div(c,a,b);
//output value of a
F.write(std::cout,a);
std::cout << " / ";
//output value of b
F.write(std::cout,b);
std::cout << " = ";
//output value of c
F.write(std::cout,c);
std::cout << " mod 101" << "\n";
//compute c = 1 /a mod 101;
F.inv(c,a);
std::cout << "1 / " << a << " = ";
//output value of c
F.write(std::cout,c);
std::cout << " mod 101" << "\n";
/* Inplace operation */
//compute a *= b;
F.mulin(a,b);
//compute a /= b;
F.divin(a,b);
//compute a <- 1 / a/;
F.invin(a);
/* a * x + y operation */
//compute c <- a * x + y;
F.axpy(c,a,x,y);
//compute c += a * x;
F.axpyin(c,a,x);
/* compare operation */
// test if a == 1 mod 101;
//output value of a
F.write(std::cout,a);
std::cout << " == 1 mod 101 " << (F.isOne(a) ? "true" : "false") << "\n";
//test if a == 0 mod 101;
//output value of a
F.write(std::cout,a);
std::cout << " == 0 mod 101 " << (F.isZero(a) ? "true" : "false") << "\n" ;
// test if a == b mod 101;
//output value of a
F.write(std::cout,a);
std::cout << " == ";
//output value of b
F.write(std::cout,b);
std::cout << " mod 101 " << (F.areEqual(a,b) ? "true" : "false") << "\n";
//For performance, we recommend to use all possible operation, for example, using axpy, instead of mul, then addin.
return 0;
}
// Local Variables:
// mode: C++
// tab-width: 4
// indent-tabs-mode: nil
// c-basic-offset: 4
// End:
// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
|
linbox-team/linbox
|
examples/fields/modular-int.C
|
C++
|
lgpl-2.1
| 3,765
|
/*
* (C) Copyright 2014 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
package com.kurento.kmf.thrift;
/**
* Exception thrown when the Thrift Server, used to receive events from the
* Media Server, can't be created or started.
*
* @author Ivan Gracia (izanmail@gmail.com)
* @since 4.2.3
*
*/
public class ThriftServerException extends ThriftInterfaceException {
private static final long serialVersionUID = -8258926012237744437L;
public ThriftServerException(String message) {
super(message);
}
public ThriftServerException(String message, Throwable cause) {
super(message, cause);
}
}
|
KurentoLegacy/kurento-media-framework
|
kmf-thrift-interface/src/main/java/com/kurento/kmf/thrift/ThriftServerException.java
|
Java
|
lgpl-2.1
| 1,128
|
#ifndef COEFFFIELD_H
#define COEFFFIELD_H
#include "Reaction.h"
// Forward declarations
class CoeffField;
template <> InputParameters validParams<CoeffField>();
class CoeffField : public Reaction {
public:
CoeffField(const InputParameters ¶meters);
protected:
virtual Real computeQpResidual() override;
virtual Real computeQpJacobian() override;
private:
Real _coefficient;
};
#endif /* COEFFFIELD_H */
|
cticenhour/EELS
|
include/kernels/CoeffField.h
|
C
|
lgpl-2.1
| 422
|
#!/bin/bash
# /opt/lampp/cgi-bin/test-mrtg-rrd2.sh
# for local testing of mrtg-rrd2.cgi
# wget https://www.dropbox.com/s/334529psoett16t/test-mrtg-rrd2.sh
#see http://stackoverflow.com/questions/2224158/how-can-i-send-post-and-get-data-to-a-perl-cgi-script-via-the-command-line
#see http://www.cgi101.com/book/ch3/text.html
# export QUERY_STRING="queryfor=flowtable"
export QUERY_STRING="target=trento"
export REQUEST_URI="/cgi-bin/mrtg-rrd2.cgi/controller/?target=trento"
export REQUEST_METHOD=GET
/usr/bin/perl -w mrtg-rrd2.cgi
|
StefanoSalsano/alien-ofelia-conet-ccnx
|
scripts_and_config/test-mrtg-rrd2.sh
|
Shell
|
lgpl-2.1
| 535
|
module WMC
# NoyesParser parses motif files with a header line and
# column lines with symbols in the DNA alphabet in order A,C,G,T
class NoyesParser
attr_accessor :motifset
attr_accessor :nukelinepattern
attr_accessor :namepattern
attr_accessor :normalize
# Arguments: input file, pattern for the nucleotide line, with four capture groups in the order A,C,G,T
# and motif name line pattern with the first capture group as the name of the motif
def initialize(inputf, nukelinepattern = /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/, namepattern = />(\S*)\t(\d+)(.*)/, normalize = true)
#0 0 0 30
@nukelinepattern = nukelinepattern
#>Dstat.old 9 PSEUDO_COUNT 1.0
@namepattern = namepattern
@normalize = true
@motifset = nil
end
# Parses the input file and returns an XMS::MotifSet object containing
# the motifs
def parse(inputf)
cols = []
motifs = []
name = ""
inputf.each_line {|line|
if line =~ /^<$/ #end of record is a line with just '<' on it
wm = XMS::WeightMatrix.new cols
motif = XMS::Motif.new wm,name,0.0
motifs << motif
cols = []
elsif line =~ @namepattern
name = $1
elsif line =~ @nukelinepattern
col = [$1.to_f,$2.to_f,$3.to_f,$4.to_f]
if @normalize
f = col.inject(0.0) {|acc,val| acc+val}
col = col.map {|v| v / f}
end
cols << col
end
}
@motifset = XMS::MotifSet.new motifs
end
end
end
|
mz2/imotifs
|
libxms-ruby/lib/noyes.rb
|
Ruby
|
lgpl-2.1
| 1,586
|
<?php
// $Id: /cvsroot/tikiwiki/tiki/tiki-print_multi_pages.php,v 1.15.2.3 2008-01-21 09:47:15 nyloth Exp $
// Copyright (c) 2002-2007, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// Initialization
require_once ('tiki-setup.php');
include_once('lib/structures/structlib.php');
if ($prefs['feature_wiki_multiprint'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_wiki_multiprint");
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST['printpages']) && !isset($_REQUEST['printstructures'])) {
$smarty->assign('msg', tra("No pages indicated"));
$smarty->display("error.tpl");
die;
} else {
if (isset($_REQUEST['printpages'])) {
$printpages = unserialize(urldecode($_REQUEST['printpages']));
} else {
$printpages = array();
}
if (isset($_REQUEST['printstructures'])) {
$printstructures = unserialize(urldecode($_REQUEST['printstructures']));
} else {
$printstructures = array();
}
}
if ( isset($_REQUEST["print"]) || isset($_REQUEST["display"])) {
check_ticket('multiprint');
// Create XMLRPC object
$pages = array();
foreach ($printpages as $page) {
// If the page doesn't exist then display an error
if (!$tikilib->page_exists($page)) {
$smarty->assign('msg', tra("Page cannot be found"));
$smarty->display("error.tpl");
die;
}
// Now check permissions to access this page
if (!$tikilib->user_has_perm_on_object($user, $page,'wiki page','tiki_p_view')) {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied you cannot view this page"));
$smarty->display("error.tpl");
die;
}
$page_info = $tikilib->get_page_info($page);
$page_info['parsed'] = $tikilib->parse_data($page_info['data'], $page_info['is_html']);
$pages[] = $page_info;
}
foreach ($printstructures as $structureId) {
$struct = $structlib->get_subtree($structureId);
foreach($struct as $struct_page) {
global $page_ref_id; $page_ref_id = $struct_page['page_ref_id']; //to interpret {toc}
if ($struct_page['pos'] != '' && $struct_page['last'] == 1)
continue;
$page_info = $tikilib->get_page_info($struct_page['pageName']);
$page_info['parsed'] = $tikilib->parse_data($page_info['data'], $page_info['is_html']);
$page_info['pos'] = $struct_page['pos'];
$page_info['h'] = empty($struct_page['pos'])? 0: count(explode('.', $struct_page['pos']));
$h = $page_info['h'] + 5;
if ($prefs['feature_page_title'] == 'y') {
++$h;
}
$page_info['parsed'] = preg_replace("/<(\/?)h6/i", "<\\1h$h", $page_info['parsed']); --$h;
$page_info['parsed'] = preg_replace("/<(\/?)h5/i", "<\\1h$h", $page_info['parsed']); --$h;
$page_info['parsed'] = preg_replace("/<(\/?)h4/i", "<\\1h$h", $page_info['parsed']); --$h;
$page_info['parsed'] = preg_replace("/<(\/?)h3/i", "<\\1h$h", $page_info['parsed']); --$h;
$page_info['parsed'] = preg_replace("/<(\/?)h2/i", "<\\1h$h", $page_info['parsed']); --$h;
$page_info['parsed'] = preg_replace("/<(\/?)h1/i", "<\\1h$h", $page_info['parsed']); --$h;
$pages[] = $page_info;
}
}
}
$smarty->assign_by_ref('pages', $pages);
ask_ticket('multiprint');
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
$smarty->assign('print_page', 'y');
$smarty->assign('display', $_REQUEST['display']);
// Allow PDF export by installing a Mod that define an appropriate function
if ( isset($_REQUEST['display']) && $_REQUEST['display'] == 'pdf' ) {
// Method using 'mozilla2ps' mod
if ( file_exists('lib/mozilla2ps/mod_urltopdf.php') ) {
include_once('lib/mozilla2ps/mod_urltopdf.php');
mod_urltopdf();
}
} else {
$smarty->display("tiki-print_multi_pages.tpl");
}
?>
|
4thAce/evilhow
|
tiki-print_multi_pages.php
|
PHP
|
lgpl-2.1
| 3,865
|
# coding: utf-8
import os
import shutil
from nxdrive.client.base_automation_client import DOWNLOAD_TMP_FILE_PREFIX, \
DOWNLOAD_TMP_FILE_SUFFIX
from nxdrive.engine.processor import Processor as OldProcessor
from nxdrive.logging_config import get_logger
log = get_logger(__name__)
class Processor(OldProcessor):
def __init__(self, engine, item_getter, name=None):
super(Processor, self).__init__(engine, item_getter, name)
def acquire_state(self, row_id):
log.warning("acquire...")
result = super(Processor, self).acquire_state(row_id)
if result is not None and self._engine.get_local_watcher().is_pending_scan(result.local_parent_path):
self._dao.release_processor(self._thread_id)
# Postpone pair for watcher delay
self._engine.get_queue_manager().postpone_pair(result, self._engine.get_local_watcher().get_scan_delay())
return None
log.warning("Acquired: %r", result)
return result
def _get_partial_folders(self):
local_client = self._engine.get_local_client()
if not local_client.exists('/.partials'):
local_client.make_folder('/', '.partials')
return local_client.abspath('/.partials')
def _download_content(self, local_client, remote_client, doc_pair, file_path):
# TODO Should share between threads
file_out = os.path.join(self._get_partial_folders(), DOWNLOAD_TMP_FILE_PREFIX +
doc_pair.remote_digest + str(self._thread_id) + DOWNLOAD_TMP_FILE_SUFFIX)
# Check if the file is already on the HD
pair = self._dao.get_valid_duplicate_file(doc_pair.remote_digest)
if pair:
shutil.copy(local_client.abspath(pair.local_path), file_out)
return file_out
tmp_file = remote_client.stream_content( doc_pair.remote_ref, file_path,
parent_fs_item_id=doc_pair.remote_parent_ref, file_out=file_out)
self._update_speed_metrics()
return tmp_file
def _update_remotely(self, doc_pair, local_client, remote_client, is_renaming):
log.warning("_update_remotely")
os_path = local_client.abspath(doc_pair.local_path)
if is_renaming:
new_os_path = os.path.join(os.path.dirname(os_path), doc_pair.remote_name)
log.debug("Replacing local file '%s' by '%s'.", os_path, new_os_path)
else:
new_os_path = os_path
log.debug("Updating content of local file '%s'.", os_path)
tmp_file = self._download_content(local_client, remote_client, doc_pair, new_os_path)
# Delete original file and rename tmp file
local_client.delete_final(doc_pair.local_path)
rel_path = local_client.get_path(tmp_file)
local_client.set_remote_id(rel_path, doc_pair.remote_ref)
# Move rename
updated_info = local_client.move(rel_path, doc_pair.local_parent_path, doc_pair.remote_name)
doc_pair.local_digest = updated_info.get_digest()
self._dao.update_last_transfer(doc_pair.id, "download")
self._refresh_local_state(doc_pair, updated_info)
def _create_remotely(self, local_client, remote_client, doc_pair, parent_pair, name):
local_parent_path = parent_pair.local_path
# TODO Shared this locking system / Can have concurrent lock
self._unlock_readonly(local_client, local_parent_path)
tmp_file = None
try:
if doc_pair.folderish:
log.debug("Creating local folder '%s' in '%s'", name,
local_client.abspath(parent_pair.local_path))
# Might want do temp name to original
path = local_client.make_folder(local_parent_path, name)
else:
path, os_path, name = local_client.get_new_file(local_parent_path,
name)
tmp_file = self._download_content(local_client, remote_client, doc_pair, os_path)
log.debug("Creating local file '%s' in '%s'", name,
local_client.abspath(parent_pair.local_path))
# Move file to its folder - might want to split it in two for events
local_client.move(local_client.get_path(tmp_file),local_parent_path, name)
self._dao.update_last_transfer(doc_pair.id, "download")
finally:
self._lock_readonly(local_client, local_parent_path)
# Clean .nxpart if needed
if tmp_file is not None and os.path.exists(tmp_file):
os.remove(tmp_file)
return path
|
ssdi-drive/nuxeo-drive
|
nuxeo-drive-client/nxdrive/engine/next/processor.py
|
Python
|
lgpl-2.1
| 4,670
|
// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2003 University of Stuttgart, 2004-2005 Brown University
// Contact: Jurgen P. Schulze, jschulze@ucsd.edu
//
// This file is part of Virvo.
//
// Virvo 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.1 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef VV_DYNLIB_H
#define VV_DYNLIB_H
#include "vvplatform.h"
#ifdef __sgi
#include <dlfcn.h>
#endif
#ifdef __hpux
#include <dl.h>
#endif
#ifdef __hpux
typedef shl_t VV_SHLIB_HANDLE;
#elif _WIN32
typedef HINSTANCE VV_SHLIB_HANDLE;
#else
typedef void *VV_SHLIB_HANDLE;
#endif
#include "vvexport.h"
/** This class encapsulates the functionality of dynamic library loading.
@author Uwe Woessner
*/
class VIRVOEXPORT vvDynLib
{
public:
static char* error(void);
static VV_SHLIB_HANDLE open(const char* filename, int mode);
static void* sym(VV_SHLIB_HANDLE handle, const char* symbolname);
static void (*glSym(const char* symbolname))(void);
static int close(VV_SHLIB_HANDLE handle);
};
#endif
// vim: sw=2:expandtab:softtabstop=2:ts=2:cino=\:0g0t0
|
deskvox/deskvox
|
virvo/virvo/vvdynlib.h
|
C
|
lgpl-2.1
| 1,731
|
/* Copyright (C) 2010, Rodrigo Cánovas, all rights reserved.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <SuffixTree.h>
using namespace std;
using namespace cds_utils;
using namespace cds_static;
SuffixTree * saveLoad(SuffixTree * bs) {
ofstream ofs("cst.tmp");
bs->save(ofs);
ofs.close();
ifstream ifs("cst.tmp");
SuffixTree * ret = SuffixTree::load(ifs);
ifs.close();
return ret;
}
bool testSuffixTree(SuffixTree *s1){
/*add any test you want*/
return true;
}
int main(int argc, char *argv[]){
char *text;
size_t length;
if(argc!=2) {
cout << "Checks if the SuffixTree of the file <arch> is save/load correctly" << endl << endl;
cout << "usage: " << argv[0] << " <arch>" << endl;
return 0;
}
if(loadText(argv[1], &text, &length))
return 1;
/*create index*/
SuffixTree *cst;
SuffixTreeY csty(text, length, DAC, CN_NPR, 32);
cst = saveLoad(&csty);
if(!testSuffixTree(cst)) {
cerr << "ERROR TESTING SuffixTreeY" << endl;
return -1;
}
delete (SuffixTreeY *)cst;
cout << "SuffixTree_Y OK\n" << endl;
delete [] text;
return 0;
}
|
migumar2/libCSD
|
libcds/tests/testSuffixTree.cpp
|
C++
|
lgpl-2.1
| 1,866
|
package org.coffeeshop.log;
public class SingleChannelLogHelper implements LogHelper {
private AbstractLogger logger = null;
private int channel = 0;
public AbstractLogger getLogger() {
return logger;
}
public void setLogger(AbstractLogger logger) {
this.logger = logger;
}
public int getChannel() {
return channel;
}
public void setChannel(int channel) {
this.channel = channel;
}
/**
* Reports a throwable object through the error channel (if it is enabled).
*
* @param throwable
* throwable object
*/
public synchronized void report(Throwable throwable) {
if (logger != null)
logger.report(throwable);
}
/**
* Reports a message through the default channel (if it is enabled).
*
* @param message
* message string
*/
public synchronized void report(String message) {
if (logger != null)
logger.report(channel, message);
}
/**
* Reports a message through a default channel. In case the channel is
* disabled it does nothing. Message is assembled from format and objects
* using {@link String#format(String, Object[])} method
*
* @param format
* message to report
* @param objects
* objects to use
*
* @see String#format(String, Object[])
*/
public synchronized void report(String format,
Object... objects) {
if (logger != null)
logger.report(channel, format, objects);
}
public synchronized void report(Object object) {
if (logger != null)
logger.report(channel, object);
}
}
|
lukacu/coffeeshop
|
core/org/coffeeshop/log/SingleChannelLogHelper.java
|
Java
|
lgpl-2.1
| 1,529
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "sshconnectionmanager.h"
#include "sshconnection.h"
#include <QCoreApplication>
#include <QList>
#include <QMutex>
#include <QMutexLocker>
#include <QObject>
#include <QThread>
namespace QSsh {
namespace Internal {
class SshConnectionManager : public QObject
{
Q_OBJECT
public:
SshConnectionManager()
{
moveToThread(QCoreApplication::instance()->thread());
}
~SshConnectionManager()
{
foreach (SshConnection * const connection, m_unacquiredConnections) {
disconnect(connection, 0, this, 0);
delete connection;
}
QSSH_ASSERT(m_acquiredConnections.isEmpty());
QSSH_ASSERT(m_deprecatedConnections.isEmpty());
}
SshConnection *acquireConnection(const SshConnectionParameters &sshParams)
{
QMutexLocker locker(&m_listMutex);
// Check in-use connections:
foreach (SshConnection * const connection, m_acquiredConnections) {
if (connection->connectionParameters() != sshParams)
continue;
if (connection->thread() != QThread::currentThread())
break;
if (m_deprecatedConnections.contains(connection)) // we were asked to no longer use this one...
break;
m_acquiredConnections.append(connection);
return connection;
}
// Checked cached open connections:
foreach (SshConnection * const connection, m_unacquiredConnections) {
if (connection->state() != SshConnection::Connected
|| connection->connectionParameters() != sshParams)
continue;
if (connection->thread() != QThread::currentThread()) {
if (connection->channelCount() != 0)
continue;
QMetaObject::invokeMethod(this, "switchToCallerThread",
Qt::BlockingQueuedConnection,
Q_ARG(SshConnection *, connection),
Q_ARG(QObject *, QThread::currentThread()));
}
m_unacquiredConnections.removeOne(connection);
m_acquiredConnections.append(connection);
return connection;
}
// create a new connection:
SshConnection * const connection = new SshConnection(sshParams);
connect(connection, SIGNAL(disconnected()), this, SLOT(cleanup()));
m_acquiredConnections.append(connection);
return connection;
}
void releaseConnection(SshConnection *connection)
{
QMutexLocker locker(&m_listMutex);
const bool wasAquired = m_acquiredConnections.removeOne(connection);
QSSH_ASSERT_AND_RETURN(wasAquired);
if (m_acquiredConnections.contains(connection))
return;
bool doDelete = false;
connection->moveToThread(QCoreApplication::instance()->thread());
if (m_deprecatedConnections.removeOne(connection)
|| connection->state() != SshConnection::Connected) {
doDelete = true;
} else {
QSSH_ASSERT_AND_RETURN(!m_unacquiredConnections.contains(connection));
// It can happen that two or more connections with the same parameters were acquired
// if the clients were running in different threads. Only keep one of them in
// such a case.
bool haveConnection = false;
foreach (SshConnection * const conn, m_unacquiredConnections) {
if (conn->connectionParameters() == connection->connectionParameters()) {
haveConnection = true;
break;
}
}
if (!haveConnection) {
connection->closeAllChannels(); // Clean up after neglectful clients.
m_unacquiredConnections.append(connection);
} else {
doDelete = true;
}
}
if (doDelete) {
disconnect(connection, 0, this, 0);
m_deprecatedConnections.removeAll(connection);
connection->deleteLater();
}
}
void forceNewConnection(const SshConnectionParameters &sshParams)
{
QMutexLocker locker(&m_listMutex);
for (int i = 0; i < m_unacquiredConnections.count(); ++i) {
SshConnection * const connection = m_unacquiredConnections.at(i);
if (connection->connectionParameters() == sshParams) {
disconnect(connection, 0, this, 0);
delete connection;
m_unacquiredConnections.removeAt(i);
break;
}
}
foreach (SshConnection * const connection, m_acquiredConnections) {
if (connection->connectionParameters() == sshParams) {
if (!m_deprecatedConnections.contains(connection))
m_deprecatedConnections.append(connection);
}
}
}
private:
Q_INVOKABLE void switchToCallerThread(SshConnection *connection, QObject *threadObj)
{
connection->moveToThread(qobject_cast<QThread *>(threadObj));
}
private slots:
void cleanup()
{
QMutexLocker locker(&m_listMutex);
SshConnection *currentConnection = qobject_cast<SshConnection *>(sender());
if (!currentConnection)
return;
if (m_unacquiredConnections.removeOne(currentConnection)) {
disconnect(currentConnection, 0, this, 0);
currentConnection->deleteLater();
}
}
private:
// We expect the number of concurrently open connections to be small.
// If that turns out to not be the case, we can still use a data
// structure with faster access.
QList<SshConnection *> m_unacquiredConnections;
// Can contain the same connection more than once; this acts as a reference count.
QList<SshConnection *> m_acquiredConnections;
QList<SshConnection *> m_deprecatedConnections;
QMutex m_listMutex;
};
} // namespace Internal
static QMutex instanceMutex;
static Internal::SshConnectionManager &instance()
{
static Internal::SshConnectionManager manager;
return manager;
}
SshConnection *acquireConnection(const SshConnectionParameters &sshParams)
{
QMutexLocker locker(&instanceMutex);
return instance().acquireConnection(sshParams);
}
void releaseConnection(SshConnection *connection)
{
QMutexLocker locker(&instanceMutex);
instance().releaseConnection(connection);
}
void forceNewConnection(const SshConnectionParameters &sshParams)
{
QMutexLocker locker(&instanceMutex);
instance().forceNewConnection(sshParams);
}
} // namespace QSsh
#include "sshconnectionmanager.moc"
|
richardmg/qtcreator
|
src/libs/ssh/sshconnectionmanager.cpp
|
C++
|
lgpl-2.1
| 8,163
|
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2010 Red Hat, Inc.
This library 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "spice-client.h"
#include "spice-common.h"
#include "spice-channel-priv.h"
#include "spice-marshal.h"
#include "spice-session-priv.h"
#include "common/snd_codec.h"
/**
* SECTION:channel-record
* @short_description: audio stream for recording
* @title: Record Channel
* @section_id:
* @see_also: #SpiceChannel, and #SpiceAudio
* @stability: Stable
* @include: spice-client.h
*
* #SpiceRecordChannel class handles an audio recording stream. The
* audio stream should start when #SpiceRecordChannel::record-start is
* emitted and should be stopped when #SpiceRecordChannel::record-stop
* is received.
*
* The audio is sent to the guest by calling spice_record_send_data()
* with the recorded PCM data.
*
* Note: You may be interested to let the #SpiceAudio class play and
* record audio channels for your application.
*/
struct _SpiceRecordChannelPrivate {
int mode;
gboolean started;
SndCodec codec;
gsize frame_bytes;
guint8 *last_frame;
gsize last_frame_current;
guint8 nchannels;
guint16 *volume;
guint8 mute;
};
G_DEFINE_TYPE_WITH_PRIVATE(SpiceRecordChannel, spice_record_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
PROP_0,
PROP_NCHANNELS,
PROP_VOLUME,
PROP_MUTE,
};
/* Signals */
enum {
SPICE_RECORD_START,
SPICE_RECORD_STOP,
SPICE_RECORD_LAST_SIGNAL,
};
static guint signals[SPICE_RECORD_LAST_SIGNAL];
static void channel_set_handlers(SpiceChannelClass *klass);
/* ------------------------------------------------------------------ */
static void spice_record_channel_reset_capabilities(SpiceChannel *channel)
{
if (!g_getenv("SPICE_DISABLE_CELT"))
if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY))
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_CELT_0_5_1);
if (!g_getenv("SPICE_DISABLE_OPUS"))
if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_OPUS, SND_CODEC_ANY_FREQUENCY))
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_OPUS);
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_VOLUME);
}
static void spice_record_channel_init(SpiceRecordChannel *channel)
{
channel->priv = spice_record_channel_get_instance_private(channel);
spice_record_channel_reset_capabilities(SPICE_CHANNEL(channel));
}
static void spice_record_channel_finalize(GObject *obj)
{
SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(obj)->priv;
g_clear_pointer(&c->last_frame, g_free);
snd_codec_destroy(&c->codec);
g_clear_pointer(&c->volume, g_free);
if (G_OBJECT_CLASS(spice_record_channel_parent_class)->finalize)
G_OBJECT_CLASS(spice_record_channel_parent_class)->finalize(obj);
}
static void spice_record_channel_get_property(GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SpiceRecordChannel *channel = SPICE_RECORD_CHANNEL(gobject);
SpiceRecordChannelPrivate *c = channel->priv;
switch (prop_id) {
case PROP_VOLUME:
g_value_set_pointer(value, c->volume);
break;
case PROP_NCHANNELS:
g_value_set_uint(value, c->nchannels);
break;
case PROP_MUTE:
g_value_set_boolean(value, c->mute);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
}
}
static void spice_record_channel_set_property(GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id) {
case PROP_VOLUME:
/* TODO: request guest volume change */
break;
case PROP_MUTE:
/* TODO: request guest mute change */
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
}
}
static void channel_reset(SpiceChannel *channel, gboolean migrating)
{
SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
g_clear_pointer(&c->last_frame, g_free);
g_coroutine_signal_emit(channel, signals[SPICE_RECORD_STOP], 0);
c->started = FALSE;
snd_codec_destroy(&c->codec);
SPICE_CHANNEL_CLASS(spice_record_channel_parent_class)->channel_reset(channel, migrating);
}
static void spice_record_channel_class_init(SpiceRecordChannelClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
SpiceChannelClass *channel_class = SPICE_CHANNEL_CLASS(klass);
gobject_class->finalize = spice_record_channel_finalize;
gobject_class->get_property = spice_record_channel_get_property;
gobject_class->set_property = spice_record_channel_set_property;
channel_class->channel_reset = channel_reset;
channel_class->channel_reset_capabilities = spice_record_channel_reset_capabilities;
g_object_class_install_property
(gobject_class, PROP_NCHANNELS,
g_param_spec_uint("nchannels",
"Number of Channels",
"Number of Channels",
0, G_MAXUINT8, 2,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property
(gobject_class, PROP_VOLUME,
g_param_spec_pointer("volume",
"Record volume",
"Record volume",
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property
(gobject_class, PROP_MUTE,
g_param_spec_boolean("mute",
"Mute",
"Mute",
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* SpiceRecordChannel::record-start:
* @channel: the #SpiceRecordChannel that emitted the signal
* @format: a #SPICE_AUDIO_FMT
* @channels: number of channels
* @rate: audio rate
*
* Notify when the recording should start, and provide audio format
* characteristics.
**/
signals[SPICE_RECORD_START] =
g_signal_new("record-start",
G_OBJECT_CLASS_TYPE(gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(SpiceRecordChannelClass, record_start),
NULL, NULL,
g_cclosure_user_marshal_VOID__INT_INT_INT,
G_TYPE_NONE,
3,
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
/**
* SpiceRecordChannel::record-stop:
* @channel: the #SpiceRecordChannel that emitted the signal
*
* Notify when the recording should stop.
**/
signals[SPICE_RECORD_STOP] =
g_signal_new("record-stop",
G_OBJECT_CLASS_TYPE(gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(SpiceRecordChannelClass, record_stop),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
/* main context */
static void spice_record_mode(SpiceRecordChannel *channel, uint32_t time,
uint32_t mode, uint8_t *data, uint32_t data_size)
{
SpiceMsgcRecordMode m = {0, };
SpiceMsgOut *msg;
g_return_if_fail(channel != NULL);
if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
return;
m.mode = mode;
m.time = time;
m.data = data;
m.data_size = data_size;
msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_RECORD_MODE);
msg->marshallers->msgc_record_mode(msg->marshaller, &m);
spice_msg_out_send(msg);
}
static int spice_record_desired_mode(SpiceChannel *channel, int frequency)
{
if (!g_getenv("SPICE_DISABLE_OPUS") &&
snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_OPUS, frequency) &&
spice_channel_test_capability(channel, SPICE_RECORD_CAP_OPUS)) {
return SPICE_AUDIO_DATA_MODE_OPUS;
} else if (!g_getenv("SPICE_DISABLE_CELT") &&
snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, frequency) &&
spice_channel_test_capability(channel, SPICE_RECORD_CAP_CELT_0_5_1)) {
return SPICE_AUDIO_DATA_MODE_CELT_0_5_1;
} else {
return SPICE_AUDIO_DATA_MODE_RAW;
}
}
/* main context */
static void spice_record_start_mark(SpiceRecordChannel *channel, uint32_t time)
{
SpiceMsgcRecordStartMark m = {0, };
SpiceMsgOut *msg;
g_return_if_fail(channel != NULL);
if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
return;
m.time = time;
msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_RECORD_START_MARK);
msg->marshallers->msgc_record_start_mark(msg->marshaller, &m);
spice_msg_out_send(msg);
}
/**
* spice_record_send_data:
* @channel: a #SpiceRecordChannel
* @data: PCM data
* @bytes: size of @data
* @time: stream timestamp
*
* Send recorded PCM data to the guest.
*
* Deprecated: 0.35: use spice_record_channel_send_data() instead.
**/
void spice_record_send_data(SpiceRecordChannel *channel, gpointer data,
gsize bytes, uint32_t time)
{
spice_record_channel_send_data(channel, data, bytes, time);
}
/**
* spice_record_channel_send_data:
* @channel: a #SpiceRecordChannel
* @data: PCM data
* @bytes: size of @data
* @time: stream timestamp
*
* Send recorded PCM data to the guest.
*
* Since: 0.35
**/
void spice_record_channel_send_data(SpiceRecordChannel *channel, gpointer data,
gsize bytes, uint32_t time)
{
SpiceRecordChannelPrivate *rc;
SpiceMsgcRecordPacket p = {0, };
g_return_if_fail(SPICE_IS_RECORD_CHANNEL(channel));
rc = channel->priv;
if (rc->last_frame == NULL) {
CHANNEL_DEBUG(channel, "recording didn't start or was reset");
return;
}
g_return_if_fail(spice_channel_get_read_only(SPICE_CHANNEL(channel)) == FALSE);
uint8_t *encode_buf = NULL;
if (!rc->started) {
spice_record_mode(channel, time, rc->mode, NULL, 0);
spice_record_start_mark(channel, time);
rc->started = TRUE;
}
if (rc->mode != SPICE_AUDIO_DATA_MODE_RAW)
encode_buf = g_alloca(SND_CODEC_MAX_COMPRESSED_BYTES);
p.time = time;
while (bytes > 0) {
gsize n;
int frame_size;
SpiceMsgOut *msg;
uint8_t *frame;
if (rc->last_frame_current > 0) {
/* complete previous frame */
n = MIN(bytes, rc->frame_bytes - rc->last_frame_current);
memcpy(rc->last_frame + rc->last_frame_current, data, n);
rc->last_frame_current += n;
if (rc->last_frame_current < rc->frame_bytes)
/* if the frame is still incomplete, return */
break;
frame = rc->last_frame;
frame_size = rc->frame_bytes;
} else {
n = MIN(bytes, rc->frame_bytes);
frame_size = n;
frame = data;
}
if (rc->last_frame_current == 0 &&
n < rc->frame_bytes) {
/* start a new frame */
memcpy(rc->last_frame, data, n);
rc->last_frame_current = n;
break;
}
if (rc->mode != SPICE_AUDIO_DATA_MODE_RAW) {
int len = SND_CODEC_MAX_COMPRESSED_BYTES;
if (snd_codec_encode(rc->codec, frame, frame_size, encode_buf, &len) != SND_CODEC_OK) {
g_warning("encode failed");
return;
}
frame = encode_buf;
frame_size = len;
}
msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_RECORD_DATA);
msg->marshallers->msgc_record_data(msg->marshaller, &p);
spice_marshaller_add(msg->marshaller, frame, frame_size);
spice_msg_out_send(msg);
if (rc->last_frame_current == rc->frame_bytes)
rc->last_frame_current = 0;
bytes -= n;
data = (guint8*)data + n;
}
}
/* ------------------------------------------------------------------ */
/* coroutine context */
static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
{
SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
SpiceMsgRecordStart *start = spice_msg_in_parsed(in);
int frame_size = SND_CODEC_MAX_FRAME_SIZE;
c->mode = spice_record_desired_mode(channel, start->frequency);
CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u mode %s", __FUNCTION__,
start->format, start->channels, start->frequency,
spice_audio_data_mode_to_string(c->mode));
g_return_if_fail(start->format == SPICE_AUDIO_FMT_S16);
snd_codec_destroy(&c->codec);
if (c->mode != SPICE_AUDIO_DATA_MODE_RAW) {
if (snd_codec_create(&c->codec, c->mode, start->frequency, SND_CODEC_ENCODE) != SND_CODEC_OK) {
g_warning("Failed to create encoder");
return;
}
frame_size = snd_codec_frame_size(c->codec);
}
g_free(c->last_frame);
c->frame_bytes = frame_size * 16 * start->channels / 8;
c->last_frame = g_malloc0(c->frame_bytes);
c->last_frame_current = 0;
g_coroutine_signal_emit(channel, signals[SPICE_RECORD_START], 0,
start->format, start->channels, start->frequency);
}
/* coroutine context */
static void record_handle_stop(SpiceChannel *channel, SpiceMsgIn *in)
{
SpiceRecordChannelPrivate *rc = SPICE_RECORD_CHANNEL(channel)->priv;
g_coroutine_signal_emit(channel, signals[SPICE_RECORD_STOP], 0);
rc->started = FALSE;
}
/* coroutine context */
static void record_handle_set_volume(SpiceChannel *channel, SpiceMsgIn *in)
{
SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
SpiceMsgAudioVolume *vol = spice_msg_in_parsed(in);
if (vol->nchannels == 0) {
g_warning("spice-server send audio-volume-msg with 0 channels");
return;
}
g_free(c->volume);
c->nchannels = vol->nchannels;
c->volume = g_new(guint16, c->nchannels);
memcpy(c->volume, vol->volume, sizeof(guint16) * c->nchannels);
g_coroutine_object_notify(G_OBJECT(channel), "volume");
}
/* coroutine context */
static void record_handle_set_mute(SpiceChannel *channel, SpiceMsgIn *in)
{
SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(channel)->priv;
SpiceMsgAudioMute *m = spice_msg_in_parsed(in);
c->mute = m->mute;
g_coroutine_object_notify(G_OBJECT(channel), "mute");
}
static void channel_set_handlers(SpiceChannelClass *klass)
{
static const spice_msg_handler handlers[] = {
[ SPICE_MSG_RECORD_START ] = record_handle_start,
[ SPICE_MSG_RECORD_STOP ] = record_handle_stop,
[ SPICE_MSG_RECORD_VOLUME ] = record_handle_set_volume,
[ SPICE_MSG_RECORD_MUTE ] = record_handle_set_mute,
};
spice_channel_set_handlers(klass, handlers, G_N_ELEMENTS(handlers));
}
|
flexVDI/spice-gtk
|
src/channel-record.c
|
C
|
lgpl-2.1
| 16,385
|
//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// GRINS - General Reacting Incompressible Navier-Stokes
//
// Copyright (C) 2014-2015 Paul T. Bauman, Roy H. Stogner
// Copyright (C) 2010-2013 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301 USA
//
//-----------------------------------------------------------------------el-
// This class
#include "grins/simulation.h"
// GRINS
#include "grins/grins_enums.h"
#include "grins/simulation_builder.h"
#include "grins/multiphysics_sys.h"
#include "grins/solver_context.h"
// libMesh
#include "libmesh/dof_map.h"
#include "libmesh/parameter_vector.h"
#include "libmesh/qoi_set.h"
#include "libmesh/sensitivity_data.h"
namespace GRINS
{
Simulation::Simulation( const GetPot& input,
SimulationBuilder& sim_builder,
const libMesh::Parallel::Communicator &comm )
: _mesh( sim_builder.build_mesh(input, comm) ),
_equation_system( new libMesh::EquationSystems( *_mesh ) ),
_solver( sim_builder.build_solver(input) ),
_system_name( input("screen-options/system_name", "GRINS" ) ),
_multiphysics_system( &(_equation_system->add_system<MultiphysicsSystem>( _system_name )) ),
_vis( sim_builder.build_vis(input, comm) ),
_postprocessing( sim_builder.build_postprocessing(input) ),
_print_mesh_info( input("screen-options/print_mesh_info", false ) ),
_print_log_info( input("screen-options/print_log_info", false ) ),
_print_equation_system_info( input("screen-options/print_equation_system_info", false ) ),
_print_qoi( input("screen-options/print_qoi", false ) ),
_print_scalars( input("screen-options/print_scalars", false ) ),
_output_vis( input("vis-options/output_vis", false ) ),
_output_adjoint( input("vis-options/output_adjoint", false ) ),
_output_residual( input( "vis-options/output_residual", false ) ),
_output_residual_sensitivities( input( "vis-options/output_residual_sensitivities", false ) ),
_output_solution_sensitivities( input( "vis-options/output_solution_sensitivities", false ) ),
_timesteps_per_vis( input("vis-options/timesteps_per_vis", 1 ) ),
_timesteps_per_perflog( input("screen-options/timesteps_per_perflog", 0 ) ),
_error_estimator(), // effectively NULL
_do_adjoint_solve(false) // Helper function will set final value
{
libmesh_deprecated();
this->init_multiphysics_system(input,sim_builder);
this->init_qois(input,sim_builder);
this->init_params(input,sim_builder);
this->init_adjoint_solve(input,_output_adjoint);
// Must be called after setting QoI on the MultiphysicsSystem
_error_estimator = sim_builder.build_error_estimator( input, libMesh::QoISet(*_multiphysics_system) );
if( input.have_variable("restart-options/restart_file") )
{
this->init_restart(input,sim_builder,comm);
}
this->check_for_unused_vars(input, false /*warning only*/);
return;
}
Simulation::Simulation( const GetPot& input,
GetPot& command_line,
SimulationBuilder& sim_builder,
const libMesh::Parallel::Communicator &comm )
: _mesh( sim_builder.build_mesh(input, comm) ),
_equation_system( new libMesh::EquationSystems( *_mesh ) ),
_solver( sim_builder.build_solver(input) ),
_system_name( input("screen-options/system_name", "GRINS" ) ),
_multiphysics_system( &(_equation_system->add_system<MultiphysicsSystem>( _system_name )) ),
_vis( sim_builder.build_vis(input, comm) ),
_postprocessing( sim_builder.build_postprocessing(input) ),
_print_mesh_info( input("screen-options/print_mesh_info", false ) ),
_print_log_info( input("screen-options/print_log_info", false ) ),
_print_equation_system_info( input("screen-options/print_equation_system_info", false ) ),
_print_qoi( input("screen-options/print_qoi", false ) ),
_print_scalars( input("screen-options/print_scalars", false ) ),
_output_vis( input("vis-options/output_vis", false ) ),
_output_adjoint( input("vis-options/output_adjoint", false ) ),
_output_residual( input( "vis-options/output_residual", false ) ),
_output_residual_sensitivities( input( "vis-options/output_residual_sensitivities", false ) ),
_output_solution_sensitivities( input( "vis-options/output_solution_sensitivities", false ) ),
_timesteps_per_vis( input("vis-options/timesteps_per_vis", 1 ) ),
_timesteps_per_perflog( input("screen-options/timesteps_per_perflog", 0 ) ),
_error_estimator(), // effectively NULL
_do_adjoint_solve(false) // Helper function will set final value
{
this->init_multiphysics_system(input,sim_builder);
this->init_qois(input,sim_builder);
this->init_params(input,sim_builder);
this->init_adjoint_solve(input,_output_adjoint);
// Must be called after setting QoI on the MultiphysicsSystem
_error_estimator = sim_builder.build_error_estimator( input, libMesh::QoISet(*_multiphysics_system) );
if( input.have_variable("restart-options/restart_file") )
{
this->init_restart(input,sim_builder,comm);
}
bool warning_only = command_line.search("--warn-only-unused-var");
this->check_for_unused_vars(input, warning_only );
return;
}
Simulation::~Simulation()
{
return;
}
void Simulation::init_multiphysics_system( const GetPot& input,
SimulationBuilder& sim_builder )
{
// Only print libMesh logging info if the user requests it
libMesh::perflog.disable_logging();
if( this->_print_log_info ) libMesh::perflog.enable_logging();
PhysicsList physics_list = sim_builder.build_physics(input);
_multiphysics_system->attach_physics_list( physics_list );
_multiphysics_system->read_input_options( input );
_multiphysics_system->register_postprocessing_vars( input, *(_postprocessing) );
// This *must* be done before equation_system->init
this->attach_dirichlet_bc_funcs( sim_builder.build_dirichlet_bcs(), _multiphysics_system );
/* Postprocessing needs to be initialized before the solver since that's
where equation_system gets init'ed */
_postprocessing->initialize( *_multiphysics_system, *_equation_system );
_solver->initialize( input, _equation_system, _multiphysics_system );
// Useful for debugging
if( input("screen-options/print_dof_constraints", false ) )
{
_multiphysics_system->get_dof_map().print_dof_constraints();
}
// This *must* be done after equation_system->init in order to get variable indices
this->attach_neumann_bc_funcs( sim_builder.build_neumann_bcs( *_equation_system ), _multiphysics_system );
return;
}
void Simulation::init_qois( const GetPot& input, SimulationBuilder& sim_builder )
{
// If the user actually asks for a QoI, then we add it.
std::tr1::shared_ptr<CompositeQoI> qois = sim_builder.build_qoi( input );
if( qois->n_qois() > 0 )
{
// This *must* be done after equation_system->init in order to get variable indices
qois->init(input, *_multiphysics_system );
/* Note that we are effectively transfering ownership of the qoi pointer because
it will be cloned in _multiphysics_system and all the calculations are done there. */
_multiphysics_system->attach_qoi( qois.get() );
}
else if (_print_qoi)
{
std::cout << "Error: print_qoi is specified but\n" <<
"no QoIs have been specified.\n" << std::endl;
libmesh_error();
}
return;
}
void Simulation::init_params( const GetPot& input,
SimulationBuilder& /*sim_builder*/ )
{
unsigned int n_adjoint_parameters =
input.vector_variable_size("QoI/adjoint_sensitivity_parameters");
unsigned int n_forward_parameters =
input.vector_variable_size("QoI/forward_sensitivity_parameters");
// If the user actually asks for parameter sensitivities, then we
// set up the parameter vectors to use.
if ( n_adjoint_parameters )
{
// If we're doing adjoint sensitivities, dq/dp only makes
// sense if we have q
CompositeQoI* qoi =
libMesh::cast_ptr<CompositeQoI*>
(this->_multiphysics_system->get_qoi());
if (!qoi)
{
std::cout <<
"Error: adjoint_sensitivity_parameters are specified but\n"
<< "no QoIs have been specified.\n" << std::endl;
libmesh_error();
}
_adjoint_parameters.initialize
(input, "QoI/adjoint_sensitivity_parameters",
*this->_multiphysics_system, qoi);
}
if ( n_forward_parameters )
{
// If we're doing forward sensitivities, du/dp can make
// sense even with no q defined
CompositeQoI* qoi =
dynamic_cast<CompositeQoI*>
(this->_multiphysics_system->get_qoi());
// dynamic_cast returns NULL if our QoI isn't a CompositeQoI;
// i.e. if there were no QoIs that made us bother setting up
// the CompositeQoI object. Passing NULL tells
// ParameterManager not to bother asking for qoi registration
// of parameters.
_forward_parameters.initialize
(input, "QoI/forward_sensitivity_parameters",
*this->_multiphysics_system, qoi);
}
}
void Simulation::init_restart( const GetPot& input, SimulationBuilder& sim_builder,
const libMesh::Parallel::Communicator &comm )
{
this->read_restart( input );
/* We do this here only if there's a restart file. Otherwise, this was done
at mesh construction time */
sim_builder.mesh_builder().do_mesh_refinement_from_input( input, comm, *_mesh );
/* \todo Any way to tell if the mesh got refined so we don't unnecessarily
call reinit()? */
_equation_system->reinit();
return;
}
void Simulation::check_for_unused_vars( const GetPot& input, bool warning_only )
{
/* Everything should be set up now, so check if there's any unused variables
in the input file. If so, then tell the user what they were and error out. */
std::vector<std::string> unused_vars = input.unidentified_variables();
if( !unused_vars.empty() )
{
libMesh::err << "==========================================================" << std::endl;
if( warning_only )
libMesh::err << "Warning: ";
else
libMesh::err << "Error: ";
libMesh::err << "Found unused variables!" << std::endl;
for( std::vector<std::string>::const_iterator it = unused_vars.begin();
it != unused_vars.end(); ++it )
{
libMesh::err << *it << std::endl;
}
libMesh::err << "==========================================================" << std::endl;
if( !warning_only )
libmesh_error();
}
return;
}
void Simulation::run()
{
this->print_sim_info();
SolverContext context;
context.system = _multiphysics_system;
context.equation_system = _equation_system;
context.vis = _vis;
context.output_adjoint = _output_adjoint;
context.timesteps_per_vis = _timesteps_per_vis;
context.timesteps_per_perflog = _timesteps_per_perflog;
context.output_vis = _output_vis;
context.output_residual = _output_residual;
context.output_residual_sensitivities = _output_residual_sensitivities;
context.output_solution_sensitivities = _output_solution_sensitivities;
context.print_scalars = _print_scalars;
context.print_perflog = _print_log_info;
context.postprocessing = _postprocessing;
context.error_estimator = _error_estimator;
context.print_qoi = _print_qoi;
context.do_adjoint_solve = _do_adjoint_solve;
if (_output_residual_sensitivities &&
!_forward_parameters.parameter_vector.size())
{
std::cout <<
"Error: output_residual_sensitivities is specified but\n" <<
"no forward sensitivity parameters have been specified.\n" <<
std::endl;
libmesh_error();
}
if (_output_solution_sensitivities &&
!_forward_parameters.parameter_vector.size())
{
std::cout <<
"Error: output_solution_sensitivities is specified but\n" <<
"no forward sensitivity parameters have been specified.\n" <<
std::endl;
libmesh_error();
}
_solver->solve( context );
if ( this->_print_qoi )
{
_multiphysics_system->assemble_qoi();
const CompositeQoI* my_qoi = libMesh::libmesh_cast_ptr<const CompositeQoI*>(this->_multiphysics_system->get_qoi());
my_qoi->output_qoi( std::cout );
}
if ( _adjoint_parameters.parameter_vector.size() )
{
// Default: "calculate sensitivities for all QoIs"
libMesh::QoISet qois;
const libMesh::ParameterVector & params =
_adjoint_parameters.parameter_vector;
libMesh::SensitivityData sensitivities
(qois, *this->_multiphysics_system, params);
_solver->adjoint_qoi_parameter_sensitivity
(context, qois, params, sensitivities);
std::cout << "Adjoint sensitivities:" << std::endl;
for (unsigned int q=0;
q != this->_multiphysics_system->qoi.size(); ++q)
{
for (unsigned int p=0; p != params.size(); ++p)
{
std::cout << "dq" << q << "/dp" << p << " = " <<
sensitivities[q][p] << std::endl;
}
}
}
if ( _forward_parameters.parameter_vector.size() )
{
// Default: "calculate sensitivities for all QoIs"
libMesh::QoISet qois;
const libMesh::ParameterVector & params =
_forward_parameters.parameter_vector;
libMesh::SensitivityData sensitivities
(qois, *this->_multiphysics_system, params);
_solver->forward_qoi_parameter_sensitivity
(context, qois, params, sensitivities);
std::cout << "Forward sensitivities:" << std::endl;
for (unsigned int q=0;
q != this->_multiphysics_system->qoi.size(); ++q)
{
for (unsigned int p=0; p != params.size(); ++p)
{
std::cout << "dq" << q << "/dp" << p << " = " <<
sensitivities[q][p] << std::endl;
}
}
}
return;
}
void Simulation::print_sim_info()
{
// Print mesh info if the user wants it
if( this->_print_mesh_info ) this->_mesh->print_info();
// Print info if requested
if( this->_print_equation_system_info ) this->_equation_system->print_info();
return;
}
std::tr1::shared_ptr<libMesh::EquationSystems> Simulation::get_equation_system()
{
return _equation_system;
}
libMesh::Number Simulation::get_qoi_value( unsigned int qoi_index ) const
{
const CompositeQoI* qoi = libMesh::libmesh_cast_ptr<const CompositeQoI*>(this->_multiphysics_system->get_qoi());
return qoi->get_qoi_value(qoi_index);
}
void Simulation::read_restart( const GetPot& input )
{
const std::string restart_file = input( "restart-options/restart_file", "none" );
// Most of this was pulled from FIN-S
if (restart_file != "none")
{
std::cout << " ====== Restarting from " << restart_file << std::endl;
// Must have correct file type to restart
if (restart_file.rfind(".xdr") < restart_file.size())
_equation_system->read(restart_file,GRINSEnums::DECODE,
//libMesh::EquationSystems::READ_HEADER | // Allow for thermochemistry upgrades
libMesh::EquationSystems::READ_DATA |
libMesh::EquationSystems::READ_ADDITIONAL_DATA);
else if (restart_file.rfind(".xda") < restart_file.size())
_equation_system->read(restart_file,GRINSEnums::READ,
//libMesh::EquationSystems::READ_HEADER | // Allow for thermochemistry upgrades
libMesh::EquationSystems::READ_DATA |
libMesh::EquationSystems::READ_ADDITIONAL_DATA);
else
{
std::cerr << "Error: Restart filename must have .xdr or .xda extension!" << std::endl;
libmesh_error();
}
const std::string system_name = input("screen-options/system_name", "GRINS" );
MultiphysicsSystem& system =
_equation_system->get_system<MultiphysicsSystem>(system_name);
// Update the old data
system.update();
}
return;
}
void Simulation::attach_neumann_bc_funcs( std::map< std::string, NBCContainer > neumann_bcs,
MultiphysicsSystem* system )
{
//_neumann_bc_funcs = neumann_bcs;
if( neumann_bcs.size() > 0 )
{
for( std::map< std::string, NBCContainer >::iterator bc = neumann_bcs.begin();
bc != neumann_bcs.end();
bc++ )
{
std::tr1::shared_ptr<Physics> physics = system->get_physics( bc->first );
physics->attach_neumann_bound_func( bc->second );
}
}
return;
}
void Simulation::attach_dirichlet_bc_funcs( std::multimap< PhysicsName, DBCContainer > dbc_map,
MultiphysicsSystem* system )
{
for( std::multimap< PhysicsName, DBCContainer >::const_iterator it = dbc_map.begin();
it != dbc_map.end();
it++ )
{
std::tr1::shared_ptr<Physics> physics = system->get_physics( it->first );
physics->attach_dirichlet_bound_func( it->second );
}
return;
}
void Simulation::init_adjoint_solve( const GetPot& input, bool output_adjoint )
{
// Check if we're doing an adjoint solve
_do_adjoint_solve = this->check_for_adjoint_solve(input);
const libMesh::DifferentiableQoI* raw_qoi = _multiphysics_system->get_qoi();
const CompositeQoI* qoi = dynamic_cast<const CompositeQoI*>( raw_qoi );
// If we are trying to do an adjoint solve without a QoI, that's an error
// If there are no QoIs, the CompositeQoI never gets built and qoi will be NULL
if( _do_adjoint_solve && !qoi )
{
libmesh_error_msg("Error: Adjoint solve requested, but no QoIs detected.");
}
/* If we are not doing an adjoint solve, but adjoint output was requested:
that's an error. */
if( !_do_adjoint_solve && output_adjoint )
{
libmesh_error_msg("Error: Adjoint output requested, but no adjoint solve requested.");
}
}
bool Simulation::check_for_adjoint_solve( const GetPot& input ) const
{
/*! \todo We need to collect these options into one spot */
std::string error_estimator = input("MeshAdaptivity/estimator_type", "none");
bool do_adjoint_solve = false;
// First check if the error estimator requires an adjoint solve
if( error_estimator.find("adjoint") != std::string::npos || error_estimator.find("ADJOINT") != std::string::npos )
do_adjoint_solve = true;
// Next check if parameter sensitivies require an adjoint solve
if ( _adjoint_parameters.parameter_vector.size() )
do_adjoint_solve = true;
// Now check if the user requested to do an adjoint solve regardless
/*! \todo This option name WILL change at some point. */
if( input( "linear-nonlinear-solver/do_adjoint_solve", false ) )
{
do_adjoint_solve = true;
}
return do_adjoint_solve;
}
#ifdef GRINS_USE_GRVY_TIMERS
void Simulation::attach_grvy_timer( GRVY::GRVY_Timer_Class* grvy_timer )
{
this->_multiphysics_system->attach_grvy_timer( grvy_timer );
return;
}
#endif
} // namespace GRINS
|
cahaynes/grins
|
src/solver/src/simulation.C
|
C++
|
lgpl-2.1
| 20,712
|
package fr.toss.FF7Bones;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fr.toss.FF7.ItemRegistry1;
public class Skull extends Item
{
public Skull(int par1)
{
super();
setMaxStackSize(64);
setCreativeTab(ItemRegistry1.Bones);
setUnlocalizedName("Skull");
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("FF7:" + getUnlocalizedName().substring(5));
}
}
|
GhostMonk3408/MidgarCrusade
|
src/main/java/fr/toss/FF7Bones/Skull.java
|
Java
|
lgpl-2.1
| 572
|
// This code is derived from jcifs smb client library <jcifs at samba dot org>
// Ported by J. Arturo <webmaster at komodosoft dot net>
//
// This library 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.1 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
using System.Text;
using WinrtCifs.Util;
using WinrtCifs.Util.Sharpen;
namespace WinrtCifs.Netbios
{
public class Name
{
private const int TypeOffset = 31;
private const int ScopeOffset = 33;
private static readonly string DefaultScope = Config.GetProperty("jcifs.netbios.scope"
);
internal static readonly string OemEncoding = Config.GetProperty("jcifs.encoding"
, Runtime.GetProperty("file.encoding"));
public string name;
public string Scope;
public int HexCode;
internal int SrcHashCode;
public Name()
{
}
public Name(string name, int hexCode, string scope)
{
if (name.Length > 15)
{
name = Runtime.Substring(name, 0, 15);
}
this.name = name.ToUpper();
this.HexCode = hexCode;
this.Scope = !string.IsNullOrEmpty(scope) ? scope : DefaultScope;
SrcHashCode = 0;
}
internal virtual int WriteWireFormat(byte[] dst, int dstIndex)
{
// write 0x20 in first byte
dst[dstIndex] = unchecked(0x20);
// write name
try
{
byte[] tmp = Runtime.GetBytesForString(name, OemEncoding
);
int i;
for (i = 0; i < tmp.Length; i++)
{
dst[dstIndex + (2 * i + 1)] = unchecked((byte)(((tmp[i] & unchecked(0xF0))
>> 4) + unchecked(0x41)));
dst[dstIndex + (2 * i + 2)] = unchecked((byte)((tmp[i] & unchecked(0x0F))
+ unchecked(0x41)));
}
for (; i < 15; i++)
{
dst[dstIndex + (2 * i + 1)] = unchecked(unchecked(0x43));
dst[dstIndex + (2 * i + 2)] = unchecked(unchecked(0x41));
}
dst[dstIndex + TypeOffset] = unchecked((byte)(((HexCode & unchecked(0xF0)
) >> 4) + unchecked(0x41)));
dst[dstIndex + TypeOffset + 1] = unchecked((byte)((HexCode & unchecked(0x0F)) + unchecked(0x41)));
}
catch (UnsupportedEncodingException)
{
}
return ScopeOffset + WriteScopeWireFormat(dst, dstIndex + ScopeOffset);
}
internal virtual int ReadWireFormat(byte[] src, int srcIndex)
{
byte[] tmp = new byte[ScopeOffset];
int length = 15;
for (int i = 0; i < 15; i++)
{
tmp[i] = unchecked((byte)(((src[srcIndex + (2 * i + 1)] & unchecked(0xFF))
- unchecked(0x41)) << 4));
tmp[i] |= unchecked((byte)(((src[srcIndex + (2 * i + 2)] & unchecked(0xFF)
) - unchecked(0x41)) & unchecked(0x0F)));
if (tmp[i] != unchecked((byte)' '))
{
length = i + 1;
}
}
try
{
name = Runtime.GetStringForBytes(tmp, 0, length, OemEncoding
);
}
catch (UnsupportedEncodingException)
{
}
HexCode = ((src[srcIndex + TypeOffset] & unchecked(0xFF)) - unchecked(0x41)) << 4;
HexCode |= ((src[srcIndex + TypeOffset + 1] & unchecked(0xFF)) - unchecked(
0x41)) & unchecked(0x0F);
return ScopeOffset + ReadScopeWireFormat(src, srcIndex + ScopeOffset);
}
internal int ReadWireFormatDos(byte[] src, int srcIndex)
{
int length = 15;
byte[] tmp = new byte[length];
Array.Copy(src, srcIndex, tmp, 0, length);
try
{
name = Runtime.GetStringForBytes(tmp, 0, length).Trim();
}
catch (Exception e)
{
LogStream.GetInstance().WriteLine(e);
}
HexCode = src[srcIndex + length];
return length + 1;
}
internal virtual int WriteScopeWireFormat(byte[] dst, int dstIndex)
{
if (Scope == null)
{
dst[dstIndex] = unchecked(unchecked(0x00));
return 1;
}
// copy new scope in
dst[dstIndex++] = unchecked((byte)('.'));
try
{
Array.Copy(Runtime.GetBytesForString(Scope, OemEncoding
), 0, dst, dstIndex, Scope.Length);
}
catch (UnsupportedEncodingException)
{
}
dstIndex += Scope.Length;
dst[dstIndex++] = unchecked(unchecked(0x00));
// now go over scope backwards converting '.' to label length
int i = dstIndex - 2;
int e = i - Scope.Length;
int c = 0;
do
{
if (dst[i] == '.')
{
dst[i] = unchecked((byte)c);
c = 0;
}
else
{
c++;
}
}
while (i-- > e);
return Scope.Length + 2;
}
internal virtual int ReadScopeWireFormat(byte[] src, int srcIndex)
{
int start = srcIndex;
int n;
StringBuilder sb;
if ((n = src[srcIndex++] & unchecked(0xFF)) == 0)
{
Scope = null;
return 1;
}
try
{
sb = new StringBuilder(Runtime.GetStringForBytes(src, srcIndex, n, OemEncoding));
srcIndex += n;
while ((n = src[srcIndex++] & unchecked(0xFF)) != 0)
{
sb.Append('.').Append(Runtime.GetStringForBytes(src, srcIndex, n, OemEncoding));
srcIndex += n;
}
Scope = sb.ToString();
}
catch (UnsupportedEncodingException)
{
}
return srcIndex - start;
}
public override int GetHashCode()
{
int result;
result = name.GetHashCode();
result += 65599 * HexCode;
result += 65599 * SrcHashCode;
if (Scope != null && Scope.Length != 0)
{
result += Scope.GetHashCode();
}
return result;
}
public override bool Equals(object obj)
{
Name n;
if (!(obj is Name))
{
return false;
}
n = (Name)obj;
if (Scope == null && n.Scope == null)
{
return name.Equals(n.name) && HexCode == n.HexCode;
}
return name.Equals(n.name) && HexCode == n.HexCode && Scope.Equals(n.Scope);
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
//return "";
string n = name;
// fix MSBROWSE name
if (n == null)
{
n = "null";
}
else
{
if (n[0] == unchecked(0x01))
{
char[] c = n.ToCharArray();
c[0] = '.';
c[1] = '.';
c[14] = '.';
n = new string(c);
}
}
sb.Append(n).Append("<").Append(Hexdump.ToHexString(HexCode, 2)).Append(">");
if (Scope != null)
{
sb.Append(".").Append(Scope);
}
return sb.ToString();
}
}
}
|
saki-saki/WinRTCifs
|
WinRTCifs/Netbios/Name.cs
|
C#
|
lgpl-2.1
| 6,732
|
/*
* i6engine
* Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
*
* This file is part of i6engine; i6engine 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "properties/DynamicAttributeProperty.h"
#include <cfloat>
#include "widgets/EmitterPropertyWindow.h"
#include "widgets/PropertyWindow.h"
#include "ParticleUniverseDynamicAttribute.h"
#include <QComboBox>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
namespace i6e {
namespace particleEditor {
namespace properties {
DynamicAttributeProperty::DynamicAttributeProperty(QWidget * par, QString label, QString name, ParticleUniverse::DynamicAttribute * value) : Property(par, label, name), _widget(nullptr), _layout(nullptr), _value(value), _widgets(), _comboBox(nullptr), _values(), _interpolationTypeBox(nullptr), _controlPoints(), _setting(false) {
widgets::DYN_FIXED = QApplication::tr("Fixed");
widgets::DYN_RANDOM = QApplication::tr("Random");
widgets::DYN_CURVED = QApplication::tr("Curved");
widgets::DYN_OSCILLATE = QApplication::tr("Oscillate");
widgets::DYN_CURVED_LINEAR = QApplication::tr("Linear");
widgets::DYN_CURVED_SPLINE = QApplication::tr("Spline");
_widget = new QWidget(this);
_layout = new QGridLayout(_widget);
_widget->setLayout(_layout);
horizontalLayout->addWidget(_widget);
createGUI();
}
DynamicAttributeProperty::~DynamicAttributeProperty() {
delete _value;
}
void DynamicAttributeProperty::setDynamicAttribute(ParticleUniverse::DynamicAttribute * value) {
_setting = true;
_comboBox = nullptr;
_interpolationTypeBox = nullptr;
for (QWidget * w : _widgets) {
_layout->removeWidget(w);
delete w;
}
_widgets.clear();
_values.clear();
delete _value;
switch (value->getType()) {
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_FIXED: {
_value = new ParticleUniverse::DynamicAttributeFixed();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_RANDOM: {
_value = new ParticleUniverse::DynamicAttributeRandom();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_CURVED: {
_value = new ParticleUniverse::DynamicAttributeCurved();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_OSCILLATE: {
_value = new ParticleUniverse::DynamicAttributeOscillate();
break;
}
default: {
_value = nullptr;
break;
}
}
value->copyAttributesTo(_value);
createGUI();
_setting = false;
}
void DynamicAttributeProperty::changedDynamicType() {
if (_comboBox && _comboBox->currentIndex() != _value->getType() && !_setting) {
ParticleUniverse::DynamicAttribute * value = nullptr;
switch (ParticleUniverse::DynamicAttribute::DynamicAttributeType(_comboBox->currentIndex())) {
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_FIXED: {
value = new ParticleUniverse::DynamicAttributeFixed();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_RANDOM: {
value = new ParticleUniverse::DynamicAttributeRandom();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_CURVED: {
value = new ParticleUniverse::DynamicAttributeCurved();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_OSCILLATE: {
value = new ParticleUniverse::DynamicAttributeOscillate();
break;
}
default: {
_value = nullptr;
break;
}
}
setDynamicAttribute(value);
delete value;
triggerChangedSignal();
}
}
void DynamicAttributeProperty::changedValue() {
if (!_setting) {
switch (_value->getType()) {
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_FIXED: {
dynamic_cast<ParticleUniverse::DynamicAttributeFixed *>(_value)->setValue(_values[PropertyTypes::Value]->value());
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_RANDOM: {
dynamic_cast<ParticleUniverse::DynamicAttributeRandom *>(_value)->setMin(_values[PropertyTypes::MinValue]->value());
dynamic_cast<ParticleUniverse::DynamicAttributeRandom *>(_value)->setMax(_values[PropertyTypes::MaxValue]->value());
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_CURVED: {
dynamic_cast<ParticleUniverse::DynamicAttributeCurved *>(_value)->setInterpolationType(ParticleUniverse::InterpolationType(_interpolationTypeBox->currentIndex()));
dynamic_cast<ParticleUniverse::DynamicAttributeCurved *>(_value)->removeAllControlPoints();
for (auto & p : _controlPoints) {
dynamic_cast<ParticleUniverse::DynamicAttributeCurved *>(_value)->addControlPoint(p.first->value(), p.second->value());
}
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_OSCILLATE: {
break;
}
default: {
break;
}
}
triggerChangedSignal();
}
}
ParticleUniverse::DynamicAttribute * DynamicAttributeProperty::getDynamicAttribute() const {
ParticleUniverse::DynamicAttribute * value = nullptr;
switch (_value->getType()) {
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_FIXED: {
value = new ParticleUniverse::DynamicAttributeFixed();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_RANDOM: {
value = new ParticleUniverse::DynamicAttributeRandom();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_CURVED: {
value = new ParticleUniverse::DynamicAttributeCurved();
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_OSCILLATE: {
value = new ParticleUniverse::DynamicAttributeOscillate();
break;
}
default: {
break;
}
}
_value->copyAttributesTo(value);
return value;
}
void DynamicAttributeProperty::createGUI() {
widgets::PRNL_EMITTER_VELOCITY = QApplication::tr("Velocity");
_comboBox = new QComboBox(this);
QStringList dynamicTypes;
dynamicTypes.append(widgets::DYN_FIXED);
dynamicTypes.append(widgets::DYN_RANDOM);
dynamicTypes.append(widgets::DYN_CURVED);
dynamicTypes.append(widgets::DYN_OSCILLATE);
_comboBox->addItems(dynamicTypes);
QLabel * l = new QLabel(QApplication::tr("Type"), _widget);
_layout->addWidget(l, 0, 0);
_layout->addWidget(_comboBox, 0, 1);
_widgets.push_back(_comboBox);
_widgets.push_back(l);
switch (_value->getType()) {
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_FIXED: {
_comboBox->setCurrentIndex(0);
l = new QLabel(QApplication::tr("Value"), _widget);
_layout->addWidget(l, 1, 0);
QDoubleSpinBox * dsb = new QDoubleSpinBox(_widget);
dsb->setMaximum(DBL_MAX);
dsb->setValue(_value->getValue());
dsb->setSizePolicy(QSizePolicy::Policy::Ignored, QSizePolicy::Policy::Fixed);
_layout->addWidget(dsb, 1, 1);
_widgets.push_back(dsb);
_widgets.push_back(l);
_values.insert(std::make_pair(PropertyTypes::Value, dsb));
connect(dsb, SIGNAL(valueChanged(double)), this, SLOT(changedValue()));
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_RANDOM: {
_comboBox->setCurrentIndex(1);
l = new QLabel(QApplication::tr("Min"), _widget);
_layout->addWidget(l, 1, 0);
QDoubleSpinBox * dsb = new QDoubleSpinBox(_widget);
dsb->setMaximum(DBL_MAX);
dsb->setValue(dynamic_cast<ParticleUniverse::DynamicAttributeRandom *>(_value)->getMin());
dsb->setSizePolicy(QSizePolicy::Policy::Ignored, QSizePolicy::Policy::Fixed);
_layout->addWidget(dsb, 1, 1);
_widgets.push_back(dsb);
_widgets.push_back(l);
_values.insert(std::make_pair(PropertyTypes::MinValue, dsb));
connect(dsb, SIGNAL(valueChanged(double)), this, SLOT(changedValue()));
l = new QLabel(QApplication::tr("Max"), _widget);
_layout->addWidget(l, 2, 0);
dsb = new QDoubleSpinBox(_widget);
dsb->setMaximum(DBL_MAX);
dsb->setValue(dynamic_cast<ParticleUniverse::DynamicAttributeRandom *>(_value)->getMax());
dsb->setSizePolicy(QSizePolicy::Policy::Ignored, QSizePolicy::Policy::Fixed);
_layout->addWidget(dsb, 2, 1);
_widgets.push_back(dsb);
_widgets.push_back(l);
_values.insert(std::make_pair(PropertyTypes::MaxValue, dsb));
connect(dsb, SIGNAL(valueChanged(double)), this, SLOT(changedValue()));
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_CURVED: {
_comboBox->setCurrentIndex(2);
QComboBox * comboBox = new QComboBox(this);
connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changedDynamicType()), Qt::QueuedConnection);
QStringList interpolationTypes;
interpolationTypes.append(widgets::DYN_CURVED_LINEAR);
interpolationTypes.append(widgets::DYN_CURVED_SPLINE);
comboBox->addItems(interpolationTypes);
_interpolationTypeBox = comboBox;
ParticleUniverse::DynamicAttributeCurved * dynAttr = dynamic_cast<ParticleUniverse::DynamicAttributeCurved *>(_value);
if (dynAttr->getInterpolationType() == ParticleUniverse::InterpolationType::IT_LINEAR) {
comboBox->setCurrentIndex(0);
} else if (dynAttr->getInterpolationType() == ParticleUniverse::InterpolationType::IT_SPLINE) {
comboBox->setCurrentIndex(1);
}
l = new QLabel(QApplication::tr("Interpolation Type"), _widget);
_layout->addWidget(l, 1, 0);
_layout->addWidget(comboBox, 1, 1);
_widgets.push_back(comboBox);
_widgets.push_back(l);
QPushButton * pb = new QPushButton(QApplication::tr("Add control point"), _widget);
_layout->addWidget(pb, 2, 0);
connect(pb, SIGNAL(clicked()), this, SLOT(addControlPoint()));
for (auto p : dynAttr->getControlPoints()) {
addControlPoint();
_controlPoints.back().first->setValue(p.x);
_controlPoints.back().second->setValue(p.y);
}
break;
}
case ParticleUniverse::DynamicAttribute::DynamicAttributeType::DAT_OSCILLATE: {
_comboBox->setCurrentIndex(3);
break;
}
default: {
break;
}
}
connect(_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changedDynamicType()), Qt::QueuedConnection);
}
void DynamicAttributeProperty::addControlPoint() {
QDoubleSpinBox * dsbTimepoint = new QDoubleSpinBox(_widget);
dsbTimepoint->setMinimum(0.0);
dsbTimepoint->setMaximum(1.0);
QDoubleSpinBox * dsbValue = new QDoubleSpinBox(_widget);
dsbValue->setMinimum(-999999);
dsbValue->setMaximum(999999);
_layout->addWidget(dsbTimepoint, 3 + int(_controlPoints.size()), 0);
_layout->addWidget(dsbValue, 3 + int(_controlPoints.size()), 1);
_widgets.push_back(dsbTimepoint);
_widgets.push_back(dsbValue);
connect(dsbTimepoint, SIGNAL(valueChanged(double)), this, SLOT(changedValue()));
connect(dsbValue, SIGNAL(valueChanged(double)), this, SLOT(changedValue()));
_controlPoints.push_back(std::make_pair(dsbTimepoint, dsbValue));
}
} /* namespace properties */
} /* namespace particleEditor */
} /* namespace i6e */
|
ClockworkOrigins/i6engine
|
tools/particleEditor/src/properties/DynamicAttributeProperty.cpp
|
C++
|
lgpl-2.1
| 11,552
|
import os
import subprocess
from pathlib import Path
import pyinstaller_versionfile
import tomli
packaging_path = Path(__file__).resolve().parent
def get_version() -> str:
project_dir = Path(__file__).resolve().parent.parent
f = project_dir / "pyproject.toml"
return str(tomli.loads(f.read_text())["tool"]["poetry"]["version"])
def make_gaphor_script():
pyproject_toml = packaging_path.parent / "pyproject.toml"
with open(pyproject_toml, "rb") as f:
toml = tomli.load(f)
gaphor_script = packaging_path / "gaphor-script.py"
with open(gaphor_script, "w") as file:
# https://github.com/pyinstaller/pyinstaller/issues/6100
# On one Windows computer, PyInstaller was adding a ; to
# end of the path, this removes it if it exists
file.write("import os\n")
file.write("if os.environ['PATH'][-1] == ';':\n")
file.write(" os.environ['PATH'] = os.environ['PATH'][:-1]\n")
# Check for and remove two semicolons in path
file.write("os.environ['PATH'] = os.environ['PATH'].replace(';;', ';')\n")
plugins = toml["tool"]["poetry"]["plugins"]
for cat in plugins.values():
for entrypoint in cat.values():
file.write(f"import {entrypoint.split(':')[0]}\n")
file.write("from gaphor.ui import main\n")
file.write("import sys\n")
file.write("main(sys.argv)\n")
def make_file_version_info():
win_packaging_path = packaging_path / "windows"
metadata = win_packaging_path / "versionfile_metadata.yml"
file_version_out = win_packaging_path / "file_version_info.txt"
version = get_version()
if "dev" in version:
version = version[: version.rfind(".dev")]
pyinstaller_versionfile.create_versionfile_from_input_file(
output_file=file_version_out,
input_file=metadata,
version=version,
)
def make_pyinstaller():
os.chdir(packaging_path)
subprocess.run(["pyinstaller", "-y", "gaphor.spec"])
|
amolenaar/gaphor
|
packaging/make-script.py
|
Python
|
lgpl-2.1
| 2,017
|
/****************************************************************************
**
** Copyright (c) 2014 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
**
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "testkeyboardgrabber.h"
namespace QtWayland {
KeyboardGrabber::~KeyboardGrabber() {}
}
void TestKeyboardGrabber::focused(QtWayland::Surface *surface)
{
Q_UNUSED(surface);
Q_EMIT focusedCalled();
}
void TestKeyboardGrabber::key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
Q_UNUSED(serial);
Q_UNUSED(time);
Q_UNUSED(key);
Q_UNUSED(state);
Q_EMIT keyCalled();
}
void TestKeyboardGrabber::modifiers(uint32_t serial, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
{
Q_UNUSED(serial);
Q_UNUSED(mods_depressed);
Q_UNUSED(mods_latched);
Q_UNUSED(mods_locked);
Q_UNUSED(group);
Q_EMIT modifiersCalled();
}
|
Tofee/qtwayland
|
tests/auto/compositor/testkeyboardgrabber.cpp
|
C++
|
lgpl-2.1
| 2,719
|
/*
* Copyright 2007 by Kappich Systemberatung Aachen
* Copyright 2004 by Kappich+Kniß Systemberatung, Aachen
*
* This file is part of de.bsvrz.dav.daf.
*
* de.bsvrz.dav.daf 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.1 of the License, or
* (at your option) any later version.
*
* de.bsvrz.dav.daf 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 de.bsvrz.dav.daf; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.bsvrz.dav.daf.communication.tcpCommunication;
import de.bsvrz.dav.daf.communication.lowLevel.ConnectionInterface;
import de.bsvrz.dav.daf.main.ConnectionException;
import de.bsvrz.sys.funclib.debug.Debug;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
/**
* TCP/IP-Implementierung des Interfaces {@link de.bsvrz.dav.daf.communication.lowLevel.ConnectionInterface}.
*
* @author Kappich Systemberatung
* @version $Revision: 9186 $
*/
public class TCP_IP_Communication implements ConnectionInterface {
/** Der Debug-Logger. */
private static final Debug _debug = Debug.getLogger();
/** Das Socket-Objekt dieser Verbindung. */
private Socket _socket;
/**
* Erzeugt ein Objekt dieser Klasse. Dieser Konstruktor wird von der Client-Seite benutzt. Der Socket wird in diesem Falle erst erzeugt, nachdem die {@link
* #connect(String,int) connect}-Methode aufgerufen wurde.
*/
public TCP_IP_Communication() {
}
/**
* Erzeugt ein Objekt dieser Klasse und hält eine Referenz auf den übergebenen Socket fest. Dieser Konstruktor wird von der Server-Seite benutzt.
*
* @param socket ein Socket
*/
public TCP_IP_Communication(Socket socket) {
_socket = socket;
}
public void connect(String mainAdress, int subAdressNumber) throws ConnectionException {
try {
_socket = new Socket(InetAddress.getByName(mainAdress), subAdressNumber);
_debug.info("TCP-Verbindung aktiv aufgebaut, " + _socket.getLocalSocketAddress() + " --> " + _socket.getRemoteSocketAddress());
}
catch(java.net.UnknownHostException ex) {
String error = "Fehler beim Verbindungsaufbau: Unbekannter Rechnername: " + mainAdress;
_debug.error(error);
throw new ConnectionException(error);
}
catch(java.net.NoRouteToHostException ex) {
String error = "Fehler beim Verbindungsaufbau: Angegebener Rechner ist nicht erreichbar: " + mainAdress;
_debug.error(error);
throw new ConnectionException(error);
}
catch(java.net.ConnectException ex) {
String error = "Fehler beim Verbindungsaufbau: Verbindung zum Rechner " + mainAdress + " auf TCP-Port " + subAdressNumber + " nicht möglich";
_debug.error(error);
throw new ConnectionException(error);
}
catch(IllegalArgumentException ex) {
String error = "Fehler beim Verbindungsaufbau zum Rechner " + mainAdress + " auf TCP-Port " + subAdressNumber + ": Ungültiges Argument";
_debug.error(error);
throw new ConnectionException(error);
}
catch(IOException ex) {
_debug.error("Fehler beim aktiven Verbindungsaufbau zum Rechner " + mainAdress + " auf TCP-Port " + subAdressNumber, ex);
throw new ConnectionException(ex.getLocalizedMessage());
}
}
public void disconnect() {
try {
final Socket mySocket = _socket;
if(mySocket != null) {
_debug.info("TCP-Verbindung wird terminiert, " + mySocket.getLocalSocketAddress() + " -|- " + mySocket.getRemoteSocketAddress());
mySocket.shutdownInput();
mySocket.shutdownOutput();
mySocket.close();
}
}
catch(IOException ex) {
_debug.info("Fehler beim Terminieren der TCP-Verbindung", ex);
}
}
public InputStream getInputStream() {
if(_socket != null) {
try {
return _socket.getInputStream();
}
catch(IOException ex) {
ex.printStackTrace();
}
}
return null;
}
public OutputStream getOutputStream() {
if(_socket != null) {
try {
return _socket.getOutputStream();
}
catch(IOException ex) {
ex.printStackTrace();
}
}
return null;
}
public String getMainAdress() {
if(_socket != null) {
return _socket.getInetAddress().getCanonicalHostName();
}
return null;
}
public int getSubAdressNumber() {
if(_socket != null) {
return _socket.getPort();
}
return -1;
}
public int getLocalSubAdressNumber() {
if(_socket != null) {
return _socket.getLocalPort();
}
return -1;
}
public boolean isConnected() {
return _socket != null && _socket.isConnected() && !_socket.isClosed();
}
}
|
datenverteiler/de.bsvrz.dav.daf
|
src/main/java/de/bsvrz/dav/daf/communication/tcpCommunication/TCP_IP_Communication.java
|
Java
|
lgpl-2.1
| 5,118
|
// Copyright 2015 Markus Ilmola
// This library 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.1 of the License, or (at your option) any later version.
#ifndef GENERATOR_TORUS_HPP
#define GENERATOR_TORUS_HPP
#include "AxisSwapMesh.hpp"
#include "CircleShape.hpp"
#include "LatheMesh.hpp"
#include "TranslateShape.hpp"
namespace generator {
/// Torus centered at origin on the xy-plane.
/// @image html TorusMesh.svg
class TorusMesh
{
private:
using Impl = AxisSwapMesh<LatheMesh<TranslateShape<CircleShape>>>;
Impl axisSwapMesh_;
public:
/// @param minor Radius of the minor (inner) ring
/// @param major Radius of the major (outer) ring
/// @param slices Subdivisions around the minor ring
/// @param segments Subdivisions around the major ring
/// @param minorStart Counterclockwise angle relative to the xy-plane.
/// @param minorSweep Counterclockwise angle around the circle.
/// @param majorStart Counterclockwise angle around the z-axis relative to the x-axis.
/// @param majorSweep Counterclockwise angle around the z-axis.
TorusMesh(
double minor = 0.25,
double major = 1.0,
int slices = 16,
int segments = 32,
double minorStart = 0.0,
double minorSweep = gml::radians(360.0),
double majorStart = 0.0,
double majorSweep = gml::radians(360.0)
);
using Triangles = typename Impl::Triangles;
Triangles triangles() const noexcept { return axisSwapMesh_.triangles(); }
using Vertices = typename Impl::Vertices;
Vertices vertices() const noexcept { return axisSwapMesh_.vertices(); }
};
}
#endif
|
ilmola/generator
|
include/generator/TorusMesh.hpp
|
C++
|
lgpl-2.1
| 1,690
|
namespace AdditionalKeyBindings.BindActions
{
public class RoadToolCycleAction : PanelValueCyclingAction<NetTool.Mode>, IActionDescription
{
public RoadToolCycleAction() : base(GameUiParts.RoadToolStrip)
{
}
public ActionCategory Category { get { return ActionCategory.Shared; } }
public string DisplayName { get { return "Road tool mode: cycle"; } }
public string Command { get { return "AKB-RoadToolCycle"; } }
}
}
|
M-Ch/AdditionalKeyBindings
|
AdditionalKeyBindings/AdditionalKeyBindings/BindActions/RoadToolCycleAction.cs
|
C#
|
lgpl-2.1
| 436
|
/*
* Copyright (C) 2003-2012 David E. Berry
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* A copy of the GNU Lesser General Public License may also be found at
* http://www.gnu.org/licenses/lgpl.txt
*/
package org.synchronoss.cpo.cassandra.exporter;
import org.synchronoss.cpo.cassandra.cpoCassandraMeta.CtCassandraArgument;
import org.synchronoss.cpo.cassandra.cpoCassandraMeta.CtCassandraAttribute;
import org.synchronoss.cpo.cassandra.meta.CassandraCpoAttribute;
import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument;
import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute;
import org.synchronoss.cpo.exporter.CoreMetaXmlObjectExporter;
import org.synchronoss.cpo.exporter.MetaXmlObjectExporter;
import org.synchronoss.cpo.meta.CpoMetaDescriptor;
import org.synchronoss.cpo.meta.domain.CpoArgument;
import org.synchronoss.cpo.meta.domain.CpoAttribute;
/**
* Created with IntelliJ IDEA.
* User: dberry
* Date: 9/10/13
* Time: 08:13 AM
* To change this template use File | Settings | File Templates.
*/
public class CassandraMetaXmlObjectExporter extends CoreMetaXmlObjectExporter implements MetaXmlObjectExporter {
public CassandraMetaXmlObjectExporter(CpoMetaDescriptor metaDescriptor) {
super(metaDescriptor);
}
@Override
public void visit(CpoAttribute cpoAttribute) {
// shouldn't happen, but if what we got wasn't a JdbcAttribute...
if (!(cpoAttribute instanceof CassandraCpoAttribute)) {
super.visit(cpoAttribute);
return;
}
CassandraCpoAttribute cassAttribute = (CassandraCpoAttribute) cpoAttribute;
if (currentCtClass != null) {
// CtClass.addNewCpoAttribute() can't be used here because it returns a CtAttribute, not a CtJdbcAttribute
CtCassandraAttribute ctCassandraAttribute = CtCassandraAttribute.Factory.newInstance();
ctCassandraAttribute.setJavaName(cassAttribute.getJavaName());
ctCassandraAttribute.setJavaType(cassAttribute.getJavaType());
ctCassandraAttribute.setDataName(cassAttribute.getDataName());
ctCassandraAttribute.setDataType(cassAttribute.getDataType());
if (cassAttribute.getTransformClassName() != null && cassAttribute.getTransformClassName().length() > 0) {
ctCassandraAttribute.setTransformClass(cassAttribute.getTransformClassName());
}
if (cassAttribute.getDescription() != null && cassAttribute.getDescription().length() > 0) {
ctCassandraAttribute.setDescription(cassAttribute.getDescription());
}
// add it to the class
CtAttribute ctAttribute = currentCtClass.addNewCpoAttribute();
ctAttribute.set(ctCassandraAttribute);
}
}
@Override
public void visit(CpoArgument cpoArgument) {
if (currentCtFunction != null) {
// CtFunction.addNewCpoArgument() can't be used here because it returns a CtArgument, not a CtJdbcArgument
CtCassandraArgument ctCassandraArgument = CtCassandraArgument.Factory.newInstance();
ctCassandraArgument.setAttributeName(cpoArgument.getAttributeName());
if (cpoArgument.getDescription() != null && cpoArgument.getDescription().length() > 0) {
ctCassandraArgument.setDescription(cpoArgument.getDescription());
}
CtArgument ctArgument = currentCtFunction.addNewCpoArgument();
ctArgument.set(ctCassandraArgument);
}
}
}
|
cpo-org/cpo-api
|
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/exporter/CassandraMetaXmlObjectExporter.java
|
Java
|
lgpl-2.1
| 4,019
|
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2012
* All rights reserved
*
* This file is part of GPAC / Media Tools sub-project
*
* GPAC 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, or (at your option)
* any later version.
*
* GPAC 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 library; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/ismacryp.h>
#include <gpac/xml.h>
#include <gpac/base_coding.h>
#include <gpac/constants.h>
#include <gpac/crypt.h>
#include <math.h>
#if !defined(GPAC_DISABLE_MCRYPT)
typedef struct
{
GF_List *tcis;
Bool has_common_key;
Bool in_text_header;
/*1: ISMACrypt - 2: CENC AES-CTR - 3: CENC AES-CBC*/
u32 crypt_type;
} GF_CryptInfo;
void isma_ea_node_start(void *sax_cbck, const char *node_name, const char *name_space, const GF_XMLAttribute *attributes, u32 nb_attributes)
{
GF_XMLAttribute *att;
GF_TrackCryptInfo *tkc;
u32 i;
GF_CryptInfo *info = (GF_CryptInfo *)sax_cbck;
if (!strcmp(node_name, "OMATextHeader")) {
info->in_text_header = 1;
return;
}
if (!strcmp(node_name, "GPACDRM")) {
for (i=0; i<nb_attributes; i++) {
att = (GF_XMLAttribute *) &attributes[i];
if (!stricmp(att->name, "type")) {
if (!stricmp(att->value, "ISMA"))info->crypt_type = 1;
else if (!stricmp(att->value, "CENC AES-CTR")) info->crypt_type = 2;
else if (!stricmp(att->value, "CENC AES-CBC")) info->crypt_type = 3;
else if (!stricmp(att->value, "ADOBE")) info->crypt_type = 4;
}
}
return;
}
if (!strcmp(node_name, "CrypTrack")) {
GF_SAFEALLOC(tkc, GF_TrackCryptInfo);
gf_list_add(info->tcis, tkc);
if (!strcmp(node_name, "OMATrack")) {
tkc->enc_type = 1;
/*default to AES 128 in OMA*/
tkc->encryption = 2;
}
for (i=0; i<nb_attributes; i++) {
att = (GF_XMLAttribute *) &attributes[i];
if (!stricmp(att->name, "trackID") || !stricmp(att->name, "ID")) {
if (!strcmp(att->value, "*")) info->has_common_key = 1;
else tkc->trackID = atoi(att->value);
}
else if (!stricmp(att->name, "key")) {
gf_bin128_parse(att->value, tkc->key);
}
else if (!stricmp(att->name, "salt")) {
u32 len, j;
char *sKey = att->value;
if (!strnicmp(sKey, "0x", 2)) sKey += 2;
len = (u32) strlen(sKey);
for (j=0; j<len; j+=2) {
char szV[5];
u32 v;
sprintf(szV, "%c%c", sKey[j], sKey[j+1]);
sscanf(szV, "%x", &v);
tkc->salt[j/2] = v;
}
}
else if (!stricmp(att->name, "kms_URI")) strcpy(tkc->KMS_URI, att->value);
else if (!stricmp(att->name, "rightsIssuerURL")) strcpy(tkc->KMS_URI, att->value);
else if (!stricmp(att->name, "scheme_URI")) strcpy(tkc->Scheme_URI, att->value);
else if (!stricmp(att->name, "selectiveType")) {
if (!stricmp(att->value, "Rap")) tkc->sel_enc_type = GF_CRYPT_SELENC_RAP;
else if (!stricmp(att->value, "Non-Rap")) tkc->sel_enc_type = GF_CRYPT_SELENC_NON_RAP;
else if (!stricmp(att->value, "Rand")) tkc->sel_enc_type = GF_CRYPT_SELENC_RAND;
else if (!strnicmp(att->value, "Rand", 4)) {
tkc->sel_enc_type = GF_CRYPT_SELENC_RAND_RANGE;
tkc->sel_enc_range = atoi(&att->value[4]);
}
else if (sscanf(att->value, "%u", &tkc->sel_enc_range)==1) {
if (tkc->sel_enc_range==1) tkc->sel_enc_range = 0;
else tkc->sel_enc_type = GF_CRYPT_SELENC_RANGE;
}
else if (!strnicmp(att->value, "Preview", 7)) {
tkc->sel_enc_type = GF_CRYPT_SELENC_PREVIEW;
}
}
else if (!stricmp(att->name, "Preview")) {
tkc->sel_enc_type = GF_CRYPT_SELENC_PREVIEW;
sscanf(att->value, "%u", &tkc->sel_enc_range);
}
else if (!stricmp(att->name, "ipmpType")) {
if (!stricmp(att->value, "None")) tkc->ipmp_type = 0;
else if (!stricmp(att->value, "IPMP")) tkc->sel_enc_type = 1;
else if (!stricmp(att->value, "IPMPX")) tkc->sel_enc_type = 2;
}
else if (!stricmp(att->name, "ipmpDescriptorID")) tkc->ipmp_desc_id = atoi(att->value);
else if (!stricmp(att->name, "encryptionMethod")) {
if (!strcmp(att->value, "AES_128_CBC")) tkc->encryption = 1;
else if (!strcmp(att->value, "None")) tkc->encryption = 0;
else if (!strcmp(att->value, "AES_128_CTR") || !strcmp(att->value, "default")) tkc->encryption = 2;
}
else if (!stricmp(att->name, "contentID")) strcpy(tkc->Scheme_URI, att->value);
else if (!stricmp(att->name, "rightsIssuerURL")) strcpy(tkc->KMS_URI, att->value);
else if (!stricmp(att->name, "transactionID")) {
if (strlen(att->value)<=16) strcpy(tkc->TransactionID, att->value);
}
else if (!stricmp(att->name, "textualHeaders")) {
}
/*CENC extensions*/
else if (!stricmp(att->name, "IsEncrypted")) {
if (!stricmp(att->value, "1"))
tkc->IsEncrypted = 1;
else
tkc->IsEncrypted = 0;
}
else if (!stricmp(att->name, "IV_size")) {
tkc->IV_size = atoi(att->value);
}
else if (!stricmp(att->name, "first_IV")) {
char *sKey = att->value;
if (!strnicmp(sKey, "0x", 2)) sKey += 2;
if ((strlen(sKey) == 16) || (strlen(sKey) == 32)) {
u32 j;
for (j=0; j<strlen(sKey); j+=2) {
u32 v;
char szV[5];
sprintf(szV, "%c%c", sKey[j], sKey[j+1]);
sscanf(szV, "%x", &v);
tkc->first_IV[j/2] = v;
}
}
}
else if (!stricmp(att->name, "saiSavedBox")) {
if (!stricmp(att->value, "uuid_psec")) tkc->sai_saved_box_type = GF_ISOM_BOX_UUID_PSEC;
else if (!stricmp(att->value, "senc")) tkc->sai_saved_box_type = GF_ISOM_BOX_TYPE_SENC;
}
else if (!stricmp(att->name, "keyRoll")) {
if (!strncmp(att->value, "idx=", 4))
tkc->defaultKeyIdx = atoi(att->value+4);
else if (!strncmp(att->value, "roll=", 5))
tkc->keyRoll = atoi(att->value+5);
}
else if (!stricmp(att->name, "metadata")) {
tkc->metadata_len = gf_base64_encode(att->value, (u32) strlen(att->value), tkc->metadata, 5000);
tkc->metadata[tkc->metadata_len] = 0;
}
}
if ((info->crypt_type == 3) && (tkc->IV_size == 8)) {
GF_LOG(GF_LOG_WARNING, GF_LOG_AUTHOR, ("[CENC] Using AES-128 CBC: IV_size should be 16\n"));
tkc->IV_size = 16;
}
}
if (!strcmp(node_name, "key")) {
tkc = (GF_TrackCryptInfo *)gf_list_last(info->tcis);
tkc->KIDs = (bin128 *)gf_realloc(tkc->KIDs, sizeof(bin128)*(tkc->KID_count+1));
tkc->keys = (bin128 *)gf_realloc(tkc->keys, sizeof(bin128)*(tkc->KID_count+1));
for (i=0; i<nb_attributes; i++) {
att = (GF_XMLAttribute *) &attributes[i];
if (!stricmp(att->name, "KID")) {
gf_bin128_parse(att->value, tkc->KIDs[tkc->KID_count]);
}
else if (!stricmp(att->name, "value")) {
gf_bin128_parse(att->value, tkc->keys[tkc->KID_count]);
}
}
tkc->KID_count++;
}
}
void isma_ea_node_end(void *sax_cbck, const char *node_name, const char *name_space)
{
GF_CryptInfo *info = (GF_CryptInfo *)sax_cbck;
if (!strcmp(node_name, "OMATextHeader")) {
info->in_text_header = 0;
return;
}
}
void isma_ea_text(void *sax_cbck, const char *text, Bool is_cdata)
{
u32 len;
GF_TrackCryptInfo *tkc;
GF_CryptInfo *info = (GF_CryptInfo *)sax_cbck;
if (!info->in_text_header) return;
tkc = (GF_TrackCryptInfo *) gf_list_last(info->tcis);
len = (u32) strlen(text);
if (len+tkc->TextualHeadersLen > 5000) return;
if (tkc->TextualHeadersLen) {
tkc->TextualHeadersLen ++;
tkc->TextualHeaders[tkc->TextualHeadersLen] = 0;
}
memcpy(tkc->TextualHeaders + tkc->TextualHeadersLen, text, sizeof(char)*len);
tkc->TextualHeadersLen += len;
tkc->TextualHeaders[tkc->TextualHeadersLen] = 0;
}
static void del_crypt_info(GF_CryptInfo *info)
{
while (gf_list_count(info->tcis)) {
GF_TrackCryptInfo *tci = (GF_TrackCryptInfo *)gf_list_last(info->tcis);
if (tci->KIDs) gf_free(tci->KIDs);
if (tci->keys) gf_free(tci->keys);
gf_list_rem_last(info->tcis);
gf_free(tci);
}
gf_list_del(info->tcis);
gf_free(info);
}
static GF_CryptInfo *load_crypt_file(const char *file)
{
GF_Err e;
GF_CryptInfo *info;
GF_SAXParser *sax;
GF_SAFEALLOC(info, GF_CryptInfo);
info->tcis = gf_list_new();
sax = gf_xml_sax_new(isma_ea_node_start, isma_ea_node_end, isma_ea_text, info);
e = gf_xml_sax_parse_file(sax, file, NULL);
gf_xml_sax_del(sax);
if (e<0) {
del_crypt_info(info);
return NULL;
}
return info;
}
GF_EXPORT
GF_Err gf_ismacryp_gpac_get_info(u32 stream_id, char *drm_file, char *key, char *salt)
{
GF_Err e;
u32 i, count;
GF_CryptInfo *info;
GF_TrackCryptInfo *tci;
e = GF_OK;
info = load_crypt_file(drm_file);
if (!info) return GF_NOT_SUPPORTED;
count = gf_list_count(info->tcis);
for (i=0; i<count; i++) {
tci = (GF_TrackCryptInfo *) gf_list_get(info->tcis, i);
if ((info->has_common_key && !tci->trackID) || (tci->trackID == stream_id) ) {
memcpy(key, tci->key, sizeof(char)*16);
memcpy(salt, tci->salt, sizeof(char)*8);
e = GF_OK;
break;
}
}
del_crypt_info(info);
return e;
}
GF_EXPORT
Bool gf_ismacryp_mpeg4ip_get_info(char *kms_uri, char *key, char *salt)
{
char szPath[1024], catKey[24];
u32 i, x;
Bool got_it;
FILE *kms;
strcpy(szPath, getenv("HOME"));
strcat(szPath , "/.kms_data");
got_it = 0;
kms = gf_fopen(szPath, "r");
while (kms && !feof(kms)) {
if (!fgets(szPath, 1024, kms)) break;
szPath[strlen(szPath) - 1] = 0;
if (stricmp(szPath, kms_uri)) continue;
for (i=0; i<24; i++) {
if (!fscanf(kms, "%x", &x)) break;
catKey[i] = x;
}
if (i==24) got_it = 1;
break;
}
if (kms) gf_fclose(kms);
if (got_it) {
/*watchout, MPEG4IP stores SALT|KEY, NOT KEY|SALT*/
memcpy(key, catKey+8, sizeof(char)*16);
memcpy(salt, catKey, sizeof(char)*8);
return 1;
}
return 0;
}
#ifndef GPAC_DISABLE_ISOM_WRITE
/*ISMACrypt*/
static GFINLINE void isma_resync_IV(GF_Crypt *mc, u64 BSO, char *salt)
{
char IV[17];
u64 count;
u32 remain;
GF_BitStream *bs;
count = BSO / 16;
remain = (u32) (BSO % 16);
/*format IV to begin of counter*/
bs = gf_bs_new(IV, 17, GF_BITSTREAM_WRITE);
gf_bs_write_u8(bs, 0); /*begin of counter*/
gf_bs_write_data(bs, salt, 8);
gf_bs_write_u64(bs, (s64) count);
gf_bs_del(bs);
gf_crypt_set_state(mc, IV, 17);
/*decrypt remain bytes*/
if (remain) {
char dummy[20];
gf_crypt_decrypt(mc, dummy, remain);
}
}
GF_EXPORT
GF_Err gf_ismacryp_decrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
GF_Err e;
Bool use_sel_enc;
u32 track, count, i, j, si, is_avc;
GF_ISOSample *samp;
GF_ISMASample *ismasamp;
GF_Crypt *mc;
unsigned char IV[17];
u32 IV_size;
Bool prev_sample_encrypted;
GF_ESD *esd;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
e = gf_isom_get_ismacryp_info(mp4, track, 1, &is_avc, NULL, NULL, NULL, NULL, &use_sel_enc, &IV_size, NULL);
is_avc = (is_avc==GF_4CC('2','6','4','b')) ? 1 : 0;
mc = gf_crypt_open("AES-128", "CTR");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open AES-128 CTR cryptography\n", tci->trackID));
return GF_IO_ERR;
}
memset(IV, 0, sizeof(char)*16);
memcpy(IV, tci->salt, sizeof(char)*8);
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
gf_crypt_close(mc);
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] cannot initialize AES-128 CTR (%s)\n", gf_error_to_string(e)));
return GF_IO_ERR;
}
GF_LOG(GF_LOG_INFO, GF_LOG_AUTHOR, ("[CENC/ISMA] Decrypting track ID %d - KMS: %s%s\n", tci->trackID, tci->KMS_URI, use_sel_enc ? " - Selective Decryption" : ""));
/*start as initialized*/
prev_sample_encrypted = 1;
/* decrypt each sample */
count = gf_isom_get_sample_count(mp4, track);
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
samp = gf_isom_get_sample(mp4, track, i+1, &si);
ismasamp = gf_isom_get_ismacryp_sample(mp4, track, samp, si);
gf_free(samp->data);
samp->data = (char *)gf_malloc(ismasamp->dataLength);
memmove(samp->data, ismasamp->data, ismasamp->dataLength);
samp->dataLength = ismasamp->dataLength;
/* Decrypt payload */
if (ismasamp->flags & GF_ISOM_ISMA_IS_ENCRYPTED) {
/*restore IV*/
if (!prev_sample_encrypted) isma_resync_IV(mc, ismasamp->IV, (char *) tci->salt);
gf_crypt_decrypt(mc, samp->data, samp->dataLength);
}
prev_sample_encrypted = (ismasamp->flags & GF_ISOM_ISMA_IS_ENCRYPTED);
gf_isom_ismacryp_delete_sample(ismasamp);
/*replace AVC start codes (0x00000001) by nalu size*/
if (is_avc) {
u32 nalu_size;
u32 remain = samp->dataLength;
char *start, *end;
start = samp->data;
end = start + 4;
while (remain>4) {
if (!end[0] && !end[1] && !end[2] && (end[3]==0x01)) {
nalu_size = (u32) (end - start - 4);
start[0] = (nalu_size>>24)&0xFF;
start[1] = (nalu_size>>16)&0xFF;
start[2] = (nalu_size>>8)&0xFF;
start[3] = (nalu_size)&0xFF;
start = end;
end = start+4;
remain -= 4;
continue;
}
end++;
remain--;
}
nalu_size = (u32) (end - start - 4);
start[0] = (nalu_size>>24)&0xFF;
start[1] = (nalu_size>>16)&0xFF;
start[2] = (nalu_size>>8)&0xFF;
start[3] = (nalu_size)&0xFF;
}
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_isom_sample_del(&samp);
gf_set_progress("ISMA Decrypt", i+1, count);
}
gf_crypt_close(mc);
/*and remove protection info*/
e = gf_isom_remove_track_protection(mp4, track, 1);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Error ISMACryp signature from trackID %d: %s\n", tci->trackID, gf_error_to_string(e)));
}
/*remove all IPMP ptrs*/
esd = gf_isom_get_esd(mp4, track, 1);
if (esd) {
while (gf_list_count(esd->IPMPDescriptorPointers)) {
GF_Descriptor *d = (GF_Descriptor *)gf_list_get(esd->IPMPDescriptorPointers, 0);
gf_list_rem(esd->IPMPDescriptorPointers, 0);
gf_odf_desc_del(d);
}
gf_isom_change_mpeg4_description(mp4, track, 1, esd);
gf_odf_desc_del((GF_Descriptor *)esd);
}
/*update OD track if any*/
track = 0;
for (i=0; i<gf_isom_get_track_count(mp4); i++) {
GF_ODCodec *cod;
if (gf_isom_get_media_type(mp4, i+1) != GF_ISOM_MEDIA_OD) continue;
/*remove all IPMPUpdate commads...*/
samp = gf_isom_get_sample(mp4, i+1, 1, &si);
cod = gf_odf_codec_new();
gf_odf_codec_set_au(cod, samp->data, samp->dataLength);
gf_odf_codec_decode(cod);
for (j=0; j<gf_list_count(cod->CommandList); j++) {
GF_IPMPUpdate *com = (GF_IPMPUpdate *)gf_list_get(cod->CommandList, j);
if (com->tag != GF_ODF_IPMP_UPDATE_TAG) continue;
gf_list_rem(cod->CommandList, j);
j--;
gf_odf_com_del((GF_ODCom **)&com);
}
gf_free(samp->data);
samp->data = NULL;
samp->dataLength = 0;
gf_odf_codec_encode(cod, 1);
gf_odf_codec_get_au(cod, &samp->data, &samp->dataLength);
gf_odf_codec_del(cod);
gf_isom_update_sample(mp4, i+1, 1, samp, 1);
gf_isom_sample_del(&samp);
/*remove IPMPToolList if any*/
gf_isom_ipmpx_remove_tool_list(mp4);
break;
}
return GF_OK;
}
GF_EXPORT
GF_Err gf_ismacryp_encrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
char IV[16];
GF_ISOSample *samp;
GF_ISMASample *isamp;
GF_Crypt *mc;
u32 i, count, di, track, IV_size, rand, avc_size_length;
u64 BSO, range_end;
GF_ESD *esd;
GF_IPMPPtr *ipmpdp;
GF_IPMP_Descriptor *ipmpd;
GF_IPMPUpdate *ipmpdU;
#ifndef GPAC_MINIMAL_ODF
GF_IPMPX_ISMACryp *ismac;
#endif
GF_Err e;
Bool prev_sample_encryped, has_crypted_samp;
avc_size_length = 0;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
if (!track) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot find TrackID %d in input file - skipping\n", tci->trackID));
return GF_OK;
}
esd = gf_isom_get_esd(mp4, track, 1);
if (esd && (esd->decoderConfig->streamType==GF_STREAM_OD)) {
gf_odf_desc_del((GF_Descriptor *) esd);
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot encrypt OD tracks - skipping"));
return GF_NOT_SUPPORTED;
}
if (esd) {
if ((esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_AVC) || (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_SVC)) avc_size_length = 1;
gf_odf_desc_del((GF_Descriptor*) esd);
}
if (avc_size_length) {
GF_AVCConfig *avccfg = gf_isom_avc_config_get(mp4, track, 1);
avc_size_length = avccfg->nal_unit_size;
gf_odf_avc_cfg_del(avccfg);
if (avc_size_length != 4) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot encrypt AVC/H264 track with %d size_length field - onmy 4 supported\n", avc_size_length));
return GF_NOT_SUPPORTED;
}
}
if (!tci->enc_type && !strlen(tci->Scheme_URI)) strcpy(tci->Scheme_URI, "urn:gpac:isma:encryption_scheme");
if (!gf_isom_has_sync_points(mp4, track) &&
((tci->sel_enc_type==GF_CRYPT_SELENC_RAP) || (tci->sel_enc_type==GF_CRYPT_SELENC_NON_RAP)) ) {
GF_LOG(GF_LOG_WARNING, GF_LOG_AUTHOR, ("[CENC/ISMA] All samples in trackID %d are random access - disabling selective encryption\n", tci->trackID));
tci->sel_enc_type = GF_CRYPT_SELENC_NONE;
}
else if ((tci->sel_enc_type==GF_CRYPT_SELENC_RAND) || (tci->sel_enc_type==GF_CRYPT_SELENC_RAND_RANGE)) {
gf_rand_init(1);
}
BSO = gf_isom_get_media_data_size(mp4, track);
if (tci->enc_type==0) {
if (BSO<0xFFFF) IV_size = 2;
else if (BSO<0xFFFFFFFF) IV_size = 4;
else IV_size = 8;
} else {
/*128 bit IV in OMA*/
IV_size = 16;
}
GF_LOG(GF_LOG_INFO, GF_LOG_AUTHOR, ("[CENC/ISMA] Encrypting track ID %d - KMS: %s%s\n", tci->trackID, tci->KMS_URI, tci->sel_enc_type ? " - Selective Encryption" : ""));
/*init crypto*/
memset(IV, 0, sizeof(char)*16);
memcpy(IV, tci->salt, sizeof(char)*8);
mc = gf_crypt_open("AES-128", "CTR");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open AES-128 CTR\n"));
return GF_IO_ERR;
}
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot initialize AES-128 CTR (%s)\n", gf_error_to_string(e)) );
gf_crypt_close(mc);
return GF_IO_ERR;
}
if (!stricmp(tci->KMS_URI, "self")) {
char Data[100], d64[100];
u32 s64;
memcpy(Data, tci->key, sizeof(char)*16);
memcpy(Data+16, tci->salt, sizeof(char)*8);
s64 = gf_base64_encode(Data, 24, d64, 100);
d64[s64] = 0;
strcpy(tci->KMS_URI, "(key)");
strcat(tci->KMS_URI, d64);
}
/*create ISMA protection*/
if (tci->enc_type==0) {
e = gf_isom_set_ismacryp_protection(mp4, track, 1, GF_ISOM_ISMACRYP_SCHEME, 1,
tci->Scheme_URI, tci->KMS_URI, (tci->sel_enc_type!=0) ? 1 : 0, 0, IV_size);
} else {
if ((tci->sel_enc_type==GF_CRYPT_SELENC_PREVIEW) && tci->sel_enc_range) {
char *szPreview = tci->TextualHeaders + tci->TextualHeadersLen;
sprintf(szPreview, "PreviewRange:%d", tci->sel_enc_range);
tci->TextualHeadersLen += (u32) strlen(szPreview)+1;
}
e = gf_isom_set_oma_protection(mp4, track, 1,
strlen(tci->Scheme_URI) ? tci->Scheme_URI : NULL,
tci->KMS_URI,
tci->encryption, BSO,
tci->TextualHeadersLen ? tci->TextualHeaders : NULL,
tci->TextualHeadersLen,
(tci->sel_enc_type!=0) ? 1 : 0, 0, IV_size);
}
if (e) return e;
has_crypted_samp = 0;
BSO = 0;
prev_sample_encryped = 1;
range_end = 0;
if (tci->sel_enc_type==GF_CRYPT_SELENC_PREVIEW) {
range_end = gf_isom_get_media_timescale(mp4, track) * tci->sel_enc_range;
}
if (gf_isom_has_time_offset(mp4, track)) gf_isom_set_cts_packing(mp4, track, 1);
count = gf_isom_get_sample_count(mp4, track);
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
samp = gf_isom_get_sample(mp4, track, i+1, &di);
isamp = gf_isom_ismacryp_new_sample();
isamp->IV_length = IV_size;
isamp->KI_length = 0;
switch (tci->sel_enc_type) {
case GF_CRYPT_SELENC_RAP:
if (samp->IsRAP) isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
case GF_CRYPT_SELENC_NON_RAP:
if (!samp->IsRAP) isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
/*random*/
case GF_CRYPT_SELENC_RAND:
rand = gf_rand();
if (rand%2) isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
/*random every sel_freq samples*/
case GF_CRYPT_SELENC_RAND_RANGE:
if (!(i%tci->sel_enc_range)) has_crypted_samp = 0;
if (!has_crypted_samp) {
rand = gf_rand();
if (!(rand%tci->sel_enc_range)) isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
if (!(isamp->flags & GF_ISOM_ISMA_IS_ENCRYPTED) && !( (1+i)%tci->sel_enc_range)) {
isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
}
has_crypted_samp = (isamp->flags & GF_ISOM_ISMA_IS_ENCRYPTED);
}
break;
/*every sel_freq samples*/
case GF_CRYPT_SELENC_RANGE:
if (!(i%tci->sel_enc_type)) isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
case GF_CRYPT_SELENC_PREVIEW:
if (samp->DTS + samp->CTS_Offset >= range_end)
isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
case 0:
isamp->flags |= GF_ISOM_ISMA_IS_ENCRYPTED;
break;
default:
break;
}
if (tci->sel_enc_type) isamp->flags |= GF_ISOM_ISMA_USE_SEL_ENC;
/*isma e&a stores AVC1 in AVC/H264 annex B bitstream fashion, with 0x00000001 start codes*/
if (avc_size_length) {
u32 done = 0;
u8 *d = (u8*)samp->data;
while (done < samp->dataLength) {
u32 nal_size = GF_4CC(d[0], d[1], d[2], d[3]);
d[0] = d[1] = d[2] = 0;
d[3] = 1;
d += 4 + nal_size;
done += 4 + nal_size;
}
}
if (isamp->flags & GF_ISOM_ISMA_IS_ENCRYPTED) {
/*resync IV*/
if (!prev_sample_encryped) isma_resync_IV(mc, BSO, (char *) tci->salt);
gf_crypt_encrypt(mc, samp->data, samp->dataLength);
prev_sample_encryped = 1;
} else {
prev_sample_encryped = 0;
}
isamp->IV = BSO;
BSO += samp->dataLength;
isamp->data = samp->data;
isamp->dataLength = samp->dataLength;
samp->data = NULL;
samp->dataLength = 0;
gf_isom_ismacryp_sample_to_sample(isamp, samp);
gf_isom_ismacryp_delete_sample(isamp);
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_isom_sample_del(&samp);
gf_set_progress("ISMA Encrypt", i+1, count);
}
gf_isom_set_cts_packing(mp4, track, 0);
gf_crypt_close(mc);
/*format as IPMP(X) - note that the ISMACryp spec is broken since it always uses IPMPPointers to a
single desc which would assume the same protection (eg key & salt) for all streams using it...*/
if (!tci->ipmp_type) return GF_OK;
ipmpdp = (GF_IPMPPtr*)gf_odf_desc_new(GF_ODF_IPMP_PTR_TAG);
if (!tci->ipmp_desc_id) tci->ipmp_desc_id = track;
if (tci->ipmp_type==2) {
ipmpdp->IPMP_DescriptorID = 0xFF;
ipmpdp->IPMP_DescriptorIDEx = tci->ipmp_desc_id;
} else {
ipmpdp->IPMP_DescriptorID = tci->ipmp_desc_id;
}
gf_isom_add_desc_to_description(mp4, track, 1, (GF_Descriptor *)ipmpdp);
gf_odf_desc_del((GF_Descriptor*)ipmpdp);
ipmpdU = (GF_IPMPUpdate*)gf_odf_com_new(GF_ODF_IPMP_UPDATE_TAG);
/*format IPMPD*/
ipmpd = (GF_IPMP_Descriptor*)gf_odf_desc_new(GF_ODF_IPMP_TAG);
if (tci->ipmp_type==2) {
#ifndef GPAC_MINIMAL_ODF
ipmpd->IPMP_DescriptorID = 0xFF;
ipmpd->IPMP_DescriptorIDEx = tci->ipmp_desc_id;
ipmpd->IPMPS_Type = 0xFFFF;
ipmpd->IPMP_ToolID[14] = 0x49;
ipmpd->IPMP_ToolID[15] = 0x53;
ipmpd->control_point = 1;
ipmpd->cp_sequence_code = 0x80;
/*format IPMPXData*/
ismac = (GF_IPMPX_ISMACryp *) gf_ipmpx_data_new(GF_IPMPX_ISMACRYP_TAG);
ismac->cryptoSuite = 1; /*default ISMA AESCTR128*/
ismac->IV_length = IV_size;
ismac->key_indicator_length = 0;
ismac->use_selective_encryption = (tci->sel_enc_type!=0)? 1 : 0;
gf_list_add(ipmpd->ipmpx_data, ismac);
#endif
} else {
ipmpd->IPMP_DescriptorID = tci->ipmp_desc_id;
}
gf_list_add(ipmpdU->IPMPDescList, ipmpd);
for (i=0; i<gf_isom_get_track_count(mp4); i++) {
GF_ODCodec *cod;
if (gf_isom_get_media_type(mp4, i+1) != GF_ISOM_MEDIA_OD) continue;
/*add com*/
samp = gf_isom_get_sample(mp4, i+1, 1, &di);
cod = gf_odf_codec_new();
gf_odf_codec_set_au(cod, samp->data, samp->dataLength);
gf_odf_codec_decode(cod);
gf_odf_codec_add_com(cod, (GF_ODCom *) ipmpdU);
gf_free(samp->data);
samp->data = NULL;
samp->dataLength = 0;
gf_odf_codec_encode(cod, 1);
gf_odf_codec_get_au(cod, &samp->data, &samp->dataLength);
ipmpdU = NULL;
gf_odf_codec_del(cod);
gf_isom_update_sample(mp4, i+1, 1, samp, 1);
gf_isom_sample_del(&samp);
if (tci->ipmp_type==2) {
GF_IPMP_ToolList*ipmptl = (GF_IPMP_ToolList*)gf_odf_desc_new(GF_ODF_IPMP_TL_TAG);
GF_IPMP_Tool *ipmpt = (GF_IPMP_Tool*)gf_odf_desc_new(GF_ODF_IPMP_TOOL_TAG);
gf_list_add(ipmptl->ipmp_tools, ipmpt);
ipmpt->IPMP_ToolID[14] = 0x49;
ipmpt->IPMP_ToolID[15] = 0x53;
gf_isom_add_desc_to_root_od(mp4, (GF_Descriptor *)ipmptl);
gf_odf_desc_del((GF_Descriptor *)ipmptl);
}
break;
}
return e;
}
/*Common Encryption*/
static void increase_counter(char *x, int x_size) {
register int i, y=0;
for (i=x_size-1; i>=0; i--) {
y = 0;
if ((u8) x[i] == 0xFF) {
x[i] = 0;
y = 1;
} else x[i]++;
if (y==0) break;
}
return;
}
static void cenc_resync_IV(GF_Crypt *mc, char IV[16], u8 IV_size) {
char next_IV[17];
int size = 17;
gf_crypt_get_state(mc, &next_IV, &size);
/*
NOTE 1: the next_IV returned by get_state has 17 bytes, the first byte being the current counter position in the following 16 bytes.
If this index is 0, this means that we are at the begining of a new block and we can use it as IV for next sample,
otherwise we must discard unsued bytes in the counter (next sample shall begin with counter at 0)
if less than 16 blocks were cyphered, we must force inscreasing the next IV for next sample, not doing so would produce the same IV for the next bytes cyphered,
which is forbidden by CENC (unique IV per sample). In GPAC, we ALWAYS force counter increase
NOTE 2: in case where IV_size is 8, because the cypher block is treated as 16 bytes while processing,
we need to increment manually the 8-bytes IV (bytes 0 to 7) for the next sample, otherwise we would likely the same IV (eg unless we had cyphered 16 * 2^64 - 1
bytes in the last sample , quite unlikely !)
NOTE 3: Bytes 8 to 15 are set to 0 when forcing a new IV for 8-bytes IVs.
NOTE 4: Since CENC forces declaration of a unique, potentially random, IV per sample, we could increase the IV counter at each sample start
but this is currently not done
*/
if (IV_size == 8) {
/*cf note 2*/
increase_counter(&next_IV[1], IV_size);
next_IV[0] = 0;
/*cf note 3*/
memset(&next_IV[9], 0, 8*sizeof(char));
} else if (next_IV[0]) {
/*cf note 1*/
increase_counter(&next_IV[1], IV_size);
next_IV[0] = 0;
}
gf_crypt_set_state(mc, next_IV, size);
memset(IV, 0, 16*sizeof(char));
memcpy(IV, next_IV+1, 16*sizeof(char));
}
static GF_Err gf_cenc_encrypt_sample_ctr(GF_Crypt *mc, GF_ISOSample *samp, Bool is_nalu_video, u32 nalu_size_length, char IV[16], u32 IV_size, char **sai, u32 *saiz, u32 bytes_in_nalhr) {
GF_BitStream *pleintext_bs, *cyphertext_bs, *sai_bs;
char *buffer;
u32 max_size, size;
u64 BSO;
GF_Err e = GF_OK;
GF_List *subsamples;
pleintext_bs = cyphertext_bs = sai_bs = NULL;
max_size = 4096;
BSO = 0;
buffer = (char*)gf_malloc(sizeof(char) * max_size);
memset(buffer, 0, max_size);
pleintext_bs = gf_bs_new(samp->data, samp->dataLength, GF_BITSTREAM_READ);
cyphertext_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
sai_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
gf_bs_write_data(sai_bs, IV, IV_size);
subsamples = gf_list_new();
if (!subsamples) {
e = GF_IO_ERR;
goto exit;
}
while (gf_bs_available(pleintext_bs)) {
GF_CENCSubSampleEntry *entry = (GF_CENCSubSampleEntry *)gf_malloc(sizeof(GF_CENCSubSampleEntry));
if (is_nalu_video) {
char nal_hdr[2];
size = gf_bs_read_int(pleintext_bs, 8*nalu_size_length);
if (size>max_size) {
buffer = (char*)gf_realloc(buffer, sizeof(char)*size);
max_size = size;
}
gf_bs_read_data(pleintext_bs, (char *)nal_hdr, bytes_in_nalhr);
gf_bs_read_data(pleintext_bs, buffer, size-bytes_in_nalhr);
gf_crypt_encrypt(mc, buffer, size-bytes_in_nalhr);
BSO += size-1;
/*write clear data and encrypted data to bitstream*/
gf_bs_write_int(cyphertext_bs, size, 8*nalu_size_length);
gf_bs_write_data(cyphertext_bs, nal_hdr, bytes_in_nalhr);
gf_bs_write_data(cyphertext_bs, buffer, size-bytes_in_nalhr);
entry->bytes_clear_data = nalu_size_length + bytes_in_nalhr;
entry->bytes_encrypted_data = size - bytes_in_nalhr;
} else {
gf_bs_read_data(pleintext_bs, buffer, samp->dataLength);
gf_crypt_encrypt(mc, buffer, samp->dataLength);
gf_bs_write_data(cyphertext_bs, buffer, samp->dataLength);
BSO += samp->dataLength;
entry->bytes_clear_data = 0;
entry->bytes_encrypted_data = samp->dataLength;
}
gf_list_add(subsamples, entry);
}
if (samp->data) {
gf_free(samp->data);
samp->data = NULL;
samp->dataLength = 0;
}
gf_bs_get_content(cyphertext_bs, &samp->data, &samp->dataLength);
gf_bs_write_u16(sai_bs, gf_list_count(subsamples));
while (gf_list_count(subsamples)) {
GF_CENCSubSampleEntry *ptr = (GF_CENCSubSampleEntry *)gf_list_get(subsamples, 0);
gf_list_rem(subsamples, 0);
gf_bs_write_u16(sai_bs, ptr->bytes_clear_data);
gf_bs_write_u32(sai_bs, ptr->bytes_encrypted_data);
gf_free(ptr);
}
gf_list_del(subsamples);
gf_bs_get_content(sai_bs, sai, saiz);
cenc_resync_IV(mc, IV, IV_size);
exit:
if (buffer) gf_free(buffer);
if (pleintext_bs) gf_bs_del(pleintext_bs);
if (cyphertext_bs) gf_bs_del(cyphertext_bs);
if (sai_bs) gf_bs_del(sai_bs);
return e;
}
static GF_Err gf_cenc_encrypt_sample_cbc(GF_Crypt *mc, GF_ISOSample *samp, Bool is_nalu_video, u32 nalu_size_length, char IV[16], u32 IV_size, char **sai, u32 *saiz, u32 bytes_in_nalhr) {
GF_BitStream *pleintext_bs, *cyphertext_bs, *sai_bs;
char *buffer;
u32 max_size, size;
GF_Err e = GF_OK;
GF_List *subsamples;
pleintext_bs = cyphertext_bs = sai_bs = NULL;
max_size = 4096;
buffer = (char*)gf_malloc(sizeof(char) * max_size);
memset(buffer, 0, max_size);
pleintext_bs = gf_bs_new(samp->data, samp->dataLength, GF_BITSTREAM_READ);
cyphertext_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
sai_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
gf_bs_write_data(sai_bs, IV, 16);
subsamples = gf_list_new();
if (!subsamples) {
e = GF_IO_ERR;
goto exit;
}
while (gf_bs_available(pleintext_bs)) {
u32 ret;
GF_CENCSubSampleEntry *entry = (GF_CENCSubSampleEntry *)gf_malloc(sizeof(GF_CENCSubSampleEntry));
if (is_nalu_video) {
char nal_hdr[2];
size = gf_bs_read_int(pleintext_bs, 8*nalu_size_length);
if (size+1 > max_size) {
buffer = (char*)gf_realloc(buffer, sizeof(char)*(size+1));
memset(buffer, 0, sizeof(char)*(size+1));
max_size = size + 1;
}
gf_bs_write_int(cyphertext_bs, size, 8*nalu_size_length);
gf_bs_read_data(pleintext_bs, (char *)nal_hdr, bytes_in_nalhr);
gf_bs_write_data(cyphertext_bs, nal_hdr, bytes_in_nalhr);
gf_bs_read_data(pleintext_bs, buffer, size-bytes_in_nalhr);
ret = (size-bytes_in_nalhr) % 16;
if (ret) {
gf_bs_write_data(cyphertext_bs, buffer, ret);
}
if (size-bytes_in_nalhr >= 16) {
gf_crypt_encrypt(mc, buffer+ret, size - bytes_in_nalhr -ret);
gf_bs_write_data(cyphertext_bs, buffer+ret, size - bytes_in_nalhr - ret);
}
entry->bytes_clear_data = nalu_size_length + bytes_in_nalhr + ret;
entry->bytes_encrypted_data = (size-bytes_in_nalhr >= 16) ? size - bytes_in_nalhr - ret : 0 ;
} else {
gf_bs_read_data(pleintext_bs, buffer, samp->dataLength);
ret = samp->dataLength % 16;
if (ret) {
gf_bs_write_data(cyphertext_bs, buffer, ret);
}
if (samp->dataLength >= 16) {
gf_crypt_encrypt(mc, buffer, samp->dataLength);
gf_bs_write_data(cyphertext_bs, buffer, samp->dataLength);
}
entry->bytes_clear_data = ret;
entry->bytes_encrypted_data = (samp->dataLength >= 16) ? samp->dataLength - ret : 0;
}
gf_list_add(subsamples, entry);
}
if (samp->data) {
gf_free(samp->data);
samp->data = NULL;
samp->dataLength = 0;
}
gf_bs_get_content(cyphertext_bs, &samp->data, &samp->dataLength);
gf_bs_write_u16(sai_bs, gf_list_count(subsamples));
while (gf_list_count(subsamples)) {
GF_CENCSubSampleEntry *ptr = (GF_CENCSubSampleEntry *)gf_list_get(subsamples, 0);
gf_list_rem(subsamples, 0);
gf_bs_write_u16(sai_bs, ptr->bytes_clear_data);
gf_bs_write_u32(sai_bs, ptr->bytes_encrypted_data);
gf_free(ptr);
}
gf_list_del(subsamples);
gf_bs_get_content(sai_bs, sai, saiz);
exit:
if (buffer) gf_free(buffer);
if (pleintext_bs) gf_bs_del(pleintext_bs);
if (cyphertext_bs) gf_bs_del(cyphertext_bs);
if (sai_bs) gf_bs_del(sai_bs);
return e;
}
/*encrypts track - logs, progress: info callbacks, NULL for default*/
GF_Err gf_cenc_encrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
GF_Err e;
char IV[16];
GF_ISOSample *samp;
GF_Crypt *mc;
Bool all_rap = GF_FALSE;
u32 i, count, di, track, len, nb_samp_encrypted, nalu_size_length, idx, bytes_in_nalhr;
GF_ESD *esd;
Bool has_crypted_samp;
Bool is_nalu_video = GF_FALSE;
char *buf;
GF_BitStream *bs;
e = GF_OK;
nalu_size_length = 0;
mc = NULL;
buf = NULL;
bs = NULL;
idx = 0;
bytes_in_nalhr = 0;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
if (!track) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot find TrackID %d in input file - skipping\n", tci->trackID));
return GF_OK;
}
esd = gf_isom_get_esd(mp4, track, 1);
if (esd && (esd->decoderConfig->streamType == GF_STREAM_OD)) {
gf_odf_desc_del((GF_Descriptor *) esd);
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot encrypt OD tracks - skipping"));
return GF_NOT_SUPPORTED;
}
if (esd) {
if ((esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_AVC) || (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_SVC)) {
GF_AVCConfig *avccfg = gf_isom_avc_config_get(mp4, track, 1);
GF_AVCConfig *svccfg = gf_isom_svc_config_get(mp4, track, 1);
if (avccfg)
nalu_size_length = avccfg->nal_unit_size;
else if (svccfg)
nalu_size_length = svccfg->nal_unit_size;
if (avccfg) gf_odf_avc_cfg_del(avccfg);
if (svccfg) gf_odf_avc_cfg_del(svccfg);
is_nalu_video = GF_TRUE;
bytes_in_nalhr = 1;
}
else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_HEVC) {
GF_HEVCConfig *hevccfg = gf_isom_hevc_config_get(mp4, track, 1);
if (hevccfg)
nalu_size_length = hevccfg->nal_unit_size;
if (hevccfg) gf_odf_hevc_cfg_del(hevccfg);
is_nalu_video = GF_TRUE;
bytes_in_nalhr = 2;
}
gf_odf_desc_del((GF_Descriptor*) esd);
}
samp = NULL;
if (tci->enc_type == 2)
mc = gf_crypt_open("AES-128", "CTR");
else if (tci->enc_type == 3)
mc = gf_crypt_open("AES-128", "CBC");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot open AES-128 %s\n", (tci->enc_type == 2) ? "CTR" : "CBC"));
e = GF_IO_ERR;
goto exit;
}
/*select key*/
if (tci->defaultKeyIdx && (tci->defaultKeyIdx < tci->KID_count)) {
memcpy(tci->key, tci->keys[tci->defaultKeyIdx], 16);
memcpy(tci->default_KID, tci->KIDs[tci->defaultKeyIdx], 16);
idx = tci->defaultKeyIdx;
} else {
memcpy(tci->key, tci->keys[0], 16);
memcpy(tci->default_KID, tci->KIDs[0], 16);
idx = 0;
}
/*create CENC protection*/
e = gf_isom_set_cenc_protection(mp4, track, 1, (tci->enc_type == 2) ? GF_ISOM_CENC_SCHEME : GF_ISOM_CBC_SCHEME, 0x00010000, tci->IsEncrypted, tci->IV_size, tci->default_KID);
if (e) goto exit;
count = gf_isom_get_sample_count(mp4, track);
has_crypted_samp = GF_FALSE;
nb_samp_encrypted = 0;
/*Sample Encryption Box*/
e = gf_isom_cenc_allocate_storage(mp4, track, tci->sai_saved_box_type, 0, 0, NULL);
if (e) goto exit;
if (! gf_isom_has_sync_points(mp4, track))
all_rap = GF_TRUE;
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
samp = gf_isom_get_sample(mp4, track, i+1, &di);
if (!samp)
{
e = GF_IO_ERR;
goto exit;
}
switch (tci->sel_enc_type) {
case GF_CRYPT_SELENC_RAP:
if (!samp->IsRAP && !all_rap) {
e = gf_isom_track_cenc_add_sample_info(mp4, track, tci->sai_saved_box_type, 0, NULL, 0);
if (e)
goto exit;
buf = NULL;
//already done: memset(tmp, 0, 16);
e = gf_isom_set_sample_cenc_group(mp4, track, i+1, 0, 0, NULL);
if (e) goto exit;
gf_isom_sample_del(&samp);
continue;
}
break;
case GF_CRYPT_SELENC_NON_RAP:
if (samp->IsRAP || all_rap) {
e = gf_isom_track_cenc_add_sample_info(mp4, track, tci->sai_saved_box_type, 0, NULL, 0);
if (e)
goto exit;
buf = NULL;
//alreaduy done: memset(tmp, 0, 16);
e = gf_isom_set_sample_cenc_group(mp4, track, i+1, 0, 0, NULL);
if (e) goto exit;
gf_isom_sample_del(&samp);
continue;
}
break;
default:
break;
}
/*generate initialization vector for the first sample in track ... */
if (!has_crypted_samp) {
memset(IV, 0, sizeof(char)*16);
if (tci->IV_size == 8) {
memcpy(IV, tci->first_IV, sizeof(char)*8);
memset(IV+8, 0, sizeof(char)*8);
}
else if (tci->IV_size == 16) {
memcpy(IV, tci->first_IV, sizeof(char)*16);
}
else
return GF_NOT_SUPPORTED;
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot initialize AES-128 %s (%s)\n", (tci->enc_type == 2) ? "CTR" : "CBC", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
has_crypted_samp = GF_TRUE;
}
else {
if (tci->keyRoll) {
idx = (nb_samp_encrypted / tci->keyRoll) % tci->KID_count;
memcpy(tci->key, tci->keys[idx], 16);
e = gf_crypt_set_key(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot set key AES-128 %s (%s)\n", (tci->enc_type == 2) ? "CTR" : "CBC", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
}
}
/*add this sample to sample encryption group*/
e = gf_isom_set_sample_cenc_group(mp4, track, i+1, 1, tci->IV_size, tci->KIDs[idx]);
if (e) goto exit;
if (tci->enc_type == 2)
gf_cenc_encrypt_sample_ctr(mc, samp, is_nalu_video, nalu_size_length, IV, tci->IV_size, &buf, &len, bytes_in_nalhr);
else if (tci->enc_type == 3) {
int IV_size = 16;
gf_crypt_get_state(mc, IV, &IV_size);
gf_cenc_encrypt_sample_cbc(mc, samp, is_nalu_video, nalu_size_length, IV, tci->IV_size, &buf, &len, bytes_in_nalhr);
}
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_isom_sample_del(&samp);
samp = NULL;
e = gf_isom_track_cenc_add_sample_info(mp4, track, tci->sai_saved_box_type, tci->IV_size, buf, len);
if (e)
goto exit;
gf_free(buf);
buf = NULL;
nb_samp_encrypted++;
gf_set_progress("CENC Encrypt", i+1, count);
}
exit:
if (samp) gf_isom_sample_del(&samp);
if (mc) gf_crypt_close(mc);
if (buf) gf_free(buf);
if (bs) gf_bs_del(bs);
return e;
}
/*decrypts track - logs, progress: info callbacks, NULL for default*/
GF_Err gf_cenc_decrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
GF_Err e;
u32 track, count, i, j, si, max_size, subsample_count, nb_samp_decrypted;
GF_ISOSample *samp = NULL;
GF_Crypt *mc;
char IV[17];
Bool prev_sample_encrypted;
GF_BitStream *pleintext_bs, *cyphertext_bs;
GF_CENCSampleAuxInfo *sai;
char *buffer;
e = GF_OK;
pleintext_bs = cyphertext_bs = NULL;
mc = NULL;
buffer = NULL;
max_size = 4096;
nb_samp_decrypted = 0;
sai = NULL;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
if (!track) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot find TrackID %d in input file - skipping\n", tci->trackID));
return GF_OK;
}
if (tci->enc_type == 2)
mc = gf_crypt_open("AES-128", "CTR");
else if (tci->enc_type == 3)
mc = gf_crypt_open("AES-128", "CBC");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot open AES-128 %s\n", (tci->enc_type == 2) ? "CTR" : "CBC"));
e = GF_IO_ERR;
goto exit;
}
/* decrypt each sample */
count = gf_isom_get_sample_count(mp4, track);
buffer = (char*)gf_malloc(sizeof(char) * max_size);
prev_sample_encrypted = GF_FALSE;
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
u32 Is_Encrypted;
u8 IV_size;
bin128 KID;
gf_isom_get_sample_cenc_info(mp4, track, i+1, &Is_Encrypted, &IV_size, &KID);
if (!Is_Encrypted)
continue;
/*select key*/
for (j = 0; j < tci->KID_count; j++) {
if (!strncmp((const char *)tci->KIDs[j], (const char *)KID, 16)) {
memcpy(tci->key, tci->keys[j], 16);
break;
}
}
if (j == tci->KID_count)
memcpy(tci->key, tci->keys[tci->defaultKeyIdx], 16);
memset(IV, 0, 17);
memset(buffer, 0, max_size);
samp = gf_isom_get_sample(mp4, track, i+1, &si);
if (!samp)
{
e = GF_IO_ERR;
goto exit;
}
e = gf_isom_cenc_get_sample_aux_info(mp4, track, i+1, &sai, NULL);
if (e) {
goto exit;
}
cyphertext_bs = gf_bs_new(samp->data, samp->dataLength, GF_BITSTREAM_READ);
pleintext_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
sai->IV_size = IV_size;
if (!prev_sample_encrypted) {
memmove(IV, sai->IV, sai->IV_size);
if (sai->IV_size == 8)
memset(IV+8, 0, sizeof(char)*8);
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot initialize AES-128 CTR (%s)\n", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
prev_sample_encrypted = GF_TRUE;
}
else {
if (tci->enc_type == 2) {
GF_BitStream *bs;
bs = gf_bs_new(IV, 17, GF_BITSTREAM_WRITE);
gf_bs_write_u8(bs, 0); /*begin of counter*/
gf_bs_write_data(bs, (char *)sai->IV, sai->IV_size);
if (sai->IV_size == 8)
gf_bs_write_u64(bs, 0);
gf_bs_del(bs);
gf_crypt_set_state(mc, IV, 17);
}
else if (tci->enc_type == 3) {
memmove(IV, sai->IV, 16);
gf_crypt_set_state(mc, IV, 16);
}
e = gf_crypt_set_key(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Cannot set key AES-128 %s (%s)\n", (tci->enc_type == 2) ? "CTR" : "CBC", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
}
//sub-sample encryption
if (sai->subsample_count) {
subsample_count = 0;
while (gf_bs_available(cyphertext_bs)) {
assert(subsample_count < sai->subsample_count);
/*read clear data and write it to pleintext bitstream*/
if (max_size < sai->subsamples[subsample_count].bytes_clear_data) {
buffer = (char*)gf_realloc(buffer, sizeof(char)*sai->subsamples[subsample_count].bytes_clear_data);
max_size = sai->subsamples[subsample_count].bytes_clear_data;
}
gf_bs_read_data(cyphertext_bs, buffer, sai->subsamples[subsample_count].bytes_clear_data);
gf_bs_write_data(pleintext_bs, buffer, sai->subsamples[subsample_count].bytes_clear_data);
/*now read encrypted data, decrypted it and write to pleintext bitstream*/
if (max_size < sai->subsamples[subsample_count].bytes_encrypted_data) {
buffer = (char*)gf_realloc(buffer, sizeof(char)*sai->subsamples[subsample_count].bytes_encrypted_data);
max_size = sai->subsamples[subsample_count].bytes_encrypted_data;
}
gf_bs_read_data(cyphertext_bs, buffer, sai->subsamples[subsample_count].bytes_encrypted_data);
gf_crypt_decrypt(mc, buffer, sai->subsamples[subsample_count].bytes_encrypted_data);
gf_bs_write_data(pleintext_bs, buffer, sai->subsamples[subsample_count].bytes_encrypted_data);
subsample_count++;
}
}
//full sample encryption
else {
if (max_size < samp->dataLength) {
buffer = (char*)gf_realloc(buffer, sizeof(char)*samp->dataLength);
max_size = samp->dataLength;
}
gf_bs_read_data(cyphertext_bs, buffer,samp->dataLength);
gf_crypt_decrypt(mc, buffer, samp->dataLength);
gf_bs_write_data(pleintext_bs, buffer, samp->dataLength);
}
gf_isom_cenc_samp_aux_info_del(sai);
sai = NULL;
gf_bs_del(cyphertext_bs);
cyphertext_bs = NULL;
if (samp->data) {
gf_free(samp->data);
samp->data = NULL;
samp->dataLength = 0;
}
gf_bs_get_content(pleintext_bs, &samp->data, &samp->dataLength);
gf_bs_del(pleintext_bs);
pleintext_bs = NULL;
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_isom_sample_del(&samp);
samp = NULL;
nb_samp_decrypted++;
gf_set_progress("CENC Decrypt", i+1, count);
}
/*remove protection info*/
e = gf_isom_remove_track_protection(mp4, track, 1);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC] Error CENC signature from trackID %d: %s\n", tci->trackID, gf_error_to_string(e)));
}
gf_isom_remove_cenc_saiz(mp4, track);
gf_isom_remove_cenc_saio(mp4, track);
gf_isom_remove_samp_enc_box(mp4, track);
gf_isom_remove_samp_group_box(mp4, track);
exit:
if (mc) gf_crypt_close(mc);
if (pleintext_bs) gf_bs_del(pleintext_bs);
if (cyphertext_bs) gf_bs_del(cyphertext_bs);
if (samp) gf_isom_sample_del(&samp);
if (buffer) gf_free(buffer);
if (sai) gf_isom_cenc_samp_aux_info_del(sai);
return e;
}
GF_Err gf_adobe_encrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
GF_Err e;
char IV[16];
GF_ISOSample *samp;
GF_Crypt *mc;
Bool all_rap = GF_FALSE;
u32 i, count, di, track, len;
Bool has_crypted_samp;
char *buf;
GF_BitStream *bs;
int IV_size;
e = GF_OK;
samp = NULL;
mc = NULL;
buf = NULL;
bs = NULL;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
if (!track) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[Adobe] Cannot find TrackID %d in input file - skipping\n", tci->trackID));
return GF_OK;
}
mc = gf_crypt_open("AES-128", "CBC");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[Adobe] Cannot open AES-128 CBC \n"));
e = GF_IO_ERR;
goto exit;
}
/*Adobe's protection scheme does not support selective key*/
memcpy(tci->key, tci->keys[0], 16);
e = gf_isom_set_adobe_protection(mp4, track, 1, GF_ISOM_ADOBE_SCHEME, 1, GF_TRUE, tci->metadata, tci->metadata_len);
if (e) goto exit;
count = gf_isom_get_sample_count(mp4, track);
has_crypted_samp = GF_FALSE;
if (! gf_isom_has_sync_points(mp4, track))
all_rap = GF_TRUE;
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
Bool is_encrypted_au = GF_TRUE;
samp = gf_isom_get_sample(mp4, track, i+1, &di);
if (!samp)
{
e = GF_IO_ERR;
goto exit;
}
len = samp->dataLength;
buf = (char *) gf_malloc(len*sizeof(char));
memmove(buf, samp->data, len);
gf_free(samp->data);
samp->dataLength = 0;
switch (tci->sel_enc_type) {
case GF_CRYPT_SELENC_RAP:
if (!samp->IsRAP && !all_rap) {
is_encrypted_au = GF_FALSE;
}
break;
case GF_CRYPT_SELENC_NON_RAP:
if (samp->IsRAP || all_rap) {
is_encrypted_au = GF_FALSE;
}
break;
default:
break;
}
if (is_encrypted_au) {
u32 padding_bytes;
if (!has_crypted_samp) {
memset(IV, 0, sizeof(char)*16);
memcpy(IV, tci->first_IV, sizeof(char)*16);
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Cannot initialize AES-128 CBC (%s)\n", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
has_crypted_samp = GF_TRUE;
}
else {
IV_size = 16;
e = gf_crypt_get_state(mc, IV, &IV_size);
}
padding_bytes = 16 - len % 16;
len += padding_bytes;
buf = (char *)gf_realloc(buf, len);
memset(buf+len-padding_bytes, padding_bytes, padding_bytes);
gf_crypt_encrypt(mc, buf, len);
}
/*rewrite sample with AU header*/
bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
if (is_encrypted_au) {
gf_bs_write_u8(bs, 0x10);
gf_bs_write_data(bs, (char *) IV, 16);
}
else {
gf_bs_write_u8(bs, 0x0);
}
gf_bs_write_data(bs, buf, len);
gf_bs_get_content(bs, &samp->data, &samp->dataLength);
gf_bs_del(bs);
bs = NULL;
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_isom_sample_del(&samp);
samp = NULL;
gf_free(buf);
buf = NULL;
gf_set_progress("Adobe's protection scheme Encrypt", i+1, count);
}
exit:
if (samp) gf_isom_sample_del(&samp);
if (mc) gf_crypt_close(mc);
if (buf) gf_free(buf);
if (bs) gf_bs_del(bs);
return e;
}
GF_Err gf_adobe_decrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u64 done, u64 total), void *cbk)
{
GF_Err e;
u32 track, count, len, i, prev_sample_decrypted, si;
u8 encrypted_au;
GF_Crypt *mc;
GF_ISOSample *samp;
char IV[17];
char *ptr;
GF_BitStream *bs;
e = GF_OK;
mc = NULL;
samp = NULL;
bs = NULL;
prev_sample_decrypted = GF_FALSE;
track = gf_isom_get_track_by_id(mp4, tci->trackID);
if (!track) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Cannot find TrackID %d in input file - skipping\n", tci->trackID));
return GF_OK;
}
mc = gf_crypt_open("AES-128", "CBC");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Cannot open AES-128 CBC\n"));
e = GF_IO_ERR;
goto exit;
}
memcpy(tci->key, tci->keys[0], 16);
count = gf_isom_get_sample_count(mp4, track);
gf_isom_set_nalu_extract_mode(mp4, track, GF_ISOM_NALU_EXTRACT_INSPECT);
for (i = 0; i < count; i++) {
u32 trim_bytes = 0;
samp = gf_isom_get_sample(mp4, track, i+1, &si);
if (!samp)
{
e = GF_IO_ERR;
goto exit;
}
ptr = samp->data;
len = samp->dataLength;
encrypted_au = ptr[0];
if (encrypted_au) {
memmove(IV, ptr+1, 16);
if (!prev_sample_decrypted) {
e = gf_crypt_init(mc, tci->key, 16, IV);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Cannot initialize AES-128 CBC (%s)\n", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
prev_sample_decrypted = GF_TRUE;
}
else {
e = gf_crypt_set_state(mc, IV, 16);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Cannot set state AES-128 CBC (%s)\n", gf_error_to_string(e)) );
gf_crypt_close(mc);
mc = NULL;
e = GF_IO_ERR;
goto exit;
}
}
ptr += 17;
len -= 17;
gf_crypt_decrypt(mc, ptr, len);
trim_bytes = ptr[len-1];
}
else {
ptr += 1;
len -= 1;
}
//rewrite decrypted sample
bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
gf_bs_write_data(bs, ptr, len - trim_bytes);
gf_free(samp->data);
samp->dataLength = 0;
gf_bs_get_content(bs, &samp->data, &samp->dataLength);
gf_isom_update_sample(mp4, track, i+1, samp, 1);
gf_bs_del(bs);
bs = NULL;
gf_isom_sample_del(&samp);
samp = NULL;
gf_set_progress("Adobe's protection scheme Decrypt", i+1, count);
}
/*remove protection info*/
e = gf_isom_remove_track_protection(mp4, track, 1);
if (e) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[ADOBE] Error Adobe's protection scheme signature from trackID %d: %s\n", tci->trackID, gf_error_to_string(e)));
}
exit:
if (mc) gf_crypt_close(mc);
if (samp) gf_isom_sample_del(&samp);
if (bs) gf_bs_del(bs);
return e;
}
GF_EXPORT
GF_Err gf_decrypt_file(GF_ISOFile *mp4, const char *drm_file)
{
GF_Err e;
u32 i, idx, count, common_idx, nb_tracks, scheme_type;
const char *scheme_URI, *KMS_URI;
GF_CryptInfo *info;
Bool is_oma;
GF_TrackCryptInfo *a_tci, tci;
is_oma = 0;
count = 0;
info = NULL;
if (drm_file) {
info = load_crypt_file(drm_file);
if (!info) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open or validate xml file %s\n", drm_file));
return GF_NOT_SUPPORTED;
}
count = gf_list_count(info->tcis);
}
common_idx=0;
if (info && info->has_common_key) {
for (common_idx=0; common_idx<count; common_idx++) {
a_tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, common_idx);
if (!a_tci->trackID) break;
}
}
nb_tracks = gf_isom_get_track_count(mp4);
e = GF_OK;
for (i=0; i<nb_tracks; i++) {
u32 trackID = gf_isom_get_track_id(mp4, i+1);
scheme_type = gf_isom_is_media_encrypted(mp4, i+1, 1);
if (!scheme_type) continue;
for (idx=0; idx<count; idx++) {
a_tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, idx);
if (a_tci->trackID == trackID) break;
}
if (idx==count) {
if (!drm_file || info->has_common_key) idx = common_idx;
/*no available KMS info for this track*/
else continue;
}
if (count) {
a_tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, idx);
memcpy(&tci, a_tci, sizeof(GF_TrackCryptInfo));
} else {
memset(&tci, 0, sizeof(GF_TrackCryptInfo));
tci.trackID = trackID;
}
switch (info->crypt_type) {
case 1:
gf_decrypt_track = gf_ismacryp_decrypt_track;
break;
case 2:
tci.enc_type = 2;
gf_decrypt_track = gf_cenc_decrypt_track;
break;
case 3:
tci.enc_type = 3;
gf_decrypt_track = gf_cenc_decrypt_track;
break;
case 4:
gf_decrypt_track = gf_adobe_decrypt_track;
break;
default:
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Encryption type not supported\n"));
return GF_NOT_SUPPORTED;;
}
if (gf_isom_is_ismacryp_media(mp4, i+1, 1)) {
e = gf_isom_get_ismacryp_info(mp4, i+1, 1, NULL, &scheme_type, NULL, &scheme_URI, &KMS_URI, NULL, NULL, NULL);
} else if (gf_isom_is_omadrm_media(mp4, i+1, 1)) {
if (!drm_file) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot decrypt OMA (P)DCF file without GPAC's DRM file & keys\n"));
continue;
}
KMS_URI = "OMA DRM";
is_oma = 1;
} else if (!gf_isom_is_cenc_media(mp4, i+1, 1) && !gf_isom_is_adobe_protection_media(mp4, i+1, 1)) {
GF_LOG(GF_LOG_WARNING, GF_LOG_AUTHOR, ("[CENC/ISMA] TrackID %d encrypted with unknown scheme %s - skipping\n", trackID, gf_4cc_to_str(scheme_type) ));
continue;
}
if (info->crypt_type == 1) {
/*get key and salt from KMS*/
/*GPAC*/
if (!strnicmp(KMS_URI, "(key)", 5)) {
char data[100];
gf_base64_decode((char*)KMS_URI+5, (u32) strlen(KMS_URI)-5, data, 100);
memcpy(tci.key, data, sizeof(char)*16);
if (info->crypt_type == 1) memcpy(tci.salt, data+16, sizeof(char)*8);
}
/*MPEG4IP*/
else if (!stricmp(KMS_URI, "AudioKey") || !stricmp(KMS_URI, "VideoKey")) {
if (!gf_ismacryp_mpeg4ip_get_info((char *) KMS_URI, (char *) tci.key, (char *) tci.salt)) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Couldn't load MPEG4IP ISMACryp keys for TrackID %d\n", trackID));
continue;
}
} else if (!drm_file) {
FILE *test = NULL;
if (!stricmp(scheme_URI, "urn:gpac:isma:encryption_scheme")) test = gf_fopen(KMS_URI, "rt");
if (!test) {
GF_LOG(GF_LOG_INFO, GF_LOG_AUTHOR, ("[CENC/ISMA] TrackID %d does not contain decryption keys - skipping\n", trackID));
continue;
}
gf_fclose(test);
if (gf_ismacryp_gpac_get_info(tci.trackID, (char *) KMS_URI, (char *) tci.key, (char *) tci.salt) != GF_OK) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Couldn't load TrackID %d keys in GPAC DRM file %s\n", tci.trackID, KMS_URI));
continue;
}
}
if (KMS_URI && strlen(tci.KMS_URI) && strcmp(KMS_URI, tci.KMS_URI) )
GF_LOG(GF_LOG_WARNING, GF_LOG_AUTHOR, ("[CENC/ISMA] KMS URI for TrackID %d Mismatch: \"%s\" in file vs \"%s\" in licence\n", trackID, KMS_URI, tci.KMS_URI));
if (drm_file || (KMS_URI && strncmp(KMS_URI, "(key)", 5)) ) {
strcpy(tci.KMS_URI, KMS_URI ? KMS_URI : "");
} else {
strcpy(tci.KMS_URI, "self-contained");
}
}
e = gf_decrypt_track(mp4, &tci, NULL, NULL);
if (e) break;
}
if (is_oma) {
e = gf_isom_set_brand_info(mp4, GF_4CC('i','s','o','2'), 0x00000001);
if (!e) e = gf_isom_modify_alternate_brand(mp4, GF_4CC('o','d','c','f'), 0);
}
if ((info->crypt_type == 2) || (info->crypt_type == 3))
e = gf_isom_remove_pssh_box(mp4);
if (info) del_crypt_info(info);
return e;
}
static GF_Err gf_cenc_parse_drm_system_info(GF_ISOFile *mp4, const char *drm_file) {
GF_DOMParser *parser;
GF_XMLNode *root, *node;
u32 i;
GF_Err e = GF_OK;
parser = gf_xml_dom_new();
e = gf_xml_dom_parse(parser, drm_file, NULL, NULL);
if (e) {
gf_xml_dom_del(parser);
return e;
}
root = gf_xml_dom_get_root(parser);
if (!root) {
gf_xml_dom_del(parser);
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open or validate xml file %s\n", drm_file));
return GF_NOT_SUPPORTED;
}
i=0;
while ((node = (GF_XMLNode *) gf_list_enum(root->content, &i))) {
Bool is_pssh;
u32 version, cypherMode, specInfoSize, len, KID_count, j;
bin128 cypherKey, cypherIV, systemID;
GF_XMLAttribute *att;
char *data, *specInfo;
GF_BitStream *bs;
bin128 *KIDs;
s32 cypherOffset = -1;
Bool has_key = GF_FALSE, has_IV = GF_FALSE;
if (strcmp(node->name, "DRMInfo")) continue;
j = 0;
is_pssh = GF_FALSE;
version = cypherMode = 0;
data = specInfo = NULL;
bs = NULL;
while ( (att = (GF_XMLAttribute *)gf_list_enum(node->attributes, &j))) {
if (!strcmp(att->name, "type")) {
if (!strcmp(att->value, "pssh"))
is_pssh = GF_TRUE;
} else if (!strcmp(att->name, "version")) {
version = atoi(att->value);
} else if (!strcmp(att->name, "cypher-mode")) {
/*cypher-mode: 0: data (default mode) - 1: all - 2: clear*/
if (!strcmp(att->value, "data"))
cypherMode = 0;
else if (!strcmp(att->value, "all"))
cypherMode = 1;
else if (!strcmp(att->value, "clear"))
cypherMode = 2;
} else if (!strcmp(att->name, "cypherKey")) {
gf_bin128_parse(att->value, cypherKey);
has_key = GF_TRUE;
} else if (!strcmp(att->name, "cypherIV")) {
gf_bin128_parse(att->value, cypherIV);
has_IV = GF_TRUE;
} else if (!strcmp(att->name, "cypherOffset")) {
cypherOffset = atoi(att->value);
}
}
if (!is_pssh) {
GF_LOG(GF_LOG_WARNING, GF_LOG_AUTHOR, ("[CENC/ISMA] Not a Protection System Specific Header Box - skipping\n"));
continue;
}
e = gf_xml_parse_bit_sequence(node, &specInfo, &specInfoSize);
if (e) {
if (specInfo) gf_free(specInfo);
gf_xml_dom_del(parser);
return e;
}
bs = gf_bs_new(specInfo, specInfoSize, GF_BITSTREAM_READ);
gf_bs_read_data(bs, (char *)systemID, 16);
if (version) {
KID_count = gf_bs_read_u32(bs);
KIDs = (bin128 *)gf_malloc(KID_count*sizeof(bin128));
for (j = 0; j < KID_count; j++) {
gf_bs_read_data(bs, (char *)KIDs[j], 16);
}
}
else {
KID_count = 0;
KIDs = NULL;
}
len = specInfoSize - 16 - (version ? 4 + 16*KID_count : 0);
data = (char *)gf_malloc(len*sizeof(char));
gf_bs_read_data(bs, data, len);
if (has_key && has_IV && (cypherOffset >= 0)) {
/*TODO*/
GF_Crypt *mc;
mc = gf_crypt_open("AES-128", "CTR");
if (!mc) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open AES-128 CTR\n"));
return GF_IO_ERR;
}
e = gf_crypt_init(mc, cypherKey, 16, cypherIV);
gf_crypt_encrypt(mc, data+cypherOffset, len-cypherOffset);
gf_crypt_close(mc);
}
e = gf_cenc_set_pssh(mp4, systemID, version, KID_count, KIDs, data, len);
if (specInfo) gf_free(specInfo);
if (data) gf_free(data);
if (KIDs) gf_free(KIDs);
if (bs) gf_bs_del(bs);
if (e) {
gf_xml_dom_del(parser);
return e;
}
}
gf_xml_dom_del(parser);
return GF_OK;
}
GF_EXPORT
GF_Err gf_crypt_file(GF_ISOFile *mp4, const char *drm_file)
{
GF_Err e;
u32 i, count, nb_tracks, common_idx, idx;
GF_CryptInfo *info;
Bool is_oma;
GF_TrackCryptInfo *tci;
is_oma = 0;
info = load_crypt_file(drm_file);
if (!info) {
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Cannot open or validate xml file %s\n", drm_file));
return GF_NOT_SUPPORTED;
}
/*write pssh box in case of CENC*/
if ((info->crypt_type == 2) || (info->crypt_type == 3)) {
e = gf_cenc_parse_drm_system_info(mp4, drm_file);
if (e) return e;
}
e = GF_OK;
count = gf_list_count(info->tcis);
common_idx=0;
if (info && info->has_common_key) {
for (common_idx=0; common_idx<count; common_idx++) {
tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, common_idx);
if (!tci->trackID) break;
}
}
nb_tracks = gf_isom_get_track_count(mp4);
for (i=0; i<nb_tracks; i++) {
u32 trackID = gf_isom_get_track_id(mp4, i+1);
for (idx=0; idx<count; idx++) {
tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, idx);
if (tci->trackID==trackID) break;
}
if (idx==count) {
if (!info->has_common_key) continue;
idx = common_idx;
}
tci = (GF_TrackCryptInfo *)gf_list_get(info->tcis, idx);
switch (info->crypt_type) {
case 1:
gf_encrypt_track = gf_ismacryp_encrypt_track;
break;
case 2:
tci->enc_type = 2;
gf_encrypt_track = gf_cenc_encrypt_track;
break;
case 3:
tci->enc_type = 3;
gf_encrypt_track = gf_cenc_encrypt_track;
break;
case 4:
gf_encrypt_track = gf_adobe_encrypt_track;
break;
default:
GF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, ("[CENC/ISMA] Encryption type not sopported\n"));
return GF_NOT_SUPPORTED;;
}
/*default to FILE uri*/
if (!strlen(tci->KMS_URI)) strcpy(tci->KMS_URI, drm_file);
e = gf_encrypt_track(mp4, tci, NULL, NULL);
if (e) break;
if (tci->enc_type==1) is_oma = 1;
}
if (is_oma) {
#if 0
/*set as OMA V2*/
e = gf_isom_set_brand_info(mp4, GF_4CC('o','d','c','f'), 0x00000002);
gf_isom_reset_alt_brands(mp4);
#else
e = gf_isom_modify_alternate_brand(mp4, GF_4CC('o','p','f','2'), 1);
#endif
}
del_crypt_info(info);
return e;
}
#endif /* !defined(GPAC_DISABLE_ISOM_WRITE)*/
#endif /* !defined(GPAC_DISABLE_MCRYPT)*/
|
drakeguan/gpac
|
src/media_tools/ismacryp.c
|
C
|
lgpl-2.1
| 61,792
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>hal 0.5.1-SNAPSHOT Reference Package org.fosstrak.hal.impl.feig.util</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="style" />
</head>
<body>
<div class="overview">
<ul>
<li>
<a href="../../../../../../overview-summary.html">Overview</a>
</li>
<li class="selected">Package</li>
</ul>
</div>
<div class="framenoframe">
<ul>
<li>
<a href="../../../../../../index.html" target="_top">FRAMES</a>
</li>
<li>
<a href="package-summary.html" target="_top">NO FRAMES</a>
</li>
</ul>
</div>
<h2>Package org.fosstrak.hal.impl.feig.util</h2>
<table class="summary">
<thead>
<tr>
<th>Class Summary</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="ISOTransponderResponseErrorCode.html" target="classFrame">ISOTransponderResponseErrorCode</a>
</td>
</tr>
<tr>
<td>
<a href="StatusByte.html" target="classFrame">StatusByte</a>
</td>
</tr>
</tbody>
</table>
<div class="overview">
<ul>
<li>
<a href="../../../../../../overview-summary.html">Overview</a>
</li>
<li class="selected">Package</li>
</ul>
</div>
<div class="framenoframe">
<ul>
<li>
<a href="../../../../../../index.html" target="_top">FRAMES</a>
</li>
<li>
<a href="package-summary.html" target="_top">NO FRAMES</a>
</li>
</ul>
</div>
<hr />
Copyright © 2008. All Rights Reserved.
</body>
</html>
|
Fosstrak/fosstrak.github.io
|
hal/xref/org/fosstrak/hal/impl/feig/util/package-summary.html
|
HTML
|
lgpl-2.1
| 2,245
|
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of copyright holders.
#
# Dr Adam S. Candy, adam.candy@imperial.ac.uk
# Applied Modelling and Computation Group
# Department of Earth Science and Engineering
# Imperial College London
#
# This library 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,
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
##########################################################################
# Makefile for Define Boundary Ids plugin
UI_FILES = Ui_Define_Boundary_Ids.py
RESOURCE_FILES = resources.py
default: compile
compile: $(UI_FILES) $(RESOURCE_FILES)
%.py : %.qrc
pyrcc4 -o $@ $<
%.py : %.ui
pyuic4 -o $@ $<
|
adamcandy/qgis-plugins-meshing-initial
|
dev/plugins/define_boundary_ids/Makefile
|
Makefile
|
lgpl-2.1
| 1,455
|
/*
Copyright (C) 2017 Alexandr Akulich <akulichalexander@gmail.com>
This file is a part of TelegramQt library.
This library 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.1 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
Lesser General Public License for more details.
*/
#include "DhLayer.hpp"
#include "MTProto/Stream.hpp"
#include "SendPackageHelper.hpp"
#include "Utils.hpp"
#include "Debug_p.hpp"
#include "DhSession.hpp"
#include <QDateTime>
#include <QLoggingCategory>
#ifdef NETWORK_LOGGING
#include "CompatibilityLayer.hpp"
#include <QDir>
#include <QFile>
#include <QTextStream>
const int valFieldWidth = 32;
QString formatTLValue(const TLValue &val)
{
const QString text = val.toString();
return QString(valFieldWidth - text.length(), QLatin1Char(' ')) + text;
}
#endif
Q_LOGGING_CATEGORY(c_baseDhLayerCategory, "telegram.base.dhlayer", QtWarningMsg)
namespace Telegram {
BaseDhLayer::BaseDhLayer(QObject *parent) :
QObject(parent)
{
}
void BaseDhLayer::setSendPackageHelper(BaseMTProtoSendHelper *helper)
{
m_sendHelper = helper;
}
void BaseDhLayer::setServerRsaKey(const RsaKey &key)
{
qCDebug(c_baseDhLayerCategory) << CALL_INFO << "Set server key:"
<< key.modulus.toHex() << key.exponent.toHex()
<< key.secretExponent.toHex() << key.fingerprint;
m_rsaKey = key;
}
Crypto::AesKey BaseDhLayer::generateTmpAesKey(const BaseDhSession *session)
{
qCDebug(c_baseDhLayerCategory) << Q_FUNC_INFO << session->serverNonce << session->newNonce;
QByteArray newNonceAndServerNonce;
newNonceAndServerNonce.append(session->newNonce.data, session->newNonce.size());
newNonceAndServerNonce.append(session->serverNonce.data, session->serverNonce.size());
QByteArray serverNonceAndNewNonce;
serverNonceAndNewNonce.append(session->serverNonce.data, session->serverNonce.size());
serverNonceAndNewNonce.append(session->newNonce.data, session->newNonce.size());
QByteArray newNonceAndNewNonce;
newNonceAndNewNonce.append(session->newNonce.data, session->newNonce.size());
newNonceAndNewNonce.append(session->newNonce.data, session->newNonce.size());
const QByteArray key = Utils::sha1(newNonceAndServerNonce)
+ Utils::sha1(serverNonceAndNewNonce).mid(0, 12);
const QByteArray iv = Utils::sha1(serverNonceAndNewNonce).mid(12, 8)
+ Utils::sha1(newNonceAndNewNonce)
+ QByteArray(session->newNonce.data, 4);
qCDebug(c_baseDhLayerCategory) << Q_FUNC_INFO << "key:" << key.toHex() << "iv:" << iv.toHex();
return Crypto::AesKey(key, iv);
}
bool BaseDhLayer::checkClientServerNonse(MTProto::Stream &stream) const
{
TLNumber128 nonce;
stream >> nonce;
if (nonce != m_session->clientNonce) {
qCDebug(c_baseDhLayerCategory) << CALL_INFO
<< "Error: Client nonce in the incoming package"
" is different from the local one.";
return false;
}
stream >> nonce;
if (nonce != m_session->serverNonce) {
qCDebug(c_baseDhLayerCategory) << CALL_INFO
<< "Error: Server nonce in the incoming package"
" is different from the local one.";
return false;
}
return true;
}
quint64 BaseDhLayer::sendPlainPackage(const QByteArray &payload, SendMode mode)
{
const quint64 authKeyId = 0;
const quint64 messageId = m_sendHelper->newMessageId(mode);
const quint32 messageLength = payload.length();
constexpr int headerSize = sizeof(authKeyId) + sizeof(messageId) + sizeof(messageLength);
QByteArray output;
output.reserve(headerSize + payload.size());
RawStream outputStream(&output, /* write */ true);
outputStream << authKeyId;
outputStream << messageId;
outputStream << messageLength;
outputStream << payload;
qCDebug(c_baseDhLayerCategory) << CALL_INFO
<< output.left(8).toHex()
<< output.mid(8).toHex();
#ifdef NETWORK_LOGGING
{
MTProto::Stream readBack(payload);
TLValue val1;
readBack >> val1;
QTextStream str(getLogFile());
str << QDateTime::currentDateTime().toString(QLatin1String("yyyyMMdd HH:mm:ss:zzz"))
<< QLatin1Char('|');
str << QLatin1String("pln|");
str << QString(QLatin1String("size: %1|")).arg(payload.length(), 4, 10, QLatin1Char('0'));
str << formatTLValue(val1) << QLatin1Char('|');
str << payload.toHex();
str << TELEGRAMQT_ENDL;
}
#endif
m_sendHelper->sendPacket(output);
return messageId;
}
bool BaseDhLayer::processPlainPackage(const QByteArray &buffer)
{
RawStream inputStream(buffer);
#ifdef NETWORK_LOGGING
{
QTextStream str(getLogFile());
str << QDateTime::currentDateTime().toString(QLatin1String("yyyyMMdd HH:mm:ss:zzz"))
<< QLatin1Char('|');
str << QLatin1String("pln|");
str << QString(QLatin1String("size: %1|")).arg(buffer.length(), 4, 10, QLatin1Char('0'));
str << QLatin1Char('|');
str << buffer.toHex();
str << TELEGRAMQT_ENDL;
}
#endif
// Plain Message
quint64 authKeyId = 0;
quint64 messageId = 0;
quint32 messageLength = 0;
QByteArray payload;
inputStream >> authKeyId;
inputStream >> messageId;
inputStream >> messageLength;
qCDebug(c_baseDhLayerCategory) << CALL_INFO
<< buffer.left(8).toHex()
<< buffer.mid(8).toHex();
if (inputStream.error()) {
qCWarning(c_baseDhLayerCategory) << CALL_INFO << "Unable to read header";
return false;
}
if (inputStream.bytesAvailable() != int(messageLength)) {
qCWarning(c_baseDhLayerCategory) << CALL_INFO
<< "Unable to read packet data. The specified"
" length does not equal to the actually available";
return false;
}
payload = inputStream.readBytes(messageLength);
qCDebug(c_baseDhLayerCategory) << "read payload:" << messageLength;
#ifdef DEVELOPER_BUILD
qCDebug(c_baseDhLayerCategory) << CALL_INFO << "new plain package in auth state"
<< m_state
<< "payload:" << TLValue::firstFromArray(payload);
#endif
processReceivedPacket(payload);
return true;
}
bool BaseDhLayer::hasKey() const
{
return m_state == State::HasKey;
}
void BaseDhLayer::setState(BaseDhLayer::State state)
{
#ifdef DEVELOPER_BUILD
qCDebug(c_baseDhLayerCategory) << CALL_INFO << state;
#endif
if (m_state == state) {
return;
}
m_state = state;
emit stateChanged(state);
}
#ifdef NETWORK_LOGGING
QFile *BaseDhLayer::getLogFile()
{
if (!m_logFile) {
QDir dir;
dir.mkdir(QLatin1String("network"));
m_logFile = new QFile(QStringLiteral("network/%1.log").arg(ulong(this), 0, 0x10));
m_logFile->open(QIODevice::WriteOnly);
}
//qDebug() << CALL_INFO << m_dcInfo.id << m_dcInfo.ipAddress << m_transport->state();
return m_logFile;
}
#endif
} // Telegram
|
Kaffeine/telegram-qt
|
TelegramQt/DhLayer.cpp
|
C++
|
lgpl-2.1
| 7,692
|
/*
* Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
* Copyright (C) 2010-2012 Jiri Techet <techet@gmail.com>
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__CHAMPLAIN_CHAMPLAIN_H_INSIDE__) && !defined (CHAMPLAIN_COMPILATION)
#error "Only <champlain/champlain.h> can be included directly."
#endif
#ifndef CHAMPLAIN_VIEW_H
#define CHAMPLAIN_VIEW_H
#include <champlain/champlain-defines.h>
#include <champlain/champlain-layer.h>
#include <champlain/champlain-map-source.h>
#include <champlain/champlain-license.h>
#include <champlain/champlain-bounding-box.h>
#include <glib.h>
#include <glib-object.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define CHAMPLAIN_TYPE_VIEW champlain_view_get_type ()
#define CHAMPLAIN_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_VIEW, ChamplainView))
#define CHAMPLAIN_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
#define CHAMPLAIN_IS_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_VIEW))
#define CHAMPLAIN_IS_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_VIEW))
#define CHAMPLAIN_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
typedef struct _ChamplainViewPrivate ChamplainViewPrivate;
/**
* ChamplainView:
*
* The #ChamplainView structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.1
*/
struct _ChamplainView
{
ClutterActor parent;
ChamplainViewPrivate *priv;
};
struct _ChamplainViewClass
{
ClutterActorClass parent_class;
};
GType champlain_view_get_type (void);
ClutterActor *champlain_view_new (void);
void champlain_view_center_on (ChamplainView *view,
gdouble latitude,
gdouble longitude);
void champlain_view_go_to (ChamplainView *view,
gdouble latitude,
gdouble longitude);
void champlain_view_stop_go_to (ChamplainView *view);
gdouble champlain_view_get_center_latitude (ChamplainView *view);
gdouble champlain_view_get_center_longitude (ChamplainView *view);
void champlain_view_zoom_in (ChamplainView *view);
void champlain_view_zoom_out (ChamplainView *view);
void champlain_view_set_zoom_level (ChamplainView *view,
guint zoom_level);
void champlain_view_set_min_zoom_level (ChamplainView *view,
guint zoom_level);
void champlain_view_set_max_zoom_level (ChamplainView *view,
guint zoom_level);
void champlain_view_ensure_visible (ChamplainView *view,
ChamplainBoundingBox *bbox,
gboolean animate);
void champlain_view_ensure_layers_visible (ChamplainView *view,
gboolean animate);
void champlain_view_set_map_source (ChamplainView *view,
ChamplainMapSource *map_source);
void champlain_view_set_deceleration (ChamplainView *view,
gdouble rate);
void champlain_view_set_kinetic_mode (ChamplainView *view,
gboolean kinetic);
void champlain_view_set_keep_center_on_resize (ChamplainView *view,
gboolean value);
void champlain_view_set_zoom_on_double_click (ChamplainView *view,
gboolean value);
void champlain_view_set_animate_zoom (ChamplainView *view,
gboolean value);
void champlain_view_add_layer (ChamplainView *view,
ChamplainLayer *layer);
void champlain_view_remove_layer (ChamplainView *view,
ChamplainLayer *layer);
guint champlain_view_get_zoom_level (ChamplainView *view);
guint champlain_view_get_min_zoom_level (ChamplainView *view);
guint champlain_view_get_max_zoom_level (ChamplainView *view);
ChamplainMapSource *champlain_view_get_map_source (ChamplainView *view);
gdouble champlain_view_get_deceleration (ChamplainView *view);
gboolean champlain_view_get_kinetic_mode (ChamplainView *view);
gboolean champlain_view_get_keep_center_on_resize (ChamplainView *view);
gboolean champlain_view_get_zoom_on_double_click (ChamplainView *view);
gboolean champlain_view_get_animate_zoom (ChamplainView *view);
ChamplainState champlain_view_get_state (ChamplainView *view);
void champlain_view_reload_tiles (ChamplainView *view);
gdouble champlain_view_x_to_longitude (ChamplainView *view,
gdouble x);
gdouble champlain_view_y_to_latitude (ChamplainView *view,
gdouble y);
gdouble champlain_view_longitude_to_x (ChamplainView *view,
gdouble longitude);
gdouble champlain_view_latitude_to_y (ChamplainView *view,
gdouble latitude);
void champlain_view_get_viewport_origin (ChamplainView *view,
gint *x,
gint *y);
void champlain_view_bin_layout_add (ChamplainView *view,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align);
ChamplainLicense *champlain_view_get_license_actor (ChamplainView *view);
G_END_DECLS
#endif
|
PabloCastellano/libchamplain
|
champlain/champlain-view.h
|
C
|
lgpl-2.1
| 5,396
|
/* $Id: crypt_win32.h 6870 2002-08-19 15:22:50Z daniel $ */
/* encrypt.h - API to 56 bit DES encryption via calls
encrypt(3), setkey(3) and crypt(3)
Copyright (C) 1991 Jochen Obalek
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _ENCRYPT_H_
#define _ENCRYPT_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <_ansi.h>
void _EXFUN(encrypt, (char *block, int edflag));
void _EXFUN(setkey, (char *key));
char * _EXFUN(crypt, (const char *key, const char *salt));
#ifdef __cplusplus
}
#endif
#endif /* _ENCRYPT_H_ */
|
piotras/ragnaroek-midgard-core
|
win32/crypt_win32.h
|
C
|
lgpl-2.1
| 1,184
|
/*****************************************************************************
* dr_49.h
* Copyright (C) 2012 VideoLAN
*
* Authors: rcorno (May 21, 2012)
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
/*!
* \file <dr_49.h>
* \author Corno Roberto <corno.roberto@gmail.com>
* \brief Application interface for the DVB "country availability"
* descriptor decoder and generator.
*
* Application interface for the DVB "country availability" descriptor
* decoder and generator. This descriptor's definition can be found in
* ETSI EN 300 468 section 6.2.10.
*/
#ifndef DR_49_H_
#define DR_49_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_country_availability_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_country_availability_dr_t
* \brief "country availability" descriptor structure.
*
* This structure is used to store a decoded "country availability"
* descriptor. (ETSI EN 300 468 section 6.2.10).
*/
/*!
* \typedef struct dvbpsi_country_availability_dr_s dvbpsi_country_availability_dr_t
* \brief dvbpsi_country_availability_dr_t type definition.
*/
/*!
* \struct dvbpsi_country_availability_dr_s
* \brief dvbpsi_country_availability_dr_s type definition @see dvbpsi_country_availability_dr_t
*/
typedef struct dvbpsi_country_availability_dr_s
{
bool b_country_availability_flag; /*!< country availability flag */
uint8_t i_code_count; /*!< length of the i_iso_639_code
array */
struct {
iso_639_language_code_t iso_639_code; /*!< ISO_639 language code */
} code[84]; /*!< ISO_639_language_code array */
} dvbpsi_country_availability_dr_t;
/*****************************************************************************
* dvbpsi_DecodeCountryAvailabilityDr
*****************************************************************************/
/*!
* \fn dvbpsi_country_availability_dr_t * dvbpsi_DecodeCountryAvailability(
dvbpsi_descriptor_t * p_descriptor)
* \brief "country availability" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "country availability" descriptor structure
* which contains the decoded data.
*/
dvbpsi_country_availability_dr_t* dvbpsi_DecodeCountryAvailability(
dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_GenCountryAvailabilityDr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_GenCountryAvailabilityDr(
dvbpsi_country_availability_dr_t * p_decoded,
bool b_duplicate)
* \brief "country availability" descriptor generator.
* \param p_decoded pointer to a decoded "country availability" descriptor
* structure
* \param b_duplicate if true then duplicate the p_decoded structure into
* the descriptor
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_GenCountryAvailabilityDr(
dvbpsi_country_availability_dr_t * p_decoded,
bool b_duplicate);
#ifdef __cplusplus
};
#endif
#else
#endif /* DR_49_H_ */
|
krieger-od/libdvbpsi
|
src/descriptors/dr_49.h
|
C
|
lgpl-2.1
| 4,292
|
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: tiki-admin_menu_options.php 43171 2012-09-27 14:07:47Z jonnybradley $
require_once ('tiki-setup.php');
include_once ('lib/menubuilder/menulib.php');
$access->check_permission(array('tiki_p_edit_menu_option'));
if (!isset($_REQUEST["menuId"])) {
$smarty->assign('msg', tra("No menu indicated"));
$smarty->display("error.tpl");
die;
}
$auto_query_args = array(
'offset',
'find',
'sort_mode',
'menuId',
'maxRecords',
'preview_css',
'preview_type',
);
if (!empty($_REQUEST['import']) && !empty($_FILES['csvfile']['tmp_name'])) {
$menulib->import_menu_options();
}
if (!empty($_REQUEST['export'])) {
$menulib->export_menu_options();
}
$maxPos = $menulib->get_max_option($_REQUEST["menuId"]);
$smarty->assign('menuId', $_REQUEST["menuId"]);
$editable_menu_info = $menulib->get_menu($_REQUEST["menuId"]);
$smarty->assign('editable_menu_info', $editable_menu_info);
if (!isset($_REQUEST["optionId"])) {
$_REQUEST["optionId"] = 0;
}
$smarty->assign('optionId', $_REQUEST["optionId"]);
if ($_REQUEST["optionId"]) {
$info = $menulib->get_menu_option($_REQUEST["optionId"]);
$cookietab = 2;
} else {
$info = array();
$info["name"] = '';
$info["url"] = '';
$info["section"] = '';
$info["perm"] = '';
$info["groupname"] = '';
$info["userlevel"] = '';
$info["type"] = 'o';
$info["icon"] = '';
$info["position"] = $maxPos + 10;
}
$smarty->assign('name', $info["name"]);
$smarty->assign('url', $info["url"]);
$smarty->assign('section', $info["section"]);
$smarty->assign('perm', $info["perm"]);
$smarty->assign('type', $info["type"]);
$smarty->assign('icon', $info["icon"]);
$smarty->assign('position', $info["position"]);
$smarty->assign('groupname', $info["groupname"]);
$smarty->assign('userlevel', $info["userlevel"]);
if (isset($_REQUEST["remove"])) {
$access->check_authenticity();
$menulib->remove_menu_option($_REQUEST["remove"]);
$maxPos = $menulib->get_max_option($_REQUEST["menuId"]);
$smarty->assign('position', $maxPos + 10);
}
if (isset($_REQUEST["up"])) {
check_ticket('admin-menu-options');
$res = $menulib->prev_pos($_REQUEST["up"]);
}
if (isset($_REQUEST["down"])) {
check_ticket('admin-menu-options');
$area = 'downmenuoption';
$res = $menulib->next_pos($_REQUEST["down"]);
}
if (isset($_REQUEST['delsel_x']) && isset($_REQUEST['checked'])) {
check_ticket('admin-menu-options');
foreach ($_REQUEST['checked'] as $id) {
$menulib->remove_menu_option($id);
}
$maxPos = $menulib->get_max_option($_REQUEST['menuId']);
$smarty->assign('position', $maxPos + 10);
}
if (isset($_REQUEST["save"])) {
if (!isset($_REQUEST['groupname'])) $_REQUEST['groupname'] = '';
elseif (is_array($_REQUEST['groupname'])) $_REQUEST['groupname'] = implode(',', $_REQUEST['groupname']);
if (!isset($_REQUEST['level'])) $_REQUEST['level'] = 0;
include_once ('lib/modules/modlib.php');
check_ticket('admin-menu-options');
$menulib->replace_menu_option($_REQUEST["menuId"], $_REQUEST["optionId"], $_REQUEST["name"], $_REQUEST["url"], $_REQUEST["type"], $_REQUEST["position"], $_REQUEST["section"], $_REQUEST["perm"], $_REQUEST["groupname"], $_REQUEST['level'], $_REQUEST['icon']);
$modlib->clear_cache();
$smarty->assign('position', $_REQUEST["position"] + 10);
$smarty->assign('name', '');
$smarty->assign('optionId', 0);
$smarty->assign('url', '');
$smarty->assign('section', '');
$smarty->assign('perm', '');
$smarty->assign('groupname', '');
$smarty->assign('userlevel', 0);
$smarty->assign('type', 'o');
$smarty->assign('icon', '');
$cookietab = 1;
}
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'position_asc';
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
if (isset($_REQUEST['maxRecords'])) {
$maxRecords = $_REQUEST['maxRecords'];
} else {
$maxRecords = $prefs['maxRecords'];
}
$smarty->assign('preview_type', isset($_REQUEST['preview_type']) && $_REQUEST['preview_type'] === 'horiz' ? 'horiz' : 'vert');
$smarty->assign('preview_css', isset($_REQUEST['preview_css']) && $_REQUEST['preview_css'] === 'On' ? 'y' : 'n');
$headerlib->add_js('var permNames = ' . json_encode(TikiLib::lib('user')->get_permission_names_for('all')) . ';');
$feature_prefs = array();
foreach ($prefs as $k => $v) { // attempt to filter out non-feature prefs (still finds 133!)
if (strpos($k, 'feature') !== false && preg_match_all('/_/m', $k, $m) === 1) {
$feature_prefs[] = $k;
}
}
$headerlib->add_js('var prefNames = ' . json_encode($feature_prefs) . ';');
$smarty->assign_by_ref('maxRecords', $maxRecords);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$allchannels = $menulib->list_menu_options($_REQUEST["menuId"], 0, -1, $sort_mode, $find);
$allchannels = $menulib->sort_menu_options($allchannels);
$channels = $menulib->list_menu_options($_REQUEST["menuId"], $offset, $maxRecords, $sort_mode, $find, true);
$channels = $menulib->describe_menu_types($channels);
$smarty->assign_by_ref('cant_pages', $channels["cant"]);
$smarty->assign_by_ref('channels', $channels["data"]);
$smarty->assign_by_ref('allchannels', $allchannels["data"]);
if (isset($info['groupname']) && !is_array($info['groupname'])) $info['groupname'] = explode(',', $info['groupname']);
$all_groups = $userlib->list_all_groups();
if (is_array($all_groups)) foreach ($all_groups as $g) $option_groups[$g] = (is_array($info['groupname']) && in_array($g, $info['groupname'])) ? 'selected="selected"' : '';
$smarty->assign_by_ref('option_groups', $option_groups);
$smarty->assign('escape_menu_labels', ($prefs['menus_item_names_raw'] === 'n' && $editable_menu_info['parse'] === 'n'));
ask_ticket('admin-menu-options');
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
// Display the template
$smarty->assign('mid', 'tiki-admin_menu_options.tpl');
$smarty->display("tiki.tpl");
|
pitbulk/tiki-saml
|
tiki-admin_menu_options.php
|
PHP
|
lgpl-2.1
| 6,245
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="1"> </td>
<td class="postheader" valign="center">
<a href="index.html">
<font color="#004faf">Home</font></a> ·
<a href="classes.html">
<font color="#004faf">All Classes</font></a> ·
<a href="namespaces.html">
<font color="#004faf">All Namespaces</font></a> ·
<a href="modules.html">
<font color="#004faf">Modules</font></a> ·
<a href="functions.html">
<font color="#004faf">Functions</font></a> ·
<a href="files.html">
<font color="#004faf">Files</font></a>
</td>
</tr>
</table>
<!-- Generated by Doxygen 1.7.5 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="a00655.html">Tp</a> </li>
<li class="navelem"><a class="el" href="a00659.html">Client</a> </li>
<li class="navelem"><a class="el" href="a00108.html">ChannelTypeContactListInterface</a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Tp::Client::ChannelTypeContactListInterface Member List</div> </div>
</div>
<div class="contents">
This is the complete list of members for <a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="a00033.html#ae73665dbe1abf1c50a8ab98221274dbe">AbstractInterface</a>(DBusProxy *proxy, const QLatin1String &interface)</td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a454ff620101be4299892b3e47fead4d2">AbstractInterface</a>(const QString &busName, const QString &path, const QLatin1String &interface, const QDBusConnection &connection, QObject *parent)</td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#asyncCall">asyncCall</a>(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#asyncCallWithArgumentList">asyncCallWithArgumentList</a>(const QString &method, const QList< QVariant > &args)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#blockSignals">blockSignals</a>(bool block)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#call">call</a>(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#call-2">call</a>(QDBus::CallMode mode, const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#callWithArgumentList">callWithArgumentList</a>(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#callWithCallback">callWithCallback</a>(const QString &method, const QList< QVariant > &args, QObject *receiver, const char *returnMethod, const char *errorMethod)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#callWithCallback-2">callWithCallback</a>(const QString &method, const QList< QVariant > &args, QObject *receiver, const char *slot)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#a0b19c65f24fd0e3b45e20be0697020db">ChannelTypeContactListInterface</a>(const QString &busName, const QString &objectPath, QObject *parent=0)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#a6bdb4bbe627bd33cbaf56017cd3f8b45">ChannelTypeContactListInterface</a>(const QDBusConnection &connection, const QString &busName, const QString &objectPath, QObject *parent=0)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#a0c2a04bc94c5a67a24cb23f040940c7a">ChannelTypeContactListInterface</a>(Tp::DBusProxy *proxy)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#a80cd1cde5874158b76f2c1fa6bc3f455">ChannelTypeContactListInterface</a>(const Tp::Client::ChannelInterface &mainInterface)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td><code> [explicit]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#af61df5ae0a86795d35fc619dddc8b8c9">ChannelTypeContactListInterface</a>(const Tp::Client::ChannelInterface &mainInterface, QObject *parent)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#checkConnectArgs">checkConnectArgs</a>(const char *signal, const QObject *object, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#child">child</a>(const char *objName, const char *inheritsClass, bool recursiveSearch) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#childEvent">childEvent</a>(QChildEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#children">children</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#className">className</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect">connect</a>(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect-2">connect</a>(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect-3">connect</a>(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#connection">connection</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connectNotify">connectNotify</a>(const char *signal)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#customEvent">customEvent</a>(QEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#deleteLater">deleteLater</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#destroyed">destroyed</a>(QObject *obj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect">disconnect</a>(const QObject *sender, const char *signal, const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-2">disconnect</a>(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-3">disconnect</a>(const char *signal, const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-4">disconnect</a>(const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnectNotify">disconnectNotify</a>(const char *signal)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dumpObjectInfo">dumpObjectInfo</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dumpObjectTree">dumpObjectTree</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dynamicPropertyNames">dynamicPropertyNames</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#event">event</a>(QEvent *e)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#eventFilter">eventFilter</a>(QObject *watched, QEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChild">findChild</a>(const QString &name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChildren">findChildren</a>(const QString &name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChildren-2">findChildren</a>(const QRegExp &regExp) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#inherits">inherits</a>(const char *className) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#insertChild">insertChild</a>(QObject *object)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#installEventFilter">installEventFilter</a>(QObject *filterObj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#interface">interface</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a0fe684d0ef843a3e36f2ecee24defed6">internalRequestAllProperties</a>() const </td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#ad97c6346a1c2bbfd893943d60da27b89">internalRequestProperty</a>(const QString &name) const </td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a735ab438b3675c6938cd534722c47b4e">internalSetProperty</a>(const QString &name, const QVariant &newValue)</td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#af265a16ed1fa8c6c3670c19473ca447e">invalidate</a>(Tp::DBusProxy *, const QString &, const QString &)</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a96caf6bfea37a71d4849b4470728ceb4">invalidationMessage</a>() const </td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a8bf99ab34d551325914c08500acadc94">invalidationReason</a>() const </td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#isA">isA</a>(const char *className) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#a6ffad807cd688510af39c9ddd808d5b5">isValid</a>() const </td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#isWidgetType">isWidgetType</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#killTimer">killTimer</a>(int id)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#lastError">lastError</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#metaObject">metaObject</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#moveToThread">moveToThread</a>(QThread *targetThread)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#name">name</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#name-2">name</a>(const char *defaultName) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#normalizeSignalSlot">normalizeSignalSlot</a>(const char *signalSlot)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">objectName</a></td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">objectName</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#parent">parent</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#path">path</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#property">property</a>(const char *name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#QObject">QObject</a>(QObject *parent)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#QObject-3">QObject</a>(QObject *parent, const char *name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#receivers">receivers</a>(const char *signal) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#removeChild">removeChild</a>(QObject *object)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#removeEventFilter">removeEventFilter</a>(QObject *obj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#ab1edb48641e8fd3e020273d0d8b86ae4">requestAllProperties</a>() const </td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#sender">sender</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#senderSignalIndex">senderSignalIndex</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#service">service</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#setName">setName</a>(const char *name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">setObjectName</a>(const QString &name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#setParent">setParent</a>(QObject *parent)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#setProperty">setProperty</a>(const char *name, const QVariant &value)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#setTimeout">setTimeout</a>(int timeout)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#signalsBlocked">signalsBlocked</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#startTimer">startTimer</a>(int interval)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00108.html#a54ef6a00756e6797f65592500091b8ef">staticInterfaceName</a>()</td><td><a class="el" href="a00108.html">Tp::Client::ChannelTypeContactListInterface</a></td><td><code> [inline, static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#thread">thread</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#timeout">timeout</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#timerEvent">timerEvent</a>(QTimerEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#tr">tr</a>(const char *sourceText, const char *disambiguation, int n)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#trUtf8">trUtf8</a>(const char *sourceText, const char *disambiguation, int n)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00033.html#ad82f1079204bca0dcfd1f6eeda3b0bcf">~AbstractInterface</a>()</td><td><a class="el" href="a00033.html">Tp::AbstractInterface</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html#dtor.QDBusAbstractInterface">~QDBusAbstractInterface</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qdbusabstractinterface.html">QDBusAbstractInterface</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dtor.QObject">~QObject</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
</table></div>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation</td>
<td width="30%" align="right"><div align="right">Telepathy-Qt4 0.8.0</div></td>
</tr></table></div></address>
</body>
</html>
|
Telekinesis/Telepathy-qt4-0.8.0
|
doc/html/a00935.html
|
HTML
|
lgpl-2.1
| 34,660
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Qt 4.8: MapExtensionReturn Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script src="scripts/jquery.js" type="text/javascript"></script>
<script src="scripts/functions.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/superfish.css" />
<link rel="stylesheet" type="text/css" href="style/narrow.css" />
<!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->
<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>
</head>
<body class="" onload="CheckEmptyAndLoadList();">
<div class="header" id="qtdocheader">
<div class="content">
<div id="nav-logo">
<a href="index.html">Home</a></div>
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
<div id="narrowsearch"></div>
<div id="nav-topright">
<ul>
<li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
<li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
<li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
DOC</a></li>
<li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
</ul>
</div>
<div id="shortCut">
<ul>
<li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
<li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li>
</ul>
</div>
<ul class="sf-menu" id="narrowmenu">
<li><a href="#">API Lookup</a>
<ul>
<li><a href="classes.html">Class index</a></li>
<li><a href="functions.html">Function index</a></li>
<li><a href="modules.html">Modules</a></li>
<li><a href="namespaces.html">Namespaces</a></li>
<li><a href="qtglobal.html">Global Declarations</a></li>
<li><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</li>
<li><a href="#">Qt Topics</a>
<ul>
<li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li><a href="qtquick.html">Device UIs & Qt Quick</a></li>
<li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li><a href="supported-platforms.html">Supported Platforms</a></li>
<li><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</li>
<li><a href="#">Examples</a>
<ul>
<li><a href="all-examples.html">Examples</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="demos.html">Demos</a></li>
<li><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="hd">
<span></span>
</div>
<div class="bd group">
<div class="sidebar">
<div class="searchlabel">
Search index:</div>
<div class="search" id="sidebarsearch">
<form id="qtdocsearch" action="" onsubmit="return false;">
<fieldset>
<input type="text" name="searchstring" id="pageType" value="" />
<div id="resultdialog">
<a href="#" id="resultclose">Close</a>
<p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p>
<p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p>
<ul id="resultlist" class="all">
</ul>
</div>
</fieldset>
</form>
</div>
<div class="box first bottombar" id="lookup">
<h2 title="API Lookup"><span></span>
API Lookup</h2>
<div id="list001" class="list">
<ul id="ul001" >
<li class="defaultLink"><a href="classes.html">Class index</a></li>
<li class="defaultLink"><a href="functions.html">Function index</a></li>
<li class="defaultLink"><a href="modules.html">Modules</a></li>
<li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
<li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
<li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</div>
</div>
<div class="box bottombar" id="topics">
<h2 title="Qt Topics"><span></span>
Qt Topics</h2>
<div id="list002" class="list">
<ul id="ul002" >
<li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li>
<li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>
<li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</div>
</div>
<div class="box" id="examples">
<h2 title="Examples"><span></span>
Examples</h2>
<div id="list003" class="list">
<ul id="ul003">
<li class="defaultLink"><a href="all-examples.html">Examples</a></li>
<li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
<li class="defaultLink"><a href="demos.html">Demos</a></li>
<li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</div>
</div>
</div>
<div class="wrap">
<div class="toolbar">
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>MapExtensionReturn</li>
</ul>
</div>
<div class="toolbuttons toolblock">
<ul>
<li id="smallA" class="t_button">A</li>
<li id="medA" class="t_button active">A</li>
<li id="bigA" class="t_button">A</li>
<li id="print" class="t_button"><a href="javascript:this.print();">
<span>Print</span></a></li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">MapExtensionReturn Class Reference</h1>
<span class="small-subtitle">(QAbstractFileEngine::MapExtensionReturn)<br/></span>
<ul>
<li><a href="qabstractfileengine-mapextensionreturn-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="details"></a>
</div>
</div>
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Digia, Qt and their respective logos are trademarks of Digia Plc
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
<script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>
|
sicily/qt4.8.4
|
doc/html/qabstractfileengine-mapextensionreturn.html
|
HTML
|
lgpl-2.1
| 9,503
|
package it.unitn.disi.smatch.loaders.mapping;
import it.unitn.disi.common.components.Configurable;
import it.unitn.disi.common.components.ConfigurableException;
import it.unitn.disi.smatch.data.mappings.IContextMapping;
import it.unitn.disi.smatch.data.mappings.IMappingElement;
import it.unitn.disi.smatch.data.mappings.IMappingFactory;
import it.unitn.disi.smatch.data.trees.IContext;
import it.unitn.disi.smatch.data.trees.INode;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import java.util.Properties;
/**
* Base class for mapping loaders.
*
* @author <a rel="author" href="http://autayeu.com/">Aliaksandr Autayeu</a>
*/
public abstract class BaseMappingLoader extends Configurable implements IMappingLoader {
private static final Logger log = Logger.getLogger(BaseMappingLoader.class);
private static final String MAPPING_FACTORY_KEY = "mappingFactory";
protected IMappingFactory mappingFactory = null;
protected int lg;
protected int mg;
protected int eq;
protected int dj;
protected long counter;
protected long cntLoaded;
@Override
public boolean setProperties(Properties newProperties) throws ConfigurableException {
Properties oldProperties = new Properties();
oldProperties.putAll(properties);
boolean result = super.setProperties(newProperties);
if (result) {
if (newProperties.containsKey(MAPPING_FACTORY_KEY)) {
mappingFactory = (IMappingFactory) configureComponent(mappingFactory, oldProperties, newProperties, "mapping factory", MAPPING_FACTORY_KEY, IMappingFactory.class);
} else {
final String errMessage = "Cannot find configuration key " + MAPPING_FACTORY_KEY;
log.error(errMessage);
throw new ConfigurableException(errMessage);
}
}
return result;
}
public IContextMapping<INode> loadMapping(IContext source, IContext target, String fileName) throws MappingLoaderException {
if (log.isEnabledFor(Level.INFO)) {
log.info("Loading mapping: " + fileName);
}
lg = mg = eq = dj = 0;
cntLoaded = 0;
IContextMapping<INode> mapping = mappingFactory.getContextMappingInstance(source, target);
process(mapping, source, target, fileName);
reportStats(mapping);
return mapping;
}
protected abstract void process(IContextMapping<INode> mapping, IContext source, IContext target, String fileName) throws MappingLoaderException;
protected void reportStats(IContextMapping<INode> mapping) {
if (log.isEnabledFor(Level.INFO)) {
log.info("Loading mapping finished. Loaded " + cntLoaded + " links");
log.info("Mapping contains " + mapping.size() + " links");
log.info("LG: " + lg);
log.info("MG: " + mg);
log.info("EQ: " + eq);
log.info("DJ: " + dj);
}
}
protected void reportProgress() {
counter++;
if (0 == (counter % 1000)) {
if (log.isEnabledFor(Level.INFO)) {
log.info("Loaded links: " + counter);
}
}
}
protected void countRelation(final char relation) {
switch (relation) {
case IMappingElement.LESS_GENERAL: {
lg++;
break;
}
case IMappingElement.MORE_GENERAL: {
mg++;
break;
}
case IMappingElement.EQUIVALENCE: {
eq++;
break;
}
case IMappingElement.DISJOINT: {
dj++;
break;
}
default:
break;
}
}
}
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/mapping/BaseMappingLoader.java
|
Java
|
lgpl-2.1
| 3,887
|
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2010 Red Hat, Inc.
This library 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.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "spice-widget.h"
#include "spice-widget-priv.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
#if GTK_CHECK_VERSION (2, 91, 0)
static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
{
*ww = gdk_window_get_width(w);
*wh = gdk_window_get_height(w);
}
#endif
G_GNUC_INTERNAL
int spicex_image_create(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
if (d->ximage != NULL)
return 0;
if (d->format == SPICE_SURFACE_FMT_16_555 ||
d->format == SPICE_SURFACE_FMT_16_565) {
d->convert = TRUE;
d->data = g_malloc0(d->area.width * d->area.height * 4);
d->ximage = cairo_image_surface_create_for_data
(d->data, CAIRO_FORMAT_RGB24, d->area.width, d->area.height, d->area.width * 4);
} else {
d->convert = FALSE;
d->ximage = cairo_image_surface_create_for_data
(d->data, CAIRO_FORMAT_RGB24, d->width, d->height, d->stride);
}
return 0;
}
G_GNUC_INTERNAL
void spicex_image_destroy(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
if (d->ximage) {
cairo_surface_finish(d->ximage);
d->ximage = NULL;
}
if (d->convert && d->data) {
g_free(d->data);
d->data = NULL;
}
d->convert = FALSE;
}
#if !GTK_CHECK_VERSION (3, 0, 0)
#define cairo_rectangle_int_t GdkRectangle
#define cairo_region_t GdkRegion
#define cairo_region_create_rectangle gdk_region_rectangle
#define cairo_region_subtract_rectangle(_dest,_rect) { GdkRegion *_region = gdk_region_rectangle (_rect); gdk_region_subtract (_dest, _region); gdk_region_destroy (_region); }
#define cairo_region_destroy gdk_region_destroy
#endif
G_GNUC_INTERNAL
void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
cairo_rectangle_int_t rect;
cairo_region_t *region;
double s;
int x, y;
int ww, wh;
int w, h;
spice_display_get_scaling(display, &s, &x, &y, &w, &h);
gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh);
/* We need to paint the bg color around the image */
rect.x = 0;
rect.y = 0;
rect.width = ww;
rect.height = wh;
region = cairo_region_create_rectangle(&rect);
/* Optionally cut out the inner area where the pixmap
will be drawn. This avoids 'flashing' since we're
not double-buffering. */
if (d->ximage) {
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
cairo_region_subtract_rectangle(region, &rect);
}
gdk_cairo_region (cr, region);
cairo_region_destroy (region);
/* Need to set a real solid color, because the default is usually
transparent these days, and non-double buffered windows can't
render transparently */
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_fill(cr);
/* Draw the display */
if (d->ximage) {
cairo_translate(cr, x, y);
cairo_rectangle(cr, 0, 0, w, h);
cairo_scale(cr, s, s);
if (!d->convert)
cairo_translate(cr, -d->area.x, -d->area.y);
cairo_set_source_surface(cr, d->ximage, 0, 0);
cairo_fill(cr);
if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER &&
d->mouse_guest_x != -1 && d->mouse_guest_y != -1 &&
!d->show_cursor) {
GdkPixbuf *image = d->mouse_pixbuf;
if (image != NULL) {
gdk_cairo_set_source_pixbuf(cr, image,
d->mouse_guest_x - d->mouse_hotspot.x,
d->mouse_guest_y - d->mouse_hotspot.y);
cairo_paint(cr);
}
}
}
}
#if ! GTK_CHECK_VERSION (2, 91, 0)
G_GNUC_INTERNAL
void spicex_expose_event(SpiceDisplay *display, GdkEventExpose *expose)
{
cairo_t *cr;
cr = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(display)));
cairo_rectangle(cr,
expose->area.x,
expose->area.y,
expose->area.width,
expose->area.height);
cairo_clip(cr);
spicex_draw_event(display, cr);
cairo_destroy(cr);
}
#endif
G_GNUC_INTERNAL
gboolean spicex_is_scaled(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
return d->allow_scaling;
}
|
mathslinux/spice-gtk
|
gtk/spice-widget-cairo.c
|
C
|
lgpl-2.1
| 5,286
|
//
// Copyright (c) 2013, Ford Motor Company
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with the
// distribution.
//
// Neither the name of the Ford Motor Company nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETDEVICELISTMARSHALLER_INCLUDE
#define NSRPC2COMMUNICATION_SMARTDEVICELINKCORE_GETDEVICELISTMARSHALLER_INCLUDE
#include <string>
#include <json/json.h>
#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/BasicCommunication/GetDeviceList.h"
namespace NsRPC2Communication
{
namespace BasicCommunication
{
struct GetDeviceListMarshaller
{
static bool checkIntegrity(GetDeviceList& e);
static bool checkIntegrityConst(const GetDeviceList& e);
static bool fromString(const std::string& s,GetDeviceList& e);
static const std::string toString(const GetDeviceList& e);
static bool fromJSON(const Json::Value& s,GetDeviceList& e);
static Json::Value toJSON(const GetDeviceList& e);
};
}
}
#endif
|
Luxoft/SDLP
|
SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/BasicCommunication/GetDeviceListMarshaller.h
|
C
|
lgpl-2.1
| 2,396
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of meegotouch-controlpanelapplets.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "themewidget.h"
#include "themedescriptor.h"
#include "themelistmodel.h"
#include "themecellcreator.h"
#include "themedialog.h"
#include <MApplication>
#include <MApplicationWindow>
#include <QGraphicsLinearLayout>
#include <MTextEdit>
#include <MList>
#include <MListFilter>
#include <MSortFilterProxyModel>
#include <MBasicListItem>
#include <MImageWidget>
#include <QTimer>
//#define DEBUG
#define WARNING
#include "../debug.h"
static const char *oviCommand = "webwidgetrunner /usr/share/webwidgets/applications/d34177b1c241ea44cb132005b63ee6527c9f6040-wrt-widget.desktop -widgetparameter themes &";
ThemeWidget::ThemeWidget (
ThemeBusinessLogic *themeBusinessLogic,
QGraphicsWidget *parent) :
DcpWidget (parent),
m_ThemeBusinessLogic (themeBusinessLogic),
m_ThemeListModel(0),
m_List(0),
m_OviItem(0)
{
createWidgets ();
}
ThemeWidget::~ThemeWidget ()
{
m_LiveFilterEditor->setParentLayoutItem (0);
}
void
ThemeWidget::createWidgets ()
{
QGraphicsLinearLayout *mainLayout;
/*
* Creating and setting up the main layout
*/
mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
mainLayout->setContentsMargins (0., 0., 0., 0.);
mainLayout->setSpacing (0.);
/*
* Creating the list with the available themes.
*/
m_List = new MList();
m_List->setObjectName ("ThemeList");
// We only connect the themeChangeStarted if we have a chance to sense the
// end of the theme change too. just to be sure.
if (connect (m_ThemeBusinessLogic, SIGNAL (themeChanged (QString)),
SLOT (enableList ()))) {
connect (m_ThemeBusinessLogic, SIGNAL (themeChangeStarted (QString)),
SLOT (disableList ()));
}
// Cellcreator
m_CellCreator = new ThemeCellCreator;
m_List->setCellCreator (m_CellCreator);
m_List->setSelectionMode (MList::SingleSelection);
// This function will create the m_LiveFilterEditor widget.
readLocalThemes ();
/*
* An item to activate the OVI link.
*/
m_OviItem = new MBasicListItem (MBasicListItem::IconWithTitle);
m_OviItem->setObjectName("OviItem");
// Currently we use the default.
//m_OviItem->setLayoutPosition (M::VerticalCenterPosition);
m_OviItem->imageWidget()->setImage ("icon-m-common-ovi");
/*
* Adding everything to the layout.
*/
m_LiveFilterEditor->setParentLayoutItem (mainLayout);
mainLayout->addItem (m_OviItem);
mainLayout->addItem (m_List);
/*
* Connecting to the signals.
*/
connect (m_OviItem, SIGNAL(clicked()),
this, SLOT(oviActivated()));
connect (m_LiveFilterEditor, SIGNAL(textChanged()),
this, SLOT(textChanged ()));
connect (m_List, SIGNAL(panningStarted()),
this, SLOT(hideEmptyTextEdit()));
connect (m_ThemeBusinessLogic, SIGNAL(refreshNeeded()),
this, SLOT(refreshNeeded ()));
setLayout(mainLayout);
retranslateUi ();
}
/*!
* A slot to disable the list of themes. We use this method to disable the user
* interaction with the list while the theme is being changed.
*/
void
ThemeWidget::disableList ()
{
m_List->setEnabled(false);
}
/*!
* A slot to enable the theme list that was disabled by the disableList()
* method.
*/
void
ThemeWidget::enableList ()
{
m_List->setEnabled(true);
selectCurrentTheme ();
}
void
ThemeWidget::retranslateUi ()
{
//% "Get more from Ovi Store"
m_OviItem->setTitle(qtTrId("qtn_teme_store"));
}
/**
* If you consider to call this function multiple times
* (for example because you want to update the theme list),
* pay attention to freeing ThemeDescriptor objects and
* m_ThemeListModel.
*
* Apparently multiple calls of setItemModel() with the same
* model doesn't update MList.
*
* You also have to deal with disconnection and reconnection of
* itemClicked() signal because MList::selectItem() emits that!
*/
void
ThemeWidget::readLocalThemes ()
{
/*
* Creating the model and connecting it to the businesslogic so we can show
* the spinner while the theme change is in progress.
*/
m_ThemeListModel = new ThemeListModel (m_ThemeBusinessLogic);
m_ThemeListModel->setObjectName ("ThemeListModel");
SYS_DEBUG ("*** m_ThemeListModel = %p", m_ThemeListModel);
m_List->setItemModel (m_ThemeListModel);
if (m_ThemeBusinessLogic) {
connect (m_ThemeBusinessLogic, SIGNAL(themeChangeStarted(QString)),
m_ThemeListModel, SLOT(themeChangeStarted(QString)));
connect (m_ThemeBusinessLogic, SIGNAL(themeChanged(QString)),
m_ThemeListModel, SLOT(themeChanged(QString)));
}
/*
* Enabling the live filter feature for the list. From this moment on the
* list will use a QSortFilterProxyModel object as model.
*/
m_List->filtering()->setEnabled (true);
m_List->filtering()->setFilterRole (ThemeListModel::SearchRole);
m_Proxy = m_List->filtering()->proxy();
m_Proxy->setSortRole (ThemeListModel::SearchRole);
m_Proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
// Seems that the sort() method simply will not sort when the
// ThemeListModel::SearchRole is used.
m_Proxy->sort(Qt::DisplayRole);
m_Proxy->setFilterKeyColumn(0);
m_LiveFilterEditor = m_List->filtering()->editor();
connect(m_List, SIGNAL(itemClicked(QModelIndex)),
this, SLOT(themeActivated(QModelIndex)));
SYS_DEBUG ("*** calling selectCurrentTheme()");
selectCurrentTheme ();
}
/*!
* This slot selects the current theme from the theme list. We needed to
* implement this feature as a slot, so we can select the current theme when the
* user pressed the cancel button in the dialog. We need to go back to the
* original theme then.
*/
void
ThemeWidget::selectCurrentTheme ()
{
QString currentThemeCodeName;
QModelIndex currentIndex;
/*
* Selecting the current theme from the list. The index must be mapped to
* the proxy model, since we are reading from our model but the list shows a
* proxy that is sorted.
*/
currentThemeCodeName = m_ThemeBusinessLogic->currentThemeCodeName();
currentIndex = m_ThemeListModel->indexOfCodeName(currentThemeCodeName);
currentIndex = m_Proxy->mapFromSource (currentIndex);
/*
* Unfortunately we need to clear the selection and re-select the current
* item, othherwise the enabling/disabling of the list causes strange
* bugs... sometimes the item is selected, but the selection is not shown.
*/
#if 0
if (m_List->selectionModel()->isSelected(currentIndex)) {
SYS_DEBUG ("Index already selected");
return;
}
#endif
m_List->selectionModel()->clear();
m_List->selectionModel()->select (
currentIndex,
QItemSelectionModel::ClearAndSelect);
m_List->scrollTo (currentIndex, MList::PositionAtCenterHint);
}
void
ThemeWidget::themeActivated (
const QModelIndex &index)
{
QString codeName;
ThemeDescriptor *descr = 0;
SYS_DEBUG ("*** index at %d, %d", index.row(), index.column());
if (m_ThemeDialog) {
SYS_DEBUG ("We already have a dialog, returning.");
return;
}
codeName = m_Proxy->data(index, ThemeListModel::CodeNameRole).toString();
/*
* If the user selects the current theme we don't do anything.
*/
if (codeName == m_ThemeBusinessLogic->currentThemeCodeName())
return;
#if 0
/*
* For debugging purposes it is possible to leave out the dialog and change
* the theme here.
*/
m_ThemeBusinessLogic->changeTheme (codeName);
return;
#endif
descr = m_ThemeBusinessLogic->themeByCodename (codeName);
if (descr == 0) {
SYS_CRITICAL("codename not found: %s", SYS_STR(codeName));
return;
}
m_ThemeDialog = new ThemeDialog (m_ThemeBusinessLogic, descr);
connect (m_ThemeDialog, SIGNAL(themeChangeCancelled()),
this, SLOT(selectCurrentTheme()));
m_ThemeDialog->showDialog ();
}
void
ThemeWidget::oviActivated ()
{
SYS_DEBUG ("Executing %s", oviCommand);
system (oviCommand);
}
void
ThemeWidget::textChanged ()
{
if (!m_List->filtering()->editor()->isOnDisplay()) {
m_List->filtering()->editor()->show();
m_List->filtering()->editor()->setFocus();
}
QGraphicsLinearLayout *mainLayout = dynamic_cast<QGraphicsLinearLayout *>(layout ());
if (mainLayout)
{
if (m_LiveFilterEditor->text ().isEmpty () == true)
{
/*
* We already have a better solution for this in the soundsettings
* applet...
*/
mainLayout->removeItem (m_LiveFilterEditor);
m_LiveFilterEditor->setPos (QPointF (0.,-200.));
}
else
{
mainLayout->insertItem (0, m_LiveFilterEditor);
}
mainLayout->invalidate ();
}
m_CellCreator->highlightByText (m_LiveFilterEditor->text());
// Seems that the sort() method simply will not sort when the
// ThemeListModel::SearchRole is used.
m_Proxy->sort(Qt::DisplayRole);
/*
* As the search string changes the current theme might appear in the list
* (if the current theme was filtered before). In this case we need to
* select this item in the list, because the selection is lost when the
* selected item is filtered out.
*/
selectCurrentTheme ();
m_ThemeListModel->refresh();
update ();
}
/*
* This slot will re-sort the model and select the current theme again. Need to
* be called when the theme package has been removed or installed, connected to
* a signal of the businesslogic.
*/
void
ThemeWidget::refreshNeeded ()
{
if (!m_Proxy)
return;
m_Proxy->sort(Qt::DisplayRole);
selectCurrentTheme ();
m_ThemeListModel->refresh();
update ();
}
void
ThemeWidget::hideEmptyTextEdit ()
{
if (m_List->filtering()->editor()->text().isEmpty())
m_List->filtering()->editor()->hide();
}
|
dudochkin-victor/touch-controlpanelapplets
|
src/themeapplet/themewidget.cpp
|
C++
|
lgpl-2.1
| 10,871
|
<?php
declare(strict_types=1);
namespace SimpleSAML\SAML2\Configuration;
interface DecryptionProvider
{
/**
* @return null|bool
*/
public function isAssertionEncryptionRequired(): ?bool;
/**
* @return null|string
*/
public function getSharedKey(): ?string;
/**
* @param string $name The name of the private key
* @param bool $required Whether or not the private key must exist
*
* @return mixed
*/
public function getPrivateKey(string $name, bool $required = null);
/**
* @return array|null
*/
public function getBlacklistedAlgorithms(): ?array;
}
|
simplesamlphp/saml2
|
src/SAML2/Configuration/DecryptionProvider.php
|
PHP
|
lgpl-2.1
| 645
|
package org.solmix.datax.jdbc.core;
public class TypeMismatchDataAccessException extends JdbcException {
public TypeMismatchDataAccessException(String msg) {
super(msg);
}
/**
* Constructor for TypeMismatchDataAccessException.
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public TypeMismatchDataAccessException(String msg, Throwable cause) {
super(msg, cause);
}
}
|
solmix/datax
|
jdbc/src/main/java/org/solmix/datax/jdbc/core/TypeMismatchDataAccessException.java
|
Java
|
lgpl-2.1
| 436
|
/*
* eXist-db Open Source Native XML Database
* Copyright (C) 2001 The eXist-db Authors
*
* info@exist-db.org
* http://www.exist-db.org
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.exist.xquery.functions.request;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.nio.file.Path;
import java.util.List;
import org.exist.dom.QName;
import org.exist.http.servlets.RequestWrapper;
import org.exist.xquery.*;
import org.exist.xquery.value.Base64BinaryValueType;
import org.exist.xquery.value.BinaryValueFromFile;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.Sequence;
import org.exist.xquery.value.SequenceType;
import org.exist.xquery.value.Type;
import org.exist.xquery.value.ValueSequence;
import javax.annotation.Nonnull;
/**
* @author wolf
*/
public class GetUploadedFile extends StrictRequestFunction {
protected static final Logger logger = LogManager.getLogger(GetUploadedFile.class);
public final static FunctionSignature[] signatures = {
new FunctionSignature(
new QName("get-uploaded-file-data", RequestModule.NAMESPACE_URI, RequestModule.PREFIX),
"Retrieve the base64 encoded data where the file part of a multi-part request has been stored. "
+ "Returns the empty sequence if the request is not a multi-part request or the parameter name "
+ "does not point to a file part.",
new SequenceType[]{
new FunctionParameterSequenceType("upload-param-name", Type.STRING, Cardinality.EXACTLY_ONE, "The parameter name")
},
new FunctionReturnSequenceType(Type.BASE64_BINARY, Cardinality.ZERO_OR_MORE, "the base64 encoded data from the uploaded file"))
};
public GetUploadedFile(final XQueryContext context, final FunctionSignature signature) {
super(context, signature);
}
@Override
public Sequence eval(final Sequence[] args, @Nonnull final RequestWrapper request)
throws XPathException {
final String uploadParamName = args[0].getStringValue();
final List<Path> files = request.getFileUploadParam(uploadParamName);
if (files == null || files.isEmpty()) {
if (logger.isDebugEnabled()) {
logger.debug("File param not found: " + uploadParamName);
}
return Sequence.EMPTY_SEQUENCE;
}
final ValueSequence result = new ValueSequence();
for (final Path file : files) {
result.add(BinaryValueFromFile.getInstance(context, new Base64BinaryValueType(), file));
}
return result;
}
}
|
ambs/exist
|
exist-core/src/main/java/org/exist/xquery/functions/request/GetUploadedFile.java
|
Java
|
lgpl-2.1
| 3,410
|
//$HeadURL$
/*----------------------------------------------------------------------------
This file is part of deegree, http://deegree.org/
Copyright (C) 2001-2009 by:
Department of Geography, University of Bonn
and
lat/lon GmbH
This library 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.1 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 Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact information:
lat/lon GmbH
Aennchenstr. 19, 53177 Bonn
Germany
http://lat-lon.de/
Department of Geography, University of Bonn
Prof. Dr. Klaus Greve
Postfach 1147, 53001 Bonn
Germany
http://www.geographie.uni-bonn.de/deegree/
e-mail: info@deegree.org
----------------------------------------------------------------------------*/
package org.deegree.protocol.wfs.getfeature.xml;
import static org.deegree.commons.xml.CommonNamespaces.OGCNS;
import static org.deegree.protocol.wfs.WFSConstants.VERSION_100;
import static org.deegree.protocol.wfs.WFSConstants.VERSION_110;
import static org.deegree.protocol.wfs.WFSConstants.VERSION_200;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.OMElement;
import org.deegree.commons.ows.exception.OWSException;
import org.deegree.commons.tom.ResolveParams;
import org.deegree.commons.tom.ows.Version;
import org.deegree.commons.utils.kvp.InvalidParameterValueException;
import org.deegree.commons.utils.kvp.MissingParameterException;
import org.deegree.commons.xml.XMLParsingException;
import org.deegree.commons.xml.XPath;
import org.deegree.commons.xml.stax.XMLStreamReaderWrapper;
import org.deegree.cs.coordinatesystems.ICRS;
import org.deegree.cs.persistence.CRSManager;
import org.deegree.filter.Filter;
import org.deegree.filter.expression.Function;
import org.deegree.filter.expression.ValueReference;
import org.deegree.filter.projection.PropertyName;
import org.deegree.filter.sort.SortProperty;
import org.deegree.filter.xml.Filter100XMLDecoder;
import org.deegree.filter.xml.Filter110XMLDecoder;
import org.deegree.protocol.wfs.WFSConstants;
import org.deegree.protocol.wfs.getfeature.GetFeature;
import org.deegree.protocol.wfs.getfeature.TypeName;
import org.deegree.protocol.wfs.query.FilterQuery;
import org.deegree.protocol.wfs.query.Query;
import org.deegree.protocol.wfs.query.StandardPresentationParams;
import org.deegree.protocol.wfs.query.xml.QueryXMLAdapter;
/**
* Adapter between XML <code>GetFeature</code> requests and {@link GetFeature} objects.
* <p>
* Supported WFS versions:
* <ul>
* <li>1.0.0</li>
* <li>1.1.0</li>
* <li>2.0.0</li>
* </ul>
* </p>
*
* @author <a href="mailto:schneider@lat-lon.de">Markus Schneider</a>
* @author <a href="mailto:ionita@lat-lon.de">Andrei Ionita</a>
* @author last edited by: $Author$
*
* @version $Revision$, $Date$
*/
public class GetFeatureXMLAdapter extends QueryXMLAdapter {
/**
* Parses a WFS <code>GetFeature</code> document into a {@link GetFeature} object. *
* <p>
* Supported WFS versions:
* <ul>
* <li>1.0.0</li>
* <li>1.1.0</li>
* <li>2.0.0</li>
* </ul>
* </p>
*
* @return parsed {@link GetFeature} request, never <code>null</code>
* @throws Exception
* @throws XMLParsingException
* if a syntax error occurs in the XML
* @throws MissingParameterException
* if the request version is unsupported
* @throws InvalidParameterValueException
* if a parameter contains a syntax error
*/
public GetFeature parse()
throws Exception {
Version version = determineVersion110Safe();
GetFeature result = null;
if ( VERSION_100.equals( version ) ) {
result = parse100();
} else if ( VERSION_110.equals( version ) ) {
result = parse110();
} else if ( VERSION_200.equals( version ) ) {
result = parse200();
} else {
String msg = "Version '" + version + "' is not supported. Supported versions are 1.0.0, 1.1.0 and 2.0.0.";
throw new Exception( msg );
}
return result;
}
/**
* Parses a WFS 1.0.0 <code>GetFeature</code> document into a {@link GetFeature} object.
*
* @return a GetFeature instance
*/
public GetFeature parse100() {
String handle = getNodeAsString( rootElement, new XPath( "@handle", nsContext ), null );
StandardPresentationParams presentationParams = parseStandardPresentationParameters100( rootElement );
List<OMElement> queryElements = getRequiredElements( rootElement, new XPath( "*", nsContext ) );
// check if all child elements are 'wfs:Query' elements (required for CITE)
for ( OMElement omElement : queryElements ) {
if ( !new QName( WFSConstants.WFS_NS, "Query" ).equals( omElement.getQName() ) ) {
String msg = "Child element '" + omElement.getQName() + "' is not allowed.";
throw new XMLParsingException( this, omElement, msg );
}
}
List<Query> queries = new ArrayList<Query>();
for ( OMElement queryEl : queryElements ) {
List<PropertyName> propNames = new ArrayList<PropertyName>();
List<OMElement> propertyNameElements = getElements( queryEl, new XPath( "ogc:PropertyName", nsContext ) );
for ( OMElement propertyNameEl : propertyNameElements ) {
ValueReference propertyName = new ValueReference( propertyNameEl.getText(),
getNamespaceContext( propertyNameEl ) );
propNames.add( new PropertyName( propertyName, null, null ) );
}
Filter filter = null;
OMElement filterEl = queryEl.getFirstChildWithName( new QName( OGCNS, "Filter" ) );
if ( filterEl != null ) {
try {
// TODO remove usage of wrapper (necessary at the moment to work around problems with AXIOM's
// XMLStreamReader)
XMLStreamReader xmlStream = new XMLStreamReaderWrapper(
filterEl.getXMLStreamReaderWithoutCaching(),
null );
// skip START_DOCUMENT
xmlStream.nextTag();
filter = Filter100XMLDecoder.parse( xmlStream );
} catch ( XMLStreamException e ) {
e.printStackTrace();
throw new XMLParsingException( this, filterEl, e.getMessage() );
}
}
String queryHandle = getNodeAsString( queryEl, new XPath( "@handle", nsContext ), null );
String typeNameStr = getRequiredNodeAsString( queryEl, new XPath( "@typeName", nsContext ) );
TypeName[] typeNames = TypeName.valuesOf( queryEl, typeNameStr );
String featureVersion = getNodeAsString( queryEl, new XPath( "@featureVersion", nsContext ), null );
// convert some lists to arrays to conform the FilterQuery constructor signature
PropertyName[] propNamesArray = new PropertyName[propNames.size()];
propNames.toArray( propNamesArray );
// build Query
Query filterQuery = new FilterQuery( queryHandle, typeNames, featureVersion, null, propNamesArray, null,
filter );
queries.add( filterQuery );
}
return new GetFeature( VERSION_100, handle, presentationParams, null, queries );
}
/**
* Parses a WFS 1.1.0 <code>GetFeature</code> document into a {@link GetFeature} object.
*
* @return a GetFeature instance
*/
public GetFeature parse110() {
String handle = getNodeAsString( rootElement, new XPath( "@handle", nsContext ), null );
StandardPresentationParams presentationParams = parseStandardPresentationParameters110( rootElement );
ResolveParams resolveParams = parseStandardResolveParameters110( rootElement );
List<OMElement> queryElements = getRequiredElements( rootElement, new XPath( "*", nsContext ) );
// check if all child elements are 'wfs:Query' elements (required for CITE)
for ( OMElement omElement : queryElements ) {
if ( !new QName( WFSConstants.WFS_NS, "Query" ).equals( omElement.getQName() ) ) {
String msg = "Child element '" + omElement.getQName() + "' is not allowed.";
throw new XMLParsingException( this, omElement, msg );
}
}
List<Query> queries = new ArrayList<Query>();
for ( OMElement queryEl : queryElements ) {
List<PropertyName> propNames = new ArrayList<PropertyName>();
List<OMElement> propertyNameElements = getElements( queryEl, new XPath( "wfs:PropertyName", nsContext ) );
for ( OMElement propertyNameEl : propertyNameElements ) {
ValueReference propertyName = new ValueReference( propertyNameEl.getText(),
getNamespaceContext( propertyNameEl ) );
propNames.add( new PropertyName( propertyName, null, null ) );
}
List<OMElement> xlinkPropertyElements = getElements( queryEl,
new XPath( "wfs:XlinkPropertyName", nsContext ) );
for ( OMElement xlinkPropertyEl : xlinkPropertyElements ) {
ValueReference xlinkProperty = new ValueReference( xlinkPropertyEl.getText(),
getNamespaceContext( xlinkPropertyEl ) );
String xlinkDepth = getRequiredNodeAsString( xlinkPropertyEl, new XPath( "@traverseXlinkDepth",
nsContext ) );
String xlinkExpiry = getNodeAsString( xlinkPropertyEl, new XPath( "@traverseXlinkExpiry", nsContext ),
null );
BigInteger resolveTimeout = null;
try {
if ( xlinkExpiry != null ) {
resolveTimeout = new BigInteger( xlinkExpiry ).multiply( BigInteger.valueOf( 60 ) );
}
} catch ( NumberFormatException e ) {
// TODO string provided as time in minutes is not an integer
}
PropertyName xlinkPropName = new PropertyName( xlinkProperty,
new ResolveParams( null, xlinkDepth,
resolveTimeout ), null );
propNames.add( xlinkPropName );
}
List<Function> functions = new ArrayList<Function>();
List<OMElement> functionElements = getElements( queryEl, new XPath( "ogc:Function", nsContext ) );
for ( OMElement functionEl : functionElements ) {
try {
XMLStreamReaderWrapper xmlStream = new XMLStreamReaderWrapper(
functionEl.getXMLStreamReaderWithoutCaching(),
getSystemId() );
// skip START_DOCUMENT
xmlStream.nextTag();
Function function = Filter110XMLDecoder.parseFunction( xmlStream );
functions.add( function );
} catch ( XMLStreamException e ) {
throw new XMLParsingException( this, functionEl, e.getMessage() );
}
}
Filter filter = null;
OMElement filterEl = queryEl.getFirstChildWithName( new QName( OGCNS, "Filter" ) );
if ( filterEl != null ) {
try {
// TODO remove usage of wrapper (necessary at the moment to work around problems with AXIOM's
// XMLStreamReader)
XMLStreamReader xmlStream = new XMLStreamReaderWrapper(
filterEl.getXMLStreamReaderWithoutCaching(),
null );
// skip START_DOCUMENT
xmlStream.nextTag();
filter = Filter110XMLDecoder.parse( xmlStream );
} catch ( XMLStreamException e ) {
e.printStackTrace();
throw new XMLParsingException( this, filterEl, e.getMessage() );
}
}
List<SortProperty> sortProps = new ArrayList<SortProperty>();
OMElement sortByEl = getElement( queryEl, new XPath( "ogc:SortBy", nsContext ) );
if ( sortByEl != null ) {
List<OMElement> sortPropertyElements = getRequiredElements( sortByEl, new XPath( "ogc:SortProperty",
nsContext ) );
for ( OMElement sortPropertyEl : sortPropertyElements ) {
OMElement propNameEl = getRequiredElement( sortPropertyEl,
new XPath( "ogc:PropertyName", nsContext ) );
String sortOrder = getNodeAsString( sortPropertyEl, new XPath( "ogc:SortOrder", nsContext ), "ASC" );
SortProperty sortProp = new SortProperty( new ValueReference( propNameEl.getText(),
getNamespaceContext( propNameEl ) ),
sortOrder.equals( "ASC" ) );
sortProps.add( sortProp );
}
}
String queryHandle = getNodeAsString( queryEl, new XPath( "@handle", nsContext ), null );
String typeNameStr = getRequiredNodeAsString( queryEl, new XPath( "@typeName", nsContext ) );
TypeName[] typeNames = TypeName.valuesOf( queryEl, typeNameStr );
String featureVersion = getNodeAsString( queryEl, new XPath( "@featureVersion", nsContext ), null );
ICRS crs = null;
String srsName = getNodeAsString( queryEl, new XPath( "@srsName", nsContext ), null );
if ( srsName != null ) {
crs = CRSManager.getCRSRef( srsName );
}
PropertyName[] propNamesArray = new PropertyName[propNames.size()];
propNames.toArray( propNamesArray );
SortProperty[] sortPropsArray = new SortProperty[sortProps.size()];
sortProps.toArray( sortPropsArray );
// build Query
Query filterQuery = new FilterQuery( queryHandle, typeNames, featureVersion, crs, propNamesArray,
sortPropsArray, filter );
queries.add( filterQuery );
}
Query[] queryArray = new FilterQuery[queries.size()];
queries.toArray( queryArray );
return new GetFeature( VERSION_110, handle, presentationParams, resolveParams, queries );
}
/**
* Parses a WFS 2.0.0 <code>GetFeature</code> document into a {@link GetFeature} object.
*
* @return corresponding GetFeature instance, never <code>null</code>
* @throws OWSException
*/
public GetFeature parse200()
throws OWSException {
// <xsd:attribute name="handle" type="xsd:string"/>
String handle = getNodeAsString( rootElement, new XPath( "@handle", nsContext ), null );
// <xsd:attributeGroup ref="wfs:StandardPresentationParams"/>
StandardPresentationParams presentationParams = parseStandardPresentationParameters200( rootElement );
// <xsd:attributeGroup ref="wfs:StandardResolveParameters"/>
ResolveParams resolveParams = parseStandardResolveParameters200( rootElement );
// <xsd:element ref="fes:AbstractQueryExpression" maxOccurs="unbounded"/>
List<OMElement> queryElements = getRequiredElements( rootElement, new XPath( "*", nsContext ) );
List<Query> queries = new ArrayList<Query>( queryElements.size() );
for ( OMElement queryEl : queryElements ) {
queries.add( parseAbstractQuery200( queryEl ) );
}
return new GetFeature( VERSION_200, handle, presentationParams, resolveParams, queries );
}
}
|
deegree/deegree3
|
deegree-core/deegree-core-protocol/deegree-protocol-wfs/src/main/java/org/deegree/protocol/wfs/getfeature/xml/GetFeatureXMLAdapter.java
|
Java
|
lgpl-2.1
| 17,524
|
/*
* libusb synchronization on Microsoft Windows
*
* Copyright © 2010 Michael Plante <michael.plante@gmail.com>
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBUSB_THREADS_WINDOWS_H
#define LIBUSB_THREADS_WINDOWS_H
#define usbi_mutex_static_t volatile LONG
#define USBI_MUTEX_INITIALIZER 0
#define usbi_mutex_t HANDLE
typedef struct usbi_cond {
// Every time a thread touches the CV, it winds up in one of these lists.
// It stays there until the CV is destroyed, even if the thread terminates.
struct list_head waiters;
struct list_head not_waiting;
} usbi_cond_t;
// We *were* getting timespec from pthread.h:
#if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED))
#define HAVE_STRUCT_TIMESPEC 1
#define _TIMESPEC_DEFINED 1
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */
// We *were* getting ETIMEDOUT from pthread.h:
#ifndef ETIMEDOUT
# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
#endif
#define usbi_tls_key_t DWORD
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex);
int usbi_mutex_init(usbi_mutex_t *mutex);
int usbi_mutex_lock(usbi_mutex_t *mutex);
int usbi_mutex_unlock(usbi_mutex_t *mutex);
int usbi_mutex_trylock(usbi_mutex_t *mutex);
int usbi_mutex_destroy(usbi_mutex_t *mutex);
int usbi_cond_init(usbi_cond_t *cond);
int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex);
int usbi_cond_timedwait(usbi_cond_t *cond,
usbi_mutex_t *mutex, const struct timeval *tv);
int usbi_cond_broadcast(usbi_cond_t *cond);
int usbi_cond_destroy(usbi_cond_t *cond);
int usbi_tls_key_create(usbi_tls_key_t *key);
void *usbi_tls_key_get(usbi_tls_key_t key);
int usbi_tls_key_set(usbi_tls_key_t key, void *value);
int usbi_tls_key_delete(usbi_tls_key_t key);
// all Windows mutexes are recursive
#define usbi_mutex_init_recursive usbi_mutex_init
int usbi_get_tid(void);
#endif /* LIBUSB_THREADS_WINDOWS_H */
|
anilgit90/libusb
|
libusb/os/threads_windows.h
|
C
|
lgpl-2.1
| 2,695
|
/*
* Created on 17-dic-2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.herac.tuxguitar.app.action.impl.effects;
import org.herac.tuxguitar.action.TGActionContext;
import org.herac.tuxguitar.app.TuxGuitar;
import org.herac.tuxguitar.app.action.TGActionBase;
import org.herac.tuxguitar.app.editors.tab.Caret;
import org.herac.tuxguitar.app.undo.undoables.measure.UndoableMeasureGeneric;
/**
* @author julian
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ChangeSlappingAction extends TGActionBase{
public static final String NAME = "action.note.effect.change-slapping";
public ChangeSlappingAction() {
super(NAME, AUTO_LOCK | AUTO_UNLOCK | AUTO_UPDATE | DISABLE_ON_PLAYING | KEY_BINDING_AVAILABLE);
}
protected void processAction(TGActionContext context){
//comienza el undoable
UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo();
Caret caret = getEditor().getTablature().getCaret();
getSongManager().getMeasureManager().changeSlapping(caret.getMeasure(),caret.getPosition(),caret.getSelectedString().getNumber());
TuxGuitar.instance().getFileHistory().setUnsavedFile();
updateTablature();
//termia el undoable
addUndoableEdit(undoable.endUndo());
}
public void updateTablature() {
fireUpdate(getEditor().getTablature().getCaret().getMeasure().getNumber());
}
}
|
certator/tuxguitar_mod
|
TuxGuitar/src/org/herac/tuxguitar/app/action/impl/effects/ChangeSlappingAction.java
|
Java
|
lgpl-2.1
| 1,524
|
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2003 Colin Walters <cwalters@gnome.org>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstqueue.c:
*
* 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; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:element-queue
*
* Data is queued until one of the limits specified by the
* #GstQueue:max-size-buffers, #GstQueue:max-size-bytes and/or
* #GstQueue:max-size-time properties has been reached. Any attempt to push
* more buffers into the queue will block the pushing thread until more space
* becomes available.
*
* The queue will create a new thread on the source pad to decouple the
* processing on sink and source pad.
*
* You can query how many buffers are queued by reading the
* #GstQueue:current-level-buffers property. You can track changes
* by connecting to the notify::current-level-buffers signal (which
* like all signals will be emitted from the streaming thread). The same
* applies to the #GstQueue:current-level-time and
* #GstQueue:current-level-bytes properties.
*
* The default queue size limits are 200 buffers, 10MB of data, or
* one second worth of data, whichever is reached first.
*
* As said earlier, the queue blocks by default when one of the specified
* maximums (bytes, time, buffers) has been reached. You can set the
* #GstQueue:leaky property to specify that instead of blocking it should
* leak (drop) new or old buffers.
*
* The #GstQueue::underrun signal is emitted when the queue has less data than
* the specified minimum thresholds require (by default: when the queue is
* empty). The #GstQueue::overrun signal is emitted when the queue is filled
* up. Both signals are emitted from the context of the streaming thread.
*/
#include "gst/gst_private.h"
#include <gst/gst.h>
#include "gstqueue.h"
#include "../../gst/gst-i18n-lib.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
GST_DEBUG_CATEGORY_STATIC (queue_debug);
#define GST_CAT_DEFAULT (queue_debug)
GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
#define STATUS(queue, pad, msg) \
GST_CAT_LOG_OBJECT (queue_dataflow, queue, \
"(%s:%s) " msg ": %u of %u-%u buffers, %u of %u-%u " \
"bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \
"-%" G_GUINT64_FORMAT " ns, %u items", \
GST_DEBUG_PAD_NAME (pad), \
queue->cur_level.buffers, \
queue->min_threshold.buffers, \
queue->max_size.buffers, \
queue->cur_level.bytes, \
queue->min_threshold.bytes, \
queue->max_size.bytes, \
queue->cur_level.time, \
queue->min_threshold.time, \
queue->max_size.time, \
queue->queue.length)
/* Queue signals and args */
enum
{
SIGNAL_UNDERRUN,
SIGNAL_RUNNING,
SIGNAL_OVERRUN,
SIGNAL_PUSHING,
LAST_SIGNAL
};
enum
{
PROP_0,
/* FIXME: don't we have another way of doing this
* "Gstreamer format" (frame/byte/time) queries? */
PROP_CUR_LEVEL_BUFFERS,
PROP_CUR_LEVEL_BYTES,
PROP_CUR_LEVEL_TIME,
PROP_MAX_SIZE_BUFFERS,
PROP_MAX_SIZE_BYTES,
PROP_MAX_SIZE_TIME,
PROP_MIN_THRESHOLD_BUFFERS,
PROP_MIN_THRESHOLD_BYTES,
PROP_MIN_THRESHOLD_TIME,
PROP_LEAKY,
PROP_SILENT
};
/* default property values */
#define DEFAULT_MAX_SIZE_BUFFERS 200 /* 200 buffers */
#define DEFAULT_MAX_SIZE_BYTES (10 * 1024 * 1024) /* 10 MB */
#define DEFAULT_MAX_SIZE_TIME GST_SECOND /* 1 second */
#define GST_QUEUE_MUTEX_LOCK(q) G_STMT_START { \
g_mutex_lock (q->qlock); \
} G_STMT_END
#define GST_QUEUE_MUTEX_LOCK_CHECK(q,label) G_STMT_START { \
GST_QUEUE_MUTEX_LOCK (q); \
if (q->srcresult != GST_FLOW_OK) \
goto label; \
} G_STMT_END
#define GST_QUEUE_MUTEX_UNLOCK(q) G_STMT_START { \
g_mutex_unlock (q->qlock); \
} G_STMT_END
#define GST_QUEUE_WAIT_DEL_CHECK(q, label) G_STMT_START { \
STATUS (q, q->sinkpad, "wait for DEL"); \
q->waiting_del = TRUE; \
g_cond_wait (q->item_del, q->qlock); \
q->waiting_del = FALSE; \
if (q->srcresult != GST_FLOW_OK) { \
STATUS (q, q->srcpad, "received DEL wakeup"); \
goto label; \
} \
STATUS (q, q->sinkpad, "received DEL"); \
} G_STMT_END
#define GST_QUEUE_WAIT_ADD_CHECK(q, label) G_STMT_START { \
STATUS (q, q->srcpad, "wait for ADD"); \
q->waiting_add = TRUE; \
g_cond_wait (q->item_add, q->qlock); \
q->waiting_add = FALSE; \
if (q->srcresult != GST_FLOW_OK) { \
STATUS (q, q->srcpad, "received ADD wakeup"); \
goto label; \
} \
STATUS (q, q->srcpad, "received ADD"); \
} G_STMT_END
#define GST_QUEUE_SIGNAL_DEL(q) G_STMT_START { \
if (q->waiting_del) { \
STATUS (q, q->srcpad, "signal DEL"); \
g_cond_signal (q->item_del); \
} \
} G_STMT_END
#define GST_QUEUE_SIGNAL_ADD(q) G_STMT_START { \
if (q->waiting_add) { \
STATUS (q, q->sinkpad, "signal ADD"); \
g_cond_signal (q->item_add); \
} \
} G_STMT_END
#define _do_init(bla) \
GST_DEBUG_CATEGORY_INIT (queue_debug, "queue", 0, "queue element"); \
GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0, \
"dataflow inside the queue element");
GST_BOILERPLATE_FULL (GstQueue, gst_queue, GstElement,
GST_TYPE_ELEMENT, _do_init);
static void gst_queue_finalize (GObject * object);
static void gst_queue_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_queue_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_queue_chain (GstPad * pad, GstBuffer * buffer);
static GstFlowReturn gst_queue_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf);
static GstFlowReturn gst_queue_push_one (GstQueue * queue);
static void gst_queue_loop (GstPad * pad);
static gboolean gst_queue_handle_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_queue_acceptcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_queue_getcaps (GstPad * pad);
static GstPadLinkReturn gst_queue_link_sink (GstPad * pad, GstPad * peer);
static GstPadLinkReturn gst_queue_link_src (GstPad * pad, GstPad * peer);
static void gst_queue_locked_flush (GstQueue * queue);
static gboolean gst_queue_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_queue_sink_activate_push (GstPad * pad, gboolean active);
static gboolean gst_queue_is_empty (GstQueue * queue);
static gboolean gst_queue_is_filled (GstQueue * queue);
#define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ())
static GType
queue_leaky_get_type (void)
{
static GType queue_leaky_type = 0;
static const GEnumValue queue_leaky[] = {
{GST_QUEUE_NO_LEAK, "Not Leaky", "no"},
{GST_QUEUE_LEAK_UPSTREAM, "Leaky on upstream (new buffers)", "upstream"},
{GST_QUEUE_LEAK_DOWNSTREAM, "Leaky on downstream (old buffers)",
"downstream"},
{0, NULL, NULL},
};
if (!queue_leaky_type) {
queue_leaky_type = g_enum_register_static ("GstQueueLeaky", queue_leaky);
}
return queue_leaky_type;
}
static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
static void
gst_queue_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (gstelement_class,
"Queue",
"Generic", "Simple data queue", "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
}
static void
gst_queue_class_init (GstQueueClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_queue_set_property;
gobject_class->get_property = gst_queue_get_property;
/* signals */
/**
* GstQueue::underrun:
* @queue: the queue instance
*
* Reports that the buffer became empty (underrun).
* A buffer is empty if the total amount of data inside it (num-buffers, time,
* size) is lower than the boundary values which can be set through the
* GObject properties.
*/
gst_queue_signals[SIGNAL_UNDERRUN] =
g_signal_new ("underrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstQueueClass, underrun), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* GstQueue::running:
* @queue: the queue instance
*
* Reports that enough (min-threshold) data is in the queue. Use this signal
* together with the underrun signal to pause the pipeline on underrun and
* wait for the queue to fill-up before resume playback.
*/
gst_queue_signals[SIGNAL_RUNNING] =
g_signal_new ("running", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstQueueClass, running), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* GstQueue::overrun:
* @queue: the queue instance
*
* Reports that the buffer became full (overrun).
* A buffer is full if the total amount of data inside it (num-buffers, time,
* size) is higher than the boundary values which can be set through the
* GObject properties.
*/
gst_queue_signals[SIGNAL_OVERRUN] =
g_signal_new ("overrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstQueueClass, overrun), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* GstQueue::pushing:
* @queue: the queue instance
*
* Reports when the queue has enough data to start pushing data again on the
* source pad.
*/
gst_queue_signals[SIGNAL_PUSHING] =
g_signal_new ("pushing", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstQueueClass, pushing), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/* properties */
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BYTES,
g_param_spec_uint ("current-level-bytes", "Current level (kB)",
"Current amount of data in the queue (bytes)",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BUFFERS,
g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
"Current number of buffers in the queue",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_TIME,
g_param_spec_uint64 ("current-level-time", "Current level (ns)",
"Current amount of data in the queue (in ns)",
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BYTES,
g_param_spec_uint ("max-size-bytes", "Max. size (kB)",
"Max. amount of data in the queue (bytes, 0=disable)",
0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BUFFERS,
g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
"Max. number of buffers in the queue (0=disable)", 0, G_MAXUINT,
DEFAULT_MAX_SIZE_BUFFERS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_TIME,
g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
"Max. amount of data in the queue (in ns, 0=disable)", 0, G_MAXUINT64,
DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_BYTES,
g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)",
"Min. amount of data in the queue to allow reading (bytes, 0=disable)",
0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_BUFFERS,
g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)",
"Min. number of buffers in the queue to allow reading (0=disable)",
0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_TIME,
g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)",
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LEAKY,
g_param_spec_enum ("leaky", "Leaky",
"Where the queue leaks, if at all",
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstQueue:silent
*
* Don't emit queue signals. Makes queues more lightweight if no signals are
* needed.
*
* Since: 0.10.31
*/
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent",
"Don't emit queue signals", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gobject_class->finalize = gst_queue_finalize;
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_chain);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_sink_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_handle_sink_event);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_sink);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_getcaps);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_acceptcaps);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_bufferalloc);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_src_activate_push);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_src);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_handle_src_event);
GST_DEBUG_REGISTER_FUNCPTR (gst_queue_handle_src_query);
}
static void
gst_queue_init (GstQueue * queue, GstQueueClass * g_class)
{
queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
gst_pad_set_chain_function (queue->sinkpad, gst_queue_chain);
gst_pad_set_activatepush_function (queue->sinkpad,
gst_queue_sink_activate_push);
gst_pad_set_event_function (queue->sinkpad, gst_queue_handle_sink_event);
gst_pad_set_link_function (queue->sinkpad, gst_queue_link_sink);
gst_pad_set_getcaps_function (queue->sinkpad, gst_queue_getcaps);
gst_pad_set_acceptcaps_function (queue->sinkpad, gst_queue_acceptcaps);
gst_pad_set_bufferalloc_function (queue->sinkpad, gst_queue_bufferalloc);
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
gst_pad_set_activatepush_function (queue->srcpad,
gst_queue_src_activate_push);
gst_pad_set_link_function (queue->srcpad, gst_queue_link_src);
gst_pad_set_acceptcaps_function (queue->srcpad, gst_queue_acceptcaps);
gst_pad_set_getcaps_function (queue->srcpad, gst_queue_getcaps);
gst_pad_set_event_function (queue->srcpad, gst_queue_handle_src_event);
gst_pad_set_query_function (queue->srcpad, gst_queue_handle_src_query);
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
GST_QUEUE_CLEAR_LEVEL (queue->cur_level);
queue->max_size.buffers = DEFAULT_MAX_SIZE_BUFFERS;
queue->max_size.bytes = DEFAULT_MAX_SIZE_BYTES;
queue->max_size.time = DEFAULT_MAX_SIZE_TIME;
GST_QUEUE_CLEAR_LEVEL (queue->min_threshold);
GST_QUEUE_CLEAR_LEVEL (queue->orig_min_threshold);
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
queue->head_needs_discont = queue->tail_needs_discont = FALSE;
queue->leaky = GST_QUEUE_NO_LEAK;
queue->srcresult = GST_FLOW_WRONG_STATE;
queue->qlock = g_mutex_new ();
queue->item_add = g_cond_new ();
queue->item_del = g_cond_new ();
g_queue_init (&queue->queue);
queue->sinktime = GST_CLOCK_TIME_NONE;
queue->srctime = GST_CLOCK_TIME_NONE;
queue->sink_tainted = TRUE;
queue->src_tainted = TRUE;
queue->newseg_applied_to_src = FALSE;
GST_DEBUG_OBJECT (queue,
"initialized queue's not_empty & not_full conditions");
}
/* called only once, as opposed to dispose */
static void
gst_queue_finalize (GObject * object)
{
GstMiniObject *data;
GstQueue *queue = GST_QUEUE (object);
GST_DEBUG_OBJECT (queue, "finalizing queue");
while ((data = g_queue_pop_head (&queue->queue)))
gst_mini_object_unref (data);
g_queue_clear (&queue->queue);
g_mutex_free (queue->qlock);
g_cond_free (queue->item_add);
g_cond_free (queue->item_del);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
gst_queue_acceptcaps (GstPad * pad, GstCaps * caps)
{
gboolean result;
GstQueue *queue;
GstPad *otherpad;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return FALSE;
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_accept_caps (otherpad, caps);
gst_object_unref (queue);
return result;
}
static GstCaps *
gst_queue_getcaps (GstPad * pad)
{
GstQueue *queue;
GstPad *otherpad;
GstCaps *result;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return gst_caps_new_any ();
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_get_caps (otherpad);
if (result == NULL)
result = gst_caps_new_any ();
gst_object_unref (queue);
return result;
}
static GstPadLinkReturn
gst_queue_link_sink (GstPad * pad, GstPad * peer)
{
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
gst_queue_link_src (GstPad * pad, GstPad * peer)
{
GstPadLinkReturn result = GST_PAD_LINK_OK;
GstQueue *queue;
queue = GST_QUEUE (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (queue, "queue linking source pad");
if (GST_PAD_LINKFUNC (peer)) {
result = GST_PAD_LINKFUNC (peer) (peer, pad);
}
if (GST_PAD_LINK_SUCCESSFUL (result)) {
GST_QUEUE_MUTEX_LOCK (queue);
if (queue->srcresult == GST_FLOW_OK) {
queue->push_newsegment = TRUE;
gst_pad_start_task (pad, (GstTaskFunction) gst_queue_loop, pad);
GST_DEBUG_OBJECT (queue, "starting task as pad is linked");
} else {
GST_DEBUG_OBJECT (queue, "not starting task reason %s",
gst_flow_get_name (queue->srcresult));
}
GST_QUEUE_MUTEX_UNLOCK (queue);
}
gst_object_unref (queue);
return result;
}
static GstFlowReturn
gst_queue_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
GstBuffer ** buf)
{
GstQueue *queue;
GstFlowReturn result;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return GST_FLOW_WRONG_STATE;
/* Forward to src pad, without setting caps on the src pad */
result = gst_pad_alloc_buffer (queue->srcpad, offset, size, caps, buf);
gst_object_unref (queue);
return result;
}
/* calculate the diff between running time on the sink and src of the queue.
* This is the total amount of time in the queue. */
static void
update_time_level (GstQueue * queue)
{
gint64 sink_time, src_time;
if (queue->sink_tainted) {
queue->sinktime =
gst_segment_to_running_time (&queue->sink_segment, GST_FORMAT_TIME,
queue->sink_segment.last_stop);
queue->sink_tainted = FALSE;
}
sink_time = queue->sinktime;
if (queue->src_tainted) {
queue->srctime =
gst_segment_to_running_time (&queue->src_segment, GST_FORMAT_TIME,
queue->src_segment.last_stop);
queue->src_tainted = FALSE;
}
src_time = queue->srctime;
GST_LOG_OBJECT (queue, "sink %" GST_TIME_FORMAT ", src %" GST_TIME_FORMAT,
GST_TIME_ARGS (sink_time), GST_TIME_ARGS (src_time));
if (sink_time >= src_time)
queue->cur_level.time = sink_time - src_time;
else
queue->cur_level.time = 0;
}
/* take a NEWSEGMENT event and apply the values to segment, updating the time
* level of queue. */
static void
apply_segment (GstQueue * queue, GstEvent * event, GstSegment * segment,
gboolean sink)
{
gboolean update;
GstFormat format;
gdouble rate, arate;
gint64 start, stop, time;
gst_event_parse_new_segment_full (event, &update, &rate, &arate,
&format, &start, &stop, &time);
/* now configure the values, we use these to track timestamps on the
* sinkpad. */
if (format != GST_FORMAT_TIME) {
/* non-time format, pretent the current time segment is closed with a
* 0 start and unknown stop time. */
update = FALSE;
format = GST_FORMAT_TIME;
start = 0;
stop = -1;
time = 0;
}
gst_segment_set_newsegment_full (segment, update,
rate, arate, format, start, stop, time);
if (sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
GST_DEBUG_OBJECT (queue,
"configured NEWSEGMENT %" GST_SEGMENT_FORMAT, segment);
/* segment can update the time level of the queue */
update_time_level (queue);
}
/* take a buffer and update segment, updating the time level of the queue. */
static void
apply_buffer (GstQueue * queue, GstBuffer * buffer, GstSegment * segment,
gboolean with_duration, gboolean sink)
{
GstClockTime duration, timestamp;
timestamp = GST_BUFFER_TIMESTAMP (buffer);
duration = GST_BUFFER_DURATION (buffer);
/* if no timestamp is set, assume it's continuous with the previous
* time */
if (timestamp == GST_CLOCK_TIME_NONE)
timestamp = segment->last_stop;
/* add duration */
if (with_duration && duration != GST_CLOCK_TIME_NONE)
timestamp += duration;
GST_LOG_OBJECT (queue, "last_stop updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
gst_segment_set_last_stop (segment, GST_FORMAT_TIME, timestamp);
if (sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (queue);
}
static void
gst_queue_locked_flush (GstQueue * queue)
{
GstMiniObject *data;
while ((data = g_queue_pop_head (&queue->queue))) {
/* Then lose another reference because we are supposed to destroy that
data when flushing */
gst_mini_object_unref (data);
}
GST_QUEUE_CLEAR_LEVEL (queue->cur_level);
queue->min_threshold.buffers = queue->orig_min_threshold.buffers;
queue->min_threshold.bytes = queue->orig_min_threshold.bytes;
queue->min_threshold.time = queue->orig_min_threshold.time;
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
queue->head_needs_discont = queue->tail_needs_discont = FALSE;
queue->sinktime = queue->srctime = GST_CLOCK_TIME_NONE;
queue->sink_tainted = queue->src_tainted = TRUE;
/* we deleted a lot of something */
GST_QUEUE_SIGNAL_DEL (queue);
}
/* enqueue an item an update the level stats, with QUEUE_LOCK */
static inline void
gst_queue_locked_enqueue_buffer (GstQueue * queue, gpointer item)
{
GstBuffer *buffer = GST_BUFFER_CAST (item);
/* add buffer to the statistics */
queue->cur_level.buffers++;
queue->cur_level.bytes += GST_BUFFER_SIZE (buffer);
apply_buffer (queue, buffer, &queue->sink_segment, TRUE, TRUE);
g_queue_push_tail (&queue->queue, item);
GST_QUEUE_SIGNAL_ADD (queue);
}
static inline void
gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item)
{
GstEvent *event = GST_EVENT_CAST (item);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* Zero the thresholds, this makes sure the queue is completely
* filled and we can read all data from the queue. */
GST_QUEUE_CLEAR_LEVEL (queue->min_threshold);
/* mark the queue as EOS. This prevents us from accepting more data. */
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "got EOS from upstream");
queue->eos = TRUE;
break;
case GST_EVENT_NEWSEGMENT:
apply_segment (queue, event, &queue->sink_segment, TRUE);
/* if the queue is empty, apply sink segment on the source */
if (queue->queue.length == 0) {
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "Apply segment on srcpad");
apply_segment (queue, event, &queue->src_segment, FALSE);
queue->newseg_applied_to_src = TRUE;
}
/* a new segment allows us to accept more buffers if we got UNEXPECTED
* from downstream */
queue->unexpected = FALSE;
break;
default:
break;
}
g_queue_push_tail (&queue->queue, item);
GST_QUEUE_SIGNAL_ADD (queue);
}
/* dequeue an item from the queue and update level stats, with QUEUE_LOCK */
static GstMiniObject *
gst_queue_locked_dequeue (GstQueue * queue, gboolean * is_buffer)
{
GstMiniObject *item;
item = g_queue_pop_head (&queue->queue);
if (item == NULL)
goto no_item;
if (GST_IS_BUFFER (item)) {
GstBuffer *buffer = GST_BUFFER_CAST (item);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"retrieved buffer %p from queue", buffer);
queue->cur_level.buffers--;
queue->cur_level.bytes -= GST_BUFFER_SIZE (buffer);
apply_buffer (queue, buffer, &queue->src_segment, TRUE, FALSE);
/* if the queue is empty now, update the other side */
if (queue->cur_level.buffers == 0)
queue->cur_level.time = 0;
*is_buffer = TRUE;
} else if (GST_IS_EVENT (item)) {
GstEvent *event = GST_EVENT_CAST (item);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"retrieved event %p from queue", event);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* queue is empty now that we dequeued the EOS */
GST_QUEUE_CLEAR_LEVEL (queue->cur_level);
break;
case GST_EVENT_NEWSEGMENT:
/* apply newsegment if it has not already been applied */
if (G_LIKELY (!queue->newseg_applied_to_src)) {
apply_segment (queue, event, &queue->src_segment, FALSE);
} else {
queue->newseg_applied_to_src = FALSE;
}
break;
default:
break;
}
*is_buffer = FALSE;
} else {
g_warning
("Unexpected item %p dequeued from queue %s (refcounting problem?)",
item, GST_OBJECT_NAME (queue));
item = NULL;
}
GST_QUEUE_SIGNAL_DEL (queue);
return item;
/* ERRORS */
no_item:
{
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "the queue is empty");
return NULL;
}
}
static gboolean
gst_queue_handle_sink_event (GstPad * pad, GstEvent * event)
{
GstQueue *queue;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL)) {
gst_event_unref (event);
return FALSE;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
{
STATUS (queue, pad, "received flush start event");
/* forward event */
gst_pad_push_event (queue->srcpad, event);
/* now unblock the chain function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
/* unblock the loop and chain functions */
GST_QUEUE_SIGNAL_ADD (queue);
GST_QUEUE_SIGNAL_DEL (queue);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* make sure it pauses, this should happen since we sent
* flush_start downstream. */
gst_pad_pause_task (queue->srcpad);
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "loop stopped");
goto done;
}
case GST_EVENT_FLUSH_STOP:
{
STATUS (queue, pad, "received flush stop event");
/* forward event */
gst_pad_push_event (queue->srcpad, event);
GST_QUEUE_MUTEX_LOCK (queue);
gst_queue_locked_flush (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
if (gst_pad_is_linked (queue->srcpad)) {
gst_pad_start_task (queue->srcpad, (GstTaskFunction) gst_queue_loop,
queue->srcpad);
} else {
GST_INFO_OBJECT (queue, "not re-starting task as pad is not linked");
}
GST_QUEUE_MUTEX_UNLOCK (queue);
STATUS (queue, pad, "after flush");
goto done;
}
default:
if (GST_EVENT_IS_SERIALIZED (event)) {
/* serialized events go in the queue */
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
/* refuse more events on EOS */
if (queue->eos)
goto out_eos;
gst_queue_locked_enqueue_event (queue, event);
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* non-serialized events are passed upstream. */
gst_pad_push_event (queue->srcpad, event);
}
break;
}
done:
gst_object_unref (queue);
return TRUE;
/* ERRORS */
out_flushing:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"refusing event, we are flushing");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_object_unref (queue);
gst_event_unref (event);
return FALSE;
}
out_eos:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "refusing event, we are EOS");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_object_unref (queue);
gst_event_unref (event);
return FALSE;
}
}
static gboolean
gst_queue_is_empty (GstQueue * queue)
{
if (queue->queue.length == 0)
return TRUE;
/* It is possible that a max size is reached before all min thresholds are.
* Therefore, only consider it empty if it is not filled. */
return ((queue->min_threshold.buffers > 0 &&
queue->cur_level.buffers < queue->min_threshold.buffers) ||
(queue->min_threshold.bytes > 0 &&
queue->cur_level.bytes < queue->min_threshold.bytes) ||
(queue->min_threshold.time > 0 &&
queue->cur_level.time < queue->min_threshold.time)) &&
!gst_queue_is_filled (queue);
}
static gboolean
gst_queue_is_filled (GstQueue * queue)
{
return (((queue->max_size.buffers > 0 &&
queue->cur_level.buffers >= queue->max_size.buffers) ||
(queue->max_size.bytes > 0 &&
queue->cur_level.bytes >= queue->max_size.bytes) ||
(queue->max_size.time > 0 &&
queue->cur_level.time >= queue->max_size.time)));
}
static void
gst_queue_leak_downstream (GstQueue * queue)
{
/* for as long as the queue is filled, dequeue an item and discard it */
while (gst_queue_is_filled (queue)) {
GstMiniObject *leak;
gboolean is_buffer;
leak = gst_queue_locked_dequeue (queue, &is_buffer);
/* there is nothing to dequeue and the queue is still filled.. This should
* not happen */
g_assert (leak != NULL);
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
"queue is full, leaking item %p on downstream end", leak);
gst_mini_object_unref (leak);
/* last buffer needs to get a DISCONT flag */
queue->head_needs_discont = TRUE;
}
}
static GstFlowReturn
gst_queue_chain (GstPad * pad, GstBuffer * buffer)
{
GstQueue *queue;
GstClockTime duration, timestamp;
queue = (GstQueue *) GST_OBJECT_PARENT (pad);
/* we have to lock the queue since we span threads */
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
/* when we received EOS, we refuse any more data */
if (queue->eos)
goto out_eos;
if (queue->unexpected)
goto out_unexpected;
timestamp = GST_BUFFER_TIMESTAMP (buffer);
duration = GST_BUFFER_DURATION (buffer);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"received buffer %p of size %d, time %" GST_TIME_FORMAT ", duration %"
GST_TIME_FORMAT, buffer, GST_BUFFER_SIZE (buffer),
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
/* We make space available if we're "full" according to whatever
* the user defined as "full". Note that this only applies to buffers.
* We always handle events and they don't count in our statistics. */
while (gst_queue_is_filled (queue)) {
if (!queue->silent) {
GST_QUEUE_MUTEX_UNLOCK (queue);
g_signal_emit (queue, gst_queue_signals[SIGNAL_OVERRUN], 0);
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
/* we recheck, the signal could have changed the thresholds */
if (!gst_queue_is_filled (queue))
break;
}
/* how are we going to make space for this buffer? */
switch (queue->leaky) {
case GST_QUEUE_LEAK_UPSTREAM:
/* next buffer needs to get a DISCONT flag */
queue->tail_needs_discont = TRUE;
/* leak current buffer */
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
"queue is full, leaking buffer on upstream end");
/* now we can clean up and exit right away */
goto out_unref;
case GST_QUEUE_LEAK_DOWNSTREAM:
gst_queue_leak_downstream (queue);
break;
default:
g_warning ("Unknown leaky type, using default");
/* fall-through */
case GST_QUEUE_NO_LEAK:
{
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
"queue is full, waiting for free space");
/* don't leak. Instead, wait for space to be available */
do {
/* for as long as the queue is filled, wait till an item was deleted. */
GST_QUEUE_WAIT_DEL_CHECK (queue, out_flushing);
} while (gst_queue_is_filled (queue));
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not full");
if (!queue->silent) {
GST_QUEUE_MUTEX_UNLOCK (queue);
g_signal_emit (queue, gst_queue_signals[SIGNAL_RUNNING], 0);
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
}
break;
}
}
}
if (queue->tail_needs_discont) {
GstBuffer *subbuffer = gst_buffer_make_metadata_writable (buffer);
if (subbuffer) {
buffer = subbuffer;
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
} else {
GST_DEBUG_OBJECT (queue, "Could not mark buffer as DISCONT");
}
queue->tail_needs_discont = FALSE;
}
/* put buffer in queue now */
gst_queue_locked_enqueue_buffer (queue, buffer);
GST_QUEUE_MUTEX_UNLOCK (queue);
return GST_FLOW_OK;
/* special conditions */
out_unref:
{
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_buffer_unref (buffer);
return GST_FLOW_OK;
}
out_flushing:
{
GstFlowReturn ret = queue->srcresult;
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"exit because task paused, reason: %s", gst_flow_get_name (ret));
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_buffer_unref (buffer);
return ret;
}
out_eos:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_buffer_unref (buffer);
return GST_FLOW_UNEXPECTED;
}
out_unexpected:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"exit because we received UNEXPECTED");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_buffer_unref (buffer);
return GST_FLOW_UNEXPECTED;
}
}
static void
gst_queue_push_newsegment (GstQueue * queue)
{
GstSegment *s;
GstEvent *event;
s = &queue->src_segment;
if (s->accum != 0) {
event = gst_event_new_new_segment_full (FALSE, 1.0, 1.0, s->format, 0,
s->accum, 0);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pushing accum newsegment event");
gst_pad_push_event (queue->srcpad, event);
}
event = gst_event_new_new_segment_full (FALSE, s->rate, s->applied_rate,
s->format, s->start, s->stop, s->time);
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "pushing real newsegment event");
gst_pad_push_event (queue->srcpad, event);
}
/* dequeue an item from the queue an push it downstream. This functions returns
* the result of the push. */
static GstFlowReturn
gst_queue_push_one (GstQueue * queue)
{
GstFlowReturn result = GST_FLOW_OK;
GstMiniObject *data;
gboolean is_buffer;
data = gst_queue_locked_dequeue (queue, &is_buffer);
if (data == NULL)
goto no_item;
next:
if (is_buffer) {
GstBuffer *buffer;
GstCaps *caps;
buffer = GST_BUFFER_CAST (data);
if (queue->head_needs_discont) {
GstBuffer *subbuffer = gst_buffer_make_metadata_writable (buffer);
if (subbuffer) {
buffer = subbuffer;
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
} else {
GST_DEBUG_OBJECT (queue, "Could not mark buffer as DISCONT");
}
queue->head_needs_discont = FALSE;
}
caps = GST_BUFFER_CAPS (buffer);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* set the right caps on the pad now. We do this before pushing the buffer
* because the pad_push call will check (using acceptcaps) if the buffer can
* be set on the pad, which might fail because this will be propagated
* upstream. Also note that if the buffer has NULL caps, it means that the
* caps did not change, so we don't have to change caps on the pad. */
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
gst_pad_set_caps (queue->srcpad, caps);
if (queue->push_newsegment) {
gst_queue_push_newsegment (queue);
}
result = gst_pad_push (queue->srcpad, buffer);
/* need to check for srcresult here as well */
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
if (result == GST_FLOW_UNEXPECTED) {
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"got UNEXPECTED from downstream");
/* stop pushing buffers, we dequeue all items until we see an item that we
* can push again, which is EOS or NEWSEGMENT. If there is nothing in the
* queue we can push, we set a flag to make the sinkpad refuse more
* buffers with an UNEXPECTED return value. */
while ((data = gst_queue_locked_dequeue (queue, &is_buffer))) {
if (is_buffer) {
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"dropping UNEXPECTED buffer %p", data);
gst_buffer_unref (GST_BUFFER_CAST (data));
} else {
GstEvent *event = GST_EVENT_CAST (data);
GstEventType type = GST_EVENT_TYPE (event);
if (type == GST_EVENT_EOS || type == GST_EVENT_NEWSEGMENT) {
/* we found a pushable item in the queue, push it out */
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pushing pushable event %s after UNEXPECTED",
GST_EVENT_TYPE_NAME (event));
goto next;
}
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"dropping UNEXPECTED event %p", event);
gst_event_unref (event);
}
}
/* no more items in the queue. Set the unexpected flag so that upstream
* make us refuse any more buffers on the sinkpad. Since we will still
* accept EOS and NEWSEGMENT we return _FLOW_OK to the caller so that the
* task function does not shut down. */
queue->unexpected = TRUE;
result = GST_FLOW_OK;
}
} else {
GstEvent *event = GST_EVENT_CAST (data);
GstEventType type = GST_EVENT_TYPE (event);
GST_QUEUE_MUTEX_UNLOCK (queue);
if (queue->push_newsegment && type != GST_EVENT_NEWSEGMENT) {
gst_queue_push_newsegment (queue);
}
gst_pad_push_event (queue->srcpad, event);
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
/* if we're EOS, return UNEXPECTED so that the task pauses. */
if (type == GST_EVENT_EOS) {
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pushed EOS event %p, return UNEXPECTED", event);
result = GST_FLOW_UNEXPECTED;
}
}
return result;
/* ERRORS */
no_item:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"exit because we have no item in the queue");
return GST_FLOW_ERROR;
}
out_flushing:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we are flushing");
return GST_FLOW_WRONG_STATE;
}
}
static void
gst_queue_loop (GstPad * pad)
{
GstQueue *queue;
GstFlowReturn ret;
queue = (GstQueue *) GST_PAD_PARENT (pad);
/* have to lock for thread-safety */
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
while (gst_queue_is_empty (queue)) {
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is empty");
if (!queue->silent) {
GST_QUEUE_MUTEX_UNLOCK (queue);
g_signal_emit (queue, gst_queue_signals[SIGNAL_UNDERRUN], 0);
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
}
/* we recheck, the signal could have changed the thresholds */
while (gst_queue_is_empty (queue)) {
GST_QUEUE_WAIT_ADD_CHECK (queue, out_flushing);
}
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not empty");
if (!queue->silent) {
GST_QUEUE_MUTEX_UNLOCK (queue);
g_signal_emit (queue, gst_queue_signals[SIGNAL_RUNNING], 0);
g_signal_emit (queue, gst_queue_signals[SIGNAL_PUSHING], 0);
GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing);
}
}
ret = gst_queue_push_one (queue);
queue->push_newsegment = FALSE;
queue->srcresult = ret;
if (ret != GST_FLOW_OK)
goto out_flushing;
GST_QUEUE_MUTEX_UNLOCK (queue);
return;
/* ERRORS */
out_flushing:
{
gboolean eos = queue->eos;
GstFlowReturn ret = queue->srcresult;
gst_pad_pause_task (queue->srcpad);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pause task, reason: %s", gst_flow_get_name (ret));
GST_QUEUE_SIGNAL_DEL (queue);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* let app know about us giving up if upstream is not expected to do so */
/* UNEXPECTED is already taken care of elsewhere */
if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED)) {
GST_ELEMENT_ERROR (queue, STREAM, FAILED,
(_("Internal data flow error.")),
("streaming task paused, reason %s (%d)",
gst_flow_get_name (ret), ret));
gst_pad_push_event (queue->srcpad, gst_event_new_eos ());
}
return;
}
}
static gboolean
gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
{
gboolean res = TRUE;
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL)) {
gst_event_unref (event);
return FALSE;
}
#ifndef GST_DISABLE_GST_DEBUG
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%d)",
event, GST_EVENT_TYPE (event));
#endif
res = gst_pad_push_event (queue->sinkpad, event);
gst_object_unref (queue);
return res;
}
static gboolean
gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
{
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
GstPad *peer;
gboolean res;
if (G_UNLIKELY (queue == NULL))
return FALSE;
if (!(peer = gst_pad_get_peer (queue->sinkpad))) {
gst_object_unref (queue);
return FALSE;
}
res = gst_pad_query (peer, query);
gst_object_unref (peer);
if (!res) {
gst_object_unref (queue);
return FALSE;
}
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
gint64 peer_pos;
GstFormat format;
/* get peer position */
gst_query_parse_position (query, &format, &peer_pos);
/* FIXME: this code assumes that there's no discont in the queue */
switch (format) {
case GST_FORMAT_BYTES:
peer_pos -= queue->cur_level.bytes;
break;
case GST_FORMAT_TIME:
peer_pos -= queue->cur_level.time;
break;
default:
GST_DEBUG_OBJECT (queue, "Can't adjust query in %s format, don't "
"know how to adjust value", gst_format_get_name (format));
return TRUE;
}
/* set updated position */
gst_query_set_position (query, format, peer_pos);
break;
}
case GST_QUERY_LATENCY:
{
gboolean live;
GstClockTime min, max;
gst_query_parse_latency (query, &live, &min, &max);
/* we can delay up to the limit of the queue in time. If we have no time
* limit, the best thing we can do is to return an infinite delay. In
* reality a better estimate would be the byte/buffer rate but that is not
* possible right now. */
if (queue->max_size.time > 0 && max != -1)
max += queue->max_size.time;
else
max = -1;
/* adjust for min-threshold */
if (queue->min_threshold.time > 0 && min != -1)
min += queue->min_threshold.time;
gst_query_set_latency (query, live, min, max);
break;
}
default:
/* peer handled other queries */
break;
}
gst_object_unref (queue);
return TRUE;
}
static gboolean
gst_queue_sink_activate_push (GstPad * pad, gboolean active)
{
gboolean result = TRUE;
GstQueue *queue;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock chain function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
gst_queue_locked_flush (queue);
GST_QUEUE_MUTEX_UNLOCK (queue);
}
gst_object_unref (queue);
return result;
}
static gboolean
gst_queue_src_activate_push (GstPad * pad, gboolean active)
{
gboolean result = FALSE;
GstQueue *queue;
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (active) {
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
queue->eos = FALSE;
queue->unexpected = FALSE;
/* we do not start the task yet if the pad is not connected */
if (gst_pad_is_linked (pad))
result = gst_pad_start_task (pad, (GstTaskFunction) gst_queue_loop, pad);
else {
GST_INFO_OBJECT (queue, "not starting task as pad is not linked");
result = TRUE;
}
GST_QUEUE_MUTEX_UNLOCK (queue);
} else {
/* step 1, unblock loop function */
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
/* the item add signal will unblock */
g_cond_signal (queue->item_add);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* step 2, make sure streaming finishes */
result = gst_pad_stop_task (pad);
}
gst_object_unref (queue);
return result;
}
static void
queue_capacity_change (GstQueue * queue)
{
if (queue->leaky == GST_QUEUE_LEAK_DOWNSTREAM) {
gst_queue_leak_downstream (queue);
}
/* changing the capacity of the queue must wake up
* the _chain function, it might have more room now
* to store the buffer/event in the queue */
GST_QUEUE_SIGNAL_DEL (queue);
}
/* Changing the minimum required fill level must
* wake up the _loop function as it might now
* be able to preceed.
*/
#define QUEUE_THRESHOLD_CHANGE(q)\
GST_QUEUE_SIGNAL_ADD (q);
static void
gst_queue_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstQueue *queue = GST_QUEUE (object);
/* someone could change levels here, and since this
* affects the get/put funcs, we need to lock for safety. */
GST_QUEUE_MUTEX_LOCK (queue);
switch (prop_id) {
case PROP_MAX_SIZE_BYTES:
queue->max_size.bytes = g_value_get_uint (value);
queue_capacity_change (queue);
break;
case PROP_MAX_SIZE_BUFFERS:
queue->max_size.buffers = g_value_get_uint (value);
queue_capacity_change (queue);
break;
case PROP_MAX_SIZE_TIME:
queue->max_size.time = g_value_get_uint64 (value);
queue_capacity_change (queue);
break;
case PROP_MIN_THRESHOLD_BYTES:
queue->min_threshold.bytes = g_value_get_uint (value);
queue->orig_min_threshold.bytes = queue->min_threshold.bytes;
QUEUE_THRESHOLD_CHANGE (queue);
break;
case PROP_MIN_THRESHOLD_BUFFERS:
queue->min_threshold.buffers = g_value_get_uint (value);
queue->orig_min_threshold.buffers = queue->min_threshold.buffers;
QUEUE_THRESHOLD_CHANGE (queue);
break;
case PROP_MIN_THRESHOLD_TIME:
queue->min_threshold.time = g_value_get_uint64 (value);
queue->orig_min_threshold.time = queue->min_threshold.time;
QUEUE_THRESHOLD_CHANGE (queue);
break;
case PROP_LEAKY:
queue->leaky = g_value_get_enum (value);
break;
case PROP_SILENT:
queue->silent = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_QUEUE_MUTEX_UNLOCK (queue);
}
static void
gst_queue_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstQueue *queue = GST_QUEUE (object);
GST_QUEUE_MUTEX_LOCK (queue);
switch (prop_id) {
case PROP_CUR_LEVEL_BYTES:
g_value_set_uint (value, queue->cur_level.bytes);
break;
case PROP_CUR_LEVEL_BUFFERS:
g_value_set_uint (value, queue->cur_level.buffers);
break;
case PROP_CUR_LEVEL_TIME:
g_value_set_uint64 (value, queue->cur_level.time);
break;
case PROP_MAX_SIZE_BYTES:
g_value_set_uint (value, queue->max_size.bytes);
break;
case PROP_MAX_SIZE_BUFFERS:
g_value_set_uint (value, queue->max_size.buffers);
break;
case PROP_MAX_SIZE_TIME:
g_value_set_uint64 (value, queue->max_size.time);
break;
case PROP_MIN_THRESHOLD_BYTES:
g_value_set_uint (value, queue->min_threshold.bytes);
break;
case PROP_MIN_THRESHOLD_BUFFERS:
g_value_set_uint (value, queue->min_threshold.buffers);
break;
case PROP_MIN_THRESHOLD_TIME:
g_value_set_uint64 (value, queue->min_threshold.time);
break;
case PROP_LEAKY:
g_value_set_enum (value, queue->leaky);
break;
case PROP_SILENT:
g_value_set_boolean (value, queue->silent);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_QUEUE_MUTEX_UNLOCK (queue);
}
|
ylatuya/gstreamer
|
plugins/elements/gstqueue.c
|
C
|
lgpl-2.1
| 52,053
|
/*
* JRoadMap - https://jroadmap.dev.java.net/
* Copyright (C) 2007 Fernando Boaflio (boaglio at gmail dot com)
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.boaglio.jroadmap.controller.service;
import java.util.List;
import com.boaglio.jroadmap.model.dao.PlanDAO;
import com.boaglio.jroadmap.model.pojo.Plan;
import com.boaglio.jroadmap.model.vo.PlanVO;
public class PlanServiceImpl implements PlanService {
private PlanDAO planDAO;
public void delete(Integer planId) {
planDAO.delete(planId);
}
public List findAll() {
return planDAO.findAll();
}
public Plan getById(Integer id) {
return planDAO.getById(id);
}
public void publish(Plan plan) {
planDAO.add(plan);
}
public void update(Plan plan) {
planDAO.update(plan);
}
public PlanDAO getPlanVODAO() {
return planDAO;
}
public void setPlanVODAO(PlanDAO planDAO) {
this.planDAO = planDAO;
}
}
|
boaglio/jroadmap
|
src/main/java/com/boaglio/jroadmap/controller/service/PlanServiceImpl.java
|
Java
|
lgpl-2.1
| 1,748
|
// xiva (acronym for HTTP Extended EVent Automata) is a simple HTTP server.
// Copyright (C) 2009 Yandex <highpower@yandex.ru>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef XIVA_PYTHON_PYTHON_SETTINGS_HPP_INCLUDED
#define XIVA_PYTHON_PYTHON_SETTINGS_HPP_INCLUDED
#include <string>
#include <boost/python.hpp>
#include "xiva/settings.hpp"
namespace py = boost::python;
namespace xiva { namespace python {
class python_settings : public settings {
public:
python_settings(py::object const &impl);
virtual ~python_settings();
virtual std::string address() const;
virtual unsigned short port() const;
virtual unsigned short backlog() const;
virtual std::string ssl_address() const;
virtual unsigned short ssl_port() const;
virtual unsigned short ssl_backlog() const;
virtual std::string ssl_cert_file_name() const;
virtual std::string ssl_cacert_file_name() const;
virtual unsigned int read_timeout() const;
virtual unsigned int write_timeout() const;
virtual unsigned int inactive_timeout() const;
virtual unsigned int ping_interval() const;
virtual unsigned short handler_threads() const;
virtual unsigned short listener_threads() const;
virtual std::string policy_file_name() const;
virtual std::string value(char const *name) const;
virtual enumeration<std::string>::ptr_type value_list(char const *prefix) const;
private:
python_settings(python_settings const &);
python_settings& operator = (python_settings const &);
template <typename Result> Result get(char const *method, Result const &defval) const;
private:
py::object impl_;
};
}} // namespaces
#endif // XIVA_PYTHON_PYTHON_SETTINGS_HPP_INCLUDED
|
highpower/xiva
|
python/python_settings.hpp
|
C++
|
lgpl-2.1
| 2,325
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library 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.1 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
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// <h1>FEMSystem Example 1 - Unsteady Navier-Stokes Equations with
// FEMSystem</h1>
// \author Roy Stogner
// \date 2006
//
// This example shows how the transient nonlinear problem from
// example 13 can be solved using the
// DifferentiableSystem class framework
// C++ includes
#include <iomanip>
// Basic include files
#include "libmesh/equation_systems.h"
#include "libmesh/error_vector.h"
#include "libmesh/getpot.h"
#include "libmesh/exodusII_io.h"
#include "libmesh/kelly_error_estimator.h"
#include "libmesh/mesh.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/mesh_refinement.h"
#include "libmesh/uniform_refinement_estimator.h"
#include "libmesh/auto_ptr.h" // libmesh_make_unique
// The systems and solvers we may use
#include "naviersystem.h"
#include "libmesh/diff_solver.h"
#include "libmesh/euler_solver.h"
#include "libmesh/steady_solver.h"
// Bring in everything from the libMesh namespace
using namespace libMesh;
// The main program.
int main (int argc, char ** argv)
{
// Initialize libMesh.
LibMeshInit init (argc, argv);
// This example requires a linear solver package.
libmesh_example_requires(libMesh::default_solver_package() != INVALID_SOLVER_PACKAGE,
"--enable-petsc, --enable-trilinos, or --enable-eigen");
// This example fails without at least double precision FP
#ifdef LIBMESH_DEFAULT_SINGLE_PRECISION
libmesh_example_requires(false, "--disable-singleprecision");
#endif
#ifndef LIBMESH_ENABLE_AMR
libmesh_example_requires(false, "--enable-amr");
#else
// Trilinos and Eigen solvers NaN by default here.
// We'll skip this example for now.
libmesh_example_requires(libMesh::default_solver_package() != EIGEN_SOLVERS, "--enable-petsc");
libmesh_example_requires(libMesh::default_solver_package() != TRILINOS_SOLVERS, "--enable-petsc");
// Parse the input file
GetPot infile("fem_system_ex1.in");
// Read in parameters from the input file
const Real global_tolerance = infile("global_tolerance", 0.);
const unsigned int nelem_target = infile("n_elements", 400);
const bool transient = infile("transient", true);
const Real deltat = infile("deltat", 0.005);
unsigned int n_timesteps = infile("n_timesteps", 20);
const unsigned int coarsegridsize = infile("coarsegridsize", 1);
const unsigned int coarserefinements = infile("coarserefinements", 0);
const unsigned int max_adaptivesteps = infile("max_adaptivesteps", 10);
const unsigned int dim = infile("dimension", 2);
#ifdef LIBMESH_HAVE_EXODUS_API
const unsigned int write_interval = infile("write_interval", 5);
#endif
// Skip higher-dimensional examples on a lower-dimensional libMesh build
libmesh_example_requires(dim <= LIBMESH_DIM, "2D/3D support");
// We have only defined 2 and 3 dimensional problems
libmesh_assert (dim == 2 || dim == 3);
// Create a mesh, with dimension to be overridden later, distributed
// across the default MPI communicator.
Mesh mesh(init.comm());
// And an object to refine it
MeshRefinement mesh_refinement(mesh);
mesh_refinement.coarsen_by_parents() = true;
mesh_refinement.absolute_global_tolerance() = global_tolerance;
mesh_refinement.nelem_target() = nelem_target;
mesh_refinement.refine_fraction() = 0.3;
mesh_refinement.coarsen_fraction() = 0.3;
mesh_refinement.coarsen_threshold() = 0.1;
// Use the MeshTools::Generation mesh generator to create a uniform
// grid on the square [-1,1]^D. We instruct the mesh generator
// to build a mesh of 8x8 Quad9 elements in 2D, or Hex27
// elements in 3D. Building these higher-order elements allows
// us to use higher-order approximation, as in example 3.
if (dim == 2)
MeshTools::Generation::build_square (mesh,
coarsegridsize,
coarsegridsize,
0., 1.,
0., 1.,
QUAD9);
else if (dim == 3)
MeshTools::Generation::build_cube (mesh,
coarsegridsize,
coarsegridsize,
coarsegridsize,
0., 1.,
0., 1.,
0., 1.,
HEX27);
mesh_refinement.uniformly_refine(coarserefinements);
// Print information about the mesh to the screen.
mesh.print_info();
// Create an equation systems object.
EquationSystems equation_systems (mesh);
// Declare the system "Navier-Stokes" and its variables.
NavierSystem & system =
equation_systems.add_system<NavierSystem> ("Navier-Stokes");
// Solve this as a time-dependent or steady system
if (transient)
system.time_solver = libmesh_make_unique<EulerSolver>(system);
else
{
system.time_solver = libmesh_make_unique<SteadySolver>(system);
libmesh_assert_equal_to (n_timesteps, 1);
}
// Initialize the system
equation_systems.init ();
// Set the time stepping options
system.deltat = deltat;
// And the nonlinear solver options
DiffSolver & solver = *(system.time_solver->diff_solver().get());
solver.quiet = infile("solver_quiet", true);
solver.verbose = !solver.quiet;
solver.max_nonlinear_iterations =
infile("max_nonlinear_iterations", 15);
solver.relative_step_tolerance =
infile("relative_step_tolerance", 1.e-3);
solver.relative_residual_tolerance =
infile("relative_residual_tolerance", 0.0);
solver.absolute_residual_tolerance =
infile("absolute_residual_tolerance", 0.0);
// And the linear solver options
solver.max_linear_iterations =
infile("max_linear_iterations", 50000);
solver.initial_linear_tolerance =
infile("initial_linear_tolerance", 1.e-3);
// Print information about the system to the screen.
equation_systems.print_info();
// Now we begin the timestep loop to compute the time-accurate
// solution of the equations.
for (unsigned int t_step=0; t_step != n_timesteps; ++t_step)
{
// A pretty update message
libMesh::out << "\n\nSolving time step "
<< t_step
<< ", time = "
<< system.time
<< std::endl;
// Adaptively solve the timestep
unsigned int a_step = 0;
for (; a_step != max_adaptivesteps; ++a_step)
{
system.solve();
system.postprocess();
ErrorVector error;
std::unique_ptr<ErrorEstimator> error_estimator;
// To solve to a tolerance in this problem we
// need a better estimator than Kelly
if (global_tolerance != 0.)
{
// We can't adapt to both a tolerance and a mesh
// size at once
libmesh_assert_equal_to (nelem_target, 0);
UniformRefinementEstimator * u = new UniformRefinementEstimator;
// The lid-driven cavity problem isn't in H1, so
// lets estimate L2 error
u->error_norm = L2;
error_estimator.reset(u);
}
else
{
// If we aren't adapting to a tolerance we need a
// target mesh size
libmesh_assert_greater (nelem_target, 0);
// Kelly is a lousy estimator to use for a problem
// not in H1 - if we were doing more than a few
// timesteps we'd need to turn off or limit the
// maximum level of our adaptivity eventually
error_estimator.reset(new KellyErrorEstimator);
}
// Calculate error based on u and v (and w?) but not p
std::vector<Real> weights(2,1.0); // u, v
if (dim == 3)
weights.push_back(1.0); // w
weights.push_back(0.0); // p
// Keep the same default norm type.
std::vector<FEMNormType>
norms(1, error_estimator->error_norm.type(0));
error_estimator->error_norm = SystemNorm(norms, weights);
error_estimator->estimate_error(system, error);
// Print out status at each adaptive step.
Real global_error = error.l2_norm();
libMesh::out << "Adaptive step "
<< a_step
<< ": "
<< std::endl;
if (global_tolerance != 0.)
libMesh::out << "Global_error = "
<< global_error
<< std::endl;
if (global_tolerance != 0.)
libMesh::out << "Worst element error = "
<< error.maximum()
<< ", mean = "
<< error.mean()
<< std::endl;
if (global_tolerance != 0.)
{
// If we've reached our desired tolerance, we
// don't need any more adaptive steps
if (global_error < global_tolerance)
break;
mesh_refinement.flag_elements_by_error_tolerance(error);
}
else
{
// If flag_elements_by_nelem_target returns true, this
// should be our last adaptive step.
if (mesh_refinement.flag_elements_by_nelem_target(error))
{
mesh_refinement.refine_and_coarsen_elements();
equation_systems.reinit();
a_step = max_adaptivesteps;
break;
}
}
// Carry out the adaptive mesh refinement/coarsening
mesh_refinement.refine_and_coarsen_elements();
equation_systems.reinit();
libMesh::out << "Refined mesh to "
<< mesh.n_active_elem()
<< " active elements and "
<< equation_systems.n_active_dofs()
<< " active dofs."
<< std::endl;
}
// Do one last solve if necessary
if (a_step == max_adaptivesteps)
{
system.solve();
system.postprocess();
}
// Advance to the next timestep in a transient problem
system.time_solver->advance_timestep();
#ifdef LIBMESH_HAVE_EXODUS_API
// Write out this timestep if we're requested to
if ((t_step+1)%write_interval == 0)
{
std::ostringstream file_name;
// We write the file in the ExodusII format.
file_name << "out_"
<< std::setw(3)
<< std::setfill('0')
<< std::right
<< t_step+1
<< ".e";
ExodusII_IO(mesh).write_timestep(file_name.str(),
equation_systems,
1, // This number indicates how many time steps
// are being written to the file
system.time);
}
#endif // #ifdef LIBMESH_HAVE_EXODUS_API
}
#endif // #ifndef LIBMESH_ENABLE_AMR
// All done.
return 0;
}
|
balborian/libmesh
|
examples/fem_system/fem_system_ex1/fem_system_ex1.C
|
C++
|
lgpl-2.1
| 12,237
|
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This 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.1 of
* the License, or (at your option) any later version.
*
* This software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.crypto.params.cipher.asymmetric;
/**
* Public key parameters.
*
* @version $Id$
* @since 5.4M1
*/
public interface PublicKeyParameters extends AsymmetricKeyParameters
{
}
|
xwiki/xwiki-commons
|
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-common/src/main/java/org/xwiki/crypto/params/cipher/asymmetric/PublicKeyParameters.java
|
Java
|
lgpl-2.1
| 1,089
|
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
#include "WebPage.h"
#include "ArgumentCoders.h"
#include "Connection.h"
#if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE)
#include "DummyType.h"
#endif
#include "HandleMessage.h"
#if PLATFORM(MAC)
#include "MachPort.h"
#endif
#include "MessageDecoder.h"
#include "Plugin.h"
#include "WebCoreArgumentCoders.h"
#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
#include "WebEvent.h"
#endif
#include "WebPageMessages.h"
#include "WebPreferencesStore.h"
#include <WebCore/GraphicsLayer.h>
#if PLATFORM(MAC)
#include <WebCore/KeyboardEvent.h>
#endif
#include <WebCore/PluginData.h>
#include <utility>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace Messages {
namespace WebPage {
GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
: m_connection(connection)
, m_encoder(WTFMove(encoder))
{
}
GetPluginProcessConnection::DelayedReply::~DelayedReply()
{
ASSERT(!m_connection);
}
bool GetPluginProcessConnection::DelayedReply::send(const IPC::Connection::Handle& connectionHandle)
{
ASSERT(m_encoder);
*m_encoder << connectionHandle;
bool _result = m_connection->sendSyncReply(WTFMove(m_encoder));
m_connection = nullptr;
return _result;
}
TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)
: m_connection(connection)
, m_encoder(WTFMove(encoder))
{
}
TestMultipleAttributes::DelayedReply::~DelayedReply()
{
ASSERT(!m_connection);
}
bool TestMultipleAttributes::DelayedReply::send()
{
ASSERT(m_encoder);
bool _result = m_connection->sendSyncReply(WTFMove(m_encoder));
m_connection = nullptr;
return _result;
}
} // namespace WebPage
} // namespace Messages
namespace WebKit {
void WebPage::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder)
{
if (decoder.messageName() == Messages::WebPage::LoadURL::name()) {
IPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL);
return;
}
#if ENABLE(TOUCH_EVENTS)
if (decoder.messageName() == Messages::WebPage::LoadSomething::name()) {
IPC::handleMessage<Messages::WebPage::LoadSomething>(decoder, this, &WebPage::loadSomething);
return;
}
#endif
#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
if (decoder.messageName() == Messages::WebPage::TouchEvent::name()) {
IPC::handleMessage<Messages::WebPage::TouchEvent>(decoder, this, &WebPage::touchEvent);
return;
}
#endif
#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
if (decoder.messageName() == Messages::WebPage::AddEvent::name()) {
IPC::handleMessage<Messages::WebPage::AddEvent>(decoder, this, &WebPage::addEvent);
return;
}
#endif
#if ENABLE(TOUCH_EVENTS)
if (decoder.messageName() == Messages::WebPage::LoadSomethingElse::name()) {
IPC::handleMessage<Messages::WebPage::LoadSomethingElse>(decoder, this, &WebPage::loadSomethingElse);
return;
}
#endif
if (decoder.messageName() == Messages::WebPage::DidReceivePolicyDecision::name()) {
IPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(decoder, this, &WebPage::didReceivePolicyDecision);
return;
}
if (decoder.messageName() == Messages::WebPage::Close::name()) {
IPC::handleMessage<Messages::WebPage::Close>(decoder, this, &WebPage::close);
return;
}
if (decoder.messageName() == Messages::WebPage::PreferencesDidChange::name()) {
IPC::handleMessage<Messages::WebPage::PreferencesDidChange>(decoder, this, &WebPage::preferencesDidChange);
return;
}
if (decoder.messageName() == Messages::WebPage::SendDoubleAndFloat::name()) {
IPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(decoder, this, &WebPage::sendDoubleAndFloat);
return;
}
if (decoder.messageName() == Messages::WebPage::SendInts::name()) {
IPC::handleMessage<Messages::WebPage::SendInts>(decoder, this, &WebPage::sendInts);
return;
}
if (decoder.messageName() == Messages::WebPage::TestParameterAttributes::name()) {
IPC::handleMessage<Messages::WebPage::TestParameterAttributes>(decoder, this, &WebPage::testParameterAttributes);
return;
}
if (decoder.messageName() == Messages::WebPage::TemplateTest::name()) {
IPC::handleMessage<Messages::WebPage::TemplateTest>(decoder, this, &WebPage::templateTest);
return;
}
if (decoder.messageName() == Messages::WebPage::SetVideoLayerID::name()) {
IPC::handleMessage<Messages::WebPage::SetVideoLayerID>(decoder, this, &WebPage::setVideoLayerID);
return;
}
#if PLATFORM(MAC)
if (decoder.messageName() == Messages::WebPage::DidCreateWebProcessConnection::name()) {
IPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(decoder, this, &WebPage::didCreateWebProcessConnection);
return;
}
#endif
#if ENABLE(DEPRECATED_FEATURE)
if (decoder.messageName() == Messages::WebPage::DeprecatedOperation::name()) {
IPC::handleMessage<Messages::WebPage::DeprecatedOperation>(decoder, this, &WebPage::deprecatedOperation);
return;
}
#endif
#if ENABLE(EXPERIMENTAL_FEATURE)
if (decoder.messageName() == Messages::WebPage::ExperimentalOperation::name()) {
IPC::handleMessage<Messages::WebPage::ExperimentalOperation>(decoder, this, &WebPage::experimentalOperation);
return;
}
#endif
UNUSED_PARAM(connection);
UNUSED_PARAM(decoder);
ASSERT_NOT_REACHED();
}
void WebPage::didReceiveSyncMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
{
if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) {
IPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin);
return;
}
if (decoder.messageName() == Messages::WebPage::RunJavaScriptAlert::name()) {
IPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(decoder, *replyEncoder, this, &WebPage::runJavaScriptAlert);
return;
}
if (decoder.messageName() == Messages::WebPage::GetPlugins::name()) {
IPC::handleMessage<Messages::WebPage::GetPlugins>(decoder, *replyEncoder, this, &WebPage::getPlugins);
return;
}
if (decoder.messageName() == Messages::WebPage::GetPluginProcessConnection::name()) {
IPC::handleMessageDelayed<Messages::WebPage::GetPluginProcessConnection>(connection, decoder, replyEncoder, this, &WebPage::getPluginProcessConnection);
return;
}
if (decoder.messageName() == Messages::WebPage::TestMultipleAttributes::name()) {
IPC::handleMessageDelayed<Messages::WebPage::TestMultipleAttributes>(connection, decoder, replyEncoder, this, &WebPage::testMultipleAttributes);
return;
}
#if PLATFORM(MAC)
if (decoder.messageName() == Messages::WebPage::InterpretKeyEvent::name()) {
IPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(decoder, *replyEncoder, this, &WebPage::interpretKeyEvent);
return;
}
#endif
UNUSED_PARAM(connection);
UNUSED_PARAM(decoder);
UNUSED_PARAM(replyEncoder);
ASSERT_NOT_REACHED();
}
} // namespace WebKit
#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
|
annulen/qtwebkit-snapshots
|
Source/WebKit2/Scripts/webkit/MessageReceiver-expected.cpp
|
C++
|
lgpl-2.1
| 9,148
|
<?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: index.php 57940 2016-03-17 19:24:00Z jyhem $
// This redirects to the sites root to prevent directory browsing
header("location: ../../index.php");
die;
|
XavierSolerFR/diem25tiki
|
templates/tablesorter/index.php
|
PHP
|
lgpl-2.1
| 421
|
// function fn_moveElement(elementID,finalX,finalY,interval){
// if (!document.getElementById && !document.getElementById("elementID")) {
// return false;
// }
// var elem=document.getElementById(elementID);
// var xPos=parseInt(elem.style.left);
// var yPos=parseInt(elem.style.top);
// if (xPos===finalX&&yPos===finalY) {
// return true;
// }
// if (xPos<finalX) {
// xPos++;
// }
// if (xPos>finalX) {
// xPos--;
// }
// if (yPos<finalY) {
// yPos++;
// }
// if (yPos>finalY) {
// yPos--;
// }
// elem.style.left=xPos+"px";
// elem.style.top=yPos+"px";
// var repeat="moveElement('"+elementID+"',"+finalX+","+finalY+","+interval+")";
// movement=setTimeout(repeat,interval);
// }
//
function fn_positionMessage() {
// body...
if (!document.getElementById && !document.getElementById("message")) {
return false;
}
var elem=document.getElementById("message");
elem.style.position="absolute";
elem.style.left="50px";
elem.style.top="100px";
moveElement("message",125,25,10);
}
fn_addLoadEvent(fn_positionMessage);
function moveElement(elementID,finalX,finalY,interval){
if (!document.getElementById && !document.getElementById("elementID")) {
return false;
}
var elem=document.getElementById(elementID);
var xPos=parseInt(elem.style.left);
var yPos=parseInt(elem.style.top);
if (xPos===finalX&&yPos===finalY) {
return true;
}
if (xPos<finalX) {
xPos++;
}
if (xPos>finalX) {
xPos--;
}
if (yPos<finalY) {
yPos++;
}
if (yPos>finalY) {
yPos--;
}
elem.style.left=xPos+"px";
elem.style.top=yPos+"px";
var repeat="moveElement('"+elementID+"',"+finalX+","+finalY+","+interval+")";
movement=setTimeout(repeat,interval);
}
|
weixianpin/test
|
JavaScriptDOM编程艺术/chapter10/JS/positionMessage.js
|
JavaScript
|
lgpl-2.1
| 1,687
|
/*
* jingle-mint.c - creates and configures a GabbleJingleFactory
* Copyright ©2012 Collabora Ltd.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*
* "Mint" is intended in the manufacturing sense: a mint is a factory which
* produces coins. <http://en.wikipedia.org/wiki/Mint_(coin)>. It was chosen
* in favour of "factory" because this is a "factory factory"; and in favour of
* "foundry" to make JingleFactory and this class have different initials.
*/
#include "jingle-mint.h"
#define DEBUG_FLAG GABBLE_DEBUG_MEDIA
#include "debug.h"
#include "connection.h"
#include "conn-presence.h"
#include "jingle-factory.h"
#include "jingle-session.h"
#include "presence-cache.h"
struct _GabbleJingleMintPrivate {
GabbleConnection *conn;
GabbleJingleFactory *factory;
};
enum {
INCOMING_SESSION = 0,
N_SIGNALS
};
static guint signals[N_SIGNALS];
enum
{
PROP_CONNECTION = 1,
};
static void connection_status_changed_cb (
GabbleConnection *conn,
guint status,
guint reason,
gpointer user_data);
static void connection_porter_available_cb (
GabbleConnection *conn,
WockyPorter *porter,
gpointer user_data);
static void factory_new_session_cb (
GabbleJingleFactory *factory,
GabbleJingleSession *session,
gboolean initiated_locally,
gpointer user_data);
static gboolean factory_query_cap_cb (
GabbleJingleFactory *factory,
WockyContact *contact,
const gchar *cap_or_quirk,
gpointer user_data);
G_DEFINE_TYPE (GabbleJingleMint, gabble_jingle_mint, G_TYPE_OBJECT)
static void
gabble_jingle_mint_init (GabbleJingleMint *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GABBLE_TYPE_JINGLE_MINT,
GabbleJingleMintPrivate);
}
static void
gabble_jingle_mint_get_property (
GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (object);
GabbleJingleMintPrivate *priv = self->priv;
switch (property_id)
{
case PROP_CONNECTION:
g_value_set_object (value, priv->conn);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
gabble_jingle_mint_set_property (
GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (object);
GabbleJingleMintPrivate *priv = self->priv;
switch (property_id)
{
case PROP_CONNECTION:
priv->conn = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
gabble_jingle_mint_constructed (GObject *object)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (object);
GabbleJingleMintPrivate *priv = self->priv;
GObjectClass *parent_class = gabble_jingle_mint_parent_class;
if (parent_class->constructed != NULL)
parent_class->constructed (object);
tp_g_signal_connect_object (priv->conn, "status-changed",
(GCallback) connection_status_changed_cb, self, 0);
tp_g_signal_connect_object (priv->conn, "porter-available",
(GCallback) connection_porter_available_cb, self, 0);
}
static void
gabble_jingle_mint_dispose (GObject *object)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (object);
GabbleJingleMintPrivate *priv = self->priv;
GObjectClass *parent_class = gabble_jingle_mint_parent_class;
g_clear_object (&priv->factory);
if (parent_class->dispose != NULL)
parent_class->dispose (object);
}
static void
gabble_jingle_mint_class_init (GabbleJingleMintClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *param_spec;
object_class->get_property = gabble_jingle_mint_get_property;
object_class->set_property = gabble_jingle_mint_set_property;
object_class->constructed = gabble_jingle_mint_constructed;
object_class->dispose = gabble_jingle_mint_dispose;
g_type_class_add_private (klass, sizeof (GabbleJingleMintPrivate));
param_spec = g_param_spec_object ("connection", "GabbleConnection object",
"Gabble connection object that uses this JingleMint object",
GABBLE_TYPE_CONNECTION,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
signals[INCOMING_SESSION] = g_signal_new ("incoming-session",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, GABBLE_TYPE_JINGLE_SESSION);
}
GabbleJingleMint *
gabble_jingle_mint_new (
GabbleConnection *connection)
{
return g_object_new (GABBLE_TYPE_JINGLE_MINT,
"connection", connection,
NULL);
}
static void
connection_status_changed_cb (
GabbleConnection *conn,
guint status,
guint reason,
gpointer user_data)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (user_data);
GabbleJingleMintPrivate *priv = self->priv;
switch (status)
{
case TP_CONNECTION_STATUS_CONNECTING:
g_assert (priv->conn != NULL);
break;
case TP_CONNECTION_STATUS_CONNECTED:
{
GabbleJingleInfo *info = gabble_jingle_mint_get_info (self);
gchar *stun_server = NULL;
guint stun_port = 0;
g_object_get (priv->conn,
"stun-server", &stun_server,
"stun-port", &stun_port,
NULL);
if (stun_server != NULL)
gabble_jingle_info_take_stun_server (info,
stun_server, stun_port, FALSE);
g_object_get (priv->conn,
"fallback-stun-server", &stun_server,
"fallback-stun-port", &stun_port,
NULL);
if (stun_server != NULL)
gabble_jingle_info_take_stun_server (info,
stun_server, stun_port, TRUE);
if (priv->conn->features &
GABBLE_CONNECTION_FEATURES_GOOGLE_JINGLE_INFO)
{
gabble_jingle_info_send_request (info);
}
}
break;
case TP_CONNECTION_STATUS_DISCONNECTED:
if (priv->factory != NULL)
gabble_jingle_factory_stop (priv->factory);
break;
}
}
static void
connection_porter_available_cb (
GabbleConnection *conn,
WockyPorter *porter,
gpointer user_data)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (user_data);
GabbleJingleMintPrivate *priv = self->priv;
/* If we have a WockyPorter, we should definitely have a WockySession */
g_assert (conn->session != NULL);
g_assert (priv->factory == NULL);
priv->factory = gabble_jingle_factory_new (conn->session);
tp_g_signal_connect_object (priv->factory, "new-session",
(GCallback) factory_new_session_cb, self, 0);
tp_g_signal_connect_object (priv->factory, "query-cap",
(GCallback) factory_query_cap_cb, self, 0);
}
static void
session_about_to_initiate_cb (
GabbleJingleSession *session,
gpointer user_data)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (user_data);
GabbleJingleMintPrivate *priv = self->priv;
const gchar *peer_jid = gabble_jingle_session_get_peer_jid (session);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
(TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
TpHandle peer = tp_handle_ensure (contact_repo, peer_jid, NULL, NULL);
/* send directed presence (including our own caps, avatar etc.) to
* the peer, if we aren't already visible to them */
if (!conn_presence_visible_to (priv->conn, peer))
conn_presence_signal_own_presence (priv->conn, peer_jid, NULL);
}
static void
factory_new_session_cb (
GabbleJingleFactory *factory,
GabbleJingleSession *session,
gboolean initiated_locally,
gpointer user_data)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (user_data);
if (initiated_locally)
tp_g_signal_connect_object (session, "about-to-initiate",
(GCallback) session_about_to_initiate_cb, self, 0);
/* Proxy the signal outwards if this is a new incoming session. */
if (!initiated_locally)
g_signal_emit (self, signals[INCOMING_SESSION], 0, session);
}
static gboolean
factory_query_cap_cb (
GabbleJingleFactory *factory,
WockyContact *contact,
const gchar *cap_or_quirk,
gpointer user_data)
{
GabbleJingleMint *self = GABBLE_JINGLE_MINT (user_data);
GabbleJingleMintPrivate *priv = self->priv;
GabblePresence *presence = gabble_presence_cache_get_for_contact (
priv->conn->presence_cache, contact);
if (presence == NULL)
return FALSE;
if (WOCKY_IS_RESOURCE_CONTACT (contact))
{
const gchar *peer_resource = wocky_resource_contact_get_resource (
WOCKY_RESOURCE_CONTACT (contact));
return gabble_presence_resource_has_caps (presence, peer_resource,
gabble_capability_set_predicate_has, cap_or_quirk);
}
else
{
return gabble_presence_has_cap (presence, cap_or_quirk);
}
}
GabbleJingleFactory *
gabble_jingle_mint_get_factory (
GabbleJingleMint *self)
{
return self->priv->factory;
}
GabbleJingleInfo *
gabble_jingle_mint_get_info (
GabbleJingleMint *self)
{
return gabble_jingle_factory_get_jingle_info (self->priv->factory);
}
|
mlundblad/telepathy-gabble
|
src/jingle-mint.c
|
C
|
lgpl-2.1
| 9,926
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="1"> </td>
<td class="postheader" valign="center">
<a href="index.html">
<font color="#004faf">Home</font></a> ·
<a href="classes.html">
<font color="#004faf">All Classes</font></a> ·
<a href="namespaces.html">
<font color="#004faf">All Namespaces</font></a> ·
<a href="modules.html">
<font color="#004faf">Modules</font></a> ·
<a href="functions.html">
<font color="#004faf">Functions</font></a> ·
<a href="files.html">
<font color="#004faf">Files</font></a>
</td>
</tr>
</table>
<!-- Generated by Doxygen 1.7.5 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="a00655.html">Tp</a> </li>
<li class="navelem"><a class="el" href="a00361.html">SimpleCallObserver</a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Tp::SimpleCallObserver Member List</div> </div>
</div>
<div class="contents">
This is the complete list of members for <a class="el" href="a00361.html">Tp::SimpleCallObserver</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="a00361.html#a5cb4db5e9da32cd9600bb6f96bdad089">account</a>() const </td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#blockSignals">blockSignals</a>(bool block)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#af228184fac78b39b0a11775d13987a57">CallDirection</a> enum name</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#af228184fac78b39b0a11775d13987a57afda9b5f637110570a664a9a4ed82bd41">CallDirectionBoth</a> enum value</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#af228184fac78b39b0a11775d13987a57a11582abca95d2634cf630aede9684215">CallDirectionIncoming</a> enum value</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#af228184fac78b39b0a11775d13987a57a80229d03595171d4cd8735a7b3737660">CallDirectionOutgoing</a> enum value</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#checkConnectArgs">checkConnectArgs</a>(const char *signal, const QObject *object, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#child">child</a>(const char *objName, const char *inheritsClass, bool recursiveSearch) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#childEvent">childEvent</a>(QChildEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#children">children</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#className">className</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect">connect</a>(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect-2">connect</a>(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connect-3">connect</a>(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#connectNotify">connectNotify</a>(const char *signal)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#a616b07b43343e9b382d604dea3556743">contactIdentifier</a>() const </td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#afbccd8b64b3eda96a992f6b5cadf7b42">create</a>(const AccountPtr &account, CallDirection direction=CallDirectionBoth)</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#a9a72405936afe6f7769e26fa53fce7b3">create</a>(const AccountPtr &account, const ContactPtr &contact, CallDirection direction=CallDirectionBoth)</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#a66d9f03294552eccd8be2c104296333b">create</a>(const AccountPtr &account, const QString &contactIdentifier, CallDirection direction=CallDirectionBoth)</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#customEvent">customEvent</a>(QEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#deleteLater">deleteLater</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00336.html#ab76182f103a5b026d92e01b22a63c84a">deref</a>() const </td><td><a class="el" href="a00336.html">Tp::RefCounted</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#destroyed">destroyed</a>(QObject *obj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#ad28a5bc0308e9e08c5eda325ab02bbb0">direction</a>() const </td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect">disconnect</a>(const QObject *sender, const char *signal, const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-2">disconnect</a>(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-3">disconnect</a>(const char *signal, const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnect-4">disconnect</a>(const QObject *receiver, const char *method)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#disconnectNotify">disconnectNotify</a>(const char *signal)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dumpObjectInfo">dumpObjectInfo</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dumpObjectTree">dumpObjectTree</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dynamicPropertyNames">dynamicPropertyNames</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#event">event</a>(QEvent *e)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#eventFilter">eventFilter</a>(QObject *watched, QEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChild">findChild</a>(const QString &name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChildren">findChildren</a>(const QString &name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#findChildren-2">findChildren</a>(const QRegExp &regExp) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#inherits">inherits</a>(const char *className) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#insertChild">insertChild</a>(QObject *object)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#installEventFilter">installEventFilter</a>(QObject *filterObj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#isA">isA</a>(const char *className) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#isWidgetType">isWidgetType</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#killTimer">killTimer</a>(int id)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#metaObject">metaObject</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#moveToThread">moveToThread</a>(QThread *targetThread)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#name">name</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#name-2">name</a>(const char *defaultName) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#normalizeSignalSlot">normalizeSignalSlot</a>(const char *signalSlot)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">objectName</a></td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">objectName</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#parent">parent</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#property">property</a>(const char *name) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#QObject">QObject</a>(QObject *parent)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#QObject-3">QObject</a>(QObject *parent, const char *name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#receivers">receivers</a>(const char *signal) const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00336.html#a9aba496ce91d68a147c9a7c6d29c2095">ref</a>() const </td><td><a class="el" href="a00336.html">Tp::RefCounted</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00336.html#ace03ea74806fd9a180b8863ae23c838c">RefCounted</a>()</td><td><a class="el" href="a00336.html">Tp::RefCounted</a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#removeChild">removeChild</a>(QObject *object)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#removeEventFilter">removeEventFilter</a>(QObject *obj)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#sender">sender</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#senderSignalIndex">senderSignalIndex</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject-qt3.html#setName">setName</a>(const char *name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#objectName-prop">setObjectName</a>(const QString &name)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#setParent">setParent</a>(QObject *parent)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#setProperty">setProperty</a>(const char *name, const QVariant &value)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#signalsBlocked">signalsBlocked</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#startTimer">startTimer</a>(int interval)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#a73f129b605d4a91ef15858cdaf60a1c5">streamedMediaCallEnded</a>(const Tp::StreamedMediaChannelPtr &channel, const QString &errorName, const QString &errorMessage)</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [signal]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#a43041e2aa9859c607c912016c02bb40c">streamedMediaCalls</a>() const </td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#af3300d394f47220c23d293366e271035">streamedMediaCallStarted</a>(const Tp::StreamedMediaChannelPtr &channel)</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [signal]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00336.html#a76c6988cd2e89252a44e0b89893eb416">strongref</a></td><td><a class="el" href="a00336.html">Tp::RefCounted</a></td><td><code> [mutable]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#thread">thread</a>() const</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#timerEvent">timerEvent</a>(QTimerEvent *event)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [protected, virtual]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#tr">tr</a>(const char *sourceText, const char *disambiguation, int n)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#trUtf8">trUtf8</a>(const char *sourceText, const char *disambiguation, int n)</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [static]</code></td></tr>
<tr class="memlist"><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html#dtor.QObject">~QObject</a>()</td><td><a class="elRef" doxygen="qt.tags:/you/forgot/to/run/installdox" href="/you/forgot/to/run/installdox/qobject.html">QObject</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00336.html#a56b3618d2e02f6999c77da00d4e1bfd4">~RefCounted</a>()</td><td><a class="el" href="a00336.html">Tp::RefCounted</a></td><td><code> [inline, virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00361.html#ac5fb12b263c1cf21579b29f97faa90fb">~SimpleCallObserver</a>()</td><td><a class="el" href="a00361.html">Tp::SimpleCallObserver</a></td><td><code> [virtual]</code></td></tr>
</table></div>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation</td>
<td width="30%" align="right"><div align="right">Telepathy-Qt4 0.8.0</div></td>
</tr></table></div></address>
</body>
</html>
|
Telekinesis/Telepathy-qt4-0.8.0
|
doc/html/a00809.html
|
HTML
|
lgpl-2.1
| 27,720
|
/**
*
* Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
**/
package lucee.runtime.functions.dynamicEvaluation;
import lucee.runtime.PageContext;
import lucee.runtime.exp.PageException;
import lucee.runtime.ext.function.Function;
/**
* Implements the CFML Function evaluate
*/
public final class PrecisionEvaluate implements Function {
public static Object call(PageContext pc, Object[] objs) throws PageException {
return Evaluate.call(pc, objs, true);
}
}
|
lucee/Lucee
|
core/src/main/java/lucee/runtime/functions/dynamicEvaluation/PrecisionEvaluate.java
|
Java
|
lgpl-2.1
| 1,166
|
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, save_data, contains_word
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_dataraster_coloring():
srs = '+init=epsg:32630'
lyr = mapnik.Layer('dataraster')
lyr.datasource = mapnik.Gdal(
file = '../data/raster/dataraster.tif',
band = 1,
)
lyr.srs = srs
_map = mapnik.Map(256,256, srs)
style = mapnik.Style()
rule = mapnik.Rule()
sym = mapnik.RasterSymbolizer()
# Assigning a colorizer to the RasterSymbolizer tells the later
# that it should use it to colorize the raw data raster
sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color("transparent"))
for value, color in [
( 0, "#0044cc"),
( 10, "#00cc00"),
( 20, "#ffff00"),
( 30, "#ff7f00"),
( 40, "#ff0000"),
( 50, "#ff007f"),
( 60, "#ff00ff"),
( 70, "#cc00cc"),
( 80, "#990099"),
( 90, "#660066"),
( 200, "transparent"),
]:
sym.colorizer.add_stop(value, mapnik.Color(color))
rule.symbols.append(sym)
style.rules.append(rule)
_map.append_style('foo', style)
lyr.styles.append('foo')
_map.layers.append(lyr)
_map.zoom_to_box(lyr.envelope())
im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im)
# save a png somewhere so we can see it
save_data('test_dataraster_coloring.png', im.tostring('png'))
imdata = im.tostring()
# we have some values in the [20,30) interval so check that they're colored
assert contains_word('\xff\xff\x00\xff', imdata)
def test_dataraster_query_point():
srs = '+init=epsg:32630'
lyr = mapnik.Layer('dataraster')
lyr.datasource = mapnik.Gdal(
file = '../data/raster/dataraster.tif',
band = 1,
)
lyr.srs = srs
_map = mapnik.Map(256,256, srs)
_map.layers.append(lyr)
# point inside raster extent with valid data
x, y = 427417, 4477517
features = _map.query_point(0,x,y).features
assert len(features) == 1
feat = features[0]
center = feat.envelope().center()
assert center.x==x and center.y==y, center
value = feat['value']
assert value == 21.0, value
# point outside raster extent
features = _map.query_point(0,-427417,4477517).features
assert len(features) == 0
# point inside raster extent with nodata
features = _map.query_point(0,126850,4596050).features
assert len(features) == 0
def test_load_save_map():
map = mapnik.Map(256,256)
in_map = "../data/good_maps/raster_symbolizer.xml"
mapnik.load_map(map, in_map)
out_map = mapnik.save_map_to_string(map)
assert 'RasterSymbolizer' in out_map
assert 'RasterColorizer' in out_map
assert 'stop' in out_map
def test_raster_with_alpha_blends_correctly_with_background():
WIDTH = 500
HEIGHT = 500
map = mapnik.Map(WIDTH, HEIGHT)
WHITE = mapnik.Color(255, 255, 255)
map.background = WHITE
style = mapnik.Style()
rule = mapnik.Rule()
symbolizer = mapnik.RasterSymbolizer()
#XXX: This fixes it, see http://trac.mapnik.org/ticket/759#comment:3
# (and remove comment when this test passes)
#symbolizer.scaling="bilinear_old"
rule.symbols.append(symbolizer)
style.rules.append(rule)
map.append_style('raster_style', style)
map_layer = mapnik.Layer('test_layer')
filepath = '../data/raster/white-alpha.png'
map_layer.datasource = mapnik.Gdal(file=filepath)
map_layer.styles.append('raster_style')
map.layers.append(map_layer)
map.zoom_all()
mim = mapnik.Image(WIDTH, HEIGHT)
mapnik.render(map, mim)
save_data('test_raster_with_alpha_blends_correctly_with_background.png',
mim.tostring('png'))
imdata = mim.tostring()
# All white is expected
assert contains_word('\xff\xff\xff\xff', imdata)
def test_raster_warping():
lyrSrs = "+init=epsg:32630"
mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
lyr = mapnik.Layer('dataraster', lyrSrs)
lyr.datasource = mapnik.Gdal(
file = '../data/raster/dataraster.tif',
band = 1,
)
sym = mapnik.RasterSymbolizer()
sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(255,255,0))
rule = mapnik.Rule()
rule.symbols.append(sym)
style = mapnik.Style()
style.rules.append(rule)
_map = mapnik.Map(256,256, mapSrs)
_map.append_style('foo', style)
lyr.styles.append('foo')
_map.layers.append(lyr)
prj_trans = mapnik.ProjTransform(mapnik.Projection(mapSrs),
mapnik.Projection(lyrSrs))
_map.zoom_to_box(prj_trans.backward(lyr.envelope()))
im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im)
# save a png somewhere so we can see it
save_data('test_raster_warping.png', im.tostring('png'))
imdata = im.tostring()
assert contains_word('\xff\xff\x00\xff', imdata)
def test_raster_warping_does_not_overclip_source():
lyrSrs = "+init=epsg:32630"
mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
lyr = mapnik.Layer('dataraster', lyrSrs)
lyr.datasource = mapnik.Gdal(
file = '../data/raster/dataraster.tif',
band = 1,
)
sym = mapnik.RasterSymbolizer()
sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(255,255,0))
rule = mapnik.Rule()
rule.symbols.append(sym)
style = mapnik.Style()
style.rules.append(rule)
_map = mapnik.Map(256,256, mapSrs)
_map.background=mapnik.Color('white')
_map.append_style('foo', style)
lyr.styles.append('foo')
_map.layers.append(lyr)
_map.zoom_to_box(mapnik.Box2d(3,42,4,43))
im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im)
# save a png somewhere so we can see it
save_data('test_raster_warping_does_not_overclip_source.png',
im.tostring('png'))
assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff'
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]
|
mojodna/debian-mapnik
|
tests/python_tests/raster_symbolizer_test.py
|
Python
|
lgpl-2.1
| 6,314
|
#include "MDLRoot.h"
using namespace mdl;
MDLRoot::MDLRoot()
{}
MDLRoot::~MDLRoot()
{}
void MDLRoot::addBodyPart(BodyPart *newPart)
{
// Add the new part to our list
body_parts.push_back(newPart);
}
int MDLRoot::getNumBodyParts()
{
return body_parts.size();
}
BodyPart* MDLRoot::getBodyPart(int partIndex)
{
if ((partIndex < 0) || (partIndex >= static_cast<int>(body_parts.size())))
return NULL;
else
return body_parts[partIndex];
}
|
hyyh619/OpenSceneGraph-3.4.0
|
src/osgPlugins/mdl/MDLRoot.cpp
|
C++
|
lgpl-2.1
| 481
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This 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.1 of
* the License, or (at your option) any later version.
*
* This software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.weld.deployment.processor;
import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME;
import java.util.function.Supplier;
import javax.enterprise.inject.spi.BeanManager;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.as.ee.beanvalidation.BeanValidationAttachments;
import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.as.weld.CdiValidatorFactoryService;
import org.jboss.as.weld.ServiceNames;
import org.jboss.as.weld.WeldCapability;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
/**
* Deployment processor that replaces the delegate of LazyValidatorFactory with a CDI-enabled ValidatorFactory.
*
* @author Farah Juma
* @author Martin Kouba
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class CdiBeanValidationFactoryProcessor implements DeploymentUnitProcessor {
@Override
public void deploy(DeploymentPhaseContext phaseContext) {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final DeploymentUnit topLevelDeployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
final ServiceName weldStartService = topLevelDeployment.getServiceName().append(ServiceNames.WELD_START_SERVICE_NAME);
final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
final WeldCapability weldCapability;
try {
weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class);
} catch (CapabilityServiceSupport.NoSuchCapabilityException ignored) {
return;
}
if (!weldCapability.isPartOfWeldDeployment(deploymentUnit)) {
return;
}
if (!deploymentUnit.hasAttachment(BeanValidationAttachments.VALIDATOR_FACTORY)) {
return;
}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final ServiceName serviceName = deploymentUnit.getServiceName().append(CdiValidatorFactoryService.SERVICE_NAME);
final ServiceBuilder<?> sb = serviceTarget.addService(serviceName);
final Supplier<BeanManager> beanManagerSupplier = weldCapability.addBeanManagerService(deploymentUnit, sb);
sb.requires(weldStartService);
sb.setInstance(new CdiValidatorFactoryService(deploymentUnit, beanManagerSupplier));
sb.install();
}
@Override
public void undeploy(DeploymentUnit context) {
}
}
|
tadamski/wildfly
|
weld/bean-validation/src/main/java/org/jboss/as/weld/deployment/processor/CdiBeanValidationFactoryProcessor.java
|
Java
|
lgpl-2.1
| 3,831
|
#ifndef FSTARPUFMMPRIORITIES_HPP
#define FSTARPUFMMPRIORITIES_HPP
#include "../../Utils/FGlobal.hpp"
#include "FStarPUUtils.hpp"
#include "FStarPUKernelCapacities.hpp"
/**
* @brief The FStarPUFmmPriorities class
* This class should have an static method to be called by hetero getPrio.
*/
#ifdef STARPU_SUPPORT_SCHEDULER
#include "FStarPUHeteoprio.hpp"
class FStarPUFmmPriorities{
int insertionPositionP2M;
int insertionPositionM2M;
int insertionPositionP2MSend;
int insertionPositionM2MSend;
int insertionPositionM2L;
int insertionPositionM2LExtern;
int insertionPositionM2LLastLevel;
int insertionPositionL2L;
int insertionPositionL2P;
int insertionPositionP2P;
int insertionPositionP2PExtern;
int treeHeight;
FStarPUKernelCapacities* capacities;
static FStarPUFmmPriorities controller;
FStarPUFmmPriorities(){
}
public:
static FStarPUFmmPriorities& Controller(){
return controller;
}
static void InitSchedulerCallback(unsigned sched_ctx_id, void* heteroprio){
Controller().initSchedulerCallback(sched_ctx_id, (struct _starpu_heteroprio_center_policy_heteroprio*)heteroprio);
}
void init(struct starpu_conf* conf, const int inTreeHeight,
FStarPUKernelCapacities* inCapacities){
capacities = inCapacities;
conf->sched_policy = &_starpu_sched_heteroprio_policy;
starpu_heteroprio_set_callback(&InitSchedulerCallback);
treeHeight = inTreeHeight;
if(inTreeHeight > 2){
int incPrio = 0;
FLOG( FLog::Controller << "Buckets:\n" );
insertionPositionP2MSend = incPrio++;
FLOG( FLog::Controller << "\t P2M Send " << insertionPositionP2MSend << "\n" );
insertionPositionP2M = incPrio++;
FLOG( FLog::Controller << "\t P2M " << insertionPositionP2M << "\n" );
insertionPositionM2MSend = incPrio++;
FLOG( FLog::Controller << "\t M2M Send " << insertionPositionM2MSend << "\n" );
insertionPositionM2M = incPrio++;
FLOG( FLog::Controller << "\t M2M " << insertionPositionM2M << "\n" );
insertionPositionM2L = incPrio++;
FLOG( FLog::Controller << "\t M2L " << insertionPositionM2L << "\n" );
insertionPositionM2LExtern = incPrio++;
FLOG( FLog::Controller << "\t M2L Outer " << insertionPositionM2LExtern << "\n" );
insertionPositionL2L = incPrio++;
FLOG( FLog::Controller << "\t L2L " << insertionPositionL2L << "\n" );
incPrio += (treeHeight-3) - 1; // M2L is done treeHeight-2 times
incPrio += (treeHeight-3) - 1; // M2L is done treeHeight-2 times
incPrio += (treeHeight-3) - 1; // L2L is done treeHeight-3 times
insertionPositionP2P = incPrio++;
FLOG( FLog::Controller << "\t P2P " << insertionPositionP2P << "\n" );
insertionPositionM2LLastLevel = incPrio++;
FLOG( FLog::Controller << "\t M2L last " << insertionPositionM2LLastLevel << "\n" );
insertionPositionL2P = incPrio++;
FLOG( FLog::Controller << "\t L2P " << insertionPositionL2P << "\n" );
insertionPositionP2PExtern = incPrio++;
FLOG( FLog::Controller << "\t P2P Outer " << insertionPositionP2PExtern << "\n" );
assert(incPrio == 8 + (treeHeight-3) + (treeHeight-3) + (treeHeight-3));
}
else{
int incPrio = 0;
insertionPositionP2MSend = -1;
insertionPositionP2M = -1;
insertionPositionM2MSend = -1;
insertionPositionM2M = -1;
insertionPositionM2L = -1;
insertionPositionM2LExtern = -1;
insertionPositionM2LLastLevel = -1;
insertionPositionL2L = -1;
insertionPositionP2P = incPrio++;
insertionPositionP2PExtern = insertionPositionP2P;
insertionPositionL2P = -1;
assert(incPrio == 1);
}
}
void initSchedulerCallback(unsigned /*sched_ctx_id*/,
struct _starpu_heteroprio_center_policy_heteroprio *heteroprio){
const bool workOnlyOnLeaves = (treeHeight <= 2);
#ifdef STARPU_USE_CPU
// CPU follows the real prio
{
int cpuCountPrio = 0;
if( !workOnlyOnLeaves && capacities->supportP2M(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio P2M Send " << cpuCountPrio << " bucket " << insertionPositionP2MSend << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionP2MSend;
heteroprio->buckets[insertionPositionP2MSend].valide_archs |= STARPU_CPU;
FLOG( FLog::Controller << "\t CPU prio P2M " << cpuCountPrio << " bucket " << insertionPositionP2M << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionP2M;
heteroprio->buckets[insertionPositionP2M].valide_archs |= STARPU_CPU;
}
if(!workOnlyOnLeaves && capacities->supportM2M(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio M2M Send " << cpuCountPrio << " bucket " << insertionPositionM2MSend << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionM2MSend;
heteroprio->buckets[insertionPositionM2MSend].valide_archs |= STARPU_CPU;
FLOG( FLog::Controller << "\t CPU prio M2M " << cpuCountPrio << " bucket " << insertionPositionM2M << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionM2M;
heteroprio->buckets[insertionPositionM2M].valide_archs |= STARPU_CPU;
}
for(int idxLevel = 2 ; idxLevel < treeHeight-1 ; ++idxLevel){
if(capacities->supportM2L(FSTARPU_CPU_IDX)){
const int prioM2LAtLevel = getInsertionPosM2L(idxLevel);
FLOG( FLog::Controller << "\t CPU prio M2L " << cpuCountPrio << " bucket " << prioM2LAtLevel << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = prioM2LAtLevel;
heteroprio->buckets[prioM2LAtLevel].valide_archs |= STARPU_CPU;
const int prioM2LAtLevelExtern = getInsertionPosM2LExtern(idxLevel);
FLOG( FLog::Controller << "\t CPU prio M2L extern " << cpuCountPrio << " bucket " << prioM2LAtLevelExtern << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = prioM2LAtLevelExtern;
heteroprio->buckets[prioM2LAtLevelExtern].valide_archs |= STARPU_CPU;
}
if(capacities->supportL2L(FSTARPU_CPU_IDX)){
const int prioL2LAtLevel = getInsertionPosL2L(idxLevel);
FLOG( FLog::Controller << "\t CPU prio L2L " << cpuCountPrio << " bucket " << prioL2LAtLevel << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = prioL2LAtLevel;
heteroprio->buckets[prioL2LAtLevel].valide_archs |= STARPU_CPU;
}
}
if( capacities->supportP2P(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio P2P " << cpuCountPrio << " bucket " << insertionPositionP2P << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionP2P;
heteroprio->buckets[insertionPositionP2P].valide_archs |= STARPU_CPU;
}
#ifndef STARPU_USE_REDUX
if( capacities->supportP2PExtern(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio P2P Extern " << cpuCountPrio << " bucket " << insertionPositionP2PExtern << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionP2PExtern;
heteroprio->buckets[insertionPositionP2PExtern].valide_archs |= STARPU_CPU;
}
#endif
if(capacities->supportM2L(FSTARPU_CPU_IDX)){
const int prioM2LAtLevel = getInsertionPosM2L(treeHeight-1);
FLOG( FLog::Controller << "\t CPU prio M2L " << cpuCountPrio << " bucket " << prioM2LAtLevel << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = prioM2LAtLevel;
heteroprio->buckets[prioM2LAtLevel].valide_archs |= STARPU_CPU;
}
if( !workOnlyOnLeaves && capacities->supportL2P(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio L2P " << cpuCountPrio << " bucket " << insertionPositionL2P << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionL2P;
heteroprio->buckets[insertionPositionL2P].valide_archs |= STARPU_CPU;
}
#ifdef STARPU_USE_REDUX
if( capacities->supportP2PExtern(FSTARPU_CPU_IDX)){
FLOG( FLog::Controller << "\t CPU prio P2P Extern " << cpuCountPrio << " bucket " << insertionPositionP2PExtern << "\n" );
heteroprio->prio_mapping_per_arch_index[FSTARPU_CPU_IDX][cpuCountPrio++] = insertionPositionP2PExtern;
heteroprio->buckets[insertionPositionP2PExtern].valide_archs |= STARPU_CPU;
}
#endif
heteroprio->nb_prio_per_arch_index[FSTARPU_CPU_IDX] = unsigned(cpuCountPrio);
FLOG( FLog::Controller << "\t CPU Priorities: " << cpuCountPrio << "\n" );
}
#endif
#ifdef STARPU_USE_OPENCL
{
int openclCountPrio = 0;
//insertionPositionP2P = insertionPositionL2L + (treeHeight-3)*2+1 +1;
//insertionPositionP2PExtern = insertionPositionP2P;
//insertionPositionP2PMpi = insertionPositionP2P;
if(capacities->supportP2P(FSTARPU_OPENCL_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionP2P;
heteroprio->buckets[insertionPositionP2P].factor_base_arch_index = FSTARPU_OPENCL_IDX;
heteroprio->buckets[insertionPositionP2P].valide_archs |= STARPU_OPENCL;
#ifdef STARPU_USE_CPU
heteroprio->buckets[insertionPositionP2P].slow_factors_per_index[FSTARPU_CPU_IDX] = 40.0f;
#endif
}
// insertionPositionM2L = insertionPositionM2M+1;
// insertionPositionM2LExtern = insertionPositionM2L;
// insertionPositionM2LMpi = insertionPositionM2L;
for(int idxLevel = 2 ; idxLevel < treeHeight ; ++idxLevel){
if(capacities->supportM2L(FSTARPU_OPENCL_IDX)){
const int prioM2LAtLevel = getInsertionPosM2L(idxLevel);
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = prioM2LAtLevel;
heteroprio->buckets[prioM2LAtLevel].factor_base_arch_index = FSTARPU_OPENCL_IDX;
heteroprio->buckets[prioM2LAtLevel].valide_archs |= STARPU_OPENCL;
#ifdef STARPU_USE_CPU
heteroprio->buckets[prioM2LAtLevel].slow_factors_per_index[FSTARPU_CPU_IDX] = 40.0f;
#endif
}
}
//insertionPositionP2MSend = 0;
//insertionPositionP2M = insertionPositionP2MSend+1;
if( !workOnlyOnLeaves && capacities->supportP2M(FSTARPU_OPENCL_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionP2MSend;
heteroprio->buckets[insertionPositionP2MSend].valide_archs |= STARPU_OPENCL;
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionP2M;
heteroprio->buckets[insertionPositionP2M].valide_archs |= STARPU_OPENCL;
}
//insertionPositionM2MSend = insertionPositionP2M+1;
//insertionPositionM2M = insertionPositionM2MSend+1;
if( !workOnlyOnLeaves && capacities->supportM2M(FSTARPU_OPENCL_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionM2MSend;
heteroprio->buckets[insertionPositionM2MSend].valide_archs |= STARPU_OPENCL;
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionM2M;
heteroprio->buckets[insertionPositionM2M].valide_archs |= STARPU_OPENCL;
}
// insertionPositionL2L = insertionPositionM2L+1;
for(int idxLevel = 2 ; idxLevel < treeHeight ; ++idxLevel){
if(idxLevel != treeHeight-1 && capacities->supportL2L(FSTARPU_OPENCL_IDX)){
const int prioL2LAtLevel = getInsertionPosL2L(idxLevel);
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = prioL2LAtLevel;
heteroprio->buckets[prioL2LAtLevel].valide_archs |= STARPU_OPENCL;
}
}
//insertionPositionL2P = insertionPositionP2PMpi+1;
if( !workOnlyOnLeaves && capacities->supportL2P(FSTARPU_OPENCL_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_OPENCL_IDX][openclCountPrio++] = insertionPositionL2P;
heteroprio->buckets[insertionPositionL2P].valide_archs |= STARPU_OPENCL;
}
heteroprio->nb_prio_per_arch_index[FSTARPU_OPENCL_IDX] = unsigned(openclCountPrio);
}
#endif
#ifdef STARPU_USE_CUDA
{
int openclCountPrio = 0;
//insertionPositionP2P = insertionPositionL2L + (treeHeight-3)*2+1 +1;
//insertionPositionP2PExtern = insertionPositionP2P;
//insertionPositionP2PMpi = insertionPositionP2P;
if(capacities->supportP2P(FSTARPU_CUDA_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionP2P;
heteroprio->buckets[insertionPositionP2P].valide_archs |= STARPU_CUDA;
heteroprio->buckets[insertionPositionP2P].factor_base_arch_index = FSTARPU_CUDA_IDX;
#ifdef STARPU_USE_CPU
heteroprio->buckets[insertionPositionP2P].slow_factors_per_index[FSTARPU_CPU_IDX] = 40.0f;
#endif
}
// insertionPositionM2L = insertionPositionM2M+1;
// insertionPositionM2LExtern = insertionPositionM2L;
// insertionPositionM2LMpi = insertionPositionM2L;
for(int idxLevel = 2 ; idxLevel < treeHeight ; ++idxLevel){
if(capacities->supportM2L(FSTARPU_CUDA_IDX)){
const int prioM2LAtLevel = getInsertionPosM2L(idxLevel);
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = prioM2LAtLevel;
heteroprio->buckets[prioM2LAtLevel].valide_archs |= STARPU_CUDA;
heteroprio->buckets[prioM2LAtLevel].factor_base_arch_index = FSTARPU_CUDA_IDX;
#ifdef STARPU_USE_CPU
heteroprio->buckets[prioM2LAtLevel].slow_factors_per_index[FSTARPU_CPU_IDX] = 40.0f;
#endif
}
}
//insertionPositionP2MSend = 0;
//insertionPositionP2M = insertionPositionP2MSend+1;
if( !workOnlyOnLeaves && capacities->supportP2M(FSTARPU_CUDA_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionP2MSend;
heteroprio->buckets[insertionPositionP2MSend].valide_archs |= STARPU_CUDA;
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionP2M;
heteroprio->buckets[insertionPositionP2M].valide_archs |= STARPU_CUDA;
}
//insertionPositionM2MSend = insertionPositionP2M+1;
//insertionPositionM2M = insertionPositionM2MSend+1;
if( !workOnlyOnLeaves && capacities->supportM2M(FSTARPU_CUDA_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionM2MSend;
heteroprio->buckets[insertionPositionM2MSend].valide_archs |= STARPU_CUDA;
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionM2M;
heteroprio->buckets[insertionPositionM2M].valide_archs |= STARPU_CUDA;
}
// insertionPositionL2L = insertionPositionM2L+1;
for(int idxLevel = 2 ; idxLevel < treeHeight ; ++idxLevel){
if(idxLevel != treeHeight-1 && capacities->supportL2L(FSTARPU_CUDA_IDX)){
const int prioL2LAtLevel = getInsertionPosL2L(idxLevel);
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = prioL2LAtLevel;
heteroprio->buckets[prioL2LAtLevel].valide_archs |= STARPU_CUDA;
}
}
//insertionPositionL2P = insertionPositionP2PMpi+1;
if( !workOnlyOnLeaves && capacities->supportL2P(FSTARPU_CUDA_IDX)){
heteroprio->prio_mapping_per_arch_index[FSTARPU_CUDA_IDX][openclCountPrio++] = insertionPositionL2P;
heteroprio->buckets[insertionPositionL2P].valide_archs |= STARPU_CUDA;
}
heteroprio->nb_prio_per_arch_index[FSTARPU_CUDA_IDX] = int(openclCountPrio);
}
#endif
}
int getInsertionPosP2M() const {
return insertionPositionP2M;
}
int getInsertionPosM2M(const int /*inLevel*/) const {
return insertionPositionM2M;
}
int getInsertionPosP2M(bool willBeSend) const {
return willBeSend?insertionPositionP2MSend:insertionPositionP2M;
}
int getInsertionPosM2M(const int /*inLevel*/, bool willBeSend) const {
return willBeSend?insertionPositionM2MSend:insertionPositionM2M;
}
int getInsertionPosM2L(const int inLevel) const {
return (inLevel==treeHeight-1? insertionPositionM2LLastLevel : insertionPositionM2L + (inLevel - 2)*3);
}
int getInsertionPosM2LExtern(const int inLevel) const {
return (inLevel==treeHeight-1? insertionPositionM2LLastLevel : insertionPositionM2LExtern + (inLevel - 2)*3);
}
int getInsertionPosL2L(const int inLevel) const {
return insertionPositionL2L + (inLevel - 2)*3;
}
int getInsertionPosL2P() const {
return insertionPositionL2P;
}
int getInsertionPosP2P() const {
return insertionPositionP2P;
}
int getInsertionPosP2PExtern() const {
return insertionPositionP2PExtern;
}
};
FStarPUFmmPriorities FStarPUFmmPriorities::controller;
#elif defined(SCALFMM_STARPU_USE_PRIO)// STARPU_SUPPORT_SCHEDULER
#include "FOmpPriorities.hpp"
class FStarPUFmmPriorities {
static FStarPUFmmPriorities controller;
FOmpPriorities ompPrio;
FStarPUFmmPriorities() : ompPrio(0){
}
public:
static FStarPUFmmPriorities& Controller(){
return controller;
}
void init(struct starpu_conf* /*conf*/, const int inTreeHeight,
FStarPUKernelCapacities* /*inCapacities*/){
ompPrio = FOmpPriorities(inTreeHeight);
}
int getInsertionPosP2M() const {
return ompPrio.getInsertionPosP2M();
}
int getInsertionPosM2M(const int inLevel) const {
return ompPrio.getInsertionPosM2M(inLevel);
}
int getInsertionPosP2M(bool /*willBeSend*/) const {
return ompPrio.getInsertionPosP2M();
}
int getInsertionPosM2M(const int inLevel, bool /*willBeSend*/) const {
return ompPrio.getInsertionPosM2M(inLevel);
}
int getInsertionPosM2L(const int inLevel) const {
return ompPrio.getInsertionPosM2L(inLevel);
}
int getInsertionPosM2LExtern(const int inLevel) const {
return ompPrio.getInsertionPosM2LExtern(inLevel);
}
int getInsertionPosL2L(const int inLevel) const {
return ompPrio.getInsertionPosL2L(inLevel);
}
int getInsertionPosL2P() const {
return ompPrio.getInsertionPosL2P();
}
int getInsertionPosP2P() const {
return ompPrio.getInsertionPosP2P();
}
int getInsertionPosP2PExtern() const {
return ompPrio.getInsertionPosP2PExtern();
}
};
FStarPUFmmPriorities FStarPUFmmPriorities::controller;
#endif // SCALFMM_STARPU_USE_PRIO - STARPU_SUPPORT_SCHEDULER
#endif // FSTARPUFMMPRIORITIES_HPP
|
xikaij/poisson
|
contrib/scalfmm/Src/GroupTree/StarPUUtils/FStarPUFmmPriorities.hpp
|
C++
|
lgpl-2.1
| 20,803
|
/*
* Polyglotter (http://polyglotter.org)
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership. Some portions may be licensed
* to Red Hat, Inc. under one or more contributor license agreements.
* See the AUTHORS.txt file in the distribution for a full listing of
* individual contributors.
*
* Polyglotter is free software. Unless otherwise indicated, all code in Polyglotter
* is licensed to you under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Polyglotter 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.chrysalix;
import org.chrysalix.transformation.ValueDescriptor;
/**
* Defines constants that represent namespaces, node types, and node properties related to the Polyglotter data mapper and defined
* in one or more CND files.
*/
public interface ChrysalixLexicon {
/**
* JCR names related to Polyglotter operation inputs. Nodes are named using the input's {@link ValueDescriptor descriptor}
* identifier.
*/
interface Input {
/**
* The JCR node type name for an input node.
*/
String NODE_TYPE = Namespace.PREFIX + ":input";
/**
* The name of the <code>path</code> boolean property. The value will be <code>true</code> if the {@link #VALUE value}
* property represents a node path.
*/
String PATH = Namespace.PREFIX + ":path";
/**
* The name of the <code>value</code> string property. Normally this value represents a model object path but it can also be
* a literal value.
*/
String VALUE = Namespace.PREFIX + ":value";
}
/**
* Polyglotter namespace related constants.
*/
interface Namespace {
/**
* The Polyglotter data mapper namespace prefix.
*/
String PREFIX = "tx";
/**
* The Polglotter data mapper URI.
*/
String URI = "http://www.polyglotter.org/transform/1.0";
}
/**
* JCR names related to Polyglotter operations. Nodes are named using the operation's {@link ValueDescriptor output descriptor}
* identifier. Child nodes for the operation inputs are named using the input's descriptor ID.
*/
interface Operation {
/**
* The JCR node type name for an operation node.
*/
String NODE_TYPE = Namespace.PREFIX + ":operation";
}
/**
* JCR names related to Polyglotter transformations. Child nodes for the transformation operations are named using the
* operation's output descriptor IDs.
*/
interface Transformation {
/**
* The JCR node type name for a transformation node.
*/
String NODE_TYPE = Namespace.PREFIX + ":transformation";
/**
* The name of the <code>sources</code> multi-valued property. The values consist of model paths.
*/
String SOURCES = Namespace.PREFIX + ":sources";
/**
* The name of the <code>targets</code> multi-valued property. The values consist of model paths.
*/
String TARGETS = Namespace.PREFIX + ":targets";
}
}
|
Polyglotter/chrysalix
|
chrysalix-engine/src/main/java/org/chrysalix/ChrysalixLexicon.java
|
Java
|
lgpl-2.1
| 3,771
|
/**
* DSS - Digital Signature Services
* Copyright (C) 2015 European Commission, provided under the CEF programme
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package eu.europa.esig.dss.validation.process.vpfswatsp.checks.vts;
import eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks;
import eu.europa.esig.dss.detailedreport.jaxb.XmlCRS;
import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
import eu.europa.esig.dss.diagnostic.CertificateWrapper;
import eu.europa.esig.dss.diagnostic.RevocationWrapper;
import eu.europa.esig.dss.diagnostic.TokenProxy;
import eu.europa.esig.dss.enumerations.TimestampedObjectType;
import eu.europa.esig.dss.i18n.I18nProvider;
import eu.europa.esig.dss.i18n.MessageTag;
import eu.europa.esig.dss.policy.ValidationPolicy;
import eu.europa.esig.dss.validation.process.ChainItem;
import eu.europa.esig.dss.validation.process.vpfltvd.LongTermValidationCertificateRevocationSelector;
import eu.europa.esig.dss.validation.process.vpfswatsp.POEExtraction;
import eu.europa.esig.dss.validation.process.vpfswatsp.checks.vts.checks.POEExistsAtOrBeforeControlTimeCheck;
import eu.europa.esig.dss.validation.process.vpfswatsp.checks.vts.checks.RevocationIssuedBeforeControlTimeCheck;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Filters revocation data on a "Validation Time Sliding" process
*
*/
public class ValidationTimeSlidingCertificateRevocationSelector extends LongTermValidationCertificateRevocationSelector {
/** POE container */
private final POEExtraction poe;
/** List of acceptable certificate revocation data for VTS processing */
private final List<CertificateRevocationWrapper> certificateRevocationData;
/**
* Default constructor
*
* @param i18nProvider {@link I18nProvider}
* @param certificate {@link CertificateWrapper}
* @param certificateRevocationData a list of {@link CertificateRevocationWrapper}s
* @param currentTime {@link Date} validation time
* @param bbbs a map of {@link XmlBasicBuildingBlocks}
* @param tokenId {@link String} current token id being validated
* @param poe {@link POEExtraction}
* @param validationPolicy {@link ValidationPolicy}
*/
public ValidationTimeSlidingCertificateRevocationSelector(
I18nProvider i18nProvider, CertificateWrapper certificate, List<CertificateRevocationWrapper> certificateRevocationData,
Date currentTime, Map<String, XmlBasicBuildingBlocks> bbbs, String tokenId, POEExtraction poe, ValidationPolicy validationPolicy) {
super(i18nProvider, certificate, currentTime, bbbs, tokenId, validationPolicy);
this.certificateRevocationData = certificateRevocationData;
this.poe = poe;
}
@Override
protected MessageTag getTitle() {
return MessageTag.VTS_CRS;
}
@Override
public List<CertificateRevocationWrapper> getCertificateRevocationData() {
return certificateRevocationData;
}
@Override
protected ChainItem<XmlCRS> verifyRevocationData(ChainItem<XmlCRS> item, CertificateRevocationWrapper revocationWrapper) {
item = super.verifyRevocationData(item, revocationWrapper);
Boolean validity = revocationDataValidityMap.get(revocationWrapper);
if (Boolean.TRUE.equals(validity)) {
item = item.setNextItem(revocationIssuedBeforeControlTime(revocationWrapper, currentTime));
validity = revocationWrapper.getThisUpdate() != null && revocationWrapper.getThisUpdate().before(currentTime);
if (Boolean.TRUE.equals(validity)) {
item = item.setNextItem(poeExistsAtOrBeforeControlTime(certificate, TimestampedObjectType.CERTIFICATE, currentTime));
item = item.setNextItem(poeExistsAtOrBeforeControlTime(revocationWrapper, TimestampedObjectType.REVOCATION, currentTime));
validity = poe.isPOEExists(certificate.getId(), currentTime) && poe.isPOEExists(revocationWrapper.getId(), currentTime);
}
// update the validity map
revocationDataValidityMap.put(revocationWrapper, validity);
}
return item;
}
private ChainItem<XmlCRS> revocationIssuedBeforeControlTime(RevocationWrapper revocation, Date controlTime) {
return new RevocationIssuedBeforeControlTimeCheck<>(i18nProvider, result, revocation, controlTime, getWarnLevelConstraint());
}
private ChainItem<XmlCRS> poeExistsAtOrBeforeControlTime(TokenProxy token, TimestampedObjectType objectType, Date controlTime) {
return new POEExistsAtOrBeforeControlTimeCheck<>(i18nProvider, result, token, objectType, controlTime, poe, getWarnLevelConstraint());
}
}
|
esig/dss
|
validation-policy/src/main/java/eu/europa/esig/dss/validation/process/vpfswatsp/checks/vts/ValidationTimeSlidingCertificateRevocationSelector.java
|
Java
|
lgpl-2.1
| 5,567
|
/**
* DSS - Digital Signature Services
* Copyright (C) 2015 European Commission, provided under the CEF programme
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* This library 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package eu.europa.esig.dss.validation.process.bbb.sav.checks;
import eu.europa.esig.dss.detailedreport.jaxb.XmlSAV;
import eu.europa.esig.dss.diagnostic.SignatureWrapper;
import eu.europa.esig.dss.enumerations.Indication;
import eu.europa.esig.dss.enumerations.SubIndication;
import eu.europa.esig.dss.i18n.I18nProvider;
import eu.europa.esig.dss.i18n.MessageTag;
import eu.europa.esig.dss.policy.jaxb.MultiValuesConstraint;
import eu.europa.esig.dss.validation.process.bbb.AbstractMultiValuesCheckItem;
import java.util.List;
/**
* Checks if the claimed roles are acceptable
*/
public class ClaimedRolesCheck extends AbstractMultiValuesCheckItem<XmlSAV> {
/** The signature to check */
private final SignatureWrapper signature;
/**
* Default constructor
*
* @param i18nProvider {@link I18nProvider}
* @param result {@link XmlSAV}
* @param signature {@link SignatureWrapper}
* @param constraint {@link MultiValuesConstraint}
*/
public ClaimedRolesCheck(I18nProvider i18nProvider, XmlSAV result, SignatureWrapper signature,
MultiValuesConstraint constraint) {
super(i18nProvider, result, constraint);
this.signature = signature;
}
@Override
protected boolean process() {
List<String> claimedRoles = signature.getSignerRoleDetails(signature.getClaimedRoles());
return processValuesCheck(claimedRoles);
}
@Override
protected MessageTag getMessageTag() {
return MessageTag.BBB_SAV_ICRM;
}
@Override
protected MessageTag getErrorMessageTag() {
return MessageTag.BBB_SAV_ICRM_ANS;
}
@Override
protected Indication getFailedIndicationForConclusion() {
return Indication.INDETERMINATE;
}
@Override
protected SubIndication getFailedSubIndicationForConclusion() {
return SubIndication.SIG_CONSTRAINTS_FAILURE;
}
}
|
esig/dss
|
validation-policy/src/main/java/eu/europa/esig/dss/validation/process/bbb/sav/checks/ClaimedRolesCheck.java
|
Java
|
lgpl-2.1
| 2,718
|
/*
Copyright 2020 by Angelo Naselli <anaselli at linux dot it>
This library 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.1 of the
License, or (at your option) version 3.0 of the License. This library
is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details. You should have received a copy of the GNU
Lesser General Public License along with this library; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Floor, Boston, MA 02110-1301 USA
*/
/*-/
File: YGMenuBar.h
Author: Angelo Naselli <anaselli@linux.it>
/-*/
#ifndef YGMenuBar_h
#define YGMenuBar_h
#include <yui/YMenuBar.h>
#include <gtk/gtk.h>
#include <gtk/gtktypes.h>
class YGMenuBar : public YMenuBar, public YGWidget
{
public:
YGMenuBar ( YWidget *parent );
virtual ~YGMenuBar ( );
/**
* Rebuild the displayed menu tree from the internally stored YMenuItems.
*
* Reimplemented from YMenuWidget.
**/
virtual void rebuildMenuTree();
/**
* Enable or disable an item.
*
* Reimplemented from YMenuWidget.
**/
virtual void setItemEnabled( YMenuItem * item, bool enabled );
/**
* Show or hide an item.
*
* Reimplemented from YMenuWidget.
**/
virtual void setItemVisible( YMenuItem * item, bool visible );
/**
* Activate the item selected in the tree. Can be used in tests to simulate
* user input.
**/
virtual void activateItem( YMenuItem * item );
/**
* Delete all items.
*
* Reimplemented from YMenuWidget
**/
virtual void deleteAllItems();
YGWIDGET_IMPL_COMMON (YMenuBar)
private:
struct Private;
Private *d;
void doCreateMenu (GtkWidget *menu, YItemIterator begin, YItemIterator end);
};
#endif // YGMenuBar_h
|
libyui/libyui-gtk
|
src/YGMenuBar.h
|
C
|
lgpl-3.0
| 2,064
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qstyleoption.cpp -->
<title>Qt 4.7: List of All Members for QStyleOptionHeader</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QStyleOptionHeader</li>
</ul>
</div>
</div>
<div class="content mainContent">
<h1 class="title">List of All Members for QStyleOptionHeader</h1>
<p>This is the complete list of members for <a href="qstyleoptionheader.html">QStyleOptionHeader</a>, including inherited members.</p>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn">enum <span class="name"><b><a href="qstyleoption.html#OptionType-enum">OptionType</a></b></span></li>
<li class="fn">enum <span class="name"><b><a href="qstyleoptionheader.html#SectionPosition-enum">SectionPosition</a></b></span></li>
<li class="fn">enum <span class="name"><b><a href="qstyleoptionheader.html#SelectedPosition-enum">SelectedPosition</a></b></span></li>
<li class="fn">enum <span class="name"><b><a href="qstyleoptionheader.html#SortIndicator-enum">SortIndicator</a></b></span></li>
<li class="fn">enum <span class="name"><b><a href="qstyleoptionheader.html#StyleOptionType-enum">StyleOptionType</a></b></span></li>
<li class="fn">enum <span class="name"><b><a href="qstyleoptionheader.html#StyleOptionVersion-enum">StyleOptionVersion</a></b></span></li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#QStyleOptionHeader">QStyleOptionHeader</a></b></span> ()</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#QStyleOptionHeader-2">QStyleOptionHeader</a></b></span> ( const QStyleOptionHeader & )</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#direction-var">direction</a></b></span> : Qt::LayoutDirection</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#fontMetrics-var">fontMetrics</a></b></span> : QFontMetrics</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#icon-var">icon</a></b></span> : QIcon</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#iconAlignment-var">iconAlignment</a></b></span> : Qt::Alignment</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#initFrom">initFrom</a></b></span> ( const QWidget * )</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#orientation-var">orientation</a></b></span> : Qt::Orientation</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#palette-var">palette</a></b></span> : QPalette</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#position-var">position</a></b></span> : SectionPosition</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#rect-var">rect</a></b></span> : QRect</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#section-var">section</a></b></span> : int</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#selectedPosition-var">selectedPosition</a></b></span> : SelectedPosition</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#sortIndicator-var">sortIndicator</a></b></span> : SortIndicator</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#state-var">state</a></b></span> : QStyle::State</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#text-var">text</a></b></span> : QString</li>
<li class="fn"><span class="name"><b><a href="qstyleoptionheader.html#textAlignment-var">textAlignment</a></b></span> : Qt::Alignment</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#type-var">type</a></b></span> : int</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#version-var">version</a></b></span> : int</li>
<li class="fn"><span class="name"><b><a href="qstyleoption.html#operator-eq">operator=</a></b></span> ( const QStyleOption & ) : QStyleOption &</li>
</ul>
</td></tr>
</table>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2008-2011 Nokia Corporation and/or its
subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide.</p>
<p>
All other trademarks are property of their respective owners. <a title="Privacy Policy"
href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p>
<br />
<p>
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.</p>
<p>
Alternatively, this document may be used under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU
Free Documentation License version 1.3</a>
as published by the Free Software Foundation.</p>
</div>
</body>
</html>
|
ssangkong/NVRAM_KWU
|
qt-everywhere-opensource-src-4.7.4/doc/html/qstyleoptionheader-members.html
|
HTML
|
lgpl-3.0
| 5,650
|
namespace Areas.ControllerRunner
{
using Sitecore.Data;
using Sitecore.Mvc.Pipelines.Response.GetRenderer;
using Sitecore.Mvc.Presentation;
/// <summary>
/// CREDITS: http://sitecore-estate.nl/wp/2014/12/sitecore-mvc-areas/
/// </summary>
public class GetAreaControllerRendering : GetRendererProcessor
{
public override void Process(GetRendererArgs args)
{
// the new "Area Controller Rendering" template has to be added with a new field "Area"
var areaControllerRendering = new ID("2A3E91A0-7987-44B5-AB34-35C2D9DE83B9");
if (!args.RenderingTemplate.DescendsFromOrEquals(areaControllerRendering))
{
return;
}
args.Result = this.GetRender(args.Rendering);
}
private Renderer GetRender(Rendering rendering)
{
var action = rendering.RenderingItem.InnerItem["controller action"];
var controller = rendering.RenderingItem.InnerItem["controller"];
// get from the new field
var area = rendering.RenderingItem.InnerItem["area"];
return new AreaControllerRenderer { Action = action, Controller = controller, Area = area };
}
}
}
|
unic/SUGCON2015
|
src/Areas/ControllerRunner/GetAreaControllerRenderer.cs
|
C#
|
lgpl-3.0
| 1,274
|
%Descripción del rol de los integrantes del equipo de trabajo
\begin{table}[h]
\centering
\begin{tabular}{|p{5cm}|p{5cm}|p{4cm}|}
\hline
\rowcolor{tableheadcolor} \textbf{Nombre} & \textbf{Rol} &
\textbf{Tiempo de dedicación al Proyecto (horas semanales)} \\
\hline
Víctor Velásquez Solano & Ejecutor & 30 \\
\hline
Álvaro Palacios & Patrocinante & 1.5 \\
\hline
Mauricio Ruiz-Tagle Molina & Copatrocinante
& 1.5 \\
\hline
\end{tabular}
\end{table}
|
vmrvs/anteproyecto
|
09/capitulo.tex
|
TeX
|
lgpl-3.0
| 482
|
package org.evomaster.client.java.controller.problem;
import java.util.ArrayList;
import java.util.List;
/**
* Created by arcuri82 on 05-Nov-18.
*/
public class RestProblem implements ProblemInfo{
private final String openApiUrl;
private final List<String> endpointsToSkip;
private final String openApiSchema;
public RestProblem(String openApiUrl, List<String> endpointsToSkip) {
this(openApiUrl, endpointsToSkip, null);
}
/**
*
* @param openApiUrl Provide the URL of where the OpenAPI schema can be found.
* @param endpointsToSkip When testing a REST API, there might be some endpoints that are not
* so important to test.
* For example, in Spring, health-check endpoints like "/heapdump"
* are not so interesting to test, and they can be very expensive to run.
* Here can specify a list of endpoints (as defined in the schema) to skip.
* @param openApiSchema the actual schema, as a string. Note, if this specified, then
* openApiUrl must be null
*/
public RestProblem(String openApiUrl, List<String> endpointsToSkip, String openApiSchema) {
this.openApiUrl = openApiUrl;
this.endpointsToSkip = endpointsToSkip == null
? new ArrayList<>()
: new ArrayList<>(endpointsToSkip);
this.openApiSchema = openApiSchema;
boolean url = openApiUrl != null && !openApiUrl.isEmpty();
boolean schema = openApiSchema != null && !openApiSchema.isEmpty();
if(!url && !schema){
throw new IllegalArgumentException("MUST either provide a URL or a full schema for OpenAPI");
}
if(url && schema){
throw new IllegalArgumentException("Cannot specify BOTH a URL and a whole schema. Choose one only");
}
}
public String getOpenApiUrl() {
return openApiUrl;
}
public List<String> getEndpointsToSkip() {
return endpointsToSkip;
}
public String getOpenApiSchema() {
return openApiSchema;
}
}
|
EMResearch/EvoMaster
|
client-java/controller/src/main/java/org/evomaster/client/java/controller/problem/RestProblem.java
|
Java
|
lgpl-3.0
| 2,091
|
// Created file "Lib\src\Shell32\X64\shguid"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(FOLDERID_Profile, 0x5e6c858f, 0x0e22, 0x4760, 0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73);
|
Frankie-PellesC/fSDK
|
Lib/src/shell32/X64/shguid000000E1.c
|
C
|
lgpl-3.0
| 454
|
package nif.niobject;
import java.io.IOException;
import java.nio.ByteBuffer;
import nif.ByteConvert;
import nif.NifVer;
import nif.compound.NifVector4;
public class NiBinaryVoxelData extends NiObject
{
/**
<niobject name="NiBinaryVoxelData" abstract="0" inherit="NiObject" ver1="3.1">
Voxel data object.
<add name="Unknown Short 1" type="ushort">Unknown.</add>
<add name="Unknown Short 2" type="ushort">Unknown.</add>
<add name="Unknown Short 3" type="ushort">Unknown. Is this^3 the Unknown Bytes 1 size?</add>
<add name="Unknown 7 Floats" type="float" arr1="7">Unknown.</add>
<add name="Unknown Bytes 1" type="byte" arr1="7" arr2="12">Unknown. Always a multiple of 7.</add>
<add name="Num Unknown Vectors" type="uint">Unknown.</add>
<add name="Unknown Vectors" type="Vector4" arr1="Num Unknown Vectors">Vectors on the unit sphere.</add>
<add name="Num Unknown Bytes 2" type="uint">Unknown.</add>
<add name="Unknown Bytes 2" type="byte" arr1="Num Unknown Bytes 2">Unknown.</add>
<add name="Unknown 5 Ints" type="uint" arr1="5">Unknown.</add>
</niobject>
*/
public short unknownShort1;
public short unknownShort2;
public short unknownShort3;
public float[] unknown7Floats;
public byte[][] unknownBytes1;
public int numUnknownVectors;
public NifVector4[] unknownVectors;
public int numUnknownBytes2;
public byte[] unknownBytes2;
public int[] unknown5Ints;
public boolean readFromStream(ByteBuffer stream, NifVer nifVer) throws IOException
{
boolean success = super.readFromStream(stream, nifVer);
unknownShort1 = ByteConvert.readShort(stream);
unknownShort2 = ByteConvert.readShort(stream);
unknownShort3 = ByteConvert.readShort(stream);
unknown7Floats = new float[7];
for (int i = 0; i < 7; i++)
{
unknown7Floats[i] = ByteConvert.readFloat(stream);
}
unknownBytes1 = new byte[7][12];
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 12; j++)
{
unknownBytes1[i][j] = ByteConvert.readByte(stream);
}
}
numUnknownVectors = ByteConvert.readInt(stream);
unknownVectors = new NifVector4[numUnknownVectors];
for (int i = 0; i < numUnknownVectors; i++)
{
unknownVectors[i] = new NifVector4(stream);
}
numUnknownBytes2 = ByteConvert.readInt(stream);
unknownBytes2 = new byte[numUnknownBytes2];
for (int i = 0; i < numUnknownBytes2; i++)
{
unknownBytes2[i] = ByteConvert.readByte(stream);
}
unknown5Ints = new int[5];
for (int i = 0; i < 5; i++)
{
unknown5Ints[i] = ByteConvert.readInt(stream);
}
return success;
}
}
|
philjord/jnif
|
jnif/src/nif/niobject/NiBinaryVoxelData.java
|
Java
|
lgpl-3.0
| 2,645
|
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Articulo extends CI_Model
{
public function todos()
{
return $this->db->query('select * from articulos')->result_array();
}
public function borrar($id)
{
return $this->db->query("delete from articulos where id = ?",
array($id));
}
public function por_id($id)
{
$res = $this->db->query('select * from articulos where id = ?',
array($id));
return $res->num_rows() > 0 ? $res->row_array() : FALSE;
}
public function por_codigo($codigo)
{
$res = $this->db->query('select * from articulos where codigo = ?',
array($codigo));
return $res->num_rows() > 0 ? $res->row_array() : FALSE;
}
public function insertar($valores)
{
return $this->db->insert('articulos', $valores);
}
public function editar($valores, $id)
{
return $this->db->where('id', $id)->update('articulos', $valores);
}
}
|
archsupremo/code
|
application/models/Articulo.php
|
PHP
|
lgpl-3.0
| 1,092
|
package net.starborne.server.entity;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class BlockSystemControlEntity extends Entity {
public BlockSystemControlEntity(World world) {
super(world);
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound compound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound compound) {
}
}
|
Starborne/Starborne
|
src/main/java/net/starborne/server/entity/BlockSystemControlEntity.java
|
Java
|
lgpl-3.0
| 513
|
#include <iomanip>
#include "block.hpp"
using namespace std;
namespace kp{
namespace core{
const char Block::TAG[] = "Block";
Block::Block(SymbolTable& globals, Program& tac_program)
: block_(), globals_(globals), tac_program_(tac_program), symbol_text_(""), symbol_("")
{
const uint64_t buffer_capacity = globals_.capacity()+1;
const uint64_t tac_capacity = tac_program_.capacity()+1;
block_.buffers = new kp_buffer*[buffer_capacity];
block_.operands = new kp_operand*[buffer_capacity];
block_.tacs = new int64_t[tac_capacity];
block_.array_tacs = new int64_t[tac_capacity];
}
Block::~Block()
{
if (block_.buffers) { // Buffers
delete[] block_.buffers;
block_.buffers = NULL;
}
if (block_.operands) { // Operands
delete[] block_.operands;
block_.operands = NULL;
}
if (block_.tacs) { // Block tacs
delete[] block_.tacs;
block_.tacs = NULL;
}
if (block_.array_tacs) { // Block array tacs
delete[] block_.array_tacs;
block_.array_tacs = NULL;
}
clear();
}
void Block::clear(void)
{ // Reset the state of the kp_block (C interface)
block_.nbuffers = 0; // Buffers
block_.noperands = 0; // Operands
block_.iterspace.layout = KP_SCALAR_TEMP; // Iteraton space
block_.iterspace.ndim = 0;
block_.iterspace.shape = NULL;
block_.iterspace.nelem = 0;
block_.omask = 0; // Operation mask
block_.ntacs = 0; // Block tacs
block_.narray_tacs = 0; // Block array tacs
// End of kp_block reset, dynamic memory is reused.
buffer_ids_.clear(); // Reset the state of Block (C++ interface)
buffer_refs_.clear();
global_to_local_.clear(); // global to local kp_operand mapping
local_to_global_.clear(); // local to global kp_operand mapping
symbol_text_ = ""; // textual block-symbol representation
symbol_ = ""; // hashed block-symbol representation
}
void Block::_compose(bh_ir_kernel& krnl, bool array_contraction, size_t prg_idx)
{
kp_tac& tac = tac_program_[prg_idx];
block_.tacs[block_.ntacs++] = prg_idx; // <-- All tacs
block_.omask |= tac.op; // Update omask
if ((tac.op & (KP_ARRAY_OPS))>0) { // <-- Only array operations
block_.array_tacs[block_.narray_tacs++] = prg_idx;
}
switch(tac_noperands(tac)) {
case 3:
_localize_scope(tac.in2); // Localize scope, in2
if ((tac.op & (KP_ARRAY_OPS))>0) {
if (array_contraction && (krnl.get_temps().find((bh_base*)globals_[tac.in2].base)!=krnl.get_temps().end())) {
globals_.turn_contractable(tac.in2); // Mark contractable, in2
}
_bufferize(tac.in2); // Note down buffer id, in2
}
case 2:
_localize_scope(tac.in1); // Localize scope, in1
if ((tac.op & (KP_ARRAY_OPS))>0) {
if (array_contraction && (krnl.get_temps().find((bh_base*)globals_[tac.in1].base)!=krnl.get_temps().end())) {
globals_.turn_contractable(tac.in1); // Mark contractable, in1
}
_bufferize(tac.in1); // Note down buffer id, in1
}
case 1:
_localize_scope(tac.out); // Localize scope, out
if ((tac.op & (KP_ARRAY_OPS))>0) {
if (array_contraction && (krnl.get_temps().find((bh_base*)globals_[tac.out].base)!=krnl.get_temps().end())) {
globals_.turn_contractable(tac.out); // Mark contractable, out
}
_bufferize(tac.out); // Note down buffer id, out
}
default:
break;
}
}
void Block::compose(bh_ir_kernel& krnl, bool array_contraction)
{
for(std::vector<uint64_t>::iterator idx_it = krnl.instr_indexes.begin();
idx_it != krnl.instr_indexes.end();
++idx_it) {
_compose(krnl, array_contraction, *idx_it);
}
if (array_contraction) { // Turn kernel-temps into scalars aka array-contraction
for (bh_base* base: krnl.get_temps()) {
for(int64_t oidx = 0; oidx < noperands(); ++oidx) {
if (operand(oidx).base == (kp_buffer*)base) {
globals_.turn_contractable(local_to_global(oidx));
}
}
}
}
_update_iterspace(); // Update the iteration space
}
void Block::compose(bh_ir_kernel& krnl, size_t prg_idx)
{
_compose(krnl, false, prg_idx);
_update_iterspace(); // Update the iteration space
}
void Block::_bufferize(size_t global_idx)
{
// Maintain references to buffers within the block.
if ((globals_[global_idx].layout & (KP_DYNALLOC_LAYOUT))>0) {
kp_buffer* buffer = globals_[global_idx].base;
std::map<kp_buffer*, size_t>::iterator buf = buffer_ids_.find(buffer);
if (buf == buffer_ids_.end()) {
size_t buffer_id = block_.nbuffers++;
buffer_ids_.insert(pair<kp_buffer *, size_t>(
buffer,
buffer_id
));
block_.buffers[buffer_id] = buffer;
}
buffer_refs_[buffer].insert(global_idx);
}
}
size_t Block::_localize_scope(size_t global_idx)
{
//
// Reuse kp_operand identifiers: Detect if we have seen it before and reuse the index.
int64_t local_idx = 0;
bool found = false;
for(int64_t i=0; i<block_.noperands; ++i) {
if (!core::equivalent(*block_.operands[i], globals_[global_idx])) {
continue; // Not equivalent, continue search.
}
// Found one! Use it instead of the incremented identifier.
local_idx = i;
found = true;
break;
}
// Create the kp_operand in block-scope
if (!found) {
local_idx = block_.noperands;
block_.operands[local_idx] = &globals_[global_idx];
++block_.noperands;
}
//
// Insert entry such that tac operands can be resolved in block-scope.
global_to_local_.insert(pair<size_t,size_t>(global_idx, local_idx));
local_to_global_.insert(pair<size_t,size_t>(local_idx, global_idx));
return local_idx;
}
bool Block::symbolize(void)
{
stringstream tacs, operands_ss;
//
// Scope
for(int64_t oidx=0; oidx <block_.noperands; ++oidx) {
operands_ss << "~" << oidx;
operands_ss << core::layout_text_shand(block_.operands[oidx]->layout);
operands_ss << core::etype_text_shand(block_.operands[oidx]->etype);
// Let the "Restrictable" flag be part of the symbol.
if (buffer_refs_[block_.operands[oidx]->base].size()==1) {
operands_ss << "R";
} else {
operands_ss << "A";
}
}
//
// Program
bool first = true;
for(int64_t tac_iter=0; tac_iter<block_.ntacs; ++tac_iter) {
kp_tac& tac = this->tac(tac_iter);
// Do not include system opcodes in the kernel symbol.
if ((tac.op == KP_SYSTEM) || (tac.op == KP_EXTENSION)) {
continue;
}
if (!first) { // Separate op+oper with "_"
tacs << "_";
}
first = false;
tacs << core::operation_text(tac.op);
size_t ndim = ((tac.op & (KP_REDUCE_COMPLETE | KP_REDUCE_PARTIAL))>0) ? globals_[tac.in1].ndim : globals_[tac.out].ndim;
//
// Adding info of whether the kernel does reduction on the inner-most
// dimensions or another "axis" dimension.
//
if ((tac.op & KP_REDUCE_PARTIAL)>0) {
if (*((uint64_t*)globals_[tac.in2].const_data) == (ndim-1)) {
tacs << "_INNER";
} else {
tacs << "_AXIS";
}
}
//
// Add ndim up to 3
//
tacs << "-" << core::operator_text(tac.oper);
tacs << "-";
if (ndim <= 3) {
tacs << ndim;
} else {
tacs << "N";
}
tacs << "D";
// Add operand IDs
switch(tac_noperands(tac)) {
case 3:
tacs << "_" << global_to_local(tac.out);
tacs << "_" << global_to_local(tac.in1);
tacs << "_" << global_to_local(tac.in2);
break;
case 2:
tacs << "_" << global_to_local(tac.out);
tacs << "_" << global_to_local(tac.in1);
break;
case 1:
tacs << "_" << global_to_local(tac.out);
break;
case 0:
break;
default:
fprintf(stderr, "Something horrible happened...\n");
}
}
symbol_text_ = tacs.str() +"_"+ operands_ss.str();
symbol_ = core::hash_text(symbol_text_);
return true;
}
kp_buffer& Block::buffer(size_t buffer_id)
{
return *block_.buffers[buffer_id];
}
size_t Block::resolve_buffer(kp_buffer* buffer)
{
std::map<kp_buffer*, size_t>::iterator buf = buffer_ids_.find(buffer);
if (buf == buffer_ids_.end()) {
// TODO: Raise exception
}
return buf->second;
}
kp_buffer** Block::buffers(void)
{
return block_.buffers;
}
int64_t Block::nbuffers()
{
return block_.nbuffers;
}
size_t Block::buffer_refcount(kp_buffer* buffer)
{
return buffer_refs_[buffer].size();
}
kp_operand & Block::operand(size_t local_idx)
{
return *block_.operands[local_idx];
}
kp_operand** Block::operands(void)
{
return block_.operands;
}
int64_t Block::noperands(void) const
{
return block_.noperands;
}
size_t Block::global_to_local(size_t global_idx) const
{
return global_to_local_.find(global_idx)->second;
}
size_t Block::local_to_global(size_t local_idx) const
{
return local_to_global_.find(local_idx)->second;
}
kp_tac& Block::tac(size_t idx) const
{
return tac_program_[block_.tacs[idx]];
}
kp_tac & Block::array_tac(size_t idx) const
{
return tac_program_[block_.array_tacs[idx]];
}
uint32_t Block::omask(void)
{
return block_.omask;
}
size_t Block::ntacs(void) const
{
return block_.ntacs;
}
size_t Block::narray_tacs(void) const
{
return block_.narray_tacs;
}
string Block::symbol(void) const
{
return symbol_;
}
string Block::symbol_text(void) const
{
return symbol_text_;
}
kp_iterspace& Block::iterspace(void)
{
return block_.iterspace;
}
void Block::_update_iterspace(void)
{
//
// Determine layout, ndim and shape
for(size_t tac_idx=0; tac_idx<ntacs(); ++tac_idx) {
kp_tac & tac = this->tac(tac_idx);
if (not ((tac.op & (KP_ARRAY_OPS))>0)) { // Only interested in array ops
continue;
}
if ((tac.op & (KP_REDUCE_COMPLETE | KP_REDUCE_PARTIAL))>0) { // Reductions are weird
if (globals_[tac.in1].layout >= block_.iterspace.layout) { // Iterspace
block_.iterspace.layout = globals_[tac.in1].layout;
block_.iterspace.ndim = globals_[tac.in1].ndim;
block_.iterspace.shape = globals_[tac.in1].shape;
}
if (globals_[tac.out].layout > block_.iterspace.layout) {
block_.iterspace.layout = globals_[tac.out].layout;
}
} else {
switch(tac_noperands(tac)) {
case 3:
if (globals_[tac.in2].layout > block_.iterspace.layout) { // Iterspace
block_.iterspace.layout = globals_[tac.in2].layout;
if (block_.iterspace.layout > KP_SCALAR_TEMP) {
block_.iterspace.ndim = globals_[tac.in2].ndim;
block_.iterspace.shape = globals_[tac.in2].shape;
}
}
case 2:
if (globals_[tac.in1].layout > block_.iterspace.layout) { // Iterspace
block_.iterspace.layout = globals_[tac.in1].layout;
if (block_.iterspace.layout > KP_SCALAR_TEMP) {
block_.iterspace.ndim = globals_[tac.in1].ndim;
block_.iterspace.shape = globals_[tac.in1].shape;
}
}
case 1:
if (globals_[tac.out].layout > block_.iterspace.layout) { // Iterspace
block_.iterspace.layout = globals_[tac.out].layout;
if (block_.iterspace.layout > KP_SCALAR_TEMP) {
block_.iterspace.ndim = globals_[tac.out].ndim;
block_.iterspace.shape = globals_[tac.out].shape;
}
}
default:
break;
}
}
}
if (NULL != block_.iterspace.shape) { // Determine number of elements
block_.iterspace.nelem = 1;
for(int k=0; k<block_.iterspace.ndim; ++k) {
block_.iterspace.nelem *= block_.iterspace.shape[k];
}
}
}
string Block::dot(void) const
{
stringstream ss;
return ss.str();
}
std::string Block::text_compact(void)
{
stringstream ss;
ss << setfill('0');
ss << setw(3);
ss << narray_tacs();
ss << ",";
ss << setfill(' ');
ss << setw(36);
ss << symbol();
ss << ", ";
ss << left;
ss << setw(36);
ss << setfill('-');
ss << omask_aop_text(omask());
ss << ", ";
ss << left;
ss << setfill('-');
ss << setw(57);
ss << iterspace_text(iterspace());
return ss.str();
}
std::string Block::text(void)
{
stringstream ss;
ss << "BLOCK [" << symbol() << endl;
ss << "TACS " << "omask(" << omask() << "), ntacs(" << ntacs() << ") {" << endl;
for(uint64_t tac_idx=0; tac_idx<ntacs(); ++tac_idx) {
ss << " " << tac_text(tac(tac_idx)) << endl;
}
ss << "}" << endl;
ss << "OPERANDS (" << noperands() << ") {" << endl;
for(int64_t opr_idx=0; opr_idx < noperands(); ++opr_idx) {
kp_operand & opr = operand(opr_idx);
ss << " loc_idx(" << opr_idx << ")";
ss << " gbl_idx(" << local_to_global(opr_idx) << ") = ";
ss << operand_text(opr);
ss << endl;
}
ss << "}" << endl;
ss << "BUFFER_REFS {" << endl;
for(std::map<kp_buffer *, std::set<uint64_t> >::iterator it=buffer_refs_.begin();
it!=buffer_refs_.end();
++it) {
std::set<uint64_t>& op_bases = it->second;
ss << " " << it->first << " = ";
for(std::set<uint64_t>::iterator oit=op_bases.begin();
oit != op_bases.end();
oit++) {
ss << *oit << ", ";
}
ss << endl;
}
ss << "}" << endl;
ss << "ITERSPACE {" << endl;
ss << " LAYOUT = " << layout_text(block_.iterspace.layout) << "," << endl;
ss << " NDIM = " << block_.iterspace.ndim << "," << endl;
ss << " SHAPE = {";
for(int64_t dim=0; dim < block_.iterspace.ndim; ++dim) {
ss << block_.iterspace.shape[dim];
if (dim != (block_.iterspace.ndim-1)) {
ss << ", ";
}
}
ss << "}" << endl;
ss << " NELEM = " << block_.iterspace.nelem << endl;
ss << "}" << endl;
ss << "]" << endl;
return ss.str();
}
kp_block& Block::meta(void)
{
return block_;
}
}}
|
Ektorus/bohrium
|
ve/cpu/block.cpp
|
C++
|
lgpl-3.0
| 15,729
|
<html>
<head></head>
<body>
Title: הודאה לפני התרגיל | Prayer of Gratitude Before Exercise, by Rabbi Shmuly Yanklowitz<br />
Primary contributor: shmuly.yanklowitz<br />
For attribution and license, please consult the following URL: <a href="http://opensiddur.org/?p=20294">http://opensiddur.org/?p=20294</a>
<p />
<hr />
[xyz-ihs snippet="Table-Options"]<table style="margin-left: auto; margin-right: auto;" class="draggable">
<thead><tr><th id="x" style="text-align: right;">Hebrew</th><th style="text-align: left;">English</th></tr></thead>
<tbody>
<tr><td style="vertical-align:top;">
<div class="liturgy" lang="he">
אֱלֹהַי,
אֲשֶׁר יָצַרְתָּ אֶת נִשְׁמָתִי וְאֶת גּוּפִי,
וְצִוִּיתָנִי לִשְׁמֹר אוֹתָם מְאֹד;
חׇנֵּנִי בְּעֹז לְהַמְרִיץ אֶת עַצְמִי בַּמִּדָּה הָרְאוּיָה.
</span></div></td>
<td style="vertical-align:top;">
<div class="english" lang="en">
My God,
You have created my soul and body,
and have commanded me to fervently watch over them;
grant me the courage to exert myself to the suitable degree.
</div></td></tr>
<tr><td style="vertical-align:top;">
<div class="liturgy" lang="he">
מוֹדֶה אֲנִי לְפָנֶיךָ,
שֶׁנָּתַתָּ לִי אֶת הַכּוֹחוֹת הַנְּחוּצִים לְהִתְאַמֵּן;
כֵּן שׇׁמְרֵנִי נָא מִפְּגִיעָה בְּאִמּוּן זֶה,
שַׂמְּחֵנִי בּוֹ,
וְעֲזֹר לְמַאֲמַצַּי לְחַזֵּק אֶת גּוּפִי
וּלְהַאֲרִיךְ אֶת יָמַי בִּבְרִיאוּת.
</span></div></td>
<td style="vertical-align:top;">
<div class="english" lang="en">
I am grateful to You
that You have provided me with the necessary vigor to exercise;
please continue to guard me from injury during this training,
allow me to delight in it,
and assist my efforts to strengthen my body,
and to lengthen my days in health.
</div></td></tr>
</tbody></table>
<hr />
This prayer was first published at the Times of Israel in an essay by Rav Shmuly Yanklowitz, "<a href="http://blogs.timesofisrael.com/making-a-blessing-before-we-exercise/">Making a blessing before we exercise!</a>" on 15 June 2018. He writes:
<blockquote>Rabbi Abraham Isaac HaKohen Kook teaches that exercise can be a holy mitsvah:
<blockquote>[W]hen young people engage in sport to strengthen the power and spirit for the sake of the might of the entire nation, that holy service raises God’s Presence higher and higher, as it is raised by the songs and praises that David, King of Israel, expressed in the book of Psalms.
By means of supernal intentions, the inner soul rises. By means of actions that strengthen individuals’ bodies for the sake of the all, outer spirituality rises. These two together bring to perfection the arrangements of all holiness, emphasizing the character of the nation in that small phrase upon which all the limbs of the Torah depend: “In all your ways, know Him” (Orot, Orot Hatechiyah 34).</blockquote>
So, then, if it is a mitsvah to guard our lives and strengthen our bodies in service of our holy mission, then there should be a brakhah (blessing) before we start a session of vigorous activity; any excuse to add blessings to our day is a wonderful opportunity for personal growth! With regard to the substance of the blessing, I would propose the following language.</blockquote>
</body>
</html>
|
aharonium/opensiddur.org
|
posts/HTML/prayers/life-cycle/living/well-being-health-and-caregiving/prayer-of-gratitude-before-exercise-by-rabbi-shmuly-yanklowitz.html.md
|
Markdown
|
lgpl-3.0
| 3,518
|
package com.crobox.clickhouse.dsl.execution
import akka.stream.scaladsl.Source
import com.crobox.clickhouse.ClickhouseClient
import com.crobox.clickhouse.dsl.language.{ClickhouseTokenizerModule, TokenizerModule}
import com.crobox.clickhouse.dsl.{Query, Table}
import com.crobox.clickhouse.internal.QuerySettings
import com.crobox.clickhouse.internal.progress.QueryProgress.QueryProgress
import com.typesafe.scalalogging.LazyLogging
import spray.json.{JsonReader, _}
import scala.concurrent.{ExecutionContext, Future}
trait ClickhouseQueryExecutor extends QueryExecutor {
self: TokenizerModule =>
implicit val client: ClickhouseClient
def execute[V: JsonReader](query: Query)(implicit executionContext: ExecutionContext,
settings: QuerySettings = QuerySettings()): Future[QueryResult[V]] = {
import QueryResult._
val queryResult = client.query(toSql(query.internalQuery))
queryResult.map(_.parseJson.convertTo[QueryResult[V]])
}
def executeWithProgress[V: JsonReader](
query: Query
)(implicit executionContext: ExecutionContext,
settings: QuerySettings = QuerySettings()): Source[QueryProgress, Future[QueryResult[V]]] = {
import QueryResult._
val queryResult = client.queryWithProgress(toSql(query.internalQuery))
queryResult.mapMaterializedValue(_.map(_.parseJson.convertTo[QueryResult[V]]))
}
override def insert[V: JsonWriter](
table: Table,
values: Seq[V]
)(implicit executionContext: ExecutionContext, settings: QuerySettings = QuerySettings()): Future[String] =
Future {
values.map(_.toJson.compactPrint).mkString("\n") + "\n"
}.flatMap(
entity => client.execute(s"INSERT INTO ${table.quoted} FORMAT JSONEachRow", entity)
)
}
object ClickhouseQueryExecutor {
def default(clickhouseClient: ClickhouseClient): ClickhouseQueryExecutor =
new DefaultClickhouseQueryExecutor(clickhouseClient)
}
class DefaultClickhouseQueryExecutor(override val client: ClickhouseClient)
extends ClickhouseQueryExecutor
with ClickhouseTokenizerModule
|
crobox/clickhouse-scala-client
|
dsl/src/main/scala/com.crobox.clickhouse/dsl/execution/ClickhouseQueryExecutor.scala
|
Scala
|
lgpl-3.0
| 2,089
|
# -*- coding: UTF-8 -*-
from datetime import date
import re
import pytest
from pyopenmensa.feed import LazyBuilder
@pytest.fixture
def canteen():
return LazyBuilder()
def test_date_converting(canteen):
day = date(2013, 3, 7)
assert canteen.dayCount() == 0
canteen.setDayClosed('2013-03-07')
assert canteen.dayCount() == 1
canteen.setDayClosed(day)
assert canteen.dayCount() == 1
canteen.setDayClosed('07.03.2013')
assert canteen.dayCount() == 1
def test_has_meals_for(canteen):
day = date(2013, 3, 7)
assert canteen.hasMealsFor(day) is False
canteen._days[day] = {'Hausgericht': ('Gulash', [], {})}
assert canteen.hasMealsFor(day) is True
canteen.setDayClosed(day)
assert canteen.hasMealsFor(day) is False
def test_add_meal(canteen):
day = date(2013, 3, 7)
canteen.addMeal(day, 'Hauptgericht', 'Gulasch')
assert canteen.hasMealsFor(day)
def test_to_long_meal_name(canteen):
day = date(2013, 3, 7)
canteen.addMeal(day, 'Hauptgericht', 'Y'*251)
canteen.hasMealsFor(day)
def test_caseinsensitive_notes(canteen):
day = date(2013, 3, 7)
canteen.legendKeyFunc = lambda v: v.lower()
canteen.setLegendData(legend={'f': 'Note'})
canteen.addMeal(day, 'Test', 'Essen(F)')
assert canteen._days[day]['Test'][0] == ('Essen', ['Note'], {})
def test_notes_regex(canteen):
day = date(2013, 3, 7)
canteen.extra_regex = re.compile('_([0-9]{1,3})_(?:: +)?', re.UNICODE)
canteen.setLegendData(legend={'2': 'Found Note'})
canteen.addMeal(day, 'Test', '_2_: Essen _a_, _2,2_, (2)')
assert canteen._days[day]['Test'][0] == ('Essen _a_, _2,2_, (2)', ['Found Note'], {})
|
mswart/pyopenmensa
|
tests/feed/test_lazy_canteen.py
|
Python
|
lgpl-3.0
| 1,685
|
#**
# Makefile running all tests
#
# Redistribution of this file to outside parties is
# strictly prohibited without the written consent
# of the module owner indicated below.\n
#
# \par Module owner:
# Thierry Lepley, STMicroelectronics (thierry.lepley@st.com)
#
# \par Copyright STMicroelectronics (C) 2012-2013
#
# \par Authors:
# Thierry Lepley, STMicroelectronics (thierry.lepley@st.com)
#**
.PHONY: all build run clean
.PHONY: all build run test clean cleanall
run :
runtest
test:
@echo
@echo "*****************************************************************"
@echo "************ Posix-Posix ************ "
@echo "*****************************************************************"
runtest
@echo
@echo "*****************************************************************"
@echo "************ Posix-XP70 ************ "
@echo "*****************************************************************"
runtest -testset=tests_xp70.xml
clean :
@echo
@echo "*****************************************************************"
@echo "************ Sobel Graph ************ "
@echo "*****************************************************************"
$(MAKE) -f SobelGraph.mk clean
@echo "*****************************************************************"
@echo "************ Separable convolution Graph ************ "
@echo "*****************************************************************"
$(MAKE) -f SeparableConvolution.mk clean
@echo "*****************************************************************"
@echo "************ Upsampling ************ "
@echo "*****************************************************************"
$(MAKE) -f Upsampling.mk clean
@echo "*****************************************************************"
@echo "************ DoG ************ "
@echo "*****************************************************************"
$(MAKE) -f DoG.mk clean
cleanall : clean
@echo "* Removing build directories for all targets"
rm -rf build_*
rm -rf target
rm -rf *~
|
tlepley/KernelGenius
|
test/graph/Makefile
|
Makefile
|
lgpl-3.0
| 2,194
|
#ifndef __TEMPLATEKEYWORDS_H__5DD73091_CBAC_4be6_BE7D_3D9E5B4D27E7
#define __TEMPLATEKEYWORDS_H__5DD73091_CBAC_4be6_BE7D_3D9E5B4D27E7
#include "imc_lecturnity_converter_LPLibs.h"
// Keywords for 'Standard Navigation'
#define NUMBER_OF_NAVIGATION_STATES imc_lecturnity_converter_LPLibs_NUMBER_OF_NAVIGATION_STATES
const CString CS_NAVIGATION_KEYWORDS[] = {
"NavigationControlBar",
"NavigationStandardButtons",
"NavigationTimeLine",
"NavigationTimeDisplay",
"NavigationDocumentStructure",
"NavigationPlayerSearchField",
"NavigationPlayerConfigButtons",
"NavigationPluginContextMenu"
};
enum TE_TYPES
{
TE_TYPE_IMAGE = 1,
TE_TYPE_INTEGER,
TE_TYPE_COLOR,
TE_TYPE_GENERAL,
TE_TYPE_TEXT,
TE_TYPE_SELECT
};
struct TE_VAR
{
DWORD dwSize;
DWORD dwType;
WCHAR wszVarName[128];
};
class CTemplateKeyword
{
public:
CTemplateKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName);
virtual void Restore(LPVOID pData, DWORD dwSize);
virtual bool Serialize(LPVOID pData, DWORD *pdwSize);
virtual int GetType()=0;
virtual CString GetReplaceString()=0;
virtual CString GetStringRepresentation() = 0;
virtual bool ParseFromString(CString& csRepresentation) = 0;
public:
TE_VAR *m_pConfig;
CString m_csName;
CString m_csFriendlyName;
DWORD m_dwMinStructSize;
};
enum TE_IMAGE_SIZE_HANDLING
{
TE_IMAGE_FITS_ALREADY = 1,
TE_IMAGE_ADAPT_SIZE,
TE_IMAGE_DO_NOT_ADAPT
};
struct TE_VAR_IMAGE : TE_VAR
{
WCHAR wszFileName[MAX_PATH];
DWORD dwImageSizeHandling;
};
class CTemplateImageKeyword : public CTemplateKeyword
{
public:
CTemplateImageKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName,
int nMinWidth, int nMinHeight, int nMaxWidth, int nMaxHeight);
void SetFileName(const _TCHAR *tszFileName);
UINT GetFileName(_TCHAR *tszFileName, DWORD *pdwSize);
void SetImageSizeHandling(DWORD dwAdaptImageSize);
DWORD GetImageSizeHandling();
CString GetImageName();
virtual int GetType() {return TE_TYPE_IMAGE;}
virtual CString GetReplaceString();
virtual CString GetStringRepresentation();
virtual bool ParseFromString(CString& csRepresentation);
private:
void GetImageSizeFromFile(CString csFileName, int &nOrigWidth, int &nOrigHeight);
bool CalculateAdaptedImageSize(int &nOrigWidth, int &nOrigHeight, int &nNewWidth, int &nNewHeight);
public:
int m_nMinWidth;
int m_nMinHeight;
int m_nMaxWidth;
int m_nMaxHeight;
};
struct TE_VAR_INTEGER : TE_VAR
{
int nValue;
};
class CTemplateIntegerKeyword : public CTemplateKeyword
{
public:
CTemplateIntegerKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName,
int nMinValue, int nMaxValue);
void SetValue(int nValue);
int GetValue();
virtual int GetType() {return TE_TYPE_INTEGER;}
virtual CString GetReplaceString();
virtual CString GetStringRepresentation();
virtual bool ParseFromString(CString& csRepresentation);
public:
int m_nMinValue;
int m_nMaxValue;
};
struct TE_VAR_COLOR : TE_VAR
{
COLORREF rgbColor;
};
class CTemplateColorKeyword : public CTemplateKeyword
{
public:
CTemplateColorKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName);
void SetColor(COLORREF color);
COLORREF GetColor();
virtual int GetType() {return TE_TYPE_COLOR;}
virtual CString GetReplaceString();
virtual CString GetStringRepresentation();
virtual bool ParseFromString(CString& csRepresentation);
};
struct TE_VAR_GENERAL : TE_VAR
{
DWORD dwOffset;
WCHAR wszGeneral[1];
};
class CTemplateGeneralKeyword : public CTemplateKeyword
{
public:
CTemplateGeneralKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName);
void SetGeneral(const _TCHAR *tszGeneral);
UINT GetGeneral(_TCHAR *tszGeneral, DWORD *pdwSize);
virtual int GetType() {return TE_TYPE_GENERAL;}
virtual CString GetReplaceString();
virtual CString GetStringRepresentation();
virtual bool ParseFromString(CString& csRepresentation);
};
struct TE_VAR_TEXT : TE_VAR
{
DWORD dwOffset;
WCHAR wszText[1];
};
class CTemplateTextKeyword : public CTemplateKeyword
{
public:
CTemplateTextKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName, int nMaxLength);
void SetText(const _TCHAR *tszText);
UINT GetText(_TCHAR *tszText, DWORD *pdwText);
virtual int GetType() {return TE_TYPE_TEXT;}
virtual CString GetReplaceString();
virtual CString GetStringRepresentation();
virtual bool ParseFromString(CString& csRepresentation);
public:
int m_nMaxLength;
};
struct TE_VAR_SELECT : TE_VAR_TEXT
{
};
class CTemplateSelectKeyword : public CTemplateTextKeyword
{
public:
CTemplateSelectKeyword(const _TCHAR *tszName, const _TCHAR *tszFriendlyName,
const _TCHAR *tszVisibleOptions, const _TCHAR *tszOptions);
virtual int GetType() {return TE_TYPE_SELECT;}
// Note: the selected value is the text of the CTemplateTextKeyword (super class)
public:
CArray<CString, CString> m_caVisibleOptions;
CArray<CString, CString> m_caOptions;
int m_nOptionCount;
};
#endif // __TEMPLATEKEYWORDS_H__5DD73091_CBAC_4be6_BE7D_3D9E5B4D27E7
|
openlecturnity/os45
|
lecturnity/publisher/LPLibs/TemplateKeywords.h
|
C
|
lgpl-3.0
| 5,158
|
import React from 'react'
import styles from './styles.scss'
class FigureAnimate extends React.PureComponent {
constructor (props) {
super()
this.state = {
imgTransform: null
}
this.time = null
}
componentDidMount () {
this.time = setTimeout(() => {
this.setState({
imgTransform: {
transform: 'scale(1, 1)'
}
})
}, 1000)
}
componentWillUnmount () {
clearTimeout(this.time)
}
render () {
const { cls } = this.props
return (
<figure className={styles[cls]}>
<img
src='http://7xpwuf.com1.z0.glb.clouddn.com/WechatIMG13.jpeg'
height='300'
width='685'
className={styles.KenBurns}
style={this.state.imgTransform}
/>
<figcaption>
<h2>图片标题</h2>
<p>图片注解</p>
<p>大图片注解</p>
<p>图片注解</p>
<div />
</figcaption>
</figure>
)
}
}
export default FigureAnimate
|
LightningVII/CSS3-Transform-Effect-Demo
|
src/components/FigureAnimate/index.js
|
JavaScript
|
lgpl-3.0
| 1,020
|
/**
* Copyright (c) 2014 mediaworx berlin AG (http://mediaworx.com)
* <p>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* <p>
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* <p>
* For further information about mediaworx berlin AG, please see the
* company website: http://mediaworx.com
* <p>
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* If not, see <http://www.gnu.org/licenses/>
*/
package com.mediaworx.mojo.opencms;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
/**
* Creates or copies a module manifest.
*/
@Mojo(name = "manifest",
defaultPhase = LifecyclePhase.PACKAGE,
requiresDependencyResolution = ResolutionScope.RUNTIME)
public class ManifestMojo extends AbstractOpenCmsMojo {
/**
* Creates a OpenCms manifest either by copying and filtering an existing manifest.xml given with ${manifestFile}
* or using the stub file ${manifestMetaDir} and additional meta information generated by the IntelliJ OpenCms plugin
* in the same directory as the stub file.
*/
public void execute() throws MojoExecutionException, MojoFailureException {
addManifest();
}
}
|
zebrajaeger/opencms-maven-plugin
|
src/main/java/com/mediaworx/mojo/opencms/ManifestMojo.java
|
Java
|
lgpl-3.0
| 1,844
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DELETEEXPRESSIONRESPONSE_P_H
#define QTAWS_DELETEEXPRESSIONRESPONSE_P_H
#include "cloudsearchresponse_p.h"
namespace QtAws {
namespace CloudSearch {
class DeleteExpressionResponse;
class DeleteExpressionResponsePrivate : public CloudSearchResponsePrivate {
public:
explicit DeleteExpressionResponsePrivate(DeleteExpressionResponse * const q);
void parseDeleteExpressionResponse(QXmlStreamReader &xml);
private:
Q_DECLARE_PUBLIC(DeleteExpressionResponse)
Q_DISABLE_COPY(DeleteExpressionResponsePrivate)
};
} // namespace CloudSearch
} // namespace QtAws
#endif
|
pcolby/libqtaws
|
src/cloudsearch/deleteexpressionresponse_p.h
|
C
|
lgpl-3.0
| 1,333
|
package ecommerce
import (
"net/http"
"github.com/arvindkandhare/goamz/aws"
)
// ProductAdvertising provides methods for querying the product advertising API
type ProductAdvertising struct {
service aws.Service
associateTag string
}
// New creates a new ProductAdvertising client
func New(auth aws.Auth, associateTag string) (p *ProductAdvertising, err error) {
serviceInfo := aws.ServiceInfo{Endpoint: "https://webservices.amazon.com", Signer: aws.V2Signature}
if service, err := aws.NewService(auth, serviceInfo); err == nil {
p = &ProductAdvertising{*service, associateTag}
}
return
}
// PerformOperation is the main method used for interacting with the product advertising API
func (p *ProductAdvertising) PerformOperation(operation string, params map[string]string) (resp *http.Response, err error) {
params["Operation"] = operation
return p.query(params)
}
func (p *ProductAdvertising) query(params map[string]string) (resp *http.Response, err error) {
params["Service"] = "AWSECommerceService"
params["AssociateTag"] = p.associateTag
return p.service.Query("GET", "/onca/xml", params)
}
|
arvindkandhare/goamz
|
ecommerce/ecommerce.go
|
GO
|
lgpl-3.0
| 1,120
|
# Login-AzureRmAccount
Get-AzureRmSubscription | where { $_.SubscriptionName -like "*MVP*" } | Select-AzureRmSubscription
$rg = "RG-Docker"
$dep = "Simple-Docker-Deployment"
$path = "C:\Code\Github\Samples\ArmWorkshop\02-Docker"
New-AzureRmResourceGroup -Name $rg -Location "northeurope" -Force
New-AzureRmResourceGroupDeployment -ResourceGroupName $rg -TemplateFile "$path\azuredeploy.json" `
-TemplateParameterFile "$path\azuredeploy.parameters.json" -Name $dep
# Get-AzureRmResourceGroup -Name $rg | Remove-AzureRmResourceGroup -Force
|
rstropek/Samples
|
ArmWorkshop/02-Docker/deploy.ps1
|
PowerShell
|
lgpl-3.0
| 547
|
<?php
/*
*
* _______ _
* |__ __| (_)
* | |_ _ _ __ __ _ _ __ _ ___
* | | | | | '__/ _` | '_ \| |/ __|
* | | |_| | | | (_| | | | | | (__
* |_|\__,_|_| \__,_|_| |_|_|\___|
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* @author TuranicTeam
* @link https://github.com/TuranicTeam/Turanic
*
*/
declare(strict_types=1);
namespace pocketmine\inventory;
use pocketmine\tile\Dropper;
use pocketmine\network\mcpe\protocol\types\WindowTypes;
class DropperInventory extends ContainerInventory {
/** @var Dropper */
protected $holder;
public function __construct(Dropper $tile){
parent::__construct($tile);
}
public function getName() : string{
return "Dropper";
}
public function getDefaultSize() : int{
return 9;
}
/**
* @return Dropper
*/
public function getHolder(){
return $this->holder;
}
public function getNetworkType() : int{
return WindowTypes::DROPPER;
}
}
|
TuranicTeam/Turanic
|
src/pocketmine/inventory/DropperInventory.php
|
PHP
|
lgpl-3.0
| 1,202
|
<?php
namespace Model\activity;
/**
* Model class of activity.
* @package tcxeditor\Model\activity
* @author Marcin Zamelski <zamelcia@gmail.com>
* @version: 1.0
* @license http://www.gnu.org/copyleft/lesser.html
*
*/
class Model extends \ModelA
{
/**
* @var IActive Activity object.
*/
private $activity;
/**
* Load given file into object and return him.
*
* @param Integer $id Id of file to load
*
* @return IActive
*/
public function loadFile ($id) {
$name = $_SESSION["names"][$id];
try {
if( file_exists(DIR_UPLOAD . $name) ) {
$parse = new \parseFile();
$this->activity = $parse->parse($name);
return $this->activity;
}
else throw new \Exception ("There is no files with that name");
}
catch (\Exception $e) {
$catcher = new \catcher($e);
$catcher->show();
}
}
}
|
uchwyt/obtuse-broccoli
|
scripts/Model/activity/Model.php
|
PHP
|
lgpl-3.0
| 850
|
package org.opennaas.itests.helpers.server;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
* Defines the main architecture of a test which contains a resource capability with a HTTP REST driver.
*
* @author Adrian Rosello Rey (i2CAT)
*
*/
public abstract class MockHTTPServerTest {
private final static Log log = LogFactory.getLog(MockHTTPServerTest.class);
protected HTTPServer server;
protected List<HTTPServerBehaviour> desiredBehaviours;
/**
* Creates and starts a HTTP server in port 8080, listening for requests under the given servletURL url. It will contain the previous configured
* list of behaviors, which define the set of requests the server accepts and the responses associated to them.
*
* @param servletUrl
* @throws Exception
*/
protected void startServer(String servletUrl) throws Exception {
log.info("Creating HTTP server on http://localhost:8080" + servletUrl);
server = new HTTPServer(8080);
server.setBaseURL(servletUrl);
log.debug("Adding desired behaviors to server.");
server.setDesiredBehaviours(desiredBehaviours);
server.start();
log.info("HTTP Server successfully created on http://localhost:8080" + servletUrl);
}
/**
* Stops the server instance.
*
* @throws Exception
*/
protected void stopServer() throws Exception {
log.info("Stopping HTTP server");
server.stop();
desiredBehaviours = null;
log.info("HTTP server stopped.");
}
/**
* Method should create the list of behaviors the server will contain.
*
* @throws Exception
*/
protected abstract void prepareBehaviours() throws Exception;
}
|
dana-i2cat/opennaas
|
itests/helpers/src/main/java/org/opennaas/itests/helpers/server/MockHTTPServerTest.java
|
Java
|
lgpl-3.0
| 1,684
|
#region CodeMaid is Copyright 2007-2015 Steve Cadwallader.
// CodeMaid is free software: you can redistribute it and/or modify it under the terms of the GNU
// Lesser General Public License version 3 as published by the Free Software Foundation.
//
// CodeMaid 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 <http://www.gnu.org/licenses/>.
#endregion CodeMaid is Copyright 2007-2015 Steve Cadwallader.
using EnvDTE;
using SteveCadwallader.CodeMaid.Helpers;
using SteveCadwallader.CodeMaid.Logic.Cleaning;
using SteveCadwallader.CodeMaid.UI.Dialogs.CleanupProgress;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Windows;
namespace SteveCadwallader.CodeMaid.Integration.Commands
{
/// <summary>
/// A command that provides for cleaning up code in all documents.
/// </summary>
internal class CleanupAllCodeCommand : BaseCommand
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CleanupAllCodeCommand" /> class.
/// </summary>
/// <param name="package">The hosting package.</param>
internal CleanupAllCodeCommand(CodeMaidPackage package)
: base(package,
new CommandID(GuidList.GuidCodeMaidCommandCleanupAllCode, (int)PkgCmdIDList.CmdIDCodeMaidCleanupAllCode))
{
CodeCleanupAvailabilityLogic = CodeCleanupAvailabilityLogic.GetInstance(Package);
}
#endregion Constructors
#region BaseCommand Members
/// <summary>
/// Called to update the current status of the command.
/// </summary>
protected override void OnBeforeQueryStatus()
{
Enabled = Package.IDE.Solution.IsOpen;
}
/// <summary>
/// Called to execute the command.
/// </summary>
protected override void OnExecute()
{
base.OnExecute();
if (!CodeCleanupAvailabilityLogic.IsCleanupEnvironmentAvailable())
{
MessageBox.Show(@"Cleanup cannot run while debugging.",
@"CodeMaid: Cleanup All Code",
MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (MessageBox.Show(@"Are you ready for CodeMaid to clean everything in the solution?",
@"CodeMaid: Confirmation For Cleanup All Code",
MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No)
== MessageBoxResult.Yes)
{
using (new ActiveDocumentRestorer(Package))
{
var viewModel = new CleanupProgressViewModel(Package, AllProjectItems);
var window = new CleanupProgressWindow { DataContext = viewModel };
window.ShowModal();
}
}
}
#endregion BaseCommand Members
#region Private Properties
/// <summary>
/// Gets the list of all project items.
/// </summary>
private IEnumerable<ProjectItem> AllProjectItems
{
get { return SolutionHelper.GetAllItemsInSolution<ProjectItem>(Package.IDE.Solution).Where(x => CodeCleanupAvailabilityLogic.CanCleanup(x)); }
}
/// <summary>
/// Gets or sets the code cleanup availability logic.
/// </summary>
private CodeCleanupAvailabilityLogic CodeCleanupAvailabilityLogic { get; set; }
#endregion Private Properties
}
}
|
AlkindiX/codemaid
|
CodeMaid/Integration/Commands/CleanupAllCodeCommand.cs
|
C#
|
lgpl-3.0
| 3,898
|
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine 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 KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(DEFINE_IN_INTERFACE)
#undef KBE_BASEAPPMG_INTERFACE_MACRO_HPP
#endif
#ifndef KBE_BASEAPPMG_INTERFACE_MACRO_HPP
#define KBE_BASEAPPMG_INTERFACE_MACRO_HPP
// common include
#include "network/interface_defs.hpp"
// windows include
#if KBE_PLATFORM == PLATFORM_WIN32
#else
// linux include
#endif
namespace KBEngine{
/**
BaseappmgrÏûÏ¢ºê£¬ ²ÎÊýΪÁ÷£¬ ÐèÒª×Ô¼º½â¿ª
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_STREAM
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_STREAM(NAME) \
void NAME##BaseappmgrMessagehandler_stream::handle(Mercury::Channel* pChannel,\
KBEngine::MemoryStream& s) \
{ \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, s); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_STREAM(NAME) \
void NAME##BaseappmgrMessagehandler_stream::handle(Mercury::Channel* pChannel,\
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_STREAM(NAME) \
class NAME##BaseappmgrMessagehandler_stream : public Mercury::MessageHandler\
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_STREAM(NAME, MSG_LENGTH) \
BASEAPPMGR_MESSAGE_HANDLER_STREAM(NAME) \
NETWORK_MESSAGE_DECLARE_STREAM(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler_stream, MSG_LENGTH) \
\
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÁã¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS0
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS0(NAME) \
void NAME##BaseappmgrMessagehandler0::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS0(NAME) \
void NAME##BaseappmgrMessagehandler0::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS0(NAME) \
class NAME##BaseappmgrMessagehandler0 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS0(NAME, MSG_LENGTH) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS0(NAME) \
NETWORK_MESSAGE_DECLARE_ARGS0(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler0, MSG_LENGTH) \
\
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÒ»¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS1
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS1(NAME, ARG_TYPE1, ARG_NAME1) \
void NAME##BaseappmgrMessagehandler1::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, ARG_NAME1); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS1(NAME, ARG_TYPE1, ARG_NAME1) \
void NAME##BaseappmgrMessagehandler1::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS1(NAME, ARG_TYPE1, ARG_NAME1) \
class NAME##BaseappmgrMessagehandler1 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS1(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1)\
BASEAPPMGR_MESSAGE_HANDLER_ARGS1(NAME, ARG_TYPE1, ARG_NAME1) \
NETWORK_MESSAGE_DECLARE_ARGS1(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler1, MSG_LENGTH, ARG_TYPE1, ARG_NAME1)\
\
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»Óжþ¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS2
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS2(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2) \
void NAME##BaseappmgrMessagehandler2::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS2(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2) \
void NAME##BaseappmgrMessagehandler2::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS2(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2) \
class NAME##BaseappmgrMessagehandler2 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS2(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS2(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2) \
NETWORK_MESSAGE_DECLARE_ARGS2(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler2, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÈý¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS3
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS3(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
void NAME##BaseappmgrMessagehandler3::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, \
ARG_NAME3); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS3(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
void NAME##BaseappmgrMessagehandler3::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS3(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
class NAME##BaseappmgrMessagehandler3 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS3(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS3(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
NETWORK_MESSAGE_DECLARE_ARGS3(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler3, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐËĸö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS4
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS4(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
void NAME##BaseappmgrMessagehandler4::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, \
ARG_NAME3, ARG_NAME4); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS4(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
void NAME##BaseappmgrMessagehandler4::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS4(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
class NAME##BaseappmgrMessagehandler4 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS4(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS4(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
NETWORK_MESSAGE_DECLARE_ARGS4(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler4, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÎå¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS5
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS5(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
void NAME##BaseappmgrMessagehandler5::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, \
ARG_NAME3, ARG_NAME4, ARG_NAME5); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS5(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
void NAME##BaseappmgrMessagehandler5::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS5(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
class NAME##BaseappmgrMessagehandler5 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS5(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS5(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
NETWORK_MESSAGE_DECLARE_ARGS5(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler5, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÁù¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS6
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS6(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
void NAME##BaseappmgrMessagehandler6::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, \
ARG_NAME3, ARG_NAME4, ARG_NAME5, ARG_NAME6); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS6(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
void NAME##BaseappmgrMessagehandler6::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS6(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
class NAME##BaseappmgrMessagehandler6 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS6(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS6(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
NETWORK_MESSAGE_DECLARE_ARGS6(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler6, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÆß¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS7
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS7(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
void NAME##BaseappmgrMessagehandler7::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
ARG_TYPE7 ARG_NAME7; \
s >> ARG_NAME7; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, \
ARG_NAME3, ARG_NAME4, ARG_NAME5, ARG_NAME6, ARG_NAME7); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS7(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
void NAME##BaseappmgrMessagehandler7::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS7(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
class NAME##BaseappmgrMessagehandler7 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS7(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS7(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
NETWORK_MESSAGE_DECLARE_ARGS7(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler7, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»Óа˸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS8
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS8(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
void NAME##BaseappmgrMessagehandler8::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
ARG_TYPE7 ARG_NAME7; \
s >> ARG_NAME7; \
ARG_TYPE8 ARG_NAME8; \
s >> ARG_NAME8; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, ARG_NAME3, \
ARG_NAME4, ARG_NAME5, ARG_NAME6, \
ARG_NAME7, ARG_NAME8); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS8(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
void NAME##BaseappmgrMessagehandler8::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS8(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
class NAME##BaseappmgrMessagehandler8 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS8(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS8(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
NETWORK_MESSAGE_DECLARE_ARGS8(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler8, MSG_LENGTH, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓоŸö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS9
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS9(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
void NAME##BaseappmgrMessagehandler9::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
ARG_TYPE7 ARG_NAME7; \
s >> ARG_NAME7; \
ARG_TYPE8 ARG_NAME8; \
s >> ARG_NAME8; \
ARG_TYPE9 ARG_NAME9; \
s >> ARG_NAME9; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, ARG_NAME3, \
ARG_NAME4, ARG_NAME5, ARG_NAME6, \
ARG_NAME7, ARG_NAME8, ARG_NAME9); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS9(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
void NAME##BaseappmgrMessagehandler9::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS9(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
class NAME##BaseappmgrMessagehandler9 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS9(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS9(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
NETWORK_MESSAGE_DECLARE_ARGS9(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler9, MSG_LENGTH, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐÊ®¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS10
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS10(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
void NAME##BaseappmgrMessagehandler10::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
ARG_TYPE7 ARG_NAME7; \
s >> ARG_NAME7; \
ARG_TYPE8 ARG_NAME8; \
s >> ARG_NAME8; \
ARG_TYPE9 ARG_NAME9; \
s >> ARG_NAME9; \
ARG_TYPE10 ARG_NAME10; \
s >> ARG_NAME10; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, ARG_NAME3, \
ARG_NAME4, ARG_NAME5, ARG_NAME6, \
ARG_NAME7, ARG_NAME8, ARG_NAME9, \
ARG_NAME10); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS10(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
void NAME##BaseappmgrMessagehandler10::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS10(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
class NAME##BaseappmgrMessagehandler10 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS10(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS10(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
NETWORK_MESSAGE_DECLARE_ARGS10(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler10, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10) \
/**
BaseappmgrÏûÏ¢ºê£¬ Ö»ÓÐʮһ¸ö²ÎÊýµÄÏûÏ¢
*/
#if defined(NETWORK_INTERFACE_DECLARE_BEGIN)
#undef BASEAPPMGR_MESSAGE_HANDLER_ARGS11
#endif
#if defined(DEFINE_IN_INTERFACE)
#if defined(BASEAPPMGR)
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS11(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
void NAME##BaseappmgrMessagehandler11::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
ARG_TYPE1 ARG_NAME1; \
s >> ARG_NAME1; \
ARG_TYPE2 ARG_NAME2; \
s >> ARG_NAME2; \
ARG_TYPE3 ARG_NAME3; \
s >> ARG_NAME3; \
ARG_TYPE4 ARG_NAME4; \
s >> ARG_NAME4; \
ARG_TYPE5 ARG_NAME5; \
s >> ARG_NAME5; \
ARG_TYPE6 ARG_NAME6; \
s >> ARG_NAME6; \
ARG_TYPE7 ARG_NAME7; \
s >> ARG_NAME7; \
ARG_TYPE8 ARG_NAME8; \
s >> ARG_NAME8; \
ARG_TYPE9 ARG_NAME9; \
s >> ARG_NAME9; \
ARG_TYPE10 ARG_NAME10; \
s >> ARG_NAME10; \
ARG_TYPE11 ARG_NAME11; \
s >> ARG_NAME11; \
KBEngine::Baseappmgr::getSingleton().NAME(pChannel, \
ARG_NAME1, ARG_NAME2, ARG_NAME3, \
ARG_NAME4, ARG_NAME5, ARG_NAME6, \
ARG_NAME7, ARG_NAME8, ARG_NAME9, \
ARG_NAME10, ARG_NAME11); \
} \
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS11(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
void NAME##BaseappmgrMessagehandler11::handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s) \
{ \
} \
#endif
#else
#define BASEAPPMGR_MESSAGE_HANDLER_ARGS11(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
class NAME##BaseappmgrMessagehandler11 : public Mercury::MessageHandler \
{ \
public: \
virtual void handle(Mercury::Channel* pChannel, \
KBEngine::MemoryStream& s); \
}; \
#endif
#define BASEAPPMGR_MESSAGE_DECLARE_ARGS11(NAME, MSG_LENGTH, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
BASEAPPMGR_MESSAGE_HANDLER_ARGS11(NAME, ARG_TYPE1, ARG_NAME1, \
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
NETWORK_MESSAGE_DECLARE_ARGS11(Baseappmgr, NAME, \
NAME##BaseappmgrMessagehandler11, MSG_LENGTH, ARG_TYPE1, ARG_NAME1,\
ARG_TYPE2, ARG_NAME2, \
ARG_TYPE3, ARG_NAME3, \
ARG_TYPE4, ARG_NAME4, \
ARG_TYPE5, ARG_NAME5, \
ARG_TYPE6, ARG_NAME6, \
ARG_TYPE7, ARG_NAME7, \
ARG_TYPE8, ARG_NAME8, \
ARG_TYPE9, ARG_NAME9, \
ARG_TYPE10, ARG_NAME10, \
ARG_TYPE11, ARG_NAME11) \
}
#endif
|
amyvmiwei/kbengine
|
kbe/src/server/baseappmgr/baseappmgr_interface_macros.hpp
|
C++
|
lgpl-3.0
| 38,281
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.