code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
package acceptance;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import utils.CommandStatus;
import utils.TemporaryDigdagServer;
import java.nio.file.Path;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static utils.TestUtils.copyResource;
import static utils.TestUtils.main;
//
// This file doesn't contain normal case.
// It defined in another test.
//
public class ValidateProjectIT
{
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Rule
public TemporaryDigdagServer server = TemporaryDigdagServer.builder()
.build();
private Path config;
private Path projectDir;
@Before
public void setUp()
throws Exception
{
projectDir = folder.getRoot().toPath().resolve("foobar");
config = folder.newFile().toPath();
}
@Test
public void uploadInvalidTaskProject()
throws Exception
{
// Create new project
CommandStatus initStatus = main("init",
"-c", config.toString(),
projectDir.toString());
assertThat(initStatus.code(), is(0));
copyResource("acceptance/error_task/invalid_at_group.dig", projectDir.resolve("invalid_at_group.dig"));
// Push the project
CommandStatus pushStatus = main(
"push",
"--project", projectDir.toString(),
"foobar",
"-c", config.toString(),
"-e", server.endpoint());
assertThat(pushStatus.code(), is(1));
assertThat(pushStatus.errUtf8(), containsString("A task can't have more than one operator"));
}
@Test
public void uploadInvalidScheduleProject()
throws Exception
{
// Create new project
CommandStatus initStatus = main("init",
"-c", config.toString(),
projectDir.toString());
assertThat(initStatus.code(), is(0));
copyResource("acceptance/schedule/invalid_schedule.dig", projectDir.resolve("invalid_schedule.dig"));
// Push the project
CommandStatus pushStatus = main(
"push",
"--project", projectDir.toString(),
"foobar",
"-c", config.toString(),
"-e", server.endpoint());
assertThat(pushStatus.code(), is(1));
assertThat(pushStatus.errUtf8(), containsString("scheduler requires mm:ss format"));
}
}
| treasure-data/digdag | digdag-tests/src/test/java/acceptance/ValidateProjectIT.java | Java | apache-2.0 | 2,609 | [
30522,
7427,
9920,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
2077,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
3627,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
3231,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
3513,
1012,
5741,
10371,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>clustertools.test.test_parser — clustertools 0.1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '0.1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="clustertools 0.1.0 documentation" href="../../../index.html" />
<link rel="up" title="clustertools" href="../../clustertools.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">clustertools 0.1.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li>
<li class="nav-item nav-item-2"><a href="../../clustertools.html" accesskey="U">clustertools</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for clustertools.test.test_parser</h1><div class="highlight"><pre>
<span></span><span class="c1"># -*- coding: utf-8 -*-</span>
<span class="kn">from</span> <span class="nn">nose.tools</span> <span class="k">import</span> <span class="n">assert_equal</span><span class="p">,</span> <span class="n">assert_raises</span>
<span class="kn">from</span> <span class="nn">clustertools.parser</span> <span class="k">import</span> <span class="n">BaseParser</span><span class="p">,</span> <span class="n">ClusterParser</span><span class="p">,</span> <span class="n">positive_int</span><span class="p">,</span> \
<span class="n">time_string</span><span class="p">,</span> <span class="n">or_none</span>
<span class="n">__author__</span> <span class="o">=</span> <span class="s2">"Begon Jean-Michel <jm.begon@gmail.com>"</span>
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s2">"3-clause BSD License"</span>
<div class="viewcode-block" id="test_positive_int"><a class="viewcode-back" href="../../../source/clustertools.test.html#clustertools.test.test_parser.test_positive_int">[docs]</a><span class="k">def</span> <span class="nf">test_positive_int</span><span class="p">():</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">positive_int</span><span class="p">(</span><span class="s2">"5"</span><span class="p">))</span>
<span class="n">assert_raises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">positive_int</span><span class="p">,</span> <span class="s2">"-2"</span><span class="p">)</span>
<span class="n">assert_raises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">positive_int</span><span class="p">,</span> <span class="s2">"aaa"</span><span class="p">)</span></div>
<div class="viewcode-block" id="test_time_string"><a class="viewcode-back" href="../../../source/clustertools.test.html#clustertools.test.test_parser.test_time_string">[docs]</a><span class="k">def</span> <span class="nf">test_time_string</span><span class="p">():</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="s2">"1:00:00"</span><span class="p">,</span> <span class="n">time_string</span><span class="p">(</span><span class="s2">"1:00:00"</span><span class="p">))</span>
<span class="n">assert_raises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">time_string</span><span class="p">,</span> <span class="s2">"aaa"</span><span class="p">)</span>
<span class="n">assert_raises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">time_string</span><span class="p">,</span> <span class="s2">"23:00:00:00"</span><span class="p">)</span>
<span class="n">assert_raises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">time_string</span><span class="p">,</span> <span class="s2">"22:65:00"</span><span class="p">)</span></div>
<div class="viewcode-block" id="test_or_none"><a class="viewcode-back" href="../../../source/clustertools.test.html#clustertools.test.test_parser.test_or_none">[docs]</a><span class="k">def</span> <span class="nf">test_or_none</span><span class="p">():</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">or_none</span><span class="p">(</span><span class="nb">int</span><span class="p">)(</span><span class="mi">5</span><span class="p">))</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">or_none</span><span class="p">(</span><span class="nb">int</span><span class="p">)(</span><span class="kc">None</span><span class="p">))</span></div>
<div class="viewcode-block" id="test_base_parser"><a class="viewcode-back" href="../../../source/clustertools.test.html#clustertools.test.test_parser.test_base_parser">[docs]</a><span class="k">def</span> <span class="nf">test_base_parser</span><span class="p">():</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">BaseParser</span><span class="p">()</span>
<span class="n">environment</span><span class="p">,</span> <span class="n">custom_options</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse</span><span class="p">([</span><span class="s2">"custom1"</span><span class="p">,</span> <span class="s2">"custom2"</span><span class="p">,</span>
<span class="s2">"--capacity"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span>
<span class="s2">"-s"</span><span class="p">,</span> <span class="s2">"10"</span><span class="p">,</span>
<span class="s2">"--no_fail_fast"</span><span class="p">])</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">custom_options</span><span class="p">,</span> <span class="p">[</span><span class="s2">"custom1"</span><span class="p">,</span> <span class="s2">"custom2"</span><span class="p">])</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">fail_fast</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span></div>
<span class="c1"># TODO check start/capacity are OK (https://stackoverflow.com/questions/2677185/how-can-i-read-a-functions-signature-including-default-argument-values)</span>
<div class="viewcode-block" id="test_cluster_parser"><a class="viewcode-back" href="../../../source/clustertools.test.html#clustertools.test.test_parser.test_cluster_parser">[docs]</a><span class="k">def</span> <span class="nf">test_cluster_parser</span><span class="p">():</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">ClusterParser</span><span class="p">()</span>
<span class="n">environment</span><span class="p">,</span> <span class="n">custom_options</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse</span><span class="p">([</span><span class="s2">"--capacity"</span><span class="p">,</span> <span class="s2">"1"</span><span class="p">,</span>
<span class="s2">"-s"</span><span class="p">,</span> <span class="s2">"10"</span><span class="p">,</span>
<span class="s2">"-t"</span><span class="p">,</span> <span class="s2">"1:00:00"</span><span class="p">,</span>
<span class="s2">"--memory"</span><span class="p">,</span> <span class="s2">"7231"</span><span class="p">,</span>
<span class="s2">"--partition"</span><span class="p">,</span> <span class="s2">"luke"</span><span class="p">,</span>
<span class="s2">"--n_proc"</span><span class="p">,</span> <span class="s2">"5"</span><span class="p">,</span>
<span class="s2">"custom1"</span><span class="p">,</span>
<span class="s2">"custom2"</span><span class="p">])</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">custom_options</span><span class="p">,</span> <span class="p">[</span><span class="s2">"custom1"</span><span class="p">,</span> <span class="s2">"custom2"</span><span class="p">])</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">time</span><span class="p">,</span> <span class="s2">"1:00:00"</span><span class="p">)</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">memory</span><span class="p">,</span> <span class="mi">7231</span><span class="p">)</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">partition</span><span class="p">,</span> <span class="s2">"luke"</span><span class="p">)</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">n_proc</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="n">assert_equal</span><span class="p">(</span><span class="n">environment</span><span class="o">.</span><span class="n">fail_fast</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span></div>
<span class="c1"># TODO check start/capacity are OK</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">clustertools 0.1.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li>
<li class="nav-item nav-item-2"><a href="../../clustertools.html" >clustertools</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2018, Jean-Michel Begon.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.6.
</div>
</body>
</html> | jm-begon/clustertools | doc/_build/html/_modules/clustertools/test/test_parser.html | HTML | bsd-3-clause | 13,365 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
30524,
1012,
26718,
2094,
1000,
1028,
1026,
16129,
20950,
3619,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
2639,
1013,
1060,
11039,
19968,
1000,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package ai.hellbound;
import l2s.commons.util.Rnd;
import l2s.gameserver.ai.CtrlEvent;
import l2s.gameserver.ai.Mystic;
import l2s.gameserver.model.Creature;
import l2s.gameserver.model.Playable;
import l2s.gameserver.model.World;
import l2s.gameserver.model.instances.NpcInstance;
import bosses.BelethManager;
/**
* @author pchayka
*/
public class Beleth extends Mystic
{
private long _lastFactionNotifyTime = 0;
private static final int CLONE = 29119;
public Beleth(NpcInstance actor)
{
super(actor);
}
@Override
protected void onEvtDead(Creature killer)
{
BelethManager.setBelethDead();
super.onEvtDead(killer);
}
@Override
protected void onEvtAttacked(Creature attacker, int damage)
{
NpcInstance actor = getActor();
if(System.currentTimeMillis() - _lastFactionNotifyTime > _minFactionNotifyInterval)
{
_lastFactionNotifyTime = System.currentTimeMillis();
for(NpcInstance npc : World.getAroundNpc(actor))
if(npc.getNpcId() == CLONE)
npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, Rnd.get(1, 100));
}
super.onEvtAttacked(attacker, damage);
}
@Override
protected boolean randomWalk()
{
return false;
}
@Override
protected boolean randomAnimation()
{
return false;
}
@Override
public boolean canSeeInSilentMove(Playable target)
{
return true;
}
@Override
public boolean canSeeInHide(Playable target)
{
return true;
}
@Override
public void addTaskAttack(Creature target)
{
return;
}
} | pantelis60/L2Scripts_Underground | dist/gameserver/data/scripts/ai/hellbound/Beleth.java | Java | gpl-3.0 | 1,491 | [
30522,
7427,
9932,
1012,
3109,
15494,
1025,
12324,
1048,
2475,
2015,
1012,
7674,
1012,
21183,
4014,
1012,
29300,
2094,
1025,
12324,
1048,
2475,
2015,
1012,
2399,
2121,
6299,
1012,
9932,
1012,
14931,
20927,
15338,
1025,
12324,
1048,
2475,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <wx/bitmap.h>
#include <wx/defs.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/panel.h>
#include <wx/string.h>
#include <wx/translation.h>
#include <wx/windowid.h>
#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "DolphinWX/Globals.h"
class CFrame;
class CRegisterWindow;
class CWatchWindow;
class CBreakPointWindow;
class CMemoryWindow;
class CJitWindow;
class CCodeView;
class DSPDebuggerLLE;
class GFXDebuggerPanel;
struct SCoreStartupParameter;
class wxToolBar;
class wxListBox;
class wxMenu;
class wxMenuBar;
class CCodeWindow : public wxPanel
{
public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
CFrame * parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
const wxString& name = _("Code"));
void Load();
void Save();
// Parent interaction
CFrame *Parent;
wxMenuBar * GetMenuBar();
wxToolBar * GetToolBar();
wxBitmap m_Bitmaps[Toolbar_Debug_Bitmap_Max];
bool UseInterpreter();
bool BootToPause();
bool AutomaticStart();
bool JITNoBlockCache();
bool JITNoBlockLinking();
bool JumpToAddress(u32 address);
void Update() override;
void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxToolBar*);
void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates();
void OpenPages();
void UpdateManager();
// Menu bar
// -------------------
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void ToggleCodeWindow(bool bShow);
void ToggleRegisterWindow(bool bShow);
void ToggleWatchWindow(bool bShow);
void ToggleBreakPointWindow(bool bShow);
void ToggleMemoryWindow(bool bShow);
void ToggleJitWindow(bool bShow);
void ToggleSoundWindow(bool bShow);
void ToggleVideoWindow(bool bShow);
void OnChangeFont(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
// Sub dialogs
CRegisterWindow* m_RegisterWindow;
CWatchWindow* m_WatchWindow;
CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow;
CJitWindow* m_JitWindow;
DSPDebuggerLLE* m_SoundWindow;
GFXDebuggerPanel* m_VideoWindow;
// Settings
bool bAutomaticStart; bool bBootToPause;
bool bShowOnStart[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW + 1];
int iNbAffiliation[IDM_CODE_WINDOW - IDM_LOG_WINDOW + 1];
private:
void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event);
void OnHostMessage(wxCommandEvent& event);
// Debugger functions
void SingleStep();
void StepOver();
void StepOut();
void ToggleBreakpoint();
void UpdateLists();
void UpdateCallstack();
void InitBitmaps();
CCodeView* codeview;
wxListBox* callstack;
wxListBox* symbols;
wxListBox* callers;
wxListBox* calls;
Common::Event sync_event;
};
| dragonbane0/dolphin | Source/Core/DolphinWX/Debugger/CodeWindow.h | C | gpl-2.0 | 3,573 | [
30522,
1013,
1013,
9385,
2286,
17801,
7861,
20350,
2622,
1013,
1013,
7000,
2104,
14246,
2140,
2615,
2475,
1013,
1013,
6523,
2000,
1996,
6105,
1012,
19067,
2102,
5371,
2443,
1012,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1026,
1059,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
function ValidarPuntaje(id)
{
var aux = id.split("_");
var name=aux[0];
var fil=parseInt(aux[1]);
var col=parseInt(aux[2]);
var colpuntaje=col;
var colpuntajereal=col+1;
var puntaje=name+"_"+fil+"_"+colpuntaje;
var puntajereal=name+"_"+fil+"_"+colpuntajereal;
var num1=toFloat(puntaje);
var num2=toFloat(puntajereal);
if (num1>num2)
{
alert("El puntaje introducido no puede ser mayor al definido: "+$(puntajereal).value);
$(puntaje).value="0.00";
}
}
function totalizar()
{
var monrec=toFloat('cobdocume_recdoc');
var dscdoc=toFloat('cobdocume_dscdoc');
var abodoc=toFloat('cobdocume_abodoc');
var mondoc=toFloat('cobdocume_mondoc');
var tototal= mondoc+monrec-dscdoc+abodoc;
$('cobdocume_saldoc').value=format(tototal.toFixed(2),'.',',','.');
}
| cidesa/roraima | web/js/licitaciones/liasptecanalisis.js | JavaScript | gpl-2.0 | 835 | [
30522,
3853,
9398,
2906,
14289,
12380,
6460,
1006,
8909,
1007,
1063,
13075,
19554,
1027,
8909,
1012,
3975,
1006,
1000,
1035,
1000,
1007,
1025,
13075,
2171,
1027,
19554,
1031,
1014,
1033,
1025,
13075,
10882,
2140,
1027,
11968,
20240,
3372,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: "IT业编程四大魔道天王"
date: 2017-11-10 16:09:16 +0800
tag: [博客]
---
IT业编程四大魔道天王的博客地址。
胡正 - [辟支佛胡正 · 阿罗汉尊者 · 功德藏闯菩萨](http://www.huzheng.org/myapps.php)
田春 - [Chun Tian (binghe)](http://tianchunbinghe.blog.163.com/)
李杀 - [Xah Lee Web 李杀网](http://xahlee.org/)
王垠 - [当然我在扯淡](http://www.yinwang.org/) | wangyu892449346/wangyu892449346.github.io | _posts/2017-11-10-IT业编程四大魔道天王.md | Markdown | mit | 439 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
1000,
2009,
100,
100,
100,
1798,
1810,
100,
1957,
1811,
1909,
1000,
3058,
1024,
2418,
1011,
2340,
1011,
2184,
2385,
1024,
5641,
1024,
2385,
1009,
5511,
8889,
6415,
1024,
1031,
1786,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//10. Odd and Even Product
//You are given n integers (given in a single line, separated by a space).
//Write a program that checks whether the product of the odd elements is equal to the product of the even elements.
//Elements are counted from 1 to n, so the first element is odd, the second is even, etc.
using System;
class OddAndEvenProduct
{
static void Main()
{
Console.WriteLine("Odd And Even Product");
Console.Write("Enter a numbers in a single line separated with space: ");
string[] input = Console.ReadLine().Split();
int oddProduct = 1;
int evenProdduct = 1;
for (int index = 0; index < input.Length; index++)
{
int num = int.Parse(input[index]);
if (index %2 == 0 || index == 0)
{
oddProduct *= num;
}
else
{
evenProdduct *= num;
}
}
if (oddProduct == evenProdduct)
{
Console.WriteLine("yes");
Console.WriteLine("product = {0}", oddProduct);
}
else
{
Console.WriteLine("no");
Console.WriteLine("odd Product = {0}", oddProduct);
Console.WriteLine("even Product = {0}", evenProdduct);
}
}
}
| HMNikolova/Telerik_Academy | CSharpPartOne/6. Loops/10. OddAndEvenProduct/OddAndEvenProduct.cs | C# | mit | 1,480 | [
30522,
1013,
1013,
2184,
1012,
5976,
1998,
2130,
4031,
1013,
1013,
2017,
2024,
2445,
1050,
24028,
1006,
2445,
1999,
1037,
2309,
2240,
1010,
5459,
2011,
1037,
2686,
1007,
1012,
1013,
1013,
4339,
1037,
2565,
2008,
14148,
3251,
1996,
4031,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2020 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
package eu.webtoolkit.jwt.auth;
import eu.webtoolkit.jwt.*;
import eu.webtoolkit.jwt.chart.*;
import eu.webtoolkit.jwt.servlet.*;
import eu.webtoolkit.jwt.utils.*;
import java.io.*;
import java.lang.ref.*;
import java.time.*;
import java.util.*;
import java.util.regex.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A widget which allows a user to choose a new password.
*
* <p>This widget lets a user choose a new password.
*
* <p>The widget renders the <code>"Wt.Auth.template.update-password"</code> template.
* Optionally, it asks for the current password, as well as a new password.
*
* <p>
*
* @see AuthWidget#createUpdatePasswordView(User user, boolean promptPassword)
*/
public class UpdatePasswordWidget extends WTemplateFormView {
private static Logger logger = LoggerFactory.getLogger(UpdatePasswordWidget.class);
/**
* Constructor.
*
* <p>If <code>authModel</code> is not <code>null</code>, the user also has to authenticate first
* using his current password.
*/
public UpdatePasswordWidget(
final User user,
RegistrationModel registrationModel,
final AuthModel authModel,
WContainerWidget parentContainer) {
super(tr("Wt.Auth.template.update-password"), (WContainerWidget) null);
this.user_ = user;
this.registrationModel_ = registrationModel;
this.authModel_ = authModel;
this.updated_ = new Signal();
this.canceled_ = new Signal();
this.registrationModel_.setValue(
RegistrationModel.LoginNameField, user.getIdentity(Identity.LoginName));
this.registrationModel_.setReadOnly(RegistrationModel.LoginNameField, true);
if (user.getPassword().isEmpty()) {
this.authModel_ = null;
} else {
if (this.authModel_ != null) {
this.authModel_.reset();
}
}
if (this.authModel_ != null && this.authModel_.getBaseAuth().isEmailVerificationEnabled()) {
this.registrationModel_.setValue(
RegistrationModel.EmailField, user.getEmail() + " " + user.getUnverifiedEmail());
}
this.registrationModel_.setVisible(RegistrationModel.EmailField, false);
WPushButton okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
this.bindWidget("ok-button", okButton);
WPushButton cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
this.bindWidget("cancel-button", cancelButton);
if (this.authModel_ != null) {
this.authModel_.setValue(AuthModel.LoginNameField, user.getIdentity(Identity.LoginName));
this.updateViewField(this.authModel_, AuthModel.PasswordField);
this.authModel_.configureThrottling(okButton);
WLineEdit password = (WLineEdit) this.resolveWidget(AuthModel.PasswordField);
password.setFocus(true);
}
this.updateView(this.registrationModel_);
WLineEdit password = (WLineEdit) this.resolveWidget(RegistrationModel.ChoosePasswordField);
WLineEdit password2 = (WLineEdit) this.resolveWidget(RegistrationModel.RepeatPasswordField);
WText password2Info =
(WText) this.resolveWidget(RegistrationModel.RepeatPasswordField + "-info");
this.registrationModel_.validatePasswordsMatchJS(password, password2, password2Info);
if (!(this.authModel_ != null)) {
password.setFocus(true);
}
okButton
.clicked()
.addListener(
this,
(WMouseEvent e1) -> {
UpdatePasswordWidget.this.doUpdate();
});
cancelButton
.clicked()
.addListener(
this,
(WMouseEvent e1) -> {
UpdatePasswordWidget.this.cancel();
});
if (parentContainer != null) parentContainer.addWidget(this);
}
/**
* Constructor.
*
* <p>Calls {@link #UpdatePasswordWidget(User user, RegistrationModel registrationModel, AuthModel
* authModel, WContainerWidget parentContainer) this(user, registrationModel, authModel,
* (WContainerWidget)null)}
*/
public UpdatePasswordWidget(
final User user, RegistrationModel registrationModel, final AuthModel authModel) {
this(user, registrationModel, authModel, (WContainerWidget) null);
}
/** {@link Signal} emitted when the password was updated. */
public Signal updated() {
return this.updated_;
}
/** {@link Signal} emitted when cancel clicked. */
public Signal canceled() {
return this.canceled_;
}
protected WWidget createFormWidget(String field) {
WFormWidget result = null;
if (field == RegistrationModel.LoginNameField) {
result = new WLineEdit();
} else {
if (field == AuthModel.PasswordField) {
WLineEdit p = new WLineEdit();
p.setEchoMode(EchoMode.Password);
result = p;
} else {
if (field == RegistrationModel.ChoosePasswordField) {
WLineEdit p = new WLineEdit();
p.setEchoMode(EchoMode.Password);
p.keyWentUp()
.addListener(
this,
(WKeyEvent e1) -> {
UpdatePasswordWidget.this.checkPassword();
});
p.changed()
.addListener(
this,
() -> {
UpdatePasswordWidget.this.checkPassword();
});
result = p;
} else {
if (field == RegistrationModel.RepeatPasswordField) {
WLineEdit p = new WLineEdit();
p.setEchoMode(EchoMode.Password);
p.changed()
.addListener(
this,
() -> {
UpdatePasswordWidget.this.checkPassword2();
});
result = p;
}
}
}
}
return result;
}
private User user_;
private RegistrationModel registrationModel_;
private AuthModel authModel_;
private Signal updated_;
private Signal canceled_;
private void checkPassword() {
this.updateModelField(this.registrationModel_, RegistrationModel.ChoosePasswordField);
this.registrationModel_.validateField(RegistrationModel.ChoosePasswordField);
this.updateViewField(this.registrationModel_, RegistrationModel.ChoosePasswordField);
}
private void checkPassword2() {
this.updateModelField(this.registrationModel_, RegistrationModel.RepeatPasswordField);
this.registrationModel_.validateField(RegistrationModel.RepeatPasswordField);
this.updateViewField(this.registrationModel_, RegistrationModel.RepeatPasswordField);
}
private boolean validate() {
boolean valid = true;
if (this.authModel_ != null) {
this.updateModelField(this.authModel_, AuthModel.PasswordField);
if (!this.authModel_.validate()) {
this.updateViewField(this.authModel_, AuthModel.PasswordField);
valid = false;
}
}
this.registrationModel_.validateField(RegistrationModel.LoginNameField);
this.checkPassword();
this.checkPassword2();
this.registrationModel_.validateField(RegistrationModel.EmailField);
if (!this.registrationModel_.isValid()) {
valid = false;
}
return valid;
}
private void doUpdate() {
if (this.validate()) {
String password = this.registrationModel_.valueText(RegistrationModel.ChoosePasswordField);
this.registrationModel_.getPasswordAuth().updatePassword(this.user_, password);
this.registrationModel_.getLogin().login(this.user_);
this.updated_.trigger();
}
}
private void cancel() {
this.canceled_.trigger();
}
}
| kdeforche/jwt | src/eu/webtoolkit/jwt/auth/UpdatePasswordWidget.java | Java | gpl-2.0 | 7,657 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
12609,
7861,
8545,
2497,
1038,
30524,
1008,
1013,
7427,
7327,
1012,
4773,
3406,
4747,
23615,
1012,
1046,
26677,
1012,
8740,
2705,
1025,
12324,
7327,
1012,
4773,
3406,
4747,
23615,
1012,
1046,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* **********************************************************************************************************
* The MIT License (MIT) *
* *
* Copyright (c) 2016 Hypermediasystems Ges. f. Software mbH *
* Web: http://www.hypermediasystems.de *
* This file is part of hmsspx *
* *
* 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;
namespace hmsspx
{
partial class pageBase
{
public int add_RelatedField(int level, HMS.SP.RelatedField spRelatedField)
{
return add_RelatedField(-1, level, spRelatedField);
}
public int add_RelatedField(int pos, int level, HMS.SP.RelatedField spRelatedField)
{
if (spRelatedField.__HMSError_ != null && (spRelatedField.__HMSError_.errno != 0 || spRelatedField.__HMSError_.info != "" ))
{
pos = this.add_lineAt(pos, level, "__HMSError", HMS.Util.__HMSError.toString(spRelatedField.__HMSError_));
}
pos = this.add__deferred(pos, level, spRelatedField.__deferred_);
pos = this.add__metadata(pos, level, spRelatedField.__metadata_);
pos = this.add__rest(pos, level, spRelatedField.__rest);
pos = this.add_lineAt(pos,level, "FieldId", HMS.SP.SPUtil.toString(spRelatedField.FieldId_)); //Guid;
pos = this.add_lineAt(pos,level, "ListId", HMS.SP.SPUtil.toString(spRelatedField.ListId_)); //Guid;
pos = this.add_lineAt(pos,level, "LookupList", HMS.SP.SPUtil.toString(spRelatedField.LookupList_)); //String;
pos = this.add_lineAt(pos,level, "RelationshipDeleteBehavior", HMS.SP.SPUtil.toString(spRelatedField.RelationshipDeleteBehavior_)); //Object;
pos = this.add_lineAt(pos,level, "WebId", HMS.SP.SPUtil.toString(spRelatedField.WebId_)); //Guid;
return pos;
}
public int add_RelatedField_deferred(int pos, int level, HMS.SP.RelatedField spRelatedField)
{
{
string useUrl = spRelatedField.__deferred_.uri;
if( !String.IsNullOrEmpty(useUrl) )
{
pos = this.add_lineAt(pos, level, false, "RelatedField","", knownPages.pageRelatedField, useUrl);
}
else
{
pos = this.add_lineAt(pos, level, true, "RelatedField", "",knownPages.NONE, "");
pos = this.add_RelatedField(pos, level+1, spRelatedField);
}
}
return pos;
}
}
}
| helmuttheis/hmsspx | hmsspx/hmsspx/AddLine.gen/RelatedField_al.cs | C# | mit | 3,997 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#-*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
from datetime import datetime, date, timedelta
from dateutil.relativedelta import relativedelta
from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as OE_DATEFORMAT
class hr_employee(osv.Model):
_inherit = 'hr.employee'
def _get_contracts_list(self, employee):
'''Return list of contracts in chronological order'''
contracts = []
for c in employee.contract_ids:
l = len(contracts)
if l == 0:
contracts.append(c)
else:
dCStart = datetime.strptime(c.date_start, OE_DATEFORMAT).date()
i = l - 1
while i >= 0:
dContractStart = datetime.strptime(
contracts[i].date_start, OE_DATEFORMAT).date()
if dContractStart < dCStart:
contracts = contracts[:i + 1] + [c] + contracts[i + 1:]
break
elif i == 0:
contracts = [c] + contracts
i -= 1
return contracts
def _get_days_in_month(self, d):
last_date = d - timedelta(days=(d.day - 1)) + relativedelta(
months= +1) + relativedelta(days= -1)
return last_date.day
def get_months_service_to_date(self, cr, uid, ids, dToday=None, context=None):
'''Returns a dictionary of floats. The key is the employee id, and the value is
number of months of employment.'''
res = dict.fromkeys(ids, 0)
if dToday == None:
dToday = date.today()
for ee in self.pool.get('hr.employee').browse(cr, uid, ids, context=context):
delta = relativedelta(dToday, dToday)
contracts = self._get_contracts_list(ee)
if len(contracts) == 0:
res[ee.id] = (0.0, False)
continue
dInitial = datetime.strptime(
contracts[0].date_start, OE_DATEFORMAT).date()
if ee.initial_employment_date:
dFirstContract = dInitial
dInitial = datetime.strptime(
ee.initial_employment_date, '%Y-%m-%d').date()
if dFirstContract < dInitial:
raise osv.except_osv(_('Employment Date mismatch!'),
_('The initial employment date cannot be after the first contract in the system.\nEmployee: %s', ee.name))
delta = relativedelta(dFirstContract, dInitial)
for c in contracts:
dStart = datetime.strptime(c.date_start, '%Y-%m-%d').date()
if dStart >= dToday:
continue
# If the contract doesn't have an end date, use today's date
# If the contract has finished consider the entire duration of
# the contract, otherwise consider only the months in the
# contract until today.
#
if c.date_end:
dEnd = datetime.strptime(c.date_end, '%Y-%m-%d').date()
else:
dEnd = dToday
if dEnd > dToday:
dEnd = dToday
delta += relativedelta(dEnd, dStart)
# Set the number of months the employee has worked
date_part = float(delta.days) / float(
self._get_days_in_month(dInitial))
res[ee.id] = (
float((delta.years * 12) + delta.months) + date_part, dInitial)
return res
def _get_employed_months(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0.0)
_res = self.get_months_service_to_date(cr, uid, ids, context=context)
for k, v in _res.iteritems():
res[k] = v[0]
return res
def _search_amount(self, cr, uid, obj, name, args, context):
ids = set()
for cond in args:
amount = cond[2]
if isinstance(cond[2], (list, tuple)):
if cond[1] in ['in', 'not in']:
amount = tuple(cond[2])
else:
continue
else:
if cond[1] in ['=like', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of']:
continue
cr.execute("select id from hr_employee having %s %%s" %
(cond[1]), (amount,))
res_ids = set(id[0] for id in cr.fetchall())
ids = ids and (ids & res_ids) or res_ids
if ids:
return [('id', 'in', tuple(ids))]
return [('id', '=', '0')]
_columns = {
'initial_employment_date': fields.date('Initial Date of Employment', groups=False,
help='Date of first employment if it was before the start of the first contract in the system.'),
'length_of_service': fields.function(_get_employed_months, type='float', method=True,
groups=False,
string='Lenght of Service'),
}
| bwrsandman/openerp-hr | hr_employee_seniority/hr.py | Python | agpl-3.0 | 5,976 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
1001,
9385,
1006,
1039,
1007,
2286,
2745,
10093,
21463,
2078,
5003,
19648,
10224,
1026,
21021,
19648,
10224,
1030,
20917,
4014,
1012,
4012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* appRain CMF
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.opensource.org/licenses/mit-license.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@apprain.com so we can send you a copy immediately.
*
* @copyright Copyright (c) 2010 appRain, Inc. (http://www.apprain.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*
* HELP
*
* Official Website
* http://www.apprain.com/
*
* Download Link
* http://www.apprain.com/download
*
* Documents Link
* http ://www.apprain.com/documents
*/
class adminpanelquicklaunchController extends appRain_Base_Core {
public $name = 'Adminpanelquicklaunch';
public function __preDispatch() {
$this->Admin = App::Module('Admin')->thisAdminInfo();
$this->setAdminTab('developer');
}
public function indexAction() {
}
public function configureAction($id = null) {
if (!empty($this->post)) {
$array = array();
$menulist = App::Config()->Setting('adminpanel_quick_launch');
if (!empty($menulist)) {
$array = (array) json_decode($menulist);
}
if(empty($this->post['title'])){
if(isset($array[$this->post['mylink']])){
unset($array[$this->post['mylink']]);
}
}
else{
$array[$this->post['mylink']] = $this->post;
}
$str = json_encode($array);
App::Config()->setSiteInfo('adminpanel_quick_launch', $str);
echo '{"status":"Success"}';
exit;
}
}
}
| apprain/apprain-source | component/adminpanelquicklaunch/controllers/adminpanelquicklaunch.php | PHP | mit | 1,890 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
10439,
21166,
4642,
2546,
1008,
1008,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
10210,
6105,
2008,
2003,
24378,
1008,
2007,
2023,
7427,
1999,
1996,
5371,
6105,
1012,
19067,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*!
* Copyright (C) 2015 SequoiaDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var constants = require('./const');
var Node = require('./node');
var util = require('util');
var ReplicaGroup = function (conn, name, groupId) {
Object.defineProperty(this, 'conn', {
value: conn,
enumerable: false
});
this.name = name;
this.groupId = groupId;
this.isCatalog = (name === constants.CATALOG_GROUP);
};
/** \fn bool Stop()
* \brief Stop the current node
* \return True if succeed or False if fail
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.stop = function (callback) {
this.stopStart(false, callback);
};
/** \fn bool Start()
* \brief Start the current node
* \return True if succeed or False if fail
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.start = function (callback) {
this.stopStart(true, callback);
};
/** \fn var GetNodeNum( SDBConst.NodeStatus status)
* \brief Get the count of node with given status
* \param status The specified status as below:
*
* SDB_NODE_ALL
* SDB_NODE_ACTIVE
* SDB_NODE_INACTIVE
* SDB_NODE_UNKNOWN
* \return The count of node
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getNodeCount = function (callback) {
this.getDetail(function (err, detail) {
if (err) {
return callback(err);
}
var nodes = detail[constants.FIELD_GROUP];
callback(null, nodes.length || 0);
});
};
/** \fn var GetDetail()
* \brief Get the detail information of current group
* \return The detail information in var object
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getDetail = function (callback) {
var matcher = {};
matcher[constants.FIELD_GROUPNAME] = this.name;
matcher[constants.FIELD_GROUPID] = this.groupId;
this.conn.getList(constants.SDB_LIST_GROUPS, matcher, {}, {}, function (err, cursor) {
if (err) {
return callback(err);
}
if (cursor) {
cursor.next(function (err, detail) {
if (err) {
return callback(err);
}
if (detail) {
callback(null, detail);
} else {
callback(new Error('SDB_CLS_GRP_NOT_EXIST'));
}
});
} else {
callback(new Error('SDB_SYS'));
}
});
};
/** \fn Node CreateNode(string hostName, var port, string dbpath,
Dictionary<string, string> map)
* \brief Create the replica node
* \param hostName The host name of node
* \param port The port of node
* \param dbpath The database path of node
* \param map The other configure information of node
* \return The Node object
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.createNode = function (hostname, port, dbpath, map, callback) {
if (!hostname || port < 0 || port > 65535 || !dbpath) {
throw new Error('SDB_INVALIDARG');
}
var command = constants.ADMIN_PROMPT + constants.CREATE_CMD + " " +
constants.NODE;
var matcher = {};
matcher[constants.FIELD_GROUPNAME] = this.name;
// TODO: 删除属性不好
delete map[constants.FIELD_GROUPNAME];
matcher[constants.FIELD_HOSTNAME] = hostname;
delete map[constants.FIELD_HOSTNAME];
matcher[constants.SVCNAME] = '' + port;
delete map[constants.SVCNAME];
matcher[constants.DBPATH] = dbpath;
delete map[constants.DBPATH];
util._extend(matcher, map);
var that = this;
this.conn.sendAdminCommand(command, matcher, {}, {}, {}, function (err) {
if (err) {
return callback(err);
}
that.getNode(hostname, port, callback);
});
};
/** \fn void RemoveNode(string hostName, var port,
var configure)
* \brief Remove the specified replica node
* \param hostName The host name of node
* \param port The port of node
* \param configure The configurations for the replica node
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.removeNode = function (hostname, port, configure, callback) {
if (!hostname || port < 0 || port > 65535) {
throw new Error("SDB_INVALIDARG");
}
var command = constants.ADMIN_PROMPT + constants.REMOVE_CMD + " " +
constants.NODE;
var config = {};
config[constants.FIELD_GROUPNAME] = this.name;
config[constants.FIELD_HOSTNAME] = hostname;
config[constants.SVCNAME] = '' + port;
if (!configure) {
var keys = Object.keys(configure);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key === constants.FIELD_GROUPNAME ||
key === constants.FIELD_HOSTNAME ||
key === constants.SVCNAME) {
continue;
}
config[key] = configure[key];
}
}
this.conn.sendAdminCommand(command, config, {}, {}, {}, function (err) {
callback(err);
});
};
/** \fn Node GetMaster()
* \brief Get the master node of current group
* \return The fitted node or null
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getMaster = function (callback) {
var that = this;
this.getDetail(function (err, detail) {
if (err) {
return callback(err);
}
var primaryNode = detail[constants.FIELD_PRIMARYNODE];
var nodes = detail[constants.FIELD_GROUP];
if (typeof primaryNode !== 'number' || !Array.isArray(nodes)) {
return callback(new Error("SDB_SYS"));
}
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var nodeId = node[constants.FIELD_NODEID];
if (typeof nodeId !== 'number') {
return callback(new Error("SDB_SYS"));
}
if (nodeId === primaryNode) {
var extracted = that.extractNode(node);
return callback(null, extracted);
}
}
callback(null, null);
});
};
/** \fn Node GetSlave()
* \brief Get the slave node of current group
* \return The fitted node or null
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getSlave = function (callback) {
var that = this;
this.getDetail(function (err, detail) {
if (err) {
return callback(err);
}
var primaryID = detail[constants.FIELD_PRIMARYNODE];
var nodes = detail[constants.FIELD_GROUP];
if (typeof primaryID !== 'number' || !Array.isArray(nodes)) {
return callback(new Error("SDB_SYS"));
}
var slaves = [];
var primaryNode;
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var nodeId = node[constants.FIELD_NODEID];
if (typeof nodeId !== 'number') {
return callback(new Error("SDB_SYS"));
}
if (nodeId !== primaryID) {
slaves.push(node);
} else {
primaryNode = node;
}
}
if (slaves.length > 0) {
// 随机取一个
var index = (new Date().getTime()) % slaves.length;
callback(null, that.extractNode(nodes[index]));
} else {
callback(null, that.extractNode(primaryNode));
}
});
};
/** \fn Node GetNode(string nodeName)
* \brief Get the node by node name
* \param nodeName The node name
* \return The fitted node or null
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getNodeByName = function (nodename, callback) {
if (!nodename || nodename.indexOf(constants.NODE_NAME_SERVICE_SEP) === -1) {
throw new Error("SDB_INVALIDARG");
}
var parts = nodename.split(constants.NODE_NAME_SERVICE_SEP);
var hostname = parts[0];
var port = parseInt(parts[1], 10);
if (!hostname || !port) {
throw new Error("SDB_INVALIDARG");
}
this.getNode(hostname, port, callback);
};
/** \fn Node GetNode(string hostName, var port)
* \brief Get the node by host name and port
* \param hostName The host name
* \param port The port
* \return The fitted node or null
* \exception SequoiaDB.Error
* \exception System.Exception
*/
ReplicaGroup.prototype.getNode = function (hostname, port, callback) {
var that = this;
this.getDetail(function (err, detail) {
if (err) {
return callback(err);
}
var nodes = detail[constants.FIELD_GROUP];
if (!Array.isArray(nodes)) {
return callback(new Error("SDB_SYS"));
}
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var _hostname = node[constants.FIELD_HOSTNAME];
if (typeof _hostname !== 'string') {
return callback(new Error("SDB_SYS"));
}
if (hostname === _hostname) {
var extracted = that.extractNode(node);
if (extracted.port === port) {
return callback(null, extracted);
}
}
}
callback(null, null);
});
};
ReplicaGroup.prototype.extractNode = function (node) {
var hostname = node[constants.FIELD_HOSTNAME];
if (typeof hostname !== 'string') {
throw new Error("SDB_SYS");
}
var nodeId = node[constants.FIELD_NODEID];
if (typeof nodeId !== 'number') {
throw new Error("SDB_SYS");
}
var svcs = node[constants.FIELD_SERVICE];
if (!Array.isArray(svcs)) {
throw new Error("SDB_SYS");
}
for (var i = 0; i < svcs.length; i++) {
var svc = svcs[i];
var type = svc[constants.FIELD_SERVICE_TYPE];
if (typeof type !== 'number') {
throw new Error("SDB_SYS");
}
if (type === 0) {
var serviceName = svc[constants.FIELD_NAME];
return new Node(this, hostname, parseInt(serviceName, 10), nodeId);
}
}
return null;
};
ReplicaGroup.prototype.stopStart = function (start, callback) {
var command = constants.ADMIN_PROMPT +
(start ? constants.ACTIVE_CMD
: constants.SHUTDOWN_CMD) + " " + constants.GROUP;
var matcher = {};
matcher[constants.FIELD_GROUPNAME] = this.name;
matcher[constants.FIELD_GROUPID] = this.groupId;
this.conn.sendAdminCommand(command, matcher, {}, {}, {}, function (err, response) {
callback(null, !err);
});
};
module.exports = ReplicaGroup;
| dphdjy/node-sequoiadb | lib/replica_group.js | JavaScript | apache-2.0 | 10,516 | [
30522,
1013,
1008,
999,
1008,
9385,
1006,
1039,
1007,
2325,
7367,
28940,
25463,
18939,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.type.descriptor.java;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.BinaryStream;
import org.hibernate.engine.jdbc.internal.BinaryStreamImpl;
import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@code Byte[]} handling.
*
* @author Steve Ebersole
*/
public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
public static final ByteArrayTypeDescriptor INSTANCE = new ByteArrayTypeDescriptor();
@SuppressWarnings({ "unchecked" })
public ByteArrayTypeDescriptor() {
super( Byte[].class, ArrayMutabilityPlan.INSTANCE );
}
@Override
public String toString(Byte[] bytes) {
final StringBuilder buf = new StringBuilder();
for ( Byte aByte : bytes ) {
final String hexStr = Integer.toHexString( aByte - Byte.MIN_VALUE );
if ( hexStr.length() == 1 ) {
buf.append( '0' );
}
buf.append( hexStr );
}
return buf.toString();
}
@Override
public Byte[] fromString(String string) {
if ( string == null ) {
return null;
}
if ( string.length() % 2 != 0 ) {
throw new IllegalArgumentException( "The string is not a valid string representation of a binary content." );
}
Byte[] bytes = new Byte[string.length() / 2];
for ( int i = 0; i < bytes.length; i++ ) {
final String hexStr = string.substring( i * 2, (i + 1) * 2 );
bytes[i] = (byte) ( Integer.parseInt( hexStr, 16 ) + Byte.MIN_VALUE );
}
return bytes;
}
@SuppressWarnings({ "unchecked" })
@Override
public <X> X unwrap(Byte[] value, Class<X> type, WrapperOptions options) {
if ( value == null ) {
return null;
}
if ( Byte[].class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( byte[].class.isAssignableFrom( type ) ) {
return (X) unwrapBytes( value );
}
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( unwrapBytes( value ) );
}
if ( BinaryStream.class.isAssignableFrom( type ) ) {
return (X) new BinaryStreamImpl( unwrapBytes( value ) );
}
if ( Blob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createBlob( unwrapBytes( value ) );
}
throw unknownUnwrap( type );
}
@Override
public <X> Byte[] wrap(X value, WrapperOptions options) {
if ( value == null ) {
return null;
}
if ( Byte[].class.isInstance( value ) ) {
return (Byte[]) value;
}
if ( byte[].class.isInstance( value ) ) {
return wrapBytes( (byte[]) value );
}
if ( InputStream.class.isInstance( value ) ) {
return wrapBytes( DataHelper.extractBytes( (InputStream) value ) );
}
if ( Blob.class.isInstance( value ) || DataHelper.isNClob( value.getClass() ) ) {
try {
return wrapBytes( DataHelper.extractBytes( ( (Blob) value ).getBinaryStream() ) );
}
catch ( SQLException e ) {
throw new HibernateException( "Unable to access lob stream", e );
}
}
throw unknownWrap( value.getClass() );
}
private Byte[] wrapBytes(byte[] bytes) {
if ( bytes == null ) {
return null;
}
final Byte[] result = new Byte[bytes.length];
for ( int i = 0; i < bytes.length; i++ ) {
result[i] = bytes[i];
}
return result;
}
private byte[] unwrapBytes(Byte[] bytes) {
if ( bytes == null ) {
return null;
}
final byte[] result = new byte[bytes.length];
for ( int i = 0; i < bytes.length; i++ ) {
result[i] = bytes[i];
}
return result;
}
}
| kevin-chen-hw/LDAE | com.huawei.soa.ldae/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java | Java | lgpl-2.1 | 4,548 | [
30522,
1013,
1008,
1008,
7632,
5677,
12556,
1010,
28771,
28297,
2005,
8909,
18994,
12070,
9262,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1010,
2417,
6045,
4297,
1012,
2030,
2353,
1011,
2283,
16884,
2004,
1008,
5393,
2011,
1996,
1030,
3166,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.mmrx.yunliao.presenter.util;
import android.util.Log;
/**
* 创建人: mmrx
* 时间: 16/3/7下午4:29
* 描述: 日志工具封装类
*/
public class L {
private L()
{
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化
private static final String TAG = "YunLiaoLog";
// 下面四个是默认tag的函数
public static void i(String msg)
{
if (isDebug)
Log.i(TAG, msg);
}
public static void d(String msg)
{
if (isDebug)
Log.d(TAG, msg);
}
public static void e(String msg)
{
if (isDebug)
Log.e(TAG, msg);
}
public static void v(String msg)
{
if (isDebug)
Log.v(TAG, msg);
}
// 下面是传入自定义tag的函数
public static void i(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void d(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void e(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void v(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
}
| liulinru13/YunLiao | app/src/main/java/com/mmrx/yunliao/presenter/util/L.java | Java | apache-2.0 | 1,419 | [
30522,
7427,
4012,
1012,
3461,
2099,
2595,
1012,
22854,
6632,
2080,
1012,
10044,
1012,
21183,
4014,
1025,
12324,
11924,
1012,
21183,
4014,
1012,
8833,
1025,
1013,
1008,
1008,
1008,
100,
100,
1756,
1024,
3461,
2099,
2595,
1008,
100,
100,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*!
* Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.0.3');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa-elite {
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* makes the font 33% larger relative to the icon container */
.fa-elite-lg {
font-size: 1.3333333333333333em;
line-height: 0.75em;
vertical-align: -15%;
}
.fa-elite-2x {
font-size: 2em;
}
.fa-elite-3x {
font-size: 3em;
}
.fa-elite-4x {
font-size: 4em;
}
.fa-elite-5x {
font-size: 5em;
}
.fa-elite-fw {
width: 1.2857142857142858em;
text-align: center;
}
.fa-elite-ul {
padding-left: 0;
margin-left: 2.142857142857143em;
list-style-type: none;
}
.fa-elite-ul > li {
position: relative;
}
.fa-elite-li {
position: absolute;
left: -2.142857142857143em;
width: 2.142857142857143em;
top: 0.14285714285714285em;
text-align: center;
}
.fa-elite-li.fa-elite-lg {
left: -1.8571428571428572em;
}
.fa-elite-border {
padding: .2em .25em .15em;
border: solid 0.08em #eeeeee;
border-radius: .1em;
}
.pull-right {
float: right;
}
.pull-left {
float: left;
}
.fa.pull-left {
margin-right: .3em;
}
.fa.pull-right {
margin-left: .3em;
}
.fa-elite-spin {
-webkit-animation: spin 2s infinite linear;
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
animation: spin 2s infinite linear;
}
@-moz-keyframes spin {
0% {
-moz-transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
}
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
}
}
@-o-keyframes spin {
0% {
-o-transform: rotate(0deg);
}
100% {
-o-transform: rotate(359deg);
}
}
@-ms-keyframes spin {
0% {
-ms-transform: rotate(0deg);
}
100% {
-ms-transform: rotate(359deg);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
}
.fa-elite-rotate-90 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
.fa-elite-rotate-180 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
.fa-elite-rotate-270 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
}
.fa-elite-flip-horizontal {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
transform: scale(-1, 1);
}
.fa-elite-flip-vertical {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
-webkit-transform: scale(1, -1);
-moz-transform: scale(1, -1);
-ms-transform: scale(1, -1);
-o-transform: scale(1, -1);
transform: scale(1, -1);
}
.fa-elite-stack {
position: relative;
display: inline-block;
width: 2em;
height: 2em;
line-height: 2em;
vertical-align: middle;
}
.fa-elite-stack-1x,
.fa-elite-stack-2x {
position: absolute;
left: 0;
width: 100%;
text-align: center;
}
.fa-elite-stack-1x {
line-height: inherit;
}
.fa-elite-stack-2x {
font-size: 2em;
}
.fa-elite-inverse {
color: #ffffff;
}
/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
readers do not read off random characters that represent icons */
.fa-elite-glass:before {
content: "\f000";
}
.fa-elite-music:before {
content: "\f001";
}
.fa-elite-search:before {
content: "\f002";
}
.fa-elite-envelope-o:before {
content: "\f003";
}
.fa-elite-heart:before {
content: "\f004";
}
.fa-elite-star:before {
content: "\f005";
}
.fa-elite-star-o:before {
content: "\f006";
}
.fa-elite-user:before {
content: "\f007";
}
.fa-elite-film:before {
content: "\f008";
}
.fa-elite-th-large:before {
content: "\f009";
position: absolute;
padding-left: 8px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 9px;
}
.fa-elite-th:before {
content: "\f00a";
}
.fa-elite-th-list:before {
content: "\f00b";
position: absolute;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 10px;
padding-top: 3px;
}
.fa-elite-check:before {
content: "\f00c";
}
.fa-elite-times:before {
content: "\f00d";
}
.fa-elite-search-plus:before {
content: "\f00e";
}
.fa-elite-search-minus:before {
content: "\f010";
}
.fa-elite-power-off:before {
content: "\f011";
}
.fa-elite-signal:before {
content: "\f012";
}
.fa-elite-gear:before,
.fa-elite-cog:before {
content: "\f013";
}
.fa-elite-trash-o:before {
content: "\f014";
}
.fa-elite-home:before {
content: "\f015";
}
.fa-elite-file-o:before {
content: "\f016";
}
.fa-elite-clock-o:before {
content: "\f017";
}
.fa-elite-road:before {
content: "\f018";
}
.fa-elite-download:before {
content: "\f019";
}
.fa-elite-arrow-circle-o-down:before {
content: "\f01a";
}
.fa-elite-arrow-circle-o-up:before {
content: "\f01b";
}
.fa-elite-inbox:before {
content: "\f01c";
}
.fa-elite-play-circle-o:before {
content: "\f01d";
position: absolute;
color: #FCFCFC;
font-size: 94px;
}
.fa-elite-rotate-right:before,
.fa-elite-repeat:before {
content: "\f01e";
position: absolute;
right: 153px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-refresh:before {
content: "\f021";
}
.fa-elite-list-alt:before {
content: "\f022";
position: absolute;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 10px;
padding-top: 3px;
}
.fa-elite-lock:before {
content: "\f023";
}
.fa-elite-flag:before {
content: "\f024";
}
.fa-elite-headphones:before {
content: "\f025";
}
.fa-elite-volume-off:before {
content: "\f026";
position: absolute;
right: 132px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-volume-down:before {
content: "\f027";
}
.fa-elite-volume-up:before {
content: "\f028";
position: absolute;
right: 124px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-qrcode:before {
content: "\f029";
}
.fa-elite-barcode:before {
content: "\f02a";
}
.fa-elite-tag:before {
content: "\f02b";
}
.fa-elite-tags:before {
content: "\f02c";
}
.fa-elite-book:before {
content: "\f02d";
}
.fa-elite-bookmark:before {
content: "\f02e";
}
.fa-elite-print:before {
content: "\f02f";
}
.fa-elite-camera:before {
content: "\f030";
}
.fa-elite-font:before {
content: "\f031";
}
.fa-elite-bold:before {
content: "\f032";
}
.fa-elite-italic:before {
content: "\f033";
}
.fa-elite-text-height:before {
content: "\f034";
}
.fa-elite-text-width:before {
content: "\f035";
}
.fa-elite-align-left:before {
content: "\f036";
}
.fa-elite-align-center:before {
content: "\f037";
}
.fa-elite-align-right:before {
content: "\f038";
}
.fa-elite-align-justify:before {
content: "\f039";
}
.fa-elite-list:before {
content: "\f03a";
position: absolute;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 10px;
padding-top: 3px;
}
.fa-elite-dedent:before,
.fa-elite-outdent:before {
content: "\f03b";
position:absolute;
padding-left: 8px;
padding-right: 8px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
left: 5px;
}
.fa-elite-indent:before {
content: "\f03c";
position: absolute;
padding-left: 8px;
padding-right: 8px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
left: 5px;
}
.fa-elite-video-camera:before {
content: "\f03d";
}
.fa-elite-picture-o:before {
content: "\f03e";
}
.fa-elite-pencil:before {
content: "\f040";
}
.fa-elite-map-marker:before {
content: "\f041";
}
.fa-elite-adjust:before {
content: "\f042";
}
.fa-elite-tint:before {
content: "\f043";
}
.fa-elite-edit:before,
.fa-elite-pencil-square-o:before {
content: "\f044";
}
.fa-elite-share-square-o:before {
content: "\f045";
position: absolute;
padding-left: 9px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 9px;
line-height: normal;
left: 5px;
}
.fa-elite-check-square-o:before {
content: "\f046";
}
.fa-elite-arrows:before {
content: "\f047";
}
.fa-elite-step-backward:before {
content: "\f048";
position: absolute;
padding-left: 16px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
/* background:#ff0000; */
}
.fa-elite-backward:before {
content: "\f04a";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
/* background:#ff0000; */
}
.fa-elite-random:before {
content: "\f074";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
/* background:#ff0000; */
}
.fa-elite-forward:before {
content: "\f04e";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
/* background:#ff0000; */
}
.fa-elite-step-forward:before {
content: "\f051";
position: absolute;
padding-left: 4px;
padding-right: 7px;
padding-bottom: 17px;
padding-top: 17px;
/* background:#ff0000; */
}
.fa-elite-fast-backward:before {
content: "\f049";
position: absolute;
right: 269px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 3px;
padding-top: 3px;
}
.fa-elite-play:before {
content: "\f04b";
position: absolute;
left: 0px;
padding-left: 18px;
padding-right: 17px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-playScreen:before {
content: "\f04b";
position: absolute;
color: #ffffff;
font-size: 30px;
padding-left: 28px;
padding-right: 28px;
padding-bottom: 21px;
padding-top: 21px;
background: rgba(0, 0, 0, 0.7);
line-height: normal;
left: 0px;
}
.fa-elite-playAD:before {
content: "\f04b";
position: absolute;
top: 7px;
right: 9px;
color: rgb(255, 255, 255);
}
.fa-elite-pause:before {
content: "\f04c";
position: absolute;
left: 0px;
padding-left: 17px;
padding-right: 16px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-pauseAD:before {
content: "\f04c";
position: absolute;
top: 7px;
right: 9px;
color: rgb(255, 255, 255);
}
.fa-elite-stop:before {
content: "\f04d";
}
.fa-elite-fast-forward:before {
content: "\f050";
}
.fa-elite-step-forward-ad:before {
content: "\f051";
position: absolute;
top: 0;
right: 17px;
color: #fff;
padding-top: 32px;
padding-bottom: 32px;
}
.fa-elite-eject:before {
content: "\f052";
}
.fa-elite-chevron-left:before {
content: "\f053";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 8px;
}
.fa-elite-chevron-right:before {
content: "\f054";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 8px;
}
.fa-elite-plus-circle:before {
content: "\f055";
}
.fa-elite-minus-circle:before {
content: "\f056";
}
.fa-elite-times-circle:before {
content: "\f057";
}
.fa-elite-check-circle:before {
content: "\f058";
}
.fa-elite-question-circle:before {
content: "\f059";
}
.fa-elite-info-circle:before {
content: "\f05a";
position: absolute;
right: 239px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 3px;
padding-top: 3px;
}
.fa-elite-crosshairs:before {
content: "\f05b";
}
.fa-elite-times-circle-o:before {
content: "\f05c";
}
.fa-elite-check-circle-o:before {
content: "\f05d";
}
.fa-elite-ban:before {
content: "\f05e";
}
.fa-elite-arrow-left:before {
content: "\f060";
}
.fa-elite-arrow-right:before {
content: "\f061";
}
.fa-elite-arrow-up:before {
content: "\f062";
}
.fa-elite-arrow-down:before {
content: "\f063";
}
.fa-elite-mail-forward:before,
.fa-elite-share:before {
content: "\f064";
}
.fa-elite-share-alt:before {
content: "\f1e0";
position: absolute;
padding-left: 8px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 9px;
}
.fa-elite-expand:before {
content: "\f065";
position: absolute;
right: 0px;
padding-left: 17px;
padding-right: 17px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-compress:before {
content: "\f066";
position: absolute;
right: 0px;
padding-left: 17px;
padding-right: 17px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-expandAD:before {
content: "\f065";
position: absolute;
right: 0;
top: 0;
padding-right: 10px;
padding-top: 10px;
color: #ffffff;
cursor: pointer;
}
.fa-elite-compressAD:before {
content: "\f066";
position: absolute;
right: 0;
top: 0;
padding-right: 10px;
padding-top: 10px;
color: #ffffff;
cursor: pointer;
}
.fa-elite-plus:before {
content: "\f067";
}
.fa-elite-minus:before {
content: "\f068";
}
.fa-elite-asterisk:before {
content: "\f069";
}
.fa-elite-exclamation-circle:before {
content: "\f06a";
}
.fa-elite-gift:before {
content: "\f06b";
}
.fa-elite-leaf:before {
content: "\f06c";
}
.fa-elite-fire:before {
content: "\f06d";
}
.fa-elite-eye:before {
content: "\f06e";
}
.fa-elite-eye-slash:before {
content: "\f070";
}
.fa-elite-warning:before,
.fa-elite-exclamation-triangle:before {
content: "\f071";
}
.fa-elite-plane:before {
content: "\f072";
}
.fa-elite-calendar:before {
content: "\f073";
}
.fa-elite-comment:before {
content: "\f075";
}
.fa-elite-magnet:before {
content: "\f076";
}
.fa-elite-chevron-up:before {
content: "\f077";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-top: 5px;
}
.fa-elite-chevron-down:before {
content: "\f078";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-top: 5px;
}
.fa-elite-retweet:before {
content: "\f079";
position:absolute;
right: 190px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-shopping-cart:before {
content: "\f07a";
}
.fa-elite-folder:before {
content: "\f07b";
}
.fa-elite-folder-open:before {
content: "\f07c";
}
.fa-elite-arrows-v:before {
content: "\f07d";
}
.fa-elite-arrows-h:before {
content: "\f07e";
}
.fa-elite-bar-chart-o:before {
content: "\f080";
}
.fa-elite-twitter-square:before {
content: "\f081";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
left: 5px;
}
.fa-elite-facebook-square:before {
content: "\f082";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
}
.fa-elite-camera-retro:before {
content: "\f083";
}
.fa-elite-key:before {
content: "\f084";
}
.fa-elite-gears:before,
.fa-elite-cogs:before {
content: "\f085";
}
.fa-elite-comments:before {
content: "\f086";
}
.fa-elite-thumbs-o-up:before {
content: "\f087";
}
.fa-elite-thumbs-o-down:before {
content: "\f088";
}
.fa-elite-star-half:before {
content: "\f089";
}
.fa-elite-heart-o:before {
content: "\f08a";
}
.fa-elite-sign-out:before {
content: "\f08b";
}
.fa-elite-linkedin-square:before {
content: "\f08c";
}
.fa-elite-thumb-tack:before {
content: "\f08d";
}
.fa-elite-external-link:before {
content: "\f08e";
}
.fa-elite-sign-in:before {
content: "\f090";
}
.fa-elite-trophy:before {
content: "\f091";
}
.fa-elite-github-square:before {
content: "\f092";
}
.fa-elite-upload:before {
content: "\f093";
}
.fa-elite-lemon-o:before {
content: "\f094";
}
.fa-elite-phone:before {
content: "\f095";
}
.fa-elite-square-o:before {
content: "\f096";
}
.fa-elite-bookmark-o:before {
content: "\f097";
}
.fa-elite-phone-square:before {
content: "\f098";
}
.fa-elite-twitter:before {
content: "\f099";
position: absolute;
padding-left: 9px;
padding-right: 8px;
padding-bottom: 8px;
padding-top: 8px;
}
.fa-elite-facebook:before {
content: "\f09a";
position: absolute;
padding-left: 12px;
padding-right: 12px;
padding-bottom: 8px;
padding-top: 9px;
}
.fa-elite-github:before {
content: "\f09b";
}
.fa-elite-unlock:before {
content: "\f09c";
}
.fa-elite-credit-card:before {
content: "\f09d";
}
.fa-elite-rss:before {
content: "\f09e";
}
.fa-elite-hdd-o:before {
content: "\f0a0";
}
.fa-elite-bullhorn:before {
content: "\f0a1";
}
.fa-elite-bell:before {
content: "\f0f3";
}
.fa-elite-certificate:before {
content: "\f0a3";
}
.fa-elite-hand-o-right:before {
content: "\f0a4";
}
.fa-elite-hand-o-left:before {
content: "\f0a5";
}
.fa-elite-hand-o-up:before {
content: "\f0a6";
}
.fa-elite-hand-o-down:before {
content: "\f0a7";
}
.fa-elite-arrow-circle-left:before {
content: "\f0a8";
}
.fa-elite-arrow-circle-right:before {
content: "\f0a9";
}
.fa-elite-arrow-circle-up:before {
content: "\f0aa";
}
.fa-elite-arrow-circle-down:before {
content: "\f0ab";
}
.fa-elite-globe:before {
content: "\f0ac";
}
.fa-elite-wrench:before {
content: "\f0ad";
}
.fa-elite-tasks:before {
content: "\f0ae";
}
.fa-elite-filter:before {
content: "\f0b0";
}
.fa-elite-briefcase:before {
content: "\f0b1";
}
.fa-elite-arrows-alt:before {
content: "\f0b2";
position: absolute;
right: 0px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 17px;
padding-top: 17px;
}
.fa-elite-group:before,
.fa-elite-users:before {
content: "\f0c0";
}
.fa-elite-chain:before,
.fa-elite-link:before {
content: "\f0c1";
position: absolute;
padding-left: 9px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
left: 5px;
}
.fa-elite-cloud:before {
content: "\f0c2";
}
.fa-elite-flask:before {
content: "\f0c3";
}
.fa-elite-cut:before,
.fa-elite-scissors:before {
content: "\f0c4";
}
.fa-elite-copy:before,
.fa-elite-files-o:before {
content: "\f0c5";
}
.fa-elite-paperclip:before {
content: "\f0c6";
}
.fa-elite-save:before,
.fa-elite-floppy-o:before {
content: "\f0c7";
}
.fa-elite-square:before {
content: "\f0c8";
}
.fa-elite-bars:before {
content: "\f0c9";
position: absolute;
padding-left: 9px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 9px;
}
.fa-elite-list-ul:before {
content: "\f0ca";
position: absolute;
padding-left: 8px;
padding-right: 8px; padding-bottom: 8px; padding-top: 8px;
}
.fa-elite-list-ol:before {
content: "\f0cb";
}
.fa-elite-strikethrough:before {
content: "\f0cc";
}
.fa-elite-underline:before {
content: "\f0cd";
}
.fa-elite-table:before {
content: "\f0ce";
}
.fa-elite-magic:before {
content: "\f0d0";
}
.fa-elite-truck:before {
content: "\f0d1";
}
.fa-elite-pinterest:before {
content: "\f0d2";
}
.fa-elite-pinterest-square:before {
content: "\f0d3";
}
.fa-elite-google-plus-square:before {
content: "\f0d4";
}
.fa-elite-google-plus:before {
content: "\f0d5";
position: absolute;
padding-left: 9px;
padding-right: 9px;
padding-bottom: 7px;
padding-top: 9px;
}
.fa-elite-money:before {
content: "\f0d6";
}
.fa-elite-caret-down:before {
content: "\f0d7";
}
.fa-elite-caret-up:before {
content: "\f0d8";
}
.fa-elite-caret-left:before {
content: "\f0d9";
}
.fa-elite-caret-right:before {
content: "\f0da";
}
.fa-elite-columns:before {
content: "\f0db";
}
.fa-elite-unsorted:before,
.fa-elite-sort:before {
content: "\f0dc";
}
.fa-elite-sort-down:before,
.fa-elite-sort-asc:before {
content: "\f0dd";
position: absolute;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 15px;
padding-top: 11px;
}
.fa-elite-sort-up:before,
.fa-elite-sort-desc:before {
content: "\f0de";
position: absolute;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 11px;
padding-top: 15px;
}
.fa-elite-envelope:before {
content: "\f0e0";
position: absolute;
padding-left: 8px;
padding-right: 8px;
padding-bottom: 8px;
padding-top: 8px;
}
.fa-elite-linkedin:before {
content: "\f0e1";
}
.fa-elite-rotate-left:before,
.fa-elite-undo:before {
content: "\f0e2";
}
.fa-elite-legal:before,
.fa-elite-gavel:before {
content: "\f0e3";
}
.fa-elite-dashboard:before,
.fa-elite-tachometer:before {
content: "\f0e4";
}
.fa-elite-comment-o:before {
content: "\f0e5";
}
.fa-elite-comments-o:before {
content: "\f0e6";
}
.fa-elite-flash:before,
.fa-elite-bolt:before {
content: "\f0e7";
}
.fa-elite-sitemap:before {
content: "\f0e8";
}
.fa-elite-umbrella:before {
content: "\f0e9";
}
.fa-elite-paste:before,
.fa-elite-clipboard:before {
content: "\f0ea";
}
.fa-elite-lightbulb-o:before {
content: "\f0eb";
}
.fa-elite-exchange:before {
content: "\f0ec";
}
.fa-elite-cloud-download:before {
content: "\f0ed";
}
.fa-elite-cloud-upload:before {
content: "\f0ee";
}
.fa-elite-user-md:before {
content: "\f0f0";
}
.fa-elite-stethoscope:before {
content: "\f0f1";
}
.fa-elite-suitcase:before {
content: "\f0f2";
}
.fa-elite-bell-o:before {
content: "\f0a2";
}
.fa-elite-coffee:before {
content: "\f0f4";
}
.fa-elite-cutlery:before {
content: "\f0f5";
}
.fa-elite-file-text-o:before {
content: "\f0f6";
}
.fa-elite-building-o:before {
content: "\f0f7";
}
.fa-elite-hospital-o:before {
content: "\f0f8";
}
.fa-elite-ambulance:before {
content: "\f0f9";
}
.fa-elite-medkit:before {
content: "\f0fa";
}
.fa-elite-fighter-jet:before {
content: "\f0fb";
}
.fa-elite-beer:before {
content: "\f0fc";
}
.fa-elite-h-square:before {
content: "\f0fd";
}
.fa-elite-plus-square:before {
content: "\f0fe";
}
.fa-elite-angle-double-left:before {
content: "\f100";
position: absolute;
padding-left: 14px;
padding-right: 19px;
padding-bottom: 0px;
padding-top: 0px;
/* background: #ff0000; */;
}
.fa-elite-angle-double-right:before {
content: "\f101";
position: absolute;
padding-left: 18px;
padding-right: 19px;
padding-bottom: 0px;
padding-top: 0px;
}
.fa-elite-angle-double-up:before {
content: "\f102";
position: absolute;
padding-left: 2px;
padding-right: 3px;
padding-bottom: 15px;
padding-top: 11px;
}
.fa-elite-angle-double-down:before {
content: "\f103";
position: absolute;
padding-left: 2px;
padding-right: 3px;
padding-bottom: 15px;
padding-top: 15px;
}
.fa-elite-close:before{
content: "\f00d";
position: absolute;
top: 0px;
padding-left: 10px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 6px;
line-height: normal;
left: 5px;
}
.fa-elite-angle-left:before {
content: "\f104";
position: absolute;
padding-left: 14px;
padding-right: 19px;
padding-bottom: 0px;
padding-top: 0px;
}
.fa-elite-angle-right:before {
content: "\f105";
position: absolute;
padding-left: 14px;
padding-right: 19px;
padding-bottom: 0px;
padding-top: 0px;
}
.fa-elite-angle-up:before {
content: "\f106";
position: absolute;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 15px;
padding-top: 11px;
}
.fa-elite-angle-down:before {
content: "\f107";
position: absolute;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 11px;
padding-top: 15px;
}
.fa-elite-desktop:before {
content: "\f108";
}
.fa-elite-laptop:before {
content: "\f109";
}
.fa-elite-tablet:before {
content: "\f10a";
}
.fa-elite-mobile-phone:before,
.fa-elite-mobile:before {
content: "\f10b";
}
.fa-elite-circle-o:before {
content: "\f10c";
}
.fa-elite-quote-left:before {
content: "\f10d";
}
.fa-elite-quote-right:before {
content: "\f10e";
}
.fa-elite-spinner:before {
content: "\f110";
}
.fa-elite-circle:before {
content: "\f111";
}
.fa-elite-mail-reply:before,
.fa-elite-reply:before {
content: "\f112";
position: absolute;
right: 269px;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 3px;
padding-top: 3px;
line-height: normal;
left: 5px;
}
.fa-elite-github-alt:before {
content: "\f113";
}
.fa-elite-folder-o:before {
content: "\f114";
}
.fa-elite-folder-open-o:before {
content: "\f115";
}
.fa-elite-smile-o:before {
content: "\f118";
}
.fa-elite-frown-o:before {
content: "\f119";
}
.fa-elite-meh-o:before {
content: "\f11a";
}
.fa-elite-gamepad:before {
content: "\f11b";
}
.fa-elite-keyboard-o:before {
content: "\f11c";
}
.fa-elite-flag-o:before {
content: "\f11d";
}
.fa-elite-flag-checkered:before {
content: "\f11e";
}
.fa-elite-terminal:before {
content: "\f120";
}
.fa-elite-code:before {
content: "\f121";
position: absolute;
padding-left: 7px;
padding-right: 7px;
padding-bottom: 8px;
padding-top: 8px;
}
.fa-elite-reply-all:before {
content: "\f122";
}
.fa-elite-mail-reply-all:before {
content: "\f122";
}
.fa-elite-star-half-empty:before,
.fa-elite-star-half-full:before,
.fa-elite-star-half-o:before {
content: "\f123";
}
.fa-elite-location-arrow:before {
content: "\f124";
}
.fa-elite-crop:before {
content: "\f125";
}
.fa-elite-code-fork:before {
content: "\f126";
}
.fa-elite-unlink:before,
.fa-elite-chain-broken:before {
content: "\f127";
}
.fa-elite-question:before {
content: "\f128";
}
.fa-elite-info:before {
content: "\f129";
position: absolute;
padding-left: 13px;
padding-right: 14px;
padding-bottom: 8px;
padding-top: 8px;
line-height: normal;
left: 5px;
}
}
.fa-elite-exclamation:before {
content: "\f12a";
}
.fa-elite-superscript:before {
content: "\f12b";
}
.fa-elite-subscript:before {
content: "\f12c";
}
.fa-elite-eraser:before {
content: "\f12d";
}
.fa-elite-puzzle-piece:before {
content: "\f12e";
}
.fa-elite-microphone:before {
content: "\f130";
}
.fa-elite-microphone-slash:before {
content: "\f131";
}
.fa-elite-shield:before {
content: "\f132";
}
.fa-elite-calendar-o:before {
content: "\f133";
}
.fa-elite-fire-extinguisher:before {
content: "\f134";
}
.fa-elite-rocket:before {
content: "\f135";
}
.fa-elite-maxcdn:before {
content: "\f136";
}
.fa-elite-chevron-circle-left:before {
content: "\f137";
}
.fa-elite-chevron-circle-right:before {
content: "\f138";
}
.fa-elite-chevron-circle-up:before {
content: "\f139";
}
.fa-elite-chevron-circle-down:before {
content: "\f13a";
}
.fa-elite-html5:before {
content: "\f13b";
}
.fa-elite-css3:before {
content: "\f13c";
}
.fa-elite-anchor:before {
content: "\f13d";
}
.fa-elite-unlock-alt:before {
content: "\f13e";
}
.fa-elite-bullseye:before {
content: "\f140";
}
.fa-elite-ellipsis-h:before {
content: "\f141";
}
.fa-elite-ellipsis-v:before {
content: "\f142";
}
.fa-elite-rss-square:before {
content: "\f143";
}
.fa-elite-play-circle:before {
content: "\f144";
}
.fa-elite-ticket:before {
content: "\f145";
}
.fa-elite-minus-square:before {
content: "\f146";
}
.fa-elite-minus-square-o:before {
content: "\f147";
}
.fa-elite-level-up:before {
content: "\f148";
}
.fa-elite-level-down:before {
content: "\f149";
}
.fa-elite-check-square:before {
content: "\f14a";
}
.fa-elite-pencil-square:before {
content: "\f14b";
}
.fa-elite-external-link-square:before {
content: "\f14c";
}
.fa-elite-share-square:before {
content: "\f14d";
position: absolute;
padding-left: 8px;
padding-right: 9px;
padding-bottom: 8px;
padding-top: 9px;
}
.fa-elite-compass:before {
content: "\f14e";
}
.fa-elite-toggle-down:before,
.fa-elite-caret-square-o-down:before {
content: "\f150";
}
.fa-elite-toggle-up:before,
.fa-elite-caret-square-o-up:before {
content: "\f151";
}
.fa-elite-toggle-right:before,
.fa-elite-caret-square-o-right:before {
content: "\f152";
}
.fa-elite-euro:before,
.fa-elite-eur:before {
content: "\f153";
}
.fa-elite-gbp:before {
content: "\f154";
}
.fa-elite-dollar:before,
.fa-elite-usd:before {
content: "\f155";
}
.fa-elite-rupee:before,
.fa-elite-inr:before {
content: "\f156";
}
.fa-elite-cny:before,
.fa-elite-rmb:before,
.fa-elite-yen:before,
.fa-elite-jpy:before {
content: "\f157";
}
.fa-elite-ruble:before,
.fa-elite-rouble:before,
.fa-elite-rub:before {
content: "\f158";
}
.fa-elite-won:before,
.fa-elite-krw:before {
content: "\f159";
}
.fa-elite-bitcoin:before,
.fa-elite-btc:before {
content: "\f15a";
}
.fa-elite-file:before {
content: "\f15b";
}
.fa-elite-file-text:before {
content: "\f15c";
}
.fa-elite-sort-alpha-asc:before {
content: "\f15d";
}
.fa-elite-sort-alpha-desc:before {
content: "\f15e";
}
.fa-elite-sort-amount-asc:before {
content: "\f160";
}
.fa-elite-sort-amount-desc:before {
content: "\f161";
}
.fa-elite-sort-numeric-asc:before {
content: "\f162";
}
.fa-elite-sort-numeric-desc:before {
content: "\f163";
}
.fa-elite-thumbs-up:before {
content: "\f164";
}
.fa-elite-thumbs-down:before {
content: "\f165";
}
.fa-elite-youtube-square:before {
content: "\f166";
}
.fa-elite-youtube:before {
content: "\f167";
}
.fa-elite-xing:before {
content: "\f168";
}
.fa-elite-xing-square:before {
content: "\f169";
}
.fa-elite-youtube-play:before {
content: "\f16a";
position: absolute;
color: #ffffff;
font-size: 94px;
}
.fa-elite-dropbox:before {
content: "\f16b";
}
.fa-elite-stack-overflow:before {
content: "\f16c";
}
.fa-elite-instagram:before {
content: "\f16d";
}
.fa-elite-flickr:before {
content: "\f16e";
}
.fa-elite-adn:before {
content: "\f170";
}
.fa-elite-bitbucket:before {
content: "\f171";
}
.fa-elite-bitbucket-square:before {
content: "\f172";
}
.fa-elite-tumblr:before {
content: "\f173";
}
.fa-elite-tumblr-square:before {
content: "\f174";
}
.fa-elite-long-arrow-down:before {
content: "\f175";
}
.fa-elite-long-arrow-up:before {
content: "\f176";
}
.fa-elite-long-arrow-left:before {
content: "\f177";
}
.fa-elite-long-arrow-right:before {
content: "\f178";
}
.fa-elite-apple:before {
content: "\f179";
}
.fa-elite-windows:before {
content: "\f17a";
}
.fa-elite-android:before {
content: "\f17b";
}
.fa-elite-linux:before {
content: "\f17c";
}
.fa-elite-dribbble:before {
content: "\f17d";
}
.fa-elite-skype:before {
content: "\f17e";
}
.fa-elite-foursquare:before {
content: "\f180";
}
.fa-elite-trello:before {
content: "\f181";
}
.fa-elite-female:before {
content: "\f182";
}
.fa-elite-male:before {
content: "\f183";
}
.fa-elite-gittip:before {
content: "\f184";
}
.fa-elite-sun-o:before {
content: "\f185";
}
.fa-elite-moon-o:before {
content: "\f186";
}
.fa-elite-archive:before {
content: "\f187";
}
.fa-elite-bug:before {
content: "\f188";
}
.fa-elite-vk:before {
content: "\f189";
}
.fa-elite-weibo:before {
content: "\f18a";
}
.fa-elite-renren:before {
content: "\f18b";
}
.fa-elite-pagelines:before {
content: "\f18c";
}
.fa-elite-stack-exchange:before {
content: "\f18d";
}
.fa-elite-arrow-circle-o-right:before {
content: "\f18e";
}
.fa-elite-arrow-circle-o-left:before {
content: "\f190";
}
.fa-elite-toggle-left:before,
.fa-elite-caret-square-o-left:before {
content: "\f191";
}
.fa-elite-dot-circle-o:before {
content: "\f192";
}
.fa-elite-wheelchair:before {
content: "\f193";
}
.fa-elite-vimeo-square:before {
content: "\f194";
}
.fa-elite-turkish-lira:before,
.fa-elite-try:before {
content: "\f195";
}
.fa-elite-plus-square-o:before {
content: "\f196";
}
| Ishtiaque-Shaad/xyz | wp-content/plugins/Elite-video-player/css/font-awesome.css | CSS | gpl-2.0 | 33,903 | [
30522,
1013,
1008,
999,
1008,
15489,
12476,
1018,
1012,
1014,
1012,
1017,
2011,
1030,
4913,
5289,
5149,
1011,
8299,
1024,
1013,
1013,
15489,
10376,
2229,
8462,
1012,
22834,
1011,
1030,
15489,
10376,
2229,
8462,
1008,
6105,
1011,
8299,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* XML Type: DesignInputType
* Namespace: http://uncertws.aston.ac.uk/emulatorization
* Java type: uk.ac.aston.uncertws.emulatorization.DesignInputType
*
* Automatically generated - do not modify.
*/
package uk.ac.aston.uncertws.emulatorization.impl;
/**
* An XML DesignInputType(@http://uncertws.aston.ac.uk/emulatorization).
*
* This is a complex type.
*/
public class DesignInputTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements uk.ac.aston.uncertws.emulatorization.DesignInputType
{
private static final long serialVersionUID = 1L;
public DesignInputTypeImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
private static final javax.xml.namespace.QName IDENTIFIER$0 =
new javax.xml.namespace.QName("http://uncertws.aston.ac.uk/emulatorization", "identifier");
private static final javax.xml.namespace.QName POINTS$2 =
new javax.xml.namespace.QName("http://uncertws.aston.ac.uk/emulatorization", "points");
private static final javax.xml.namespace.QName MEAN$4 =
new javax.xml.namespace.QName("http://uncertws.aston.ac.uk/emulatorization", "mean");
private static final javax.xml.namespace.QName STDDEV$6 =
new javax.xml.namespace.QName("http://uncertws.aston.ac.uk/emulatorization", "stdDev");
/**
* Gets the "identifier" element
*/
public java.lang.String getIdentifier()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(IDENTIFIER$0, 0);
if (target == null)
{
return null;
}
return target.getStringValue();
}
}
/**
* Gets (as xml) the "identifier" element
*/
public org.apache.xmlbeans.XmlString xgetIdentifier()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(IDENTIFIER$0, 0);
return target;
}
}
/**
* Sets the "identifier" element
*/
public void setIdentifier(java.lang.String identifier)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(IDENTIFIER$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(IDENTIFIER$0);
}
target.setStringValue(identifier);
}
}
/**
* Sets (as xml) the "identifier" element
*/
public void xsetIdentifier(org.apache.xmlbeans.XmlString identifier)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(IDENTIFIER$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(IDENTIFIER$0);
}
target.set(identifier);
}
}
/**
* Gets the "points" element
*/
public java.util.List getPoints()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(POINTS$2, 0);
if (target == null)
{
return null;
}
return target.getListValue();
}
}
/**
* Gets (as xml) the "points" element
*/
public uk.ac.aston.uncertws.emulatorization.DesignInputType.Points xgetPoints()
{
synchronized (monitor())
{
check_orphaned();
uk.ac.aston.uncertws.emulatorization.DesignInputType.Points target = null;
target = (uk.ac.aston.uncertws.emulatorization.DesignInputType.Points)get_store().find_element_user(POINTS$2, 0);
return target;
}
}
/**
* Sets the "points" element
*/
public void setPoints(java.util.List points)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(POINTS$2, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(POINTS$2);
}
target.setListValue(points);
}
}
/**
* Sets (as xml) the "points" element
*/
public void xsetPoints(uk.ac.aston.uncertws.emulatorization.DesignInputType.Points points)
{
synchronized (monitor())
{
check_orphaned();
uk.ac.aston.uncertws.emulatorization.DesignInputType.Points target = null;
target = (uk.ac.aston.uncertws.emulatorization.DesignInputType.Points)get_store().find_element_user(POINTS$2, 0);
if (target == null)
{
target = (uk.ac.aston.uncertws.emulatorization.DesignInputType.Points)get_store().add_element_user(POINTS$2);
}
target.set(points);
}
}
/**
* Gets the "mean" element
*/
public double getMean()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(MEAN$4, 0);
if (target == null)
{
return 0.0;
}
return target.getDoubleValue();
}
}
/**
* Gets (as xml) the "mean" element
*/
public org.apache.xmlbeans.XmlDouble xgetMean()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlDouble target = null;
target = (org.apache.xmlbeans.XmlDouble)get_store().find_element_user(MEAN$4, 0);
return target;
}
}
/**
* True if has "mean" element
*/
public boolean isSetMean()
{
synchronized (monitor())
{
check_orphaned();
return get_store().count_elements(MEAN$4) != 0;
}
}
/**
* Sets the "mean" element
*/
public void setMean(double mean)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(MEAN$4, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(MEAN$4);
}
target.setDoubleValue(mean);
}
}
/**
* Sets (as xml) the "mean" element
*/
public void xsetMean(org.apache.xmlbeans.XmlDouble mean)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlDouble target = null;
target = (org.apache.xmlbeans.XmlDouble)get_store().find_element_user(MEAN$4, 0);
if (target == null)
{
target = (org.apache.xmlbeans.XmlDouble)get_store().add_element_user(MEAN$4);
}
target.set(mean);
}
}
/**
* Unsets the "mean" element
*/
public void unsetMean()
{
synchronized (monitor())
{
check_orphaned();
get_store().remove_element(MEAN$4, 0);
}
}
/**
* Gets the "stdDev" element
*/
public double getStdDev()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STDDEV$6, 0);
if (target == null)
{
return 0.0;
}
return target.getDoubleValue();
}
}
/**
* Gets (as xml) the "stdDev" element
*/
public org.apache.xmlbeans.XmlDouble xgetStdDev()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlDouble target = null;
target = (org.apache.xmlbeans.XmlDouble)get_store().find_element_user(STDDEV$6, 0);
return target;
}
}
/**
* True if has "stdDev" element
*/
public boolean isSetStdDev()
{
synchronized (monitor())
{
check_orphaned();
return get_store().count_elements(STDDEV$6) != 0;
}
}
/**
* Sets the "stdDev" element
*/
public void setStdDev(double stdDev)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STDDEV$6, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(STDDEV$6);
}
target.setDoubleValue(stdDev);
}
}
/**
* Sets (as xml) the "stdDev" element
*/
public void xsetStdDev(org.apache.xmlbeans.XmlDouble stdDev)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlDouble target = null;
target = (org.apache.xmlbeans.XmlDouble)get_store().find_element_user(STDDEV$6, 0);
if (target == null)
{
target = (org.apache.xmlbeans.XmlDouble)get_store().add_element_user(STDDEV$6);
}
target.set(stdDev);
}
}
/**
* Unsets the "stdDev" element
*/
public void unsetStdDev()
{
synchronized (monitor())
{
check_orphaned();
get_store().remove_element(STDDEV$6, 0);
}
}
/**
* An XML points(@http://uncertws.aston.ac.uk/emulatorization).
*
* This is a list type whose items are org.apache.xmlbeans.XmlDouble.
*/
public static class PointsImpl extends org.apache.xmlbeans.impl.values.XmlListImpl implements uk.ac.aston.uncertws.emulatorization.DesignInputType.Points
{
private static final long serialVersionUID = 1L;
public PointsImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType, false);
}
protected PointsImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
{
super(sType, b);
}
}
}
| itszootime/emulatorization-api | src/main/java/uk/ac/aston/uncertws/emulatorization/impl/DesignInputTypeImpl.java | Java | gpl-3.0 | 11,117 | [
30522,
1013,
1008,
1008,
20950,
2828,
1024,
2640,
2378,
18780,
13874,
1008,
3415,
15327,
1024,
8299,
1024,
1013,
1013,
4895,
17119,
2102,
9333,
1012,
14327,
1012,
9353,
1012,
2866,
1013,
7861,
20350,
3989,
1008,
9262,
2828,
1024,
2866,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.handler.codec.marshalling;
import org.jboss.marshalling.MarshallerFactory;
import org.jboss.marshalling.Marshalling;
import org.jboss.marshalling.MarshallingConfiguration;
public class RiverCompatibleMarshallingDecoderTest extends AbstractCompatibleMarshallingDecoderTest {
@Override
protected MarshallerFactory createMarshallerFactory() {
return Marshalling.getProvidedMarshallerFactory("river");
}
@Override
protected MarshallingConfiguration createMarshallingConfig() {
// Create a configuration
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(3);
return configuration;
}
}
| jroper/netty | codec/src/test/java/io/netty/handler/codec/marshalling/RiverCompatibleMarshallingDecoderTest.java | Java | apache-2.0 | 1,352 | [
30522,
1013,
1008,
1008,
9385,
2262,
1996,
5658,
3723,
2622,
1008,
1008,
1996,
5658,
3723,
2622,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
15895,
6105,
1010,
1008,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using NetOffice;
using NetOffice.Attributes;
namespace NetOffice.WordApi.Enums
{
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
///<remarks> MSDN Online Documentation: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.WdMonthNames"/> </remarks>
[SupportByVersion("Word", 9,10,11,12,14,15,16)]
[EntityType(EntityType.IsEnum)]
public enum WdMonthNames
{
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>0</remarks>
[SupportByVersion("Word", 9,10,11,12,14,15,16)]
wdMonthNamesArabic = 0,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>1</remarks>
[SupportByVersion("Word", 9,10,11,12,14,15,16)]
wdMonthNamesEnglish = 1,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>2</remarks>
[SupportByVersion("Word", 9,10,11,12,14,15,16)]
wdMonthNamesFrench = 2
}
} | NetOfficeFw/NetOffice | Source/Word/Enums/WdMonthNames.cs | C# | mit | 1,023 | [
30522,
2478,
2291,
1025,
2478,
5658,
7245,
6610,
1025,
2478,
5658,
7245,
6610,
1012,
12332,
1025,
3415,
15327,
5658,
7245,
6610,
1012,
2773,
9331,
2072,
1012,
4372,
18163,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
2490,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Inga lallensis Benth. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Inga/Inga lallensis/README.md | Markdown | apache-2.0 | 179 | [
30522,
1001,
13749,
2050,
21348,
7770,
6190,
6260,
2232,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% extends 'hqwebapp/two_column.html' %}
{% load i18n %}
{% load hq_shared_tags %}
{% block title %}{% trans "Chat over SMS" %}{% endblock %}
{% block page-title %}
<ul class="breadcrumb">
<li>
<a href="{% url "sms_default" domain %}"><strong>{% trans "Messaging" %}</strong></a> <span class="divider">></span>
</li>
<li class="active">
<div id="report-title"><a href="{% url "chat_contacts" domain %}">{% trans "Chat over SMS" %}</a></div>
</li>
</ul>
{% endblock %}
{% block head %}{{ block.super }}
{% include "imports/datatables.html" %}
<script type="text/javascript" src="{% static 'reports/javascripts/config.dataTables.bootstrap.js' %}"></script>
{% endblock %}
{% block js-inline %}{{ block.super }}
<script>
var contactListTable = null;
function FilterViewModel() {
'use strict';
var self = this;
self.filterText = ko.observable();
self.performFilter = function() {
contactListTable.fnFilter(self.filterText());
};
self.clearFilter = function() {
self.filterText("");
self.performFilter();
};
}
$(function(){
contactListTable = $("#contact_list").dataTable({
"aoColumnDefs": [
{
"aTargets": [0],
"fnRender": function(obj) {
return '<a target="_blank" href="'+obj.aData[4]+'">'+obj.aData[0]+'</a>'+
'<span class="btn btn-primary pull-right" '+
'onClick="window.open(\''+obj.aData[5]+'\', \'_blank\', \'location=no,menubar=no,scrollbars=no,status=no,toolbar=no,height=400,width=400\');">'+
'{% trans "Chat" %} <i class="icon icon-white icon-share-alt"></i></span>';
}
}
],
"bProcessing": true,
"bServerSide": true,
"bSort": false,
"bFilter": true,
"oLanguage": {
"sLengthMenu": "{% trans "Show" %} _MENU_ {% trans "contacts per page" %}",
"sProcessing": '<img src="{% static "hqwebapp/img/ajax-loader.gif" %}" alt="loading indicator" /> {% trans "Loading Contacts..." %}',
"sInfo": "{% trans "Showing _START_ to _END_ of _TOTAL_ contacts" %}",
"sInfoFiltered": "{% trans "(filtered from _MAX_ total contacts)" %}",
},
"sAjaxSource": "{% url "chat_contact_list" domain %}",
"sDom": "lrtip",
"sPaginationType": "bootstrap"
});
var filterViewModel = new FilterViewModel();
ko.applyBindings(filterViewModel, $('#id_filter').get(0));
});
</script>
{% endblock %}
{% block main_column %}
<div id="id_filter" style="padding-bottom: 50px;" class="input-append">
<input id="id_filter_text" type="text" data-bind="value: filterText" placeholder="{% trans "Search by name or phone number" %}" />
<button class="btn btn-primary" data-bind="click: performFilter">{% trans "Search" %}</button>
<button class="btn" data-bind="click: clearFilter">{% trans "Clear" %}</button>
</div>
<table id="contact_list" class="table table-striped table-bordered">
<thead>
<tr>
<th>{% trans "Contact Name" %}</th>
<th>{% trans "Contact Type" %}</th>
<th>{% trans "Phone Number" %}</th>
</tr>
</thead>
</table>
{% endblock %}
| puttarajubr/commcare-hq | corehq/apps/sms/templates/sms/chat_contacts.html | HTML | bsd-3-clause | 3,566 | [
30522,
1063,
1003,
8908,
1005,
16260,
8545,
3676,
9397,
1013,
2048,
1035,
5930,
1012,
16129,
1005,
1003,
1065,
1063,
1003,
7170,
1045,
15136,
2078,
1003,
1065,
1063,
1003,
7170,
16260,
1035,
4207,
1035,
22073,
1003,
1065,
1063,
1003,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import envi.archs.h8.emu as h8_emu
import envi.archs.h8.regs as h8_regs
import vivisect.impemu.emulator as v_i_emulator
class H8WorkspaceEmulator(v_i_emulator.WorkspaceEmulator, h8_emu.H8Emulator):
taintregs = [h8_regs.REG_ER0, h8_regs.REG_ER1, h8_regs.REG_ER2]
def __init__(self, vw, logwrite=False, logread=False):
h8_emu.H8Emulator.__init__(self)
v_i_emulator.WorkspaceEmulator.__init__(self, vw, logwrite=logwrite, logread=logread)
| bat-serjo/vivisect | vivisect/impemu/platarch/h8.py | Python | apache-2.0 | 464 | [
30522,
12324,
4372,
5737,
1012,
7905,
2015,
1012,
1044,
2620,
1012,
7861,
2226,
2004,
1044,
2620,
1035,
7861,
2226,
12324,
4372,
5737,
1012,
7905,
2015,
1012,
1044,
2620,
1012,
19723,
2015,
2004,
1044,
2620,
1035,
19723,
2015,
12324,
6819,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Template Foundation - Sign In</title>
<link rel="icon" type="image/png" href="images/favicon.png" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.1.2/foundation.min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.min.css" />
<link rel="stylesheet" href="styles/outline.css" />
</head>
<body>
<div class="top-bar">
<div class="top-bar-left">
<a href="index.html"><img alt="Company Logo" src="images/logo-small.png" /></a>
</div>
<div class="top-bar-right">
<ul class="menu">
<li><a href="sign-in.html">Sign In</a></li>
<li><a class="button" href="sign-up.html">Sign Up</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="row">
<div class="columns">
<div class="callout alert">
User username has already been verified.
<a href="sign-in.html" class="close">×</a>
</div>
<h2>Sign In</h2>
<label>
Username
<input type="text" placeholder="Username" />
</label>
<label>
Password
<input type="password" placeholder="Password" />
</label>
<ul class="menu">
<li><a class="button" href="signed-in.html">Sign In</a></li>
<li><a href="index.html">Cancel</a></li>
</ul>
<br />
<p>
Forgot password?
<a href="reset-password.html">Reset password</a>
</p>
</div>
</div>
</div>
<footer>
<div class="row expanded">
<div class="medium-9 columns">
<ul class="menu">
<li><span class="footer-item">Follow Us:</span></li>
<li><a href="#"><span class="fi-social-twitter"></span></a></li>
<li><a href="#"><span class="fi-social-facebook"></span></a></li>
<li><a href="#"><span class="fi-social-youtube"></span></a></li>
<li><a href="#"><span class="fi-social-instagram"></span></a></li>
<li><a href="#"><span class="fi-social-pinterest"></span></a></li>
</ul>
</div>
<div class="medium-3 columns">
<ul class="menu">
<li><a href="terms.html">Terms</a></li>
<li><a href="privacy.html">Privacy</a></li>
<li><span class="footer-item">©9999 Company</span></li>
</ul>
</div>
</div>
</footer>
</body>
</html>
| intrepion/sign-up-template-foundation | sign-in-verified.html | HTML | mit | 2,730 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
2465,
1027,
1000,
2053,
1011,
1046,
2015,
1000,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# koha-sms-driver-bd
This is a perl sms driver created for integrating any local sms gateway with the open source library management system Koha
This driver works with the latest ROBI API.
| auninda/koha-sms-driver-bd | README.md | Markdown | gpl-2.0 | 190 | [
30522,
1001,
12849,
3270,
1011,
22434,
1011,
4062,
1011,
1038,
2094,
2023,
2003,
1037,
2566,
2140,
22434,
4062,
2580,
2005,
22380,
2151,
2334,
22434,
11909,
2007,
1996,
2330,
3120,
3075,
2968,
2291,
12849,
3270,
2023,
4062,
2573,
2007,
1996... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
namespace _14.MagicLetter
{
class Program
{
static void Main(string[] args)
{
char letter1 = char.Parse(Console.ReadLine());
char letter2 = char.Parse(Console.ReadLine());
string letter3 = Console.ReadLine();
for (char i = letter1; i <= letter2; i++)
{
for (char p = letter1; p <= letter2; p++)
{
for (char k = letter1; k <= letter2; k++)
{
string result = $"{i}{p}{k}";
if (!result.Contains(letter3))
{
Console.Write(result + " ");
}
}
}
}
}
}
}
| spacex13/SoftUni-Homework | ConditionalStatementsAndLoops/14.MagicLetter/Program.cs | C# | mit | 806 | [
30522,
2478,
2291,
1025,
3415,
15327,
1035,
2403,
1012,
3894,
27901,
2099,
1063,
2465,
2565,
1063,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
25869,
3661,
2487,
1027,
25869,
1012,
11968,
3366,
1006,
10122,
1012,
31... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines the version of workshop rubric grading strategy subplugin
*
* This code fragment is called by moodle_needs_upgrading() and
* /admin/index.php
*
* @package workshopform_rubric
* @copyright 2009 David Mudrak <david.mudrak@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018120300;
$plugin->requires = 2018112800; // Requires this Moodle version.
$plugin->component = 'workshopform_rubric';
| msoni11/moodle | mod/workshop/form/rubric/version.php | PHP | gpl-3.0 | 1,204 | [
30522,
1026,
1029,
25718,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
6888,
2571,
1011,
8299,
1024,
1013,
1013,
6888,
2571,
1012,
8917,
1013,
1013,
1013,
1013,
1013,
6888,
2571,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2014 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.channel.unix;
import io.netty.util.internal.ClassInitializerUtil;
import io.netty.util.internal.UnstableApi;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.PortUnreachableException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Tells if <a href="https://netty.io/wiki/native-transports.html">{@code netty-transport-native-unix}</a> is
* supported.
*/
public final class Unix {
private static final AtomicBoolean registered = new AtomicBoolean();
static {
// Preload all classes that will be used in the OnLoad(...) function of JNI to eliminate the possiblity of a
// class-loader deadlock. This is a workaround for https://github.com/netty/netty/issues/11209.
// This needs to match all the classes that are loaded via NETTY_JNI_UTIL_LOAD_CLASS or looked up via
// NETTY_JNI_UTIL_FIND_CLASS.
ClassInitializerUtil.tryLoadClasses(Unix.class,
// netty_unix_errors
OutOfMemoryError.class, RuntimeException.class, ClosedChannelException.class,
IOException.class, PortUnreachableException.class,
// netty_unix_socket
DatagramSocketAddress.class, InetSocketAddress.class
);
}
/**
* Internal method... Should never be called from the user.
*
* @param registerTask
*/
@UnstableApi
public static void registerInternal(Runnable registerTask) {
if (registered.compareAndSet(false, true)) {
registerTask.run();
Socket.initialize();
}
}
/**
* Returns {@code true} if and only if the <a href="https://netty.io/wiki/native-transports.html">{@code
* netty_transport_native_unix}</a> is available.
*/
@Deprecated
public static boolean isAvailable() {
return false;
}
/**
* Ensure that <a href="https://netty.io/wiki/native-transports.html">{@code netty_transport_native_unix}</a> is
* available.
*
* @throws UnsatisfiedLinkError if unavailable
*/
@Deprecated
public static void ensureAvailability() {
throw new UnsupportedOperationException();
}
/**
* Returns the cause of unavailability of <a href="https://netty.io/wiki/native-transports.html">
* {@code netty_transport_native_unix}</a>.
*
* @return the cause if unavailable. {@code null} if available.
*/
@Deprecated
public static Throwable unavailabilityCause() {
return new UnsupportedOperationException();
}
private Unix() {
}
}
| doom369/netty | transport-native-unix-common/src/main/java/io/netty/channel/unix/Unix.java | Java | apache-2.0 | 3,285 | [
30522,
1013,
1008,
1008,
9385,
2297,
1996,
5658,
3723,
2622,
1008,
1008,
1996,
5658,
3723,
2622,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
15895,
6105,
1010,
1008,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Ice.cpp
// Alchemy
//
// Created by Kyounghwan on 2014. 3. 1..
// 1206 Ice 2 - - 30 1 sq. - 마법 Slow 50% 확률로 3초간 Slow. 1102 1101 1
//
#include "Ice.h"
/* ALCHEMY PARAMETER */
#define DEFAULT_INDEX 0
#define LOOP 0
#define TWEEN_EASING_MAX_INDEX 0
/* OPTION */
#define AP 30
Ice::Ice(unsigned char index)
:Alchemy(Alchemy::resource_table[index])
{
m_hp = 0;
m_ap = AP;
}
Ice::~Ice()
{}
Alchemy* Ice::create(PEObject* obj)
{
Ice* pIce = new Ice(obj->PE_getResourceIndex());
return pIce;
}
void Ice::PE_initAnimation()
{
ArmatureAnimation* ani;
init(m_name.c_str());
setAnchorPoint(Vec2(0.5f, 0.0f));
ani = getAnimation();
ani->playWithIndex(DEFAULT_INDEX, -1, -1);
}
bool Ice::PE_update(unsigned int flag) {
Vec2 index = getPosIndex();
Vec2 tower_pos = getPosition();
Rect tower_box = getBoundingBox();
int idx_x = index.x;
int idx_y = index.y;
int monster_count = 0;
for(int y=idx_y-1; y<idx_y+2; y++)
{
if(y<0 || y>ROW_NUM-1) continue;
int monster_num = m_pCollision->m_monsters_matrix[idx_x].size();
monster_count += monster_num;
if(monster_num>0)
{
for(int i=0; i<monster_num; i++)
{
Monster* obj;
obj = m_pCollision->m_monsters_matrix[idx_x][i];
if(tower_box.intersectsRect(obj->getBoundingBox()))
{
obj->Hit(m_ap);
if(rand()%2 == 1)
{
obj->slow(0.5, 3);
}
}
}
}
}
return false;
}
| kkh029/Alchemy | Alchemy/Classes/Object/Alchemy/Ice.cpp | C++ | apache-2.0 | 1,493 | [
30522,
1013,
1013,
1013,
1013,
3256,
1012,
18133,
2361,
1013,
1013,
2632,
5403,
8029,
1013,
1013,
1013,
1013,
2580,
2011,
18712,
23709,
5603,
7447,
2006,
2297,
1012,
1017,
1012,
1015,
1012,
1012,
1013,
1013,
6036,
2575,
3256,
1016,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" >
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Personal Website of Junpeng Lao, PhD">
<title> Motif of the Mind | Junpeng Lao, PhD</title>
<!--link favicon -->
<link rel="icon" type="image/x-icon" href="../../img/ico/16x16.ico">
<!--link the stylesheets, including normalize.css, master.css, ie.css etc-->
<!--<link rel="stylesheet" type="text/css" href="css/normalize.css" /> -->
<link rel="stylesheet" type="text/css" href="../../css/main.css" />
<!--link fonts, google fonts or font-awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Cinzel" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Source+Serif+Pro" rel="stylesheet" type="text/css">
<!--link sniffing javascript, modernizr.js-->
<!--<script src="https://cdn.jsdelivr.net/modernizr/2.8.3/modernizr.min.js"></script>-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-83855153-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- the start of the navigation section-->
<nav class="menu">
<div class="logo"> <a href="../../index.html">Motif of<br/>the Mind</a> </div>
<div class="group">
<input type="checkbox" id="css-toggle-menu" name="css-toggle-menu">
<ul>
<li class="menu-tab"> <a href="../../index.html">About Me</a></li>
<li class="menu-tab"> <a href="../../cv/index.html">CV</a></li>
<li class="menu-tab"> <a href="../../Projects/index.html">Projects</a></li>
<li class="menu-tab"> <a href="../../Teaching/index.html">Teaching</a></li>
<li class="menu-tab active"> <a href="../index.html">Blogs</a></li>
</ul>
<label for="css-toggle-menu"></label>
</div>
<div class="ghost-space"></div>
</nav>
<!-- the end of the navigation section-->
<section>
<div class="intro-wrapper">
<div class="intro-text">
<p>2017-04-09</p>
<ptitle>Small updates</ptitle>
<p>1. I am attending <a href="http://www.maths.lu.se/bayeslund2017/#c348239">Bayes@Lund on 20 April 2017</a> and will be giving a talk on eye movement analysis using Gaussian Process. I am mostly experimenting in GPflow and PyMC3. You can find the slides and materials on <a href="https://github.com/junpenglao/Bayesian_Smoothing_EyeMovement">Github</a>.</p>
<p>2. I will be attending <a href="http://www.visionsciences.org/">VSS in May</a> and give a talk on <a href="http://www.visionsciences1.org/vss_public/mobile/show_session.php?id=64">face processing in Deaf populations</a>.</p>
<p>3. I updated my <a href="https://github.com/junpenglao/Bayesian-Cognitive-Modeling-in-Pymc3">PyMC3 port of Lee and Wagenmakers' Bayesian Cognitive Modeling</a> following the recent <a href="https://github.com/pymc-devs/pymc3/releases/tag/v3.1.rc3">updates in PyMC3</a>. I am quite pleased with the current version, as all models are running properly now after vectorization (putting my Matlab skill into used). There are so many exciting new features in PyMC3, and the development community is just fantastic.</p>
<p>4. I updated my <a href="https://gist.github.com/junpenglao/f17671b44c9c39e5a9d11e3ed95a162d">Gist</a> on Testing hypotheses via a mixture estimation model. In the previous experiments with this approach, I often discover that the trace is not mixing very well. The main reason is the multimodality of the mixture model. Inspired by <a href="http://mc-stan.org/documentation/case-studies/identifying_mixture_models.html">Michael Betancourt's case study in Stan</a>, I also sorted the mixture weight to break the multimodality. However, one must be careful of placing the order of the mixture component, as the less possible component should be placed in the front. As a heuristic, we can place the component coding for the null hypothesis before the alternative hypothesis, as our strawman null hypothesis is usually false.</p>
</div>
</div>
</section>
<!-- the start of footer -->
<footer>
<div class="ft-container">
<div class="ft-left">
<span class="copyright">Copyright © 2022 <br /> JunpengLao@gmail.com</span>
</div>
<div class="ft-right">
<ul class="list-inline social-buttons">
<li><a href="https://scholar.google.com/citations?user=J-KhWL8AAAAJ&hl=en" target="_blank"><i class="fa fa-google"></i></a>
</li>
<li><a href="https://github.com/junpenglao" target="_blank"><i class="fa fa-github"></i></a>
</li>
<li><a href="https://twitter.com/junpenglao" target="_blank"><i class="fa fa-twitter"></i></a>
</li>
<li><a href="https://medium.com/@junpenglao" target="_blank"><i class="fa fa-medium"></i></a>
</li>
</ul>
</div>
</div>
</footer>
<!-- the end of footer -->
</body>
</html>
| junpenglao/junpenglao.github.io | Blogs/posts/2017-04-09-Small_updates.html | HTML | gpl-2.0 | 5,540 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Generated by esidl 0.3.0.
// This file is expected to be modified for the Web IDL interface
// implementation. Permission to use, copy, modify and distribute
// this file in any software license is hereby granted.
#include "RGBColorImp.h"
namespace org
{
namespace w3c
{
namespace dom
{
namespace bootstrap
{
css::CSSPrimitiveValue RGBColorImp::getRed()
{
// TODO: implement me!
return nullptr;
}
css::CSSPrimitiveValue RGBColorImp::getGreen()
{
// TODO: implement me!
return nullptr;
}
css::CSSPrimitiveValue RGBColorImp::getBlue()
{
// TODO: implement me!
return nullptr;
}
}
}
}
}
| esrille/escudo | src/css/RGBColorImp.cpp | C++ | apache-2.0 | 618 | [
30522,
1013,
1013,
7013,
2011,
9686,
3593,
2140,
1014,
1012,
1017,
1012,
1014,
1012,
1013,
1013,
2023,
5371,
2003,
3517,
2000,
2022,
6310,
2005,
1996,
4773,
8909,
2140,
8278,
1013,
1013,
7375,
1012,
6656,
2000,
2224,
1010,
6100,
1010,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `forget` fn in crate `gleam`.">
<meta name="keywords" content="rust, rustlang, rust-lang, forget">
<title>gleam::gl::__gl_imports::mem::forget - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../../../index.html'>gleam</a>::<wbr><a href='../../index.html'>gl</a>::<wbr><a href='../index.html'>__gl_imports</a>::<wbr><a href='index.html'>mem</a></p><script>window.sidebarCurrent = {name: 'forget', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content fn">
<h1 class='fqn'><span class='in-band'>Function <a href='../../../index.html'>gleam</a>::<wbr><a href='../../index.html'>gl</a>::<wbr><a href='../index.html'>__gl_imports</a>::<wbr><a href='index.html'>mem</a>::<wbr><a class='fn' href=''>forget</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-6263' class='srclink' href='../../../../core/mem/fn.forget.html?gotosrc=6263' title='goto source code'>[src]</a></span></h1>
<pre class='rust fn'>pub fn forget<T>(t: T)</pre><div class='docblock'><p>Leaks a value into the void, consuming ownership and never running its
destructor.</p>
<p>This function will take ownership of its argument, but is distinct from the
<code>mem::drop</code> function in that it <strong>does not run the destructor</strong>, leaking the
value and any resources that it owns.</p>
<p>There's only a few reasons to use this function. They mainly come
up in unsafe code or FFI code.</p>
<ul>
<li>You have an uninitialized value, perhaps for performance reasons, and
need to prevent the destructor from running on it.</li>
<li>You have two copies of a value (like when writing something like
<a href="fn.swap.html"><code>mem::swap</code></a>), but need the destructor to only run once to
prevent a double <code>free</code>.</li>
<li>Transferring resources across <a href="../../book/ffi.html">FFI</a> boundaries.</li>
</ul>
<h1 id='safety' class='section-header'><a href='#safety'>Safety</a></h1>
<p>This function is not marked as <code>unsafe</code> as Rust does not guarantee that the
<code>Drop</code> implementation for a value will always run. Note, however, that
leaking resources such as memory or I/O objects is likely not desired, so
this function is only recommended for specialized use cases.</p>
<p>The safety of this function implies that when writing <code>unsafe</code> code
yourself care must be taken when leveraging a destructor that is required to
run to preserve memory safety. There are known situations where the
destructor may not run (such as if ownership of the object with the
destructor is returned) which must be taken into account.</p>
<h1 id='other-forms-of-leakage' class='section-header'><a href='#other-forms-of-leakage'>Other forms of Leakage</a></h1>
<p>It's important to point out that this function is not the only method by
which a value can be leaked in safe Rust code. Other known sources of
leakage are:</p>
<ul>
<li><code>Rc</code> and <code>Arc</code> cycles</li>
<li><code>mpsc::{Sender, Receiver}</code> cycles (they use <code>Arc</code> internally)</li>
<li>Panicking destructors are likely to leak local resources</li>
</ul>
<h1 id='example' class='section-header'><a href='#example'>Example</a></h1>
<p>Leak some heap memory by never deallocating it:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>mem</span>;
<span class='kw'>let</span> <span class='ident'>heap_memory</span> <span class='op'>=</span> <span class='ident'>Box</span>::<span class='ident'>new</span>(<span class='number'>3</span>);
<span class='ident'>mem</span>::<span class='ident'>forget</span>(<span class='ident'>heap_memory</span>);</pre>
<p>Leak an I/O object, never closing the file:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>mem</span>;
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>fs</span>::<span class='ident'>File</span>;
<span class='kw'>let</span> <span class='ident'>file</span> <span class='op'>=</span> <span class='ident'>File</span>::<span class='ident'>open</span>(<span class='string'>"foo.txt"</span>).<span class='ident'>unwrap</span>();
<span class='ident'>mem</span>::<span class='ident'>forget</span>(<span class='ident'>file</span>);</pre>
<p>The <code>mem::swap</code> function uses <code>mem::forget</code> to good effect:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>mem</span>;
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>ptr</span>;
<span class='kw'>fn</span> <span class='ident'>swap</span><span class='op'><</span><span class='ident'>T</span><span class='op'>></span>(<span class='ident'>x</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>T</span>, <span class='ident'>y</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>T</span>) {
<span class='kw'>unsafe</span> {
<span class='comment'>// Give ourselves some scratch space to work with</span>
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>t</span>: <span class='ident'>T</span> <span class='op'>=</span> <span class='ident'>mem</span>::<span class='ident'>uninitialized</span>();
<span class='comment'>// Perform the swap, `&mut` pointers never alias</span>
<span class='ident'>ptr</span>::<span class='ident'>copy_nonoverlapping</span>(<span class='kw-2'>&</span><span class='op'>*</span><span class='ident'>x</span>, <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>t</span>, <span class='number'>1</span>);
<span class='ident'>ptr</span>::<span class='ident'>copy_nonoverlapping</span>(<span class='kw-2'>&</span><span class='op'>*</span><span class='ident'>y</span>, <span class='ident'>x</span>, <span class='number'>1</span>);
<span class='ident'>ptr</span>::<span class='ident'>copy_nonoverlapping</span>(<span class='kw-2'>&</span><span class='ident'>t</span>, <span class='ident'>y</span>, <span class='number'>1</span>);
<span class='comment'>// y and t now point to the same thing, but we need to completely</span>
<span class='comment'>// forget `t` because we do not want to run the destructor for `T`</span>
<span class='comment'>// on its value, which is still owned somewhere outside this function.</span>
<span class='ident'>mem</span>::<span class='ident'>forget</span>(<span class='ident'>t</span>);
}
}</pre>
</div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../../../";
window.currentCrate = "gleam";
window.playgroundUrl = "";
</script>
<script src="../../../../jquery.js"></script>
<script src="../../../../main.js"></script>
<script defer src="../../../../search-index.js"></script>
</body>
</html> | servo/doc.servo.org | gleam/gl/__gl_imports/mem/fn.forget.html | HTML | mpl-2.0 | 10,054 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Form
* @subpackage Element
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @namespace
*/
namespace Zend\Form\Element;
use Zend\Session\Container as SessionContainer,
Zend\View\Renderer as View;
/**
* CSRF form protection
*
* @uses \Zend\Form\Element\Xhtml
* @uses \Zend\Session\Container
* @category Zend
* @package Zend_Form
* @subpackage Element
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Hash extends Xhtml
{
/**
* Use formHidden view helper by default
* @var string
*/
public $helper = 'formHidden';
/**
* Actual hash used.
*
* @var mixed
*/
protected $_hash;
/**
* Static cache of the session names to generated hashes
*
* @var array
*/
protected static $_hashCache;
/**
* Salt for CSRF token
* @var string
*/
protected $_salt = 'salt';
/**
* @var \Zend\Session\Container
*/
protected $_session;
/**
* TTL for CSRF token
* @var int
*/
protected $_timeout = 300;
/**
* Constructor
*
* Creates session namespace for CSRF token, and adds validator for CSRF
* token.
*
* @param string|array|\Zend\Config\Config $spec
* @param array|\Zend\Config\Config $options
* @return void
*/
public function __construct($spec, $options = null)
{
parent::__construct($spec, $options);
$this->setAllowEmpty(false)
->setRequired(true)
->initCsrfValidator();
}
/**
* Set session object
*
* @param \Zend\Session\Container $session
* @return \Zend\Form\Element\Hash
*/
public function setSession($session)
{
$this->_session = $session;
return $this;
}
/**
* Get session object
*
* Instantiate session object if none currently exists
*
* @return \Zend\Session\Container
*/
public function getSession()
{
if (null === $this->_session) {
$this->_session = new SessionContainer($this->getSessionName());
}
return $this->_session;
}
/**
* Initialize CSRF validator
*
* Creates Session namespace, and initializes CSRF token in session.
* Additionally, adds validator for validating CSRF token.
*
* @return \Zend\Form\Element\Hash
*/
public function initCsrfValidator()
{
$session = $this->getSession();
if (isset($session->hash)) {
$rightHash = $session->hash;
} else {
$rightHash = null;
}
$this->addValidator('Identical', true, array($rightHash));
return $this;
}
/**
* Salt for CSRF token
*
* @param string $salt
* @return \Zend\Form\Element\Hash
*/
public function setSalt($salt)
{
$this->_salt = (string) $salt;
return $this;
}
/**
* Retrieve salt for CSRF token
*
* @return string
*/
public function getSalt()
{
return $this->_salt;
}
/**
* Retrieve CSRF token
*
* If no CSRF token currently exists, generates one.
*
* @return string
*/
public function getHash()
{
if (null === $this->_hash) {
$this->_generateHash();
}
return $this->_hash;
}
/**
* Get session namespace for CSRF token
*
* Generates a session namespace based on salt, element name, and class.
*
* @return string
*/
public function getSessionName()
{
return str_replace('\\', '_', __CLASS__) . '_' . $this->getSalt() . '_' . $this->getName();
}
/**
* Set timeout for CSRF session token
*
* @param int $ttl
* @return \Zend\Form\Element\Hash
*/
public function setTimeout($ttl)
{
$this->_timeout = (int) $ttl;
return $this;
}
/**
* Get CSRF session token timeout
*
* @return int
*/
public function getTimeout()
{
return $this->_timeout;
}
/**
* Override getLabel() to always be empty
*
* @return null
*/
public function getLabel()
{
return null;
}
/**
* Initialize CSRF token in session
*
* @return void
*/
public function initCsrfToken()
{
$session = $this->getSession();
$session->setExpirationHops(1, null, true);
$session->setExpirationSeconds($this->getTimeout());
$session->hash = $this->getHash();
}
/**
* Render CSRF token in form
*
* @param \Zend\View\Renderer $view
* @return string
*/
public function render(View $view = null)
{
$this->initCsrfToken();
return parent::render($view);
}
/**
* Generate CSRF token
*
* Generates CSRF token and stores both in {@link $_hash} and element
* value.
*
* @return void
*/
protected function _generateHash()
{
if (isset(static::$_hashCache[$this->getSessionName()])) {
$this->_hash = static::$_hashCache[$this->getSessionName()];
} else {
$this->_hash = md5(
mt_rand(1,1000000)
. $this->getSalt()
. $this->getName()
. mt_rand(1,1000000)
);
static::$_hashCache[$this->getSessionName()] = $this->_hash;
}
$this->setValue($this->_hash);
}
}
| buzzengine/buzzengine | vendor/zend-framework/library/Zend/Form/Element/Hash.php | PHP | mit | 6,270 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
16729,
2094,
7705,
1008,
1008,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2047,
18667,
2094,
6105,
2008,
2003,
24378,
1008,
2007,
2023,
7427,
1999,
1996,
5371,
6105,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Similiar functionality of {@link goog.ui.ButtonRenderer},
* but uses a <div> element instead of a <button> or <input> element.
*
*/
goog.provide('goog.ui.FlatButtonRenderer');
goog.require('goog.a11y.aria');
goog.require('goog.a11y.aria.Role');
goog.require('goog.dom.classes');
goog.require('goog.ui.Button');
goog.require('goog.ui.ButtonRenderer');
goog.require('goog.ui.INLINE_BLOCK_CLASSNAME');
goog.require('goog.ui.registry');
/**
* Flat renderer for {@link goog.ui.Button}s. Flat buttons can contain
* almost arbitrary HTML content, will flow like inline elements, but can be
* styled like block-level elements.
* @constructor
* @extends {goog.ui.ButtonRenderer}
*/
goog.ui.FlatButtonRenderer = function() {
goog.ui.ButtonRenderer.call(this);
};
goog.inherits(goog.ui.FlatButtonRenderer, goog.ui.ButtonRenderer);
goog.addSingletonGetter(goog.ui.FlatButtonRenderer);
/**
* Default CSS class to be applied to the root element of components rendered
* by this renderer.
* @type {string}
*/
goog.ui.FlatButtonRenderer.CSS_CLASS = goog.getCssName('goog-flat-button');
/**
* Returns the control's contents wrapped in a div element, with
* the renderer's own CSS class and additional state-specific classes applied
* to it, and the button's disabled attribute set or cleared as needed.
* Overrides {@link goog.ui.ButtonRenderer#createDom}.
* @param {goog.ui.Control} button Button to render.
* @return {Element} Root element for the button.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.createDom = function(button) {
var classNames = this.getClassNames(button);
var attributes = {
'class': goog.ui.INLINE_BLOCK_CLASSNAME + ' ' + classNames.join(' '),
'title': button.getTooltip() || ''
};
return button.getDomHelper().createDom(
'div', attributes, button.getContent());
};
/**
* Returns the ARIA role to be applied to flat buttons.
* @return {goog.a11y.aria.Role|undefined} ARIA role.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getAriaRole = function() {
return goog.a11y.aria.Role.BUTTON;
};
/**
* Returns true if this renderer can decorate the element. Overrides
* {@link goog.ui.ButtonRenderer#canDecorate} by returning true if the
* element is a DIV, false otherwise.
* @param {Element} element Element to decorate.
* @return {boolean} Whether the renderer can decorate the element.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.canDecorate = function(element) {
return element.tagName == 'DIV';
};
/**
* Takes an existing element and decorates it with the flat button control.
* Initializes the control's ID, content, tooltip, value, and state based
* on the ID of the element, its child nodes, and its CSS classes, respectively.
* Returns the element. Overrides {@link goog.ui.ButtonRenderer#decorate}.
* @param {goog.ui.Control} button Button instance to decorate the element.
* @param {Element} element Element to decorate.
* @return {Element} Decorated element.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.decorate = function(button, element) {
goog.dom.classes.add(element, goog.ui.INLINE_BLOCK_CLASSNAME);
return goog.ui.FlatButtonRenderer.superClass_.decorate.call(this, button,
element);
};
/**
* Flat buttons can't use the value attribute since they are div elements.
* Overrides {@link goog.ui.ButtonRenderer#getValue} to prevent trying to
* access the element's value.
* @param {Element} element The button control's root element.
* @return {string} Value not valid for flat buttons.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getValue = function(element) {
// Flat buttons don't store their value in the DOM.
return '';
};
/**
* Returns the CSS class to be applied to the root element of components
* rendered using this renderer.
* @return {string} Renderer-specific CSS class.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getCssClass = function() {
return goog.ui.FlatButtonRenderer.CSS_CLASS;
};
// Register a decorator factory function for Flat Buttons.
goog.ui.registry.setDecoratorByClassName(goog.ui.FlatButtonRenderer.CSS_CLASS,
function() {
// Uses goog.ui.Button, but with FlatButtonRenderer.
return new goog.ui.Button(null, goog.ui.FlatButtonRenderer.getInstance());
});
| elsigh/browserscope | third_party/closure/goog/ui/flatbuttonrenderer.js | JavaScript | apache-2.0 | 4,935 | [
30522,
1013,
1013,
9385,
2263,
1996,
8503,
3075,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.ddd.toolbox.dao;
/**
* Callback interface for building queries.
*
* <br>
* Patterns: Callback
*
* <br>
* Revisions: jnorris: Oct 2, 2007: Initial revision.
*
* @param <T_QUERY>
* The type of the query being constructed.
*
* @author jnorris
*/
public interface QueryFactoryCallback<T_QUERY> {
/**
* Build the query.
*
* @return The resulting query.
*/
public T_QUERY build();
}
| jeremynorris/ddd-toolbox | dao/src/main/java/org/ddd/toolbox/dao/QueryFactoryCallback.java | Java | lgpl-2.1 | 468 | [
30522,
7427,
8917,
1012,
20315,
2094,
1012,
6994,
8758,
1012,
4830,
2080,
1025,
1013,
1008,
1008,
1008,
2655,
5963,
8278,
2005,
2311,
10861,
5134,
1012,
1008,
1008,
1026,
7987,
1028,
1008,
7060,
1024,
2655,
5963,
1008,
1008,
1026,
7987,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2014 Torus Knot Software Ltd
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.
-----------------------------------------------------------------------------
*/
#include "OgreShaderExHardwareSkinning.h"
#ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS
#include "OgreShaderExDualQuaternionSkinning.h"
#include "OgreShaderExLinearSkinning.h"
#include "OgreShaderFFPRenderState.h"
#include "OgreShaderProgram.h"
#include "OgreShaderParameter.h"
#include "OgreShaderProgramSet.h"
#include "OgreEntity.h"
#include "OgreSubEntity.h"
#include "OgreMaterial.h"
#include "OgreSubMesh.h"
#include "OgreShaderGenerator.h"
#define HS_DATA_BIND_NAME "HS_SRS_DATA"
namespace Ogre {
template<> RTShader::HardwareSkinningFactory* Singleton<RTShader::HardwareSkinningFactory>::msSingleton = 0;
namespace RTShader {
HardwareSkinningFactory* HardwareSkinningFactory::getSingletonPtr(void)
{
return msSingleton;
}
HardwareSkinningFactory& HardwareSkinningFactory::getSingleton(void)
{
assert( msSingleton ); return ( *msSingleton );
}
String HardwareSkinning::Type = "SGX_HardwareSkinning";
/************************************************************************/
/* */
/************************************************************************/
HardwareSkinning::HardwareSkinning() :
mCreator(NULL),
mSkinningType(ST_LINEAR)
{
}
//-----------------------------------------------------------------------
const String& HardwareSkinning::getType() const
{
return Type;
}
//-----------------------------------------------------------------------
int HardwareSkinning::getExecutionOrder() const
{
return FFP_TRANSFORM;
}
//-----------------------------------------------------------------------
void HardwareSkinning::setHardwareSkinningParam(ushort boneCount, ushort weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport)
{
mSkinningType = skinningType;
if(skinningType == ST_DUAL_QUATERNION)
{
if(mDualQuat.isNull())
{
mDualQuat.bind(OGRE_NEW DualQuaternionSkinning);
}
mActiveTechnique = mDualQuat;
}
else //if(skinningType == ST_LINEAR)
{
if(mLinear.isNull())
{
mLinear.bind(OGRE_NEW LinearSkinning);
}
mActiveTechnique = mLinear;
}
mActiveTechnique->setHardwareSkinningParam(boneCount, weightCount, correctAntipodalityHandling, scalingShearingSupport);
}
//-----------------------------------------------------------------------
ushort HardwareSkinning::getBoneCount()
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->getBoneCount();
}
//-----------------------------------------------------------------------
ushort HardwareSkinning::getWeightCount()
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->getWeightCount();
}
//-----------------------------------------------------------------------
SkinningType HardwareSkinning::getSkinningType()
{
assert(!mActiveTechnique.isNull());
return mSkinningType;
}
//-----------------------------------------------------------------------
bool HardwareSkinning::hasCorrectAntipodalityHandling()
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->hasCorrectAntipodalityHandling();
}
//-----------------------------------------------------------------------
bool HardwareSkinning::hasScalingShearingSupport()
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->hasScalingShearingSupport();
}
//-----------------------------------------------------------------------
void HardwareSkinning::copyFrom(const SubRenderState& rhs)
{
const HardwareSkinning& hardSkin = static_cast<const HardwareSkinning&>(rhs);
mDualQuat = hardSkin.mDualQuat;
mLinear = hardSkin.mLinear;
mActiveTechnique = hardSkin.mActiveTechnique;
mCreator = hardSkin.mCreator;
mSkinningType = hardSkin.mSkinningType;
}
//-----------------------------------------------------------------------
void operator<<(std::ostream& o, const HardwareSkinning::SkinningData& data)
{
o << data.isValid;
o << data.maxBoneCount;
o << data.maxWeightCount;
o << data.skinningType;
o << data.correctAntipodalityHandling;
o << data.scalingShearingSupport;
}
//-----------------------------------------------------------------------
bool HardwareSkinning::preAddToRenderState(const RenderState* renderState, Pass* srcPass, Pass* dstPass)
{
bool isValid = true;
Technique* pFirstTech = srcPass->getParent()->getParent()->getTechnique(0);
const Any& hsAny = pFirstTech->getUserObjectBindings().getUserAny(HS_DATA_BIND_NAME);
if (hsAny.isEmpty() == false)
{
HardwareSkinning::SkinningData pData =
(any_cast<HardwareSkinning::SkinningData>(hsAny));
isValid = pData.isValid;
//If the skinning data is being passed through the material, we need to create an instance of the appropriate
//skinning type and set its parameters here
setHardwareSkinningParam(pData.maxBoneCount, pData.maxWeightCount, pData.skinningType,
pData.correctAntipodalityHandling, pData.scalingShearingSupport);
}
//If there is no associated technique, default to linear skinning as a pass-through
if(mActiveTechnique.isNull())
{
setHardwareSkinningParam(0, 0, ST_LINEAR, false, false);
}
int boneCount = mActiveTechnique->getBoneCount();
int weightCount = mActiveTechnique->getWeightCount();
bool doBoneCalculations = isValid &&
(boneCount != 0) && (boneCount <= 256) &&
(weightCount != 0) && (weightCount <= 4) &&
((mCreator == NULL) || (boneCount <= mCreator->getMaxCalculableBoneCount()));
mActiveTechnique->setDoBoneCalculations(doBoneCalculations);
if ((doBoneCalculations) && (mCreator))
{
//update the receiver and caster materials
if (dstPass->getParent()->getShadowCasterMaterial().isNull())
{
dstPass->getParent()->setShadowCasterMaterial(
mCreator->getCustomShadowCasterMaterial(mSkinningType, weightCount - 1));
}
if (dstPass->getParent()->getShadowReceiverMaterial().isNull())
{
dstPass->getParent()->setShadowReceiverMaterial(
mCreator->getCustomShadowReceiverMaterial(mSkinningType, weightCount - 1));
}
}
return true;
}
//-----------------------------------------------------------------------
bool HardwareSkinning::resolveParameters(ProgramSet* programSet)
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->resolveParameters(programSet);
}
//-----------------------------------------------------------------------
bool HardwareSkinning::resolveDependencies(ProgramSet* programSet)
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->resolveDependencies(programSet);
}
//-----------------------------------------------------------------------
bool HardwareSkinning::addFunctionInvocations(ProgramSet* programSet)
{
assert(!mActiveTechnique.isNull());
return mActiveTechnique->addFunctionInvocations(programSet);
}
//-----------------------------------------------------------------------
HardwareSkinningFactory::HardwareSkinningFactory() :
mMaxCalculableBoneCount(70)
{
}
//-----------------------------------------------------------------------
const String& HardwareSkinningFactory::getType() const
{
return HardwareSkinning::Type;
}
//-----------------------------------------------------------------------
SubRenderState* HardwareSkinningFactory::createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator)
{
if (prop->name == "hardware_skinning")
{
bool hasError = false;
uint32 boneCount = 0;
uint32 weightCount = 0;
String skinningType = "";
SkinningType skinType = ST_LINEAR;
bool correctAntipodalityHandling = false;
bool scalingShearingSupport = false;
if(prop->values.size() >= 2)
{
AbstractNodeList::iterator it = prop->values.begin();
if(false == SGScriptTranslator::getUInt(*it, &boneCount))
hasError = true;
++it;
if(false == SGScriptTranslator::getUInt(*it, &weightCount))
hasError = true;
if(prop->values.size() >= 5)
{
++it;
SGScriptTranslator::getString(*it, &skinningType);
++it;
SGScriptTranslator::getBoolean(*it, &correctAntipodalityHandling);
++it;
SGScriptTranslator::getBoolean(*it, &scalingShearingSupport);
}
//If the skinningType is not specified or is specified incorrectly, default to linear skinning.
if(skinningType == "dual_quaternion")
{
skinType = ST_DUAL_QUATERNION;
}
else
{
skinType = ST_LINEAR;
}
}
if (hasError == true)
{
compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, "Expected the format: hardware_skinning <bone count> <weight count> [skinning type] [correct antipodality handling] [scaling/shearing support]");
return NULL;
}
else
{
//create and update the hardware skinning sub render state
SubRenderState* subRenderState = createOrRetrieveInstance(translator);
HardwareSkinning* hardSkinSrs = static_cast<HardwareSkinning*>(subRenderState);
hardSkinSrs->setHardwareSkinningParam(boneCount, weightCount, skinType, correctAntipodalityHandling, scalingShearingSupport);
return subRenderState;
}
}
return NULL;
}
//-----------------------------------------------------------------------
void HardwareSkinningFactory::writeInstance(MaterialSerializer* ser, SubRenderState* subRenderState,
Pass* srcPass, Pass* dstPass)
{
ser->writeAttribute(4, "hardware_skinning");
HardwareSkinning* hardSkinSrs = static_cast<HardwareSkinning*>(subRenderState);
ser->writeValue(StringConverter::toString(hardSkinSrs->getBoneCount()));
ser->writeValue(StringConverter::toString(hardSkinSrs->getWeightCount()));
//Correct antipodality handling and scaling and shearing support are only really valid for dual quaternion skinning
if(hardSkinSrs->getSkinningType() == ST_DUAL_QUATERNION)
{
ser->writeValue("dual_quaternion");
ser->writeValue(StringConverter::toString(hardSkinSrs->hasCorrectAntipodalityHandling()));
ser->writeValue(StringConverter::toString(hardSkinSrs->hasScalingShearingSupport()));
}
}
//-----------------------------------------------------------------------
SubRenderState* HardwareSkinningFactory::createInstanceImpl()
{
HardwareSkinning* pSkin = OGRE_NEW HardwareSkinning;
pSkin->_setCreator(this);
return pSkin;
}
//-----------------------------------------------------------------------
void HardwareSkinningFactory::setCustomShadowCasterMaterials(const SkinningType skinningType, const MaterialPtr& caster1Weight, const MaterialPtr& caster2Weight,
const MaterialPtr& caster3Weight, const MaterialPtr& caster4Weight)
{
if(skinningType == ST_DUAL_QUATERNION)
{
mCustomShadowCasterMaterialsDualQuaternion[0] = caster1Weight;
mCustomShadowCasterMaterialsDualQuaternion[1] = caster2Weight;
mCustomShadowCasterMaterialsDualQuaternion[2] = caster3Weight;
mCustomShadowCasterMaterialsDualQuaternion[3] = caster4Weight;
}
else //if(skinningType == ST_LINEAR)
{
mCustomShadowCasterMaterialsLinear[0] = caster1Weight;
mCustomShadowCasterMaterialsLinear[1] = caster2Weight;
mCustomShadowCasterMaterialsLinear[2] = caster3Weight;
mCustomShadowCasterMaterialsLinear[3] = caster4Weight;
}
}
//-----------------------------------------------------------------------
void HardwareSkinningFactory::setCustomShadowReceiverMaterials(const SkinningType skinningType, const MaterialPtr& receiver1Weight, const MaterialPtr& receiver2Weight,
const MaterialPtr& receiver3Weight, const MaterialPtr& receiver4Weight)
{
if(skinningType == ST_DUAL_QUATERNION)
{
mCustomShadowReceiverMaterialsDualQuaternion[0] = receiver1Weight;
mCustomShadowReceiverMaterialsDualQuaternion[1] = receiver2Weight;
mCustomShadowReceiverMaterialsDualQuaternion[2] = receiver3Weight;
mCustomShadowReceiverMaterialsDualQuaternion[3] = receiver4Weight;
}
else //if(skinningType == ST_LINEAR)
{
mCustomShadowReceiverMaterialsLinear[0] = receiver1Weight;
mCustomShadowReceiverMaterialsLinear[1] = receiver2Weight;
mCustomShadowReceiverMaterialsLinear[2] = receiver3Weight;
mCustomShadowReceiverMaterialsLinear[3] = receiver4Weight;
}
}
//-----------------------------------------------------------------------
const MaterialPtr& HardwareSkinningFactory::getCustomShadowCasterMaterial(const SkinningType skinningType, ushort index) const
{
assert(index < HS_MAX_WEIGHT_COUNT);
if(skinningType == ST_DUAL_QUATERNION)
{
return mCustomShadowCasterMaterialsDualQuaternion[index];
}
else //if(skinningType = ST_LINEAR)
{
return mCustomShadowCasterMaterialsLinear[index];
}
}
//-----------------------------------------------------------------------
const MaterialPtr& HardwareSkinningFactory::getCustomShadowReceiverMaterial(const SkinningType skinningType, ushort index) const
{
assert(index < HS_MAX_WEIGHT_COUNT);
if(skinningType == ST_DUAL_QUATERNION)
{
return mCustomShadowReceiverMaterialsDualQuaternion[index];
}
else //if(skinningType == ST_LINEAR)
{
return mCustomShadowReceiverMaterialsLinear[index];
}
}
//-----------------------------------------------------------------------
void HardwareSkinningFactory::prepareEntityForSkinning(const Entity* pEntity, SkinningType skinningType,
bool correctAntidpodalityHandling, bool shearScale)
{
if (pEntity != NULL)
{
size_t lodLevels = pEntity->getNumManualLodLevels() + 1;
for(size_t indexLod = 0 ; indexLod < lodLevels ; ++indexLod)
{
const Entity* pCurEntity = pEntity;
if (indexLod > 0) pCurEntity = pEntity->getManualLodLevel(indexLod - 1);
unsigned int numSubEntities = pCurEntity->getNumSubEntities();
for(unsigned int indexSub = 0 ; indexSub < numSubEntities ; ++indexSub)
{
ushort boneCount = 0,weightCount = 0;
bool isValid = extractSkeletonData(pCurEntity, indexSub, boneCount, weightCount);
SubEntity* pSubEntity = pCurEntity->getSubEntity(indexSub);
const MaterialPtr& pMat = pSubEntity->getMaterial();
imprintSkeletonData(pMat, isValid, boneCount, weightCount, skinningType, correctAntidpodalityHandling, shearScale);
}
}
}
}
//-----------------------------------------------------------------------
bool HardwareSkinningFactory::extractSkeletonData(const Entity* pEntity, unsigned int subEntityIndex, ushort& boneCount, ushort& weightCount)
{
bool isValidData = false;
boneCount = 0;
weightCount = 0;
//Check if we have pose animation which the HS sub render state does not
//know how to handle
bool hasVertexAnim = pEntity->getMesh()->hasVertexAnimation();
//gather data on the skeleton
if (!hasVertexAnim && pEntity->hasSkeleton())
{
//get weights count
MeshPtr pMesh = pEntity->getMesh();
RenderOperation ro;
SubMesh* pSubMesh = pMesh->getSubMesh(subEntityIndex);
pSubMesh->_getRenderOperation(ro,0);
//get the largest bone assignment
boneCount = std::max<ushort>(pMesh->sharedBlendIndexToBoneIndexMap.size(), pSubMesh->blendIndexToBoneIndexMap.size());
//go over vertex deceleration
//check that they have blend indices and blend weights
const VertexElement* pDeclWeights = ro.vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_WEIGHTS,0);
const VertexElement* pDeclIndexes = ro.vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_INDICES,0);
if ((pDeclWeights != NULL) && (pDeclIndexes != NULL))
{
isValidData = true;
switch (pDeclWeights->getType())
{
case VET_FLOAT1: weightCount = 1; break;
case VET_FLOAT2: weightCount = 2; break;
case VET_FLOAT3: weightCount = 3; break;
case VET_FLOAT4: weightCount = 4; break;
default: isValidData = false;
}
}
}
return isValidData;
}
//-----------------------------------------------------------------------
bool HardwareSkinningFactory::imprintSkeletonData(const MaterialPtr& pMaterial, bool isVaild,
ushort boneCount, ushort weightCount, SkinningType skinningType, bool correctAntidpodalityHandling, bool scalingShearingSupport)
{
bool isUpdated = false;
if (pMaterial->getNumTechniques() > 0)
{
HardwareSkinning::SkinningData data;
//get the previous skinning data if available
UserObjectBindings& binding = pMaterial->getTechnique(0)->getUserObjectBindings();
const Any& hsAny = binding.getUserAny(HS_DATA_BIND_NAME);
if (hsAny.isEmpty() == false)
{
data = (any_cast<HardwareSkinning::SkinningData>(hsAny));
}
//check if we need to update the data
if (((data.isValid == true) && (isVaild == false)) ||
(data.maxBoneCount < boneCount) ||
(data.maxWeightCount < weightCount))
{
//update the data
isUpdated = true;
data.isValid &= isVaild;
data.maxBoneCount = std::max<ushort>(data.maxBoneCount, boneCount);
data.maxWeightCount = std::max<ushort>(data.maxWeightCount, weightCount);
data.skinningType = skinningType;
data.correctAntipodalityHandling = correctAntidpodalityHandling;
data.scalingShearingSupport = scalingShearingSupport;
//update the data in the material and invalidate it in the RTShader system
//do it will be regenerated
binding.setUserAny(HS_DATA_BIND_NAME, Any(data));
size_t schemeCount = ShaderGenerator::getSingleton().getRTShaderSchemeCount();
for(size_t i = 0 ; i < schemeCount ; ++i)
{
//invalidate the material so it will be recreated with the correct
//amount of bones and weights
const String& schemeName = ShaderGenerator::getSingleton().getRTShaderScheme(i);
ShaderGenerator::getSingleton().invalidateMaterial(
schemeName, pMaterial->getName(), pMaterial->getGroup());
}
}
}
return isUpdated;
}
}
}
#endif
| xsilium-frameworks/xsilium-engine | Library/Ogre/Components/RTShaderSystem/src/OgreShaderExHardwareSkinning.cpp | C++ | mit | 18,731 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// /*
// Copyright The Kubernetes Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// */
//
// Code generated by MockGen. DO NOT EDIT.
// Source: /go/src/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/diskclient/interface.go
// Package mockdiskclient is a generated GoMock package.
package mockdiskclient
import (
context "context"
reflect "reflect"
compute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
gomock "github.com/golang/mock/gomock"
retry "sigs.k8s.io/cloud-provider-azure/pkg/retry"
)
// MockInterface is a mock of Interface interface.
type MockInterface struct {
ctrl *gomock.Controller
recorder *MockInterfaceMockRecorder
}
// MockInterfaceMockRecorder is the mock recorder for MockInterface.
type MockInterfaceMockRecorder struct {
mock *MockInterface
}
// NewMockInterface creates a new mock instance.
func NewMockInterface(ctrl *gomock.Controller) *MockInterface {
mock := &MockInterface{ctrl: ctrl}
mock.recorder = &MockInterfaceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder {
return m.recorder
}
// Get mocks base method.
func (m *MockInterface) Get(ctx context.Context, resourceGroupName, diskName string) (compute.Disk, *retry.Error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, diskName)
ret0, _ := ret[0].(compute.Disk)
ret1, _ := ret[1].(*retry.Error)
return ret0, ret1
}
// Get indicates an expected call of Get.
func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, diskName interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, diskName)
}
// CreateOrUpdate mocks base method.
func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, diskName string, diskParameter compute.Disk) *retry.Error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, diskName, diskParameter)
ret0, _ := ret[0].(*retry.Error)
return ret0
}
// CreateOrUpdate indicates an expected call of CreateOrUpdate.
func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, diskName, diskParameter interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, diskName, diskParameter)
}
// Update mocks base method.
func (m *MockInterface) Update(ctx context.Context, resourceGroupName, diskName string, diskParameter compute.DiskUpdate) *retry.Error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Update", ctx, resourceGroupName, diskName, diskParameter)
ret0, _ := ret[0].(*retry.Error)
return ret0
}
// Update indicates an expected call of Update.
func (mr *MockInterfaceMockRecorder) Update(ctx, resourceGroupName, diskName, diskParameter interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockInterface)(nil).Update), ctx, resourceGroupName, diskName, diskParameter)
}
// Delete mocks base method.
func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, diskName string) *retry.Error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, diskName)
ret0, _ := ret[0].(*retry.Error)
return ret0
}
// Delete indicates an expected call of Delete.
func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, diskName interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, diskName)
}
// ListByResourceGroup mocks base method.
func (m *MockInterface) ListByResourceGroup(ctx context.Context, resourceGroupName string) ([]compute.Disk, *retry.Error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListByResourceGroup", ctx, resourceGroupName)
ret0, _ := ret[0].([]compute.Disk)
ret1, _ := ret[1].(*retry.Error)
return ret0, ret1
}
// ListByResourceGroup indicates an expected call of ListByResourceGroup.
func (mr *MockInterfaceMockRecorder) ListByResourceGroup(ctx, resourceGroupName interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByResourceGroup", reflect.TypeOf((*MockInterface)(nil).ListByResourceGroup), ctx, resourceGroupName)
}
| kubernetes/autoscaler | cluster-autoscaler/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/diskclient/mockdiskclient/interface.go | GO | apache-2.0 | 5,056 | [
30522,
1013,
1013,
1013,
1008,
1013,
1013,
9385,
1996,
13970,
5677,
7159,
2229,
6048,
1012,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
/**
* Class representing an event.
*
* @private
*/
class Event {
/**
* Create a new `Event`.
*
* @param {String} type The name of the event
* @param {Object} target A reference to the target to which the event was dispatched
*/
constructor(type, target) {
this.target = target;
this.type = type;
}
}
/**
* Class representing a message event.
*
* @extends Event
* @private
*/
class MessageEvent extends Event {
/**
* Create a new `MessageEvent`.
*
* @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data
* @param {WebSocket} target A reference to the target to which the event was dispatched
*/
constructor(data, target) {
super('message', target);
this.data = data;
}
}
/**
* Class representing a close event.
*
* @extends Event
* @private
*/
class CloseEvent extends Event {
/**
* Create a new `CloseEvent`.
*
* @param {Number} code The status code explaining why the connection is being closed
* @param {String} reason A human-readable string explaining why the connection is closing
* @param {WebSocket} target A reference to the target to which the event was dispatched
*/
constructor(code, reason, target) {
super('close', target);
this.wasClean = target._closeFrameReceived && target._closeFrameSent;
this.reason = reason;
this.code = code;
}
}
/**
* Class representing an open event.
*
* @extends Event
* @private
*/
class OpenEvent extends Event {
/**
* Create a new `OpenEvent`.
*
* @param {WebSocket} target A reference to the target to which the event was dispatched
*/
constructor(target) {
super('open', target);
}
}
/**
* Class representing an error event.
*
* @extends Event
* @private
*/
class ErrorEvent extends Event {
/**
* Create a new `ErrorEvent`.
*
* @param {Object} error The error that generated this event
* @param {WebSocket} target A reference to the target to which the event was dispatched
*/
constructor(error, target) {
super('error', target);
this.message = error.message;
this.error = error;
}
}
/**
* This provides methods for emulating the `EventTarget` interface. It's not
* meant to be used directly.
*
* @mixin
*/
const EventTarget = {
/**
* Register an event listener.
*
* @param {String} method A string representing the event type to listen for
* @param {Function} listener The listener to add
* @public
*/
addEventListener(method, listener) {
if (typeof listener !== 'function') return;
function onMessage(data) {
listener.call(this, new MessageEvent(data, this));
}
function onClose(code, message) {
listener.call(this, new CloseEvent(code, message, this));
}
function onError(error) {
listener.call(this, new ErrorEvent(error, this));
}
function onOpen() {
listener.call(this, new OpenEvent(this));
}
if (method === 'message') {
onMessage._listener = listener;
this.on(method, onMessage);
} else if (method === 'close') {
onClose._listener = listener;
this.on(method, onClose);
} else if (method === 'error') {
onError._listener = listener;
this.on(method, onError);
} else if (method === 'open') {
onOpen._listener = listener;
this.on(method, onOpen);
} else {
this.on(method, listener);
}
},
/**
* Remove an event listener.
*
* @param {String} method A string representing the event type to remove
* @param {Function} listener The listener to remove
* @public
*/
removeEventListener(method, listener) {
const listeners = this.listeners(method);
for (var i = 0; i < listeners.length; i++) {
if (listeners[i] === listener || listeners[i]._listener === listener) {
this.removeListener(method, listeners[i]);
}
}
}
};
module.exports = EventTarget;
| BigBoss424/portfolio | v8/development/node_modules/webpack-dev-server/node_modules/ws/lib/event-target.js | JavaScript | apache-2.0 | 3,937 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
1008,
1008,
2465,
5052,
2019,
2724,
1012,
1008,
1008,
1030,
2797,
1008,
1013,
2465,
2724,
1063,
1013,
1008,
1008,
1008,
3443,
1037,
2047,
1036,
2724,
1036,
1012,
1008,
1008,
1030,
11498,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
use Symfony\Component\HttpFoundation\Request;
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'172.33.33.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
require_once __DIR__.'/../app/autoload.php';
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$request = Request::createFromGlobals();
Request::enableHttpMethodParameterOverride();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
| holyspecter/lionframe-test | web/app_dev.php | PHP | mit | 619 | [
30522,
1026,
1029,
25718,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
8299,
14876,
18426,
3508,
1032,
5227,
1025,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1030,
1002,
1035,
8241,
1031,
1005,
6556,
1035,
5587,
2099,
1005,
1033,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import promise from 'redux-promise';
import createLogger from 'redux-logger';
import allReducers from './reducers';
import App from './components/App';
const logger = createLogger();
const store = createStore(allReducers, applyMiddleware(thunk, promise, logger));
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('app')
);
| designcreative/react-redux-template | src/js/index.js | JavaScript | gpl-3.0 | 586 | [
30522,
12324,
1005,
11561,
2140,
1011,
26572,
8873,
3363,
1005,
1025,
12324,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
10509,
9527,
2013,
1005,
10509,
1011,
14383,
1005,
1025,
12324,
1063,
10802,
1065,
2013,
1005,
10509,
1011,
2417,
5602,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// AAColorView.h
// ArtStuff
//
// Created by Kyle Oba on 10/4/13.
// Copyright (c) 2013 Kyle Oba. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AAColorView : UIView
@end
| AgencyAgency/ArtStuff | ArtStuff/AAColorView.h | C | mit | 194 | [
30522,
1013,
1013,
1013,
1013,
9779,
18717,
8584,
1012,
1044,
1013,
1013,
2840,
8525,
4246,
1013,
1013,
1013,
1013,
2580,
2011,
7648,
27885,
2050,
2006,
2184,
1013,
1018,
1013,
2410,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
2286,
7648,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.0'
}
DOCUMENTATION = '''
module: iworkflow_license_pool
short_description: Manage license pools in iWorkflow.
description:
- Manage license pools in iWorkflow.
version_added: 2.4
options:
name:
description:
- Name of the license pool to create.
required: True
state:
description:
- Whether the license pool should exist, or not. A state of C(present)
will attempt to activate the license pool if C(accept_eula) is set
to C(yes).
required: False
default: present
choices:
- present
- absent
base_key:
description:
- Key that the license server uses to verify the functionality that
you are entitled to license. This option is required if you are
creating a new license.
required: False
default: None
accept_eula:
description:
- Specifies that you accept the EULA that is part of iWorkflow. Note
that this is required to activate the license pool. If this is not
specified, or it is set to C(no), then the pool will remain in a state
of limbo until you choose to accept the EULA. This option is required
when updating a license. It is also suggested that you provide it when
creating a license, but if you do not, the license will remain
inactive and you will have to run this module again with this option
set to C(yes) to activate it.
required: False
default: 'no'
choices:
- yes
- no
notes:
- Requires the f5-sdk Python package on the host. This is as easy as pip
install f5-sdk.
extends_documentation_fragment: f5
requirements:
- f5-sdk >= 2.3.0
- iWorkflow >= 2.1.0
author:
- Tim Rupp (@caphrim007)
'''
EXAMPLES = '''
- name: Create license pool
iworkflow_license_pool:
accept_eula: "yes"
name: "my-lic-pool"
base_key: "XXXXX-XXXXX-XXXXX-XXXXX-XXXXXXX"
state: "present"
server: "iwf.mydomain.com"
password: "secret"
user: "admin"
validate_certs: "no"
delegate_to: localhost
'''
RETURN = '''
'''
import time
from ansible.module_utils.basic import BOOLEANS
from ansible.module_utils.f5_utils import (
AnsibleF5Client,
AnsibleF5Parameters,
F5ModuleError,
HAS_F5SDK,
iControlUnexpectedHTTPError
)
class Parameters(AnsibleF5Parameters):
api_map = {
'baseRegKey': 'base_key'
}
returnables = []
api_attributes = [
'baseRegKey', 'state'
]
updatables = []
def to_return(self):
result = {}
for returnable in self.returnables:
result[returnable] = getattr(self, returnable)
result = self._filter_params(result)
return result
def api_params(self):
result = {}
for api_attribute in self.api_attributes:
if self.api_map is not None and api_attribute in self.api_map:
result[api_attribute] = getattr(self, self.api_map[api_attribute])
else:
result[api_attribute] = getattr(self, api_attribute)
result = self._filter_params(result)
return result
@property
def name(self):
if self._values['name'] is None:
return None
name = str(self._values['name']).strip()
if name == '':
raise F5ModuleError(
"You must specify a name for this module"
)
return name
class ModuleManager(object):
def __init__(self, client):
self.client = client
self.have = None
self.want = Parameters(self.client.module.params)
self.changes = Parameters()
def _set_changed_options(self):
changed = {}
for key in Parameters.returnables:
if getattr(self.want, key) is not None:
changed[key] = getattr(self.want, key)
if changed:
self.changes = Parameters(changed)
def _update_changed_options(self):
changed = {}
for key in Parameters.updatables:
if getattr(self.want, key) is not None:
attr1 = getattr(self.want, key)
attr2 = getattr(self.have, key)
if attr1 != attr2:
changed[key] = attr1
if changed:
self.changes = Parameters(changed)
return True
return False
def _pool_is_licensed(self):
if self.have.state == 'LICENSED':
return True
return False
def _pool_is_unlicensed_eula_unaccepted(self, current):
if current.state != 'LICENSED' and not self.want.accept_eula:
return True
return False
def exec_module(self):
changed = False
result = dict()
state = self.want.state
try:
if state == "present":
changed = self.present()
elif state == "absent":
changed = self.absent()
except iControlUnexpectedHTTPError as e:
raise F5ModuleError(str(e))
result.update(**self.changes.to_return())
result.update(dict(changed=changed))
return result
def exists(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
if len(collection) == 1:
return True
elif len(collection) == 0:
return False
else:
raise F5ModuleError(
"Multiple license pools with the provided name were found!"
)
def present(self):
if self.exists():
return self.update()
else:
return self.create()
def should_update(self):
if self._pool_is_licensed():
return False
if self._pool_is_unlicensed_eula_unaccepted():
return False
return True
def update(self):
self.have = self.read_current_from_device()
if not self.should_update():
return False
if self.module.check_mode:
return True
self.update_on_device()
return True
def update_on_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
resource.modify(
state='RELICENSE',
method='AUTOMATIC'
)
return self._wait_for_license_pool_state_to_activate(resource)
def create(self):
self._set_changed_options()
if self.client.check_mode:
return True
if self.want.base_key is None:
raise F5ModuleError(
"You must specify a 'base_key' when creating a license pool"
)
self.create_on_device()
return True
def read_current_from_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
result = resource.attrs
return Parameters(result)
def create_on_device(self):
resource = self.client.api.cm.shared.licensing.pools_s.pool.create(
name=self.want.name,
baseRegKey=self.want.base_key,
method="AUTOMATIC"
)
return self._wait_for_license_pool_state_to_activate(resource)
def _wait_for_license_pool_state_to_activate(self, pool):
error_values = ['EXPIRED', 'FAILED']
# Wait no more than 5 minutes
for x in range(1, 30):
pool.refresh()
if pool.state == 'LICENSED':
return True
elif pool.state == 'WAITING_FOR_EULA_ACCEPTANCE':
pool.modify(
eulaText=pool.eulaText,
state='ACCEPTED_EULA'
)
elif pool.state in error_values:
raise F5ModuleError(pool.errorText)
time.sleep(10)
def absent(self):
if self.exists():
return self.remove()
return False
def remove(self):
if self.client.check_mode:
return True
self.remove_from_device()
if self.exists():
raise F5ModuleError("Failed to delete the license pool")
return True
def remove_from_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
if resource:
resource.delete()
class ArgumentSpec(object):
def __init__(self):
self.supports_check_mode = True
self.argument_spec = dict(
accept_eula=dict(
type='bool',
default='no',
choices=BOOLEANS
),
base_key=dict(
required=False,
no_log=True
),
name=dict(
required=True
),
state=dict(
required=False,
default='present',
choices=['absent', 'present']
)
)
self.f5_product_name = 'iworkflow'
def main():
if not HAS_F5SDK:
raise F5ModuleError("The python f5-sdk module is required")
spec = ArgumentSpec()
client = AnsibleF5Client(
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
f5_product_name=spec.f5_product_name
)
try:
mm = ModuleManager(client)
results = mm.exec_module()
client.module.exit_json(**results)
except F5ModuleError as e:
client.module.fail_json(msg=str(e))
if __name__ == '__main__':
main()
| mcgonagle/ansible_f5 | library_old/iworkflow_license_pool.py | Python | apache-2.0 | 10,879 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
18750,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
9385,
2418,
1042,
2629,
6125,
4297,
1012,
1001,
1001,
2023,
5371,
2003,
2112,
1997,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.uavteam;
import java.awt.*;
import java.awt.image.BufferedImage;
/**
* Created by jtb20 on 6/5/2017.
*/
public class TargetData {
BufferedImage target;
double lat;
double lon;
String rotation;
String shape;
String shapeColor;
String letterColor;
String letter;
String id;
String type;
String desc;
public TargetData(BufferedImage t, double lat, double lon, String rot, String shape, String sColor, String letter, String lColor, String id, String type){
target=t;
this.lat=lat;
this.lon=lon;
rotation=rot;
this.shape=shape;
this.shapeColor=sColor;
this.letter=letter;
this.letterColor=lColor;
this.id=id;
this.type=type;
this.desc="";
}
public TargetData(double lat, double lon, String id) {
target = null;
this.lat = lat;
this.lon = lon;
rotation = "n";
this.shape = "Semicircle";
this.shapeColor = "Orange";
this.letter = "A";
this.letterColor = "White";
this.id=id;
type="standard";
desc="";
}
public void addTarget(BufferedImage t ){
target=t;
}
public void setLocation(double lat, double lon){
this.lat=lat;
this.lon=lon;
}
public void setRotation(String s) {
rotation=s;
}
public void setMetaData(String s, String sColor, String l, String lColor, String t,String desc){
shape=s.toLowerCase();
shapeColor=sColor.toLowerCase();
letter=l.toLowerCase();
letterColor=lColor.toLowerCase();
type=t.toLowerCase();
this.desc=desc;
if(t.equals("standard")||t.equals("emergent")||t.equals("off-axis")) {
type = t;
}
}
public String getRotation(){return rotation;}
public String getShape(){return shape;}
public String getShapeColor(){return shapeColor;}
public String getLetterColor(){return letterColor;}
public String getLetter(){return letter;}
public double getLat(){return lat;}
public double getLon(){return lon;}
public BufferedImage getImage(){return target;}
public String getType(){return type;}
public String getId(){return id;}
public String getDesc(){return desc;}
}
| uav-team-ut/Manual-Recognition-Station | src/org/uavteam/TargetData.java | Java | gpl-3.0 | 2,311 | [
30522,
7427,
8917,
1012,
25423,
2615,
27058,
2213,
1025,
12324,
9262,
1012,
22091,
2102,
1012,
1008,
1025,
12324,
9262,
1012,
22091,
2102,
1012,
3746,
1012,
17698,
2098,
9581,
3351,
1025,
1013,
1008,
1008,
1008,
2580,
2011,
1046,
2102,
2497... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package io.github.raptros.bson
import com.mongodb.{BasicDBList, DBObject}
import scalaz._
import scalaz.syntax.id._
import scalaz.syntax.std.boolean._
import scalaz.syntax.validation._
import scalaz.syntax.traverse._
import scala.reflect._
import org.joda.time.DateTime
import scalaz.std.list._
/** the typeclass of things that can be decoded from DBObjects.
* @tparam A not certain what effect the covariance on A has.
*/
trait DecodeBson[+A] {
/** this is the method that needs to be implemented to decode.
* @param dbo the object to attempt to decode an A from.
* @return a [[DecodeResult]] with A as the success.
*/
def decode(dbo: DBObject): DecodeResult[A]
/** an alias for [[decode]] */
def apply(dbo: DBObject): DecodeResult[A] = decode(dbo)
/** derives a new DecodeBson from this one by transforming the values decoded from this one
* @param f a function that transforms values produced by this DecodeBson
* @tparam B the type that `f` returns
* @return a DecodeBson for `B`
*/
def map[B](f: A => B): DecodeBson[B] = DecodeBson {
apply(_) map f
}
/** derives a new DecodeBson by transforming decoded values using a function that produces a new DecodeBson.
* @param f a function that produces a DecodeBson using the values produced by this one.
* the decoder returned by f will be applied to to the same dbo that this decoder extracted the value it passed to `f` from.
* the value returned by applying that new decoder is the value that the new decoder will return.
* @tparam B a type
* @return a decooder for B
*/
def flatMap[B](f: A => DecodeBson[B]): DecodeBson[B] = DecodeBson { dbo =>
apply(dbo) flatMap { r => f(r)(dbo) }
}
/** creates a decoder that first uses this decoder and then another decoder. has an alias [[|||]].
* @param x a decoder that will be tried if this one fails
* @tparam B a supertype of A that is common to both this decoder and `x`. this is the return type of the new decoder.
* @return a decoder that returns the first successfully decoded value
*/
def orElse[B >: A](x: => DecodeBson[B]): DecodeBson[B] = DecodeBson { dbo =>
apply(dbo) orElse x(dbo)
}
/** alias for [[orElse]] */
def |||[B >: A](x: => DecodeBson[B]): DecodeBson[B] = orElse(x)
/** creates a decoder that applies this decoder and `x` and returns both results together. */
def &&&[B](x: DecodeBson[B]): DecodeBson[(A, B)] = DecodeBson { dbo =>
for {
a <- apply(dbo)
b <- x(dbo)
} yield (a, b)
}
/** creates a decoder that applies a predicate to a dbo before it tries to apply this decoder.
* @param f a predicate on DBObjects.
* @param msg a function that takes the DBObject that failed the predicate, and produces a [[DecodeError]] explaining what went wrong.
*/
def validate(f: DBObject => Boolean, msg: DBObject => DecodeError) = DecodeBson { dbo =>
if (f(dbo))
decode(dbo)
else
msg(dbo).wrapNel.left
}
/** creates a decoder that only applies this decoder if the dbo has exactly `count` fields */
def validateFields(count: Int) = validate(_.keySet.size == count,
dbo => WrongFieldCount(count, dbo.keySet.size))
}
object DecodeBson extends DecodeBsons {
/** constructs [[DecodeBson]][A] by using `f` as the implementation of `decode` */
def apply[A](f: DBObject => DecodeResult[A]): DecodeBson[A] = new DecodeBson[A] {
def decode(dbo: DBObject): DecodeResult[A] = f(dbo)
}
}
/** this contains:
* - a couple DecodeBson instances
* - two Applicative implementations (one for DecodeResult, one for the [[scalaz.Validation]] equivalent)
* - a bunch of bdecode(n)f methods, which construct decoders from the combination of function that constructs a value from types that have
* [[DecodeBsonField]] instances, and a list of field names to extracted. n is the arity.
* - a bunch of bdecodeTuple(n) methods, which constructed decoders that extract the named fields into a tuple.
*/
trait DecodeBsons extends GeneratedDecodeBsons {
val ApD = Applicative[DecodeResult]
type DecodeResultV[A] = ValidationNel[DecodeError, A]
val ApV = Applicative[DecodeResultV]
import scala.reflect._
protected def tryCast[A: ClassTag](v: Any): DecodeError \/ A =
(v != null && !(classTag[A].runtimeClass isAssignableFrom v.getClass)) either WrongType(classTag[A].runtimeClass, v.getClass) or v.asInstanceOf[A]
implicit val dboDecodeBson: DecodeBson[DBObject] = DecodeBson { _.right }
implicit def listDecodeBson[A](implicit d: DecodeBsonField[A]) = DecodeBson { dbo =>
tryCast[BasicDBList](dbo) leftMap { NonEmptyList(_) } flatMap { dbl =>
//first: decode each item in the list
val decodes = (0 until dbl.size()) map { idx => d(idx.toString, dbl).validation }
//second: sequence the decode results - takes a list of decode results and makes it a decode result of a list
decodes.toList.sequence[DecodeResultV, A].disjunction
}
}
def bdecode1f[A, X](fxn: (A) => X)(ak: String)(implicit decodea: DecodeBsonField[A]): DecodeBson[X] =
DecodeBson { dbo => decodea(ak, dbo) map fxn }
}
| raptros/the-bson | core/src/main/scala/io/github/raptros/bson/DecodeBson.scala | Scala | bsd-3-clause | 5,168 | [
30522,
7427,
22834,
1012,
21025,
2705,
12083,
1012,
9680,
13181,
2015,
1012,
18667,
2239,
12324,
4012,
1012,
12256,
3995,
18939,
1012,
1063,
3937,
18939,
9863,
1010,
16962,
16429,
20614,
1065,
12324,
26743,
2480,
1012,
1035,
12324,
26743,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright (c) 2002,2007-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* 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.
*
*/
#include <linux/slab.h>
#include "kgsl.h"
#include "kgsl_sharedmem.h"
#include "adreno.h"
#define KGSL_INIT_REFTIMESTAMP 0x7FFFFFFF
/* quad for copying GMEM to context shadow */
#define QUAD_LEN 12
#define QUAD_RESTORE_LEN 14
static unsigned int gmem_copy_quad[QUAD_LEN] = {
0x00000000, 0x00000000, 0x3f800000,
0x00000000, 0x00000000, 0x3f800000,
0x00000000, 0x00000000, 0x3f800000,
0x00000000, 0x00000000, 0x3f800000
};
static unsigned int gmem_restore_quad[QUAD_RESTORE_LEN] = {
0x00000000, 0x3f800000, 0x3f800000,
0x00000000, 0x00000000, 0x00000000,
0x3f800000, 0x00000000, 0x00000000,
0x3f800000, 0x00000000, 0x00000000,
0x3f800000, 0x3f800000,
};
#define TEXCOORD_LEN 8
static unsigned int gmem_copy_texcoord[TEXCOORD_LEN] = {
0x00000000, 0x3f800000,
0x3f800000, 0x3f800000,
0x00000000, 0x00000000,
0x3f800000, 0x00000000
};
/*
* Helper functions
* These are global helper functions used by the GPUs during context switch
*/
/**
* uint2float - convert a uint to IEEE754 single precision float
* @ uintval - value to convert
*/
unsigned int uint2float(unsigned int uintval)
{
unsigned int exp, frac = 0;
if (uintval == 0)
return 0;
exp = ilog2(uintval);
/* Calculate fraction */
if (23 > exp)
frac = (uintval & (~(1 << exp))) << (23 - exp);
/* Exp is biased by 127 and shifted 23 bits */
exp = (exp + 127) << 23;
return exp | frac;
}
static void set_gmem_copy_quad(struct gmem_shadow_t *shadow)
{
/* set vertex buffer values */
gmem_copy_quad[1] = uint2float(shadow->height);
gmem_copy_quad[3] = uint2float(shadow->width);
gmem_copy_quad[4] = uint2float(shadow->height);
gmem_copy_quad[9] = uint2float(shadow->width);
gmem_restore_quad[5] = uint2float(shadow->height);
gmem_restore_quad[7] = uint2float(shadow->width);
memcpy(shadow->quad_vertices.hostptr, gmem_copy_quad, QUAD_LEN << 2);
memcpy(shadow->quad_vertices_restore.hostptr, gmem_restore_quad,
QUAD_RESTORE_LEN << 2);
memcpy(shadow->quad_texcoords.hostptr, gmem_copy_texcoord,
TEXCOORD_LEN << 2);
}
/**
* build_quad_vtxbuff - Create a quad for saving/restoring GMEM
* @ context - Pointer to the context being created
* @ shadow - Pointer to the GMEM shadow structure
* @ incmd - Pointer to pointer to the temporary command buffer
*/
/* quad for saving/restoring gmem */
void build_quad_vtxbuff(struct adreno_context *drawctxt,
struct gmem_shadow_t *shadow, unsigned int **incmd)
{
unsigned int *cmd = *incmd;
/* quad vertex buffer location (in GPU space) */
shadow->quad_vertices.hostptr = cmd;
shadow->quad_vertices.gpuaddr = virt2gpu(cmd, &drawctxt->gpustate);
cmd += QUAD_LEN;
/* Used by A3XX, but define for both to make the code easier */
shadow->quad_vertices_restore.hostptr = cmd;
shadow->quad_vertices_restore.gpuaddr =
virt2gpu(cmd, &drawctxt->gpustate);
cmd += QUAD_RESTORE_LEN;
/* tex coord buffer location (in GPU space) */
shadow->quad_texcoords.hostptr = cmd;
shadow->quad_texcoords.gpuaddr = virt2gpu(cmd, &drawctxt->gpustate);
cmd += TEXCOORD_LEN;
set_gmem_copy_quad(shadow);
*incmd = cmd;
}
/**
* adreno_drawctxt_create - create a new adreno draw context
* @device - KGSL device to create the context on
* @pagetable - Pagetable for the context
* @context- Generic KGSL context structure
* @flags - flags for the context (passed from user space)
*
* Create a new draw context for the 3D core. Return 0 on success,
* or error code on failure.
*/
int adreno_drawctxt_create(struct kgsl_device *device,
struct kgsl_pagetable *pagetable,
struct kgsl_context *context, uint32_t flags)
{
struct adreno_context *drawctxt;
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
int ret;
drawctxt = kzalloc(sizeof(struct adreno_context), GFP_KERNEL);
if (drawctxt == NULL)
return -ENOMEM;
drawctxt->pagetable = pagetable;
drawctxt->bin_base_offset = 0;
drawctxt->id = context->id;
if (flags & KGSL_CONTEXT_PREAMBLE)
drawctxt->flags |= CTXT_FLAGS_PREAMBLE;
if (flags & KGSL_CONTEXT_NO_GMEM_ALLOC)
drawctxt->flags |= CTXT_FLAGS_NOGMEMALLOC;
if (flags & KGSL_CONTEXT_PER_CONTEXT_TS)
drawctxt->flags |= CTXT_FLAGS_PER_CONTEXT_TS;
ret = adreno_dev->gpudev->ctxt_create(adreno_dev, drawctxt);
if (ret)
goto err;
kgsl_sharedmem_writel(&device->memstore,
KGSL_MEMSTORE_OFFSET(drawctxt->id, ref_wait_ts),
KGSL_INIT_REFTIMESTAMP);
context->devctxt = drawctxt;
return 0;
err:
kfree(drawctxt);
return ret;
}
/**
* adreno_drawctxt_destroy - destroy a draw context
* @device - KGSL device that owns the context
* @context- Generic KGSL context container for the context
*
* Destroy an existing context. Return 0 on success or error
* code on failure.
*/
/* destroy a drawing context */
void adreno_drawctxt_destroy(struct kgsl_device *device,
struct kgsl_context *context)
{
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
struct adreno_context *drawctxt;
if (context == NULL || context->devctxt == NULL)
return;
drawctxt = context->devctxt;
/* deactivate context */
if (adreno_dev->drawctxt_active == drawctxt) {
/* no need to save GMEM or shader, the context is
* being destroyed.
*/
drawctxt->flags &= ~(CTXT_FLAGS_GMEM_SAVE |
CTXT_FLAGS_SHADER_SAVE |
CTXT_FLAGS_GMEM_SHADOW |
CTXT_FLAGS_STATE_SHADOW);
drawctxt->flags |= CTXT_FLAGS_BEING_DESTOYED;
adreno_drawctxt_switch(adreno_dev, NULL, 0);
}
if (device->state != KGSL_STATE_HUNG)
adreno_idle(device);
kgsl_sharedmem_free(&drawctxt->gpustate);
kgsl_sharedmem_free(&drawctxt->context_gmem_shadow.gmemshadow);
kfree(drawctxt);
context->devctxt = NULL;
}
/**
* adreno_drawctxt_set_bin_base_offset - set bin base offset for the context
* @device - KGSL device that owns the context
* @context- Generic KGSL context container for the context
* @offset - Offset to set
*
* Set the bin base offset for A2XX devices. Not valid for A3XX devices.
*/
void adreno_drawctxt_set_bin_base_offset(struct kgsl_device *device,
struct kgsl_context *context,
unsigned int offset)
{
struct adreno_context *drawctxt = context->devctxt;
if (drawctxt)
drawctxt->bin_base_offset = offset;
}
/**
* adreno_drawctxt_switch - switch the current draw context
* @adreno_dev - The 3D device that owns the context
* @drawctxt - the 3D context to switch to
* @flags - Flags to accompany the switch (from user space)
*
* Switch the current draw context
*/
void adreno_drawctxt_switch(struct adreno_device *adreno_dev,
struct adreno_context *drawctxt,
unsigned int flags)
{
struct kgsl_device *device = &adreno_dev->dev;
if (drawctxt) {
if (flags & KGSL_CONTEXT_SAVE_GMEM)
/* Set the flag in context so that the save is done
* when this context is switched out. */
drawctxt->flags |= CTXT_FLAGS_GMEM_SAVE;
else
/* Remove GMEM saving flag from the context */
drawctxt->flags &= ~CTXT_FLAGS_GMEM_SAVE;
}
/* already current? */
if (adreno_dev->drawctxt_active == drawctxt) {
return;
}
KGSL_CTXT_INFO(device, "from %p to %p flags %d\n",
adreno_dev->drawctxt_active, drawctxt, flags);
/* Save the old context */
adreno_dev->gpudev->ctxt_save(adreno_dev, adreno_dev->drawctxt_active);
/* Set the new context */
adreno_dev->gpudev->ctxt_restore(adreno_dev, drawctxt);
adreno_dev->drawctxt_active = drawctxt;
}
| rachitrawat/Vengeance-Kernel-MSM7x27-JLO | drivers/gpu/msm/adreno_drawctxt.c | C | gpl-2.0 | 7,866 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2526,
1010,
2289,
1011,
2262,
1010,
3642,
13158,
7057,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"18682357","logradouro":"Rua Aratas","bairro":"Jardim Itamaraty","cidade":"Len\u00e7\u00f3is Paulista","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/18682357.jsonp.js | JavaScript | cc0-1.0 | 155 | [
30522,
1046,
3385,
2361,
1006,
30524,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
19027,
10230,
1000,
1010,
1000,
21790,
18933,
1000,
1024,
1000,
15723,
22172,
2009,
8067,
8609,
2100,
1000,
1010,
1000,
28744,
9648,
1000,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// RiverShell
// Copyright 2015 Tim Potze
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using SampSharp.GameMode.Events;
using SampSharp.GameMode.World;
namespace RiverShell.World
{
public class Vehicle : GtaVehicle
{
public Vehicle(int id) : base(id)
{
}
public override void OnStreamIn(PlayerEventArgs e)
{
var player = e.Player as Player;
if (this == GameMode.BlueTeam.TargetVehicle)
SetParametersForPlayer(player, true, player.Team == GameMode.GreenTeam);
else if (this == GameMode.GreenTeam.TargetVehicle)
SetParametersForPlayer(player, true, player.Team == GameMode.BlueTeam);
base.OnStreamIn(e);
}
}
} | ikkentim/SampSharp-rivershell | src/RiverShell/World/Vehicle.cs | C# | unlicense | 1,271 | [
30522,
1013,
1013,
5485,
18223,
1013,
1013,
9385,
2325,
5199,
8962,
4371,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Helpers;
/**
* Assets static helper
* @date 27th November, 2014
* @date May 18 2015
*/
class Assets
{
/**
* @var array Asset templates
*/
protected static $templates = array
(
'js' => '<script src="%s" type="text/javascript"></script>',
'css' => '<link href="%s" rel="stylesheet" type="text/css">'
);
/**
* Common templates for assets.
*
* @param string|array $files
* @param string $template
*/
protected static function resource($files, $template)
{
$template = self::$templates[$template];
if (is_array($files)) {
foreach ($files as $file) {
echo sprintf($template, $file) . "\n";
}
} else {
echo sprintf($template, $files) . "\n";
}
}
/**
* Output script
*
* @param array|string $file
*/
public static function js($files)
{
static::resource($files, 'js');
}
/**
* Output stylesheet
*
* @param string $file
*/
public static function css($files)
{
static::resource($files, 'css');
}
}
| NandoKstroNet/babita | app/Helpers/Assets.php | PHP | mit | 1,175 | [
30522,
1026,
1029,
25718,
3415,
15327,
2393,
2545,
1025,
1013,
1008,
1008,
1008,
7045,
10763,
2393,
2121,
1008,
1030,
3058,
15045,
2281,
1010,
2297,
1008,
1030,
3058,
2089,
2324,
2325,
1008,
1013,
2465,
7045,
1063,
1013,
1008,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ENetSharp
{
public class ENetList
{
public List<object> data = new List<object>();
internal int position;
}
public static class ENetListHelper
{
/// <summary>
/// Removes everything from the list
/// </summary>
/// <param name="list">The target list</param>
public static void enet_list_clear(ref ENetList list)
{
list.data.Clear();
}
public static ENetList enet_list_insert(ref ENetList list, int position, object data)
{
list.data.Insert(position, data);
return list;
}
public static ENetList enet_list_insert(ref ENetList list, object data)
{
list.data.Add(data);
return list;
}
public static object enet_list_remove(ref ENetList list, int position)
{
var data = list.data[position];
list.data.RemoveAt(position);
return data;
}
public static object enet_list_remove(ref ENetList list)
{
var item = list.data[list.position];
list.data.Remove(item);
return item;
}
public static object enet_list_remove(ref ENetList list, object item)
{
list.data.Remove(item);
return item;
}
public static void enet_list_remove(ref ENetList list, Predicate<object> items)
{
list.data.RemoveAll(items);
}
public static ENetList enet_list_move(ref ENetList list, int positionFirst, int positionLast)
{
object tmp = list.data[positionFirst];
list.data[positionFirst] = list.data[positionLast];
list.data[positionLast] = tmp;
return list;
}
public static int enet_list_size(ref ENetList list)
{
return list.data.Count;
}
//#define enet_list_begin(list) ((list) -> sentinel.next)
public static object enet_list_begin(ref ENetList list)
{
return list.data.First();
}
//#define enet_list_end(list) (& (list) -> sentinel)
public static object enet_list_end(ref ENetList list)
{
return list.data.Last();
}
//#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
public static bool enet_list_empty(ref ENetList list)
{
return !list.data.Any();
}
//#define enet_list_next(iterator) ((iterator) -> next)
public static object enet_list_next(ref ENetList list)
{
var d = list.data[list.position];
list.position++;
return d;
}
//#define enet_list_previous(iterator) ((iterator) -> previous)
public static object enet_list_previous(ref ENetList list)
{
var d = list.data[list.position];
list.position--;
return d;
}
//#define enet_list_front(list) ((void *) (list) -> sentinel.next)
public static object enet_list_front(ref ENetList list)
{
return list.data.First();
}
//#define enet_list_back(list) ((void *) (list) -> sentinel.previous)
public static object enet_list_back(ref ENetList list)
{
list.position--;
return list.data[list.position];
}
public static object enet_list_current(ref ENetList list)
{
return list.data[list.position];
}
}
}
| eddy5641/ENetSharp | ENetSharp/ENetSharp/List.cs | C# | gpl-3.0 | 3,725 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
4372,
8454,
8167,
2361,
1063,
2270,
2465,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===--- CodeGenAction.cpp - LLVM Code Generation Frontend Action ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "clang/CodeGen/CodeGenAction.h"
#include "CodeGenModule.h"
#include "CoverageMappingGen.h"
#include "MacroPPCallbacks.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Linker/Linker.h"
#include "llvm/Pass.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Transforms/IPO/Internalize.h"
#include <memory>
using namespace clang;
using namespace llvm;
namespace clang {
class BackendConsumer;
class ClangDiagnosticHandler final : public DiagnosticHandler {
public:
ClangDiagnosticHandler(const CodeGenOptions &CGOpts, BackendConsumer *BCon)
: CodeGenOpts(CGOpts), BackendCon(BCon) {}
bool handleDiagnostics(const DiagnosticInfo &DI) override;
bool isAnalysisRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(PassName));
}
bool isMissedOptRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkMissedPattern &&
CodeGenOpts.OptimizationRemarkMissedPattern->match(PassName));
}
bool isPassedOptRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkPattern &&
CodeGenOpts.OptimizationRemarkPattern->match(PassName));
}
bool isAnyRemarkEnabled() const override {
return (CodeGenOpts.OptimizationRemarkAnalysisPattern ||
CodeGenOpts.OptimizationRemarkMissedPattern ||
CodeGenOpts.OptimizationRemarkPattern);
}
private:
const CodeGenOptions &CodeGenOpts;
BackendConsumer *BackendCon;
};
class BackendConsumer : public ASTConsumer {
using LinkModule = CodeGenAction::LinkModule;
virtual void anchor();
DiagnosticsEngine &Diags;
BackendAction Action;
const HeaderSearchOptions &HeaderSearchOpts;
const CodeGenOptions &CodeGenOpts;
const TargetOptions &TargetOpts;
const LangOptions &LangOpts;
std::unique_ptr<raw_pwrite_stream> AsmOutStream;
ASTContext *Context;
Timer LLVMIRGeneration;
unsigned LLVMIRGenerationRefCount;
/// True if we've finished generating IR. This prevents us from generating
/// additional LLVM IR after emitting output in HandleTranslationUnit. This
/// can happen when Clang plugins trigger additional AST deserialization.
bool IRGenFinished = false;
std::unique_ptr<CodeGenerator> Gen;
SmallVector<LinkModule, 4> LinkModules;
// This is here so that the diagnostic printer knows the module a diagnostic
// refers to.
llvm::Module *CurLinkModule = nullptr;
public:
BackendConsumer(BackendAction Action, DiagnosticsEngine &Diags,
const HeaderSearchOptions &HeaderSearchOpts,
const PreprocessorOptions &PPOpts,
const CodeGenOptions &CodeGenOpts,
const TargetOptions &TargetOpts,
const LangOptions &LangOpts, bool TimePasses,
const std::string &InFile,
SmallVector<LinkModule, 4> LinkModules,
std::unique_ptr<raw_pwrite_stream> OS, LLVMContext &C,
CoverageSourceInfo *CoverageInfo = nullptr)
: Diags(Diags), Action(Action), HeaderSearchOpts(HeaderSearchOpts),
CodeGenOpts(CodeGenOpts), TargetOpts(TargetOpts), LangOpts(LangOpts),
AsmOutStream(std::move(OS)), Context(nullptr),
LLVMIRGeneration("irgen", "LLVM IR Generation Time"),
LLVMIRGenerationRefCount(0),
Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
CodeGenOpts, C, CoverageInfo)),
LinkModules(std::move(LinkModules)) {
FrontendTimesIsEnabled = TimePasses;
llvm::TimePassesIsEnabled = TimePasses;
}
llvm::Module *getModule() const { return Gen->GetModule(); }
std::unique_ptr<llvm::Module> takeModule() {
return std::unique_ptr<llvm::Module>(Gen->ReleaseModule());
}
CodeGenerator *getCodeGenerator() { return Gen.get(); }
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override {
Gen->HandleCXXStaticMemberVarInstantiation(VD);
}
void Initialize(ASTContext &Ctx) override {
assert(!Context && "initialized multiple times");
Context = &Ctx;
if (FrontendTimesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->Initialize(Ctx);
if (FrontendTimesIsEnabled)
LLVMIRGeneration.stopTimer();
}
bool HandleTopLevelDecl(DeclGroupRef D) override {
PrettyStackTraceDecl CrashInfo(*D.begin(), SourceLocation(),
Context->getSourceManager(),
"LLVM IR generation of declaration");
// Recurse.
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount += 1;
if (LLVMIRGenerationRefCount == 1)
LLVMIRGeneration.startTimer();
}
Gen->HandleTopLevelDecl(D);
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount -= 1;
if (LLVMIRGenerationRefCount == 0)
LLVMIRGeneration.stopTimer();
}
return true;
}
void HandleInlineFunctionDefinition(FunctionDecl *D) override {
PrettyStackTraceDecl CrashInfo(D, SourceLocation(),
Context->getSourceManager(),
"LLVM IR generation of inline function");
if (FrontendTimesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->HandleInlineFunctionDefinition(D);
if (FrontendTimesIsEnabled)
LLVMIRGeneration.stopTimer();
}
void HandleInterestingDecl(DeclGroupRef D) override {
// Ignore interesting decls from the AST reader after IRGen is finished.
if (!IRGenFinished)
HandleTopLevelDecl(D);
}
// Links each entry in LinkModules into our module. Returns true on error.
bool LinkInModules() {
for (auto &LM : LinkModules) {
if (LM.PropagateAttrs)
for (Function &F : *LM.Module)
Gen->CGM().AddDefaultFnAttrs(F);
CurLinkModule = LM.Module.get();
bool Err;
if (LM.Internalize) {
Err = Linker::linkModules(
*getModule(), std::move(LM.Module), LM.LinkFlags,
[](llvm::Module &M, const llvm::StringSet<> &GVS) {
internalizeModule(M, [&GVS](const llvm::GlobalValue &GV) {
return !GV.hasName() || (GVS.count(GV.getName()) == 0);
});
});
} else {
Err = Linker::linkModules(*getModule(), std::move(LM.Module),
LM.LinkFlags);
}
if (Err)
return true;
}
return false; // success
}
void HandleTranslationUnit(ASTContext &C) override {
{
PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount += 1;
if (LLVMIRGenerationRefCount == 1)
LLVMIRGeneration.startTimer();
}
Gen->HandleTranslationUnit(C);
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount -= 1;
if (LLVMIRGenerationRefCount == 0)
LLVMIRGeneration.stopTimer();
}
IRGenFinished = true;
}
// Silently ignore if we weren't initialized for some reason.
if (!getModule())
return;
// Install an inline asm handler so that diagnostics get printed through
// our diagnostics hooks.
LLVMContext &Ctx = getModule()->getContext();
LLVMContext::InlineAsmDiagHandlerTy OldHandler =
Ctx.getInlineAsmDiagnosticHandler();
void *OldContext = Ctx.getInlineAsmDiagnosticContext();
Ctx.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, this);
std::unique_ptr<DiagnosticHandler> OldDiagnosticHandler =
Ctx.getDiagnosticHandler();
Ctx.setDiagnosticHandler(llvm::make_unique<ClangDiagnosticHandler>(
CodeGenOpts, this));
Ctx.setDiagnosticsHotnessRequested(CodeGenOpts.DiagnosticsWithHotness);
if (CodeGenOpts.DiagnosticsHotnessThreshold != 0)
Ctx.setDiagnosticsHotnessThreshold(
CodeGenOpts.DiagnosticsHotnessThreshold);
std::unique_ptr<llvm::ToolOutputFile> OptRecordFile;
if (!CodeGenOpts.OptRecordFile.empty()) {
std::error_code EC;
OptRecordFile = llvm::make_unique<llvm::ToolOutputFile>(
CodeGenOpts.OptRecordFile, EC, sys::fs::F_None);
if (EC) {
Diags.Report(diag::err_cannot_open_file) <<
CodeGenOpts.OptRecordFile << EC.message();
return;
}
Ctx.setDiagnosticsOutputFile(
llvm::make_unique<yaml::Output>(OptRecordFile->os()));
if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
Ctx.setDiagnosticsHotnessRequested(true);
}
// Link each LinkModule into our module.
if (LinkInModules())
return;
EmbedBitcode(getModule(), CodeGenOpts, llvm::MemoryBufferRef());
EmitBackendOutput(Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts,
LangOpts, C.getTargetInfo().getDataLayout(),
getModule(), Action, std::move(AsmOutStream));
Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
Ctx.setDiagnosticHandler(std::move(OldDiagnosticHandler));
if (OptRecordFile)
OptRecordFile->keep();
}
void HandleTagDeclDefinition(TagDecl *D) override {
PrettyStackTraceDecl CrashInfo(D, SourceLocation(),
Context->getSourceManager(),
"LLVM IR generation of declaration");
Gen->HandleTagDeclDefinition(D);
}
void HandleTagDeclRequiredDefinition(const TagDecl *D) override {
Gen->HandleTagDeclRequiredDefinition(D);
}
void CompleteTentativeDefinition(VarDecl *D) override {
Gen->CompleteTentativeDefinition(D);
}
void AssignInheritanceModel(CXXRecordDecl *RD) override {
Gen->AssignInheritanceModel(RD);
}
void HandleVTable(CXXRecordDecl *RD) override {
Gen->HandleVTable(RD);
}
static void InlineAsmDiagHandler(const llvm::SMDiagnostic &SM,void *Context,
unsigned LocCookie) {
SourceLocation Loc = SourceLocation::getFromRawEncoding(LocCookie);
((BackendConsumer*)Context)->InlineAsmDiagHandler2(SM, Loc);
}
/// Get the best possible source location to represent a diagnostic that
/// may have associated debug info.
const FullSourceLoc
getBestLocationFromDebugLoc(const llvm::DiagnosticInfoWithLocationBase &D,
bool &BadDebugInfo, StringRef &Filename,
unsigned &Line, unsigned &Column) const;
void InlineAsmDiagHandler2(const llvm::SMDiagnostic &,
SourceLocation LocCookie);
void DiagnosticHandlerImpl(const llvm::DiagnosticInfo &DI);
/// Specialized handler for InlineAsm diagnostic.
/// \return True if the diagnostic has been successfully reported, false
/// otherwise.
bool InlineAsmDiagHandler(const llvm::DiagnosticInfoInlineAsm &D);
/// Specialized handler for StackSize diagnostic.
/// \return True if the diagnostic has been successfully reported, false
/// otherwise.
bool StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize &D);
/// Specialized handler for unsupported backend feature diagnostic.
void UnsupportedDiagHandler(const llvm::DiagnosticInfoUnsupported &D);
/// Specialized handlers for optimization remarks.
/// Note that these handlers only accept remarks and they always handle
/// them.
void EmitOptimizationMessage(const llvm::DiagnosticInfoOptimizationBase &D,
unsigned DiagID);
void
OptimizationRemarkHandler(const llvm::DiagnosticInfoOptimizationBase &D);
void OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisFPCommute &D);
void OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisAliasing &D);
void OptimizationFailureHandler(
const llvm::DiagnosticInfoOptimizationFailure &D);
};
void BackendConsumer::anchor() {}
}
bool ClangDiagnosticHandler::handleDiagnostics(const DiagnosticInfo &DI) {
BackendCon->DiagnosticHandlerImpl(DI);
return true;
}
/// ConvertBackendLocation - Convert a location in a temporary llvm::SourceMgr
/// buffer to be a valid FullSourceLoc.
static FullSourceLoc ConvertBackendLocation(const llvm::SMDiagnostic &D,
SourceManager &CSM) {
// Get both the clang and llvm source managers. The location is relative to
// a memory buffer that the LLVM Source Manager is handling, we need to add
// a copy to the Clang source manager.
const llvm::SourceMgr &LSM = *D.getSourceMgr();
// We need to copy the underlying LLVM memory buffer because llvm::SourceMgr
// already owns its one and clang::SourceManager wants to own its one.
const MemoryBuffer *LBuf =
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
// Create the copy and transfer ownership to clang::SourceManager.
// TODO: Avoid copying files into memory.
std::unique_ptr<llvm::MemoryBuffer> CBuf =
llvm::MemoryBuffer::getMemBufferCopy(LBuf->getBuffer(),
LBuf->getBufferIdentifier());
// FIXME: Keep a file ID map instead of creating new IDs for each location.
FileID FID = CSM.createFileID(std::move(CBuf));
// Translate the offset into the file.
unsigned Offset = D.getLoc().getPointer() - LBuf->getBufferStart();
SourceLocation NewLoc =
CSM.getLocForStartOfFile(FID).getLocWithOffset(Offset);
return FullSourceLoc(NewLoc, CSM);
}
/// InlineAsmDiagHandler2 - This function is invoked when the backend hits an
/// error parsing inline asm. The SMDiagnostic indicates the error relative to
/// the temporary memory buffer that the inline asm parser has set up.
void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D,
SourceLocation LocCookie) {
// There are a couple of different kinds of errors we could get here. First,
// we re-format the SMDiagnostic in terms of a clang diagnostic.
// Strip "error: " off the start of the message string.
StringRef Message = D.getMessage();
if (Message.startswith("error: "))
Message = Message.substr(7);
// If the SMDiagnostic has an inline asm source location, translate it.
FullSourceLoc Loc;
if (D.getLoc() != SMLoc())
Loc = ConvertBackendLocation(D, Context->getSourceManager());
unsigned DiagID;
switch (D.getKind()) {
case llvm::SourceMgr::DK_Error:
DiagID = diag::err_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Warning:
DiagID = diag::warn_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Note:
DiagID = diag::note_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Remark:
llvm_unreachable("remarks unexpected");
}
// If this problem has clang-level source location information, report the
// issue in the source with a note showing the instantiated
// code.
if (LocCookie.isValid()) {
Diags.Report(LocCookie, DiagID).AddString(Message);
if (D.getLoc().isValid()) {
DiagnosticBuilder B = Diags.Report(Loc, diag::note_fe_inline_asm_here);
// Convert the SMDiagnostic ranges into SourceRange and attach them
// to the diagnostic.
for (const std::pair<unsigned, unsigned> &Range : D.getRanges()) {
unsigned Column = D.getColumnNo();
B << SourceRange(Loc.getLocWithOffset(Range.first - Column),
Loc.getLocWithOffset(Range.second - Column));
}
}
return;
}
// Otherwise, report the backend issue as occurring in the generated .s file.
// If Loc is invalid, we still need to report the issue, it just gets no
// location info.
Diags.Report(Loc, DiagID).AddString(Message);
}
#define ComputeDiagID(Severity, GroupName, DiagID) \
do { \
switch (Severity) { \
case llvm::DS_Error: \
DiagID = diag::err_fe_##GroupName; \
break; \
case llvm::DS_Warning: \
DiagID = diag::warn_fe_##GroupName; \
break; \
case llvm::DS_Remark: \
llvm_unreachable("'remark' severity not expected"); \
break; \
case llvm::DS_Note: \
DiagID = diag::note_fe_##GroupName; \
break; \
} \
} while (false)
#define ComputeDiagRemarkID(Severity, GroupName, DiagID) \
do { \
switch (Severity) { \
case llvm::DS_Error: \
DiagID = diag::err_fe_##GroupName; \
break; \
case llvm::DS_Warning: \
DiagID = diag::warn_fe_##GroupName; \
break; \
case llvm::DS_Remark: \
DiagID = diag::remark_fe_##GroupName; \
break; \
case llvm::DS_Note: \
DiagID = diag::note_fe_##GroupName; \
break; \
} \
} while (false)
bool
BackendConsumer::InlineAsmDiagHandler(const llvm::DiagnosticInfoInlineAsm &D) {
unsigned DiagID;
ComputeDiagID(D.getSeverity(), inline_asm, DiagID);
std::string Message = D.getMsgStr().str();
// If this problem has clang-level source location information, report the
// issue as being a problem in the source with a note showing the instantiated
// code.
SourceLocation LocCookie =
SourceLocation::getFromRawEncoding(D.getLocCookie());
if (LocCookie.isValid())
Diags.Report(LocCookie, DiagID).AddString(Message);
else {
// Otherwise, report the backend diagnostic as occurring in the generated
// .s file.
// If Loc is invalid, we still need to report the diagnostic, it just gets
// no location info.
FullSourceLoc Loc;
Diags.Report(Loc, DiagID).AddString(Message);
}
// We handled all the possible severities.
return true;
}
bool
BackendConsumer::StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize &D) {
if (D.getSeverity() != llvm::DS_Warning)
// For now, the only support we have for StackSize diagnostic is warning.
// We do not know how to format other severities.
return false;
if (const Decl *ND = Gen->GetDeclForMangledName(D.getFunction().getName())) {
// FIXME: Shouldn't need to truncate to uint32_t
Diags.Report(ND->getASTContext().getFullLoc(ND->getLocation()),
diag::warn_fe_frame_larger_than)
<< static_cast<uint32_t>(D.getStackSize()) << Decl::castToDeclContext(ND);
return true;
}
return false;
}
const FullSourceLoc BackendConsumer::getBestLocationFromDebugLoc(
const llvm::DiagnosticInfoWithLocationBase &D, bool &BadDebugInfo,
StringRef &Filename, unsigned &Line, unsigned &Column) const {
SourceManager &SourceMgr = Context->getSourceManager();
FileManager &FileMgr = SourceMgr.getFileManager();
SourceLocation DILoc;
if (D.isLocationAvailable()) {
D.getLocation(&Filename, &Line, &Column);
const FileEntry *FE = FileMgr.getFile(Filename);
if (FE && Line > 0) {
// If -gcolumn-info was not used, Column will be 0. This upsets the
// source manager, so pass 1 if Column is not set.
DILoc = SourceMgr.translateFileLineCol(FE, Line, Column ? Column : 1);
}
BadDebugInfo = DILoc.isInvalid();
}
// If a location isn't available, try to approximate it using the associated
// function definition. We use the definition's right brace to differentiate
// from diagnostics that genuinely relate to the function itself.
FullSourceLoc Loc(DILoc, SourceMgr);
if (Loc.isInvalid())
if (const Decl *FD = Gen->GetDeclForMangledName(D.getFunction().getName()))
Loc = FD->getASTContext().getFullLoc(FD->getLocation());
if (DILoc.isInvalid() && D.isLocationAvailable())
// If we were not able to translate the file:line:col information
// back to a SourceLocation, at least emit a note stating that
// we could not translate this location. This can happen in the
// case of #line directives.
Diags.Report(Loc, diag::note_fe_backend_invalid_loc)
<< Filename << Line << Column;
return Loc;
}
void BackendConsumer::UnsupportedDiagHandler(
const llvm::DiagnosticInfoUnsupported &D) {
// We only support errors.
assert(D.getSeverity() == llvm::DS_Error);
StringRef Filename;
unsigned Line, Column;
bool BadDebugInfo = false;
FullSourceLoc Loc =
getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, Line, Column);
Diags.Report(Loc, diag::err_fe_backend_unsupported) << D.getMessage().str();
if (BadDebugInfo)
// If we were not able to translate the file:line:col information
// back to a SourceLocation, at least emit a note stating that
// we could not translate this location. This can happen in the
// case of #line directives.
Diags.Report(Loc, diag::note_fe_backend_invalid_loc)
<< Filename << Line << Column;
}
void BackendConsumer::EmitOptimizationMessage(
const llvm::DiagnosticInfoOptimizationBase &D, unsigned DiagID) {
// We only support warnings and remarks.
assert(D.getSeverity() == llvm::DS_Remark ||
D.getSeverity() == llvm::DS_Warning);
StringRef Filename;
unsigned Line, Column;
bool BadDebugInfo = false;
FullSourceLoc Loc =
getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, Line, Column);
std::string Msg;
raw_string_ostream MsgStream(Msg);
MsgStream << D.getMsg();
if (D.getHotness())
MsgStream << " (hotness: " << *D.getHotness() << ")";
Diags.Report(Loc, DiagID)
<< AddFlagValue(D.getPassName())
<< MsgStream.str();
if (BadDebugInfo)
// If we were not able to translate the file:line:col information
// back to a SourceLocation, at least emit a note stating that
// we could not translate this location. This can happen in the
// case of #line directives.
Diags.Report(Loc, diag::note_fe_backend_invalid_loc)
<< Filename << Line << Column;
}
void BackendConsumer::OptimizationRemarkHandler(
const llvm::DiagnosticInfoOptimizationBase &D) {
// Without hotness information, don't show noisy remarks.
if (D.isVerbose() && !D.getHotness())
return;
if (D.isPassed()) {
// Optimization remarks are active only if the -Rpass flag has a regular
// expression that matches the name of the pass name in \p D.
if (CodeGenOpts.OptimizationRemarkPattern &&
CodeGenOpts.OptimizationRemarkPattern->match(D.getPassName()))
EmitOptimizationMessage(D, diag::remark_fe_backend_optimization_remark);
} else if (D.isMissed()) {
// Missed optimization remarks are active only if the -Rpass-missed
// flag has a regular expression that matches the name of the pass
// name in \p D.
if (CodeGenOpts.OptimizationRemarkMissedPattern &&
CodeGenOpts.OptimizationRemarkMissedPattern->match(D.getPassName()))
EmitOptimizationMessage(
D, diag::remark_fe_backend_optimization_remark_missed);
} else {
assert(D.isAnalysis() && "Unknown remark type");
bool ShouldAlwaysPrint = false;
if (auto *ORA = dyn_cast<llvm::OptimizationRemarkAnalysis>(&D))
ShouldAlwaysPrint = ORA->shouldAlwaysPrint();
if (ShouldAlwaysPrint ||
(CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
EmitOptimizationMessage(
D, diag::remark_fe_backend_optimization_remark_analysis);
}
}
void BackendConsumer::OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisFPCommute &D) {
// Optimization analysis remarks are active if the pass name is set to
// llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
// regular expression that matches the name of the pass name in \p D.
if (D.shouldAlwaysPrint() ||
(CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
EmitOptimizationMessage(
D, diag::remark_fe_backend_optimization_remark_analysis_fpcommute);
}
void BackendConsumer::OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisAliasing &D) {
// Optimization analysis remarks are active if the pass name is set to
// llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
// regular expression that matches the name of the pass name in \p D.
if (D.shouldAlwaysPrint() ||
(CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
EmitOptimizationMessage(
D, diag::remark_fe_backend_optimization_remark_analysis_aliasing);
}
void BackendConsumer::OptimizationFailureHandler(
const llvm::DiagnosticInfoOptimizationFailure &D) {
EmitOptimizationMessage(D, diag::warn_fe_backend_optimization_failure);
}
/// This function is invoked when the backend needs
/// to report something to the user.
void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
unsigned DiagID = diag::err_fe_inline_asm;
llvm::DiagnosticSeverity Severity = DI.getSeverity();
// Get the diagnostic ID based.
switch (DI.getKind()) {
case llvm::DK_InlineAsm:
if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI)))
return;
ComputeDiagID(Severity, inline_asm, DiagID);
break;
case llvm::DK_StackSize:
if (StackSizeDiagHandler(cast<DiagnosticInfoStackSize>(DI)))
return;
ComputeDiagID(Severity, backend_frame_larger_than, DiagID);
break;
case DK_Linker:
assert(CurLinkModule);
// FIXME: stop eating the warnings and notes.
if (Severity != DS_Error)
return;
DiagID = diag::err_fe_cannot_link_module;
break;
case llvm::DK_OptimizationRemark:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<OptimizationRemark>(DI));
return;
case llvm::DK_OptimizationRemarkMissed:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<OptimizationRemarkMissed>(DI));
return;
case llvm::DK_OptimizationRemarkAnalysis:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<OptimizationRemarkAnalysis>(DI));
return;
case llvm::DK_OptimizationRemarkAnalysisFPCommute:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<OptimizationRemarkAnalysisFPCommute>(DI));
return;
case llvm::DK_OptimizationRemarkAnalysisAliasing:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<OptimizationRemarkAnalysisAliasing>(DI));
return;
case llvm::DK_MachineOptimizationRemark:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<MachineOptimizationRemark>(DI));
return;
case llvm::DK_MachineOptimizationRemarkMissed:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<MachineOptimizationRemarkMissed>(DI));
return;
case llvm::DK_MachineOptimizationRemarkAnalysis:
// Optimization remarks are always handled completely by this
// handler. There is no generic way of emitting them.
OptimizationRemarkHandler(cast<MachineOptimizationRemarkAnalysis>(DI));
return;
case llvm::DK_OptimizationFailure:
// Optimization failures are always handled completely by this
// handler.
OptimizationFailureHandler(cast<DiagnosticInfoOptimizationFailure>(DI));
return;
case llvm::DK_Unsupported:
UnsupportedDiagHandler(cast<DiagnosticInfoUnsupported>(DI));
return;
default:
// Plugin IDs are not bound to any value as they are set dynamically.
ComputeDiagRemarkID(Severity, backend_plugin, DiagID);
break;
}
std::string MsgStorage;
{
raw_string_ostream Stream(MsgStorage);
DiagnosticPrinterRawOStream DP(Stream);
DI.print(DP);
}
if (DiagID == diag::err_fe_cannot_link_module) {
Diags.Report(diag::err_fe_cannot_link_module)
<< CurLinkModule->getModuleIdentifier() << MsgStorage;
return;
}
// Report the backend message using the usual diagnostic mechanism.
FullSourceLoc Loc;
Diags.Report(Loc, DiagID).AddString(MsgStorage);
}
#undef ComputeDiagID
CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)
: Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),
OwnsVMContext(!_VMContext) {}
CodeGenAction::~CodeGenAction() {
TheModule.reset();
if (OwnsVMContext)
delete VMContext;
}
bool CodeGenAction::hasIRSupport() const { return true; }
void CodeGenAction::EndSourceFileAction() {
// If the consumer creation failed, do nothing.
if (!getCompilerInstance().hasASTConsumer())
return;
// Steal the module from the consumer.
TheModule = BEConsumer->takeModule();
}
std::unique_ptr<llvm::Module> CodeGenAction::takeModule() {
return std::move(TheModule);
}
llvm::LLVMContext *CodeGenAction::takeLLVMContext() {
OwnsVMContext = false;
return VMContext;
}
static std::unique_ptr<raw_pwrite_stream>
GetOutputStream(CompilerInstance &CI, StringRef InFile, BackendAction Action) {
switch (Action) {
case Backend_EmitAssembly:
return CI.createDefaultOutputFile(false, InFile, "s");
case Backend_EmitLL:
return CI.createDefaultOutputFile(false, InFile, "ll");
case Backend_EmitBC:
return CI.createDefaultOutputFile(true, InFile, "bc");
case Backend_EmitNothing:
return nullptr;
case Backend_EmitMCNull:
return CI.createNullOutputFile();
case Backend_EmitObj:
return CI.createDefaultOutputFile(true, InFile, "o");
}
llvm_unreachable("Invalid action!");
}
std::unique_ptr<ASTConsumer>
CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
BackendAction BA = static_cast<BackendAction>(Act);
std::unique_ptr<raw_pwrite_stream> OS = CI.takeOutputStream();
if (!OS)
OS = GetOutputStream(CI, InFile, BA);
if (BA != Backend_EmitNothing && !OS)
return nullptr;
// Load bitcode modules to link with, if we need to.
if (LinkModules.empty())
for (const CodeGenOptions::BitcodeFileToLink &F :
CI.getCodeGenOpts().LinkBitcodeFiles) {
auto BCBuf = CI.getFileManager().getBufferForFile(F.Filename);
if (!BCBuf) {
CI.getDiagnostics().Report(diag::err_cannot_open_file)
<< F.Filename << BCBuf.getError().message();
LinkModules.clear();
return nullptr;
}
Expected<std::unique_ptr<llvm::Module>> ModuleOrErr =
getOwningLazyBitcodeModule(std::move(*BCBuf), *VMContext);
if (!ModuleOrErr) {
handleAllErrors(ModuleOrErr.takeError(), [&](ErrorInfoBase &EIB) {
CI.getDiagnostics().Report(diag::err_cannot_open_file)
<< F.Filename << EIB.message();
});
LinkModules.clear();
return nullptr;
}
LinkModules.push_back({std::move(ModuleOrErr.get()), F.PropagateAttrs,
F.Internalize, F.LinkFlags});
}
CoverageSourceInfo *CoverageInfo = nullptr;
// Add the preprocessor callback only when the coverage mapping is generated.
if (CI.getCodeGenOpts().CoverageMapping) {
CoverageInfo = new CoverageSourceInfo;
CI.getPreprocessor().addPPCallbacks(
std::unique_ptr<PPCallbacks>(CoverageInfo));
}
std::unique_ptr<BackendConsumer> Result(new BackendConsumer(
BA, CI.getDiagnostics(), CI.getHeaderSearchOpts(),
CI.getPreprocessorOpts(), CI.getCodeGenOpts(), CI.getTargetOpts(),
CI.getLangOpts(), CI.getFrontendOpts().ShowTimers, InFile,
std::move(LinkModules), std::move(OS), *VMContext, CoverageInfo));
BEConsumer = Result.get();
// Enable generating macro debug info only when debug info is not disabled and
// also macro debug info is enabled.
if (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
CI.getCodeGenOpts().MacroDebugInfo) {
std::unique_ptr<PPCallbacks> Callbacks =
llvm::make_unique<MacroPPCallbacks>(BEConsumer->getCodeGenerator(),
CI.getPreprocessor());
CI.getPreprocessor().addPPCallbacks(std::move(Callbacks));
}
return std::move(Result);
}
static void BitcodeInlineAsmDiagHandler(const llvm::SMDiagnostic &SM,
void *Context,
unsigned LocCookie) {
SM.print(nullptr, llvm::errs());
auto Diags = static_cast<DiagnosticsEngine *>(Context);
unsigned DiagID;
switch (SM.getKind()) {
case llvm::SourceMgr::DK_Error:
DiagID = diag::err_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Warning:
DiagID = diag::warn_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Note:
DiagID = diag::note_fe_inline_asm;
break;
case llvm::SourceMgr::DK_Remark:
llvm_unreachable("remarks unexpected");
}
Diags->Report(DiagID).AddString("cannot compile inline asm");
}
std::unique_ptr<llvm::Module> CodeGenAction::loadModule(MemoryBufferRef MBRef) {
CompilerInstance &CI = getCompilerInstance();
SourceManager &SM = CI.getSourceManager();
// For ThinLTO backend invocations, ensure that the context
// merges types based on ODR identifiers. We also need to read
// the correct module out of a multi-module bitcode file.
if (!CI.getCodeGenOpts().ThinLTOIndexFile.empty()) {
VMContext->enableDebugTypeODRUniquing();
auto DiagErrors = [&](Error E) -> std::unique_ptr<llvm::Module> {
unsigned DiagID =
CI.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error, "%0");
handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) {
CI.getDiagnostics().Report(DiagID) << EIB.message();
});
return {};
};
Expected<std::vector<BitcodeModule>> BMsOrErr = getBitcodeModuleList(MBRef);
if (!BMsOrErr)
return DiagErrors(BMsOrErr.takeError());
BitcodeModule *Bm = FindThinLTOModule(*BMsOrErr);
// We have nothing to do if the file contains no ThinLTO module. This is
// possible if ThinLTO compilation was not able to split module. Content of
// the file was already processed by indexing and will be passed to the
// linker using merged object file.
if (!Bm) {
auto M = llvm::make_unique<llvm::Module>("empty", *VMContext);
M->setTargetTriple(CI.getTargetOpts().Triple);
return M;
}
Expected<std::unique_ptr<llvm::Module>> MOrErr =
Bm->parseModule(*VMContext);
if (!MOrErr)
return DiagErrors(MOrErr.takeError());
return std::move(*MOrErr);
}
llvm::SMDiagnostic Err;
if (std::unique_ptr<llvm::Module> M = parseIR(MBRef, Err, *VMContext))
return M;
// Translate from the diagnostic info to the SourceManager location if
// available.
// TODO: Unify this with ConvertBackendLocation()
SourceLocation Loc;
if (Err.getLineNo() > 0) {
assert(Err.getColumnNo() >= 0);
Loc = SM.translateFileLineCol(SM.getFileEntryForID(SM.getMainFileID()),
Err.getLineNo(), Err.getColumnNo() + 1);
}
// Strip off a leading diagnostic code if there is one.
StringRef Msg = Err.getMessage();
if (Msg.startswith("error: "))
Msg = Msg.substr(7);
unsigned DiagID =
CI.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error, "%0");
CI.getDiagnostics().Report(Loc, DiagID) << Msg;
return {};
}
void CodeGenAction::ExecuteAction() {
// If this is an IR file, we have to treat it specially.
if (getCurrentFileKind().getLanguage() == InputKind::LLVM_IR) {
BackendAction BA = static_cast<BackendAction>(Act);
CompilerInstance &CI = getCompilerInstance();
std::unique_ptr<raw_pwrite_stream> OS =
GetOutputStream(CI, getCurrentFile(), BA);
if (BA != Backend_EmitNothing && !OS)
return;
bool Invalid;
SourceManager &SM = CI.getSourceManager();
FileID FID = SM.getMainFileID();
llvm::MemoryBuffer *MainFile = SM.getBuffer(FID, &Invalid);
if (Invalid)
return;
TheModule = loadModule(*MainFile);
if (!TheModule)
return;
const TargetOptions &TargetOpts = CI.getTargetOpts();
if (TheModule->getTargetTriple() != TargetOpts.Triple) {
CI.getDiagnostics().Report(SourceLocation(),
diag::warn_fe_override_module)
<< TargetOpts.Triple;
TheModule->setTargetTriple(TargetOpts.Triple);
}
EmbedBitcode(TheModule.get(), CI.getCodeGenOpts(),
MainFile->getMemBufferRef());
LLVMContext &Ctx = TheModule->getContext();
Ctx.setInlineAsmDiagnosticHandler(BitcodeInlineAsmDiagHandler,
&CI.getDiagnostics());
EmitBackendOutput(CI.getDiagnostics(), CI.getHeaderSearchOpts(),
CI.getCodeGenOpts(), TargetOpts, CI.getLangOpts(),
CI.getTarget().getDataLayout(), TheModule.get(), BA,
std::move(OS));
return;
}
// Otherwise follow the normal AST path.
this->ASTFrontendAction::ExecuteAction();
}
//
void EmitAssemblyAction::anchor() { }
EmitAssemblyAction::EmitAssemblyAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitAssembly, _VMContext) {}
void EmitBCAction::anchor() { }
EmitBCAction::EmitBCAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitBC, _VMContext) {}
void EmitLLVMAction::anchor() { }
EmitLLVMAction::EmitLLVMAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitLL, _VMContext) {}
void EmitLLVMOnlyAction::anchor() { }
EmitLLVMOnlyAction::EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitNothing, _VMContext) {}
void EmitCodeGenOnlyAction::anchor() { }
EmitCodeGenOnlyAction::EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitMCNull, _VMContext) {}
void EmitObjAction::anchor() { }
EmitObjAction::EmitObjAction(llvm::LLVMContext *_VMContext)
: CodeGenAction(Backend_EmitObj, _VMContext) {}
| youtube/cobalt | third_party/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp | C++ | bsd-3-clause | 41,495 | [
30522,
1013,
1013,
1027,
1027,
1027,
1011,
1011,
1011,
3642,
6914,
18908,
3258,
1012,
18133,
2361,
1011,
2222,
2615,
2213,
3642,
4245,
2392,
10497,
2895,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1027,
1027,
1027,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core import management
from django.test import TestCase
from django.utils.six import StringIO
from .models import (
Car, CarDriver, Driver, Group, Membership, Person, UserMembership,
)
class M2MThroughTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.bob = Person.objects.create(name="Bob")
cls.jim = Person.objects.create(name="Jim")
cls.rock = Group.objects.create(name="Rock")
cls.roll = Group.objects.create(name="Roll")
cls.frank = User.objects.create_user("frank", "frank@example.com", "password")
cls.jane = User.objects.create_user("jane", "jane@example.com", "password")
# normal intermediate model
cls.bob_rock = Membership.objects.create(person=cls.bob, group=cls.rock)
cls.bob_roll = Membership.objects.create(person=cls.bob, group=cls.roll, price=50)
cls.jim_rock = Membership.objects.create(person=cls.jim, group=cls.rock, price=50)
# intermediate model with custom id column
cls.frank_rock = UserMembership.objects.create(user=cls.frank, group=cls.rock)
cls.frank_roll = UserMembership.objects.create(user=cls.frank, group=cls.roll)
cls.jane_rock = UserMembership.objects.create(user=cls.jane, group=cls.rock)
def test_retrieve_reverse_m2m_items(self):
self.assertQuerysetEqual(
self.bob.group_set.all(), [
"<Group: Rock>",
"<Group: Roll>",
],
ordered=False
)
def test_retrieve_forward_m2m_items(self):
self.assertQuerysetEqual(
self.roll.members.all(), [
"<Person: Bob>",
]
)
def test_cannot_use_setattr_on_reverse_m2m_with_intermediary_model(self):
msg = (
"Cannot set values on a ManyToManyField which specifies an "
"intermediary model. Use m2m_through_regress.Membership's Manager "
"instead."
)
with self.assertRaisesMessage(AttributeError, msg):
self.bob.group_set.set([])
def test_cannot_use_setattr_on_forward_m2m_with_intermediary_model(self):
msg = (
"Cannot set values on a ManyToManyField which specifies an "
"intermediary model. Use m2m_through_regress.Membership's Manager "
"instead."
)
with self.assertRaisesMessage(AttributeError, msg):
self.roll.members.set([])
def test_cannot_use_create_on_m2m_with_intermediary_model(self):
with self.assertRaises(AttributeError):
self.rock.members.create(name="Anne")
def test_cannot_use_create_on_reverse_m2m_with_intermediary_model(self):
with self.assertRaises(AttributeError):
self.bob.group_set.create(name="Funk")
def test_retrieve_reverse_m2m_items_via_custom_id_intermediary(self):
self.assertQuerysetEqual(
self.frank.group_set.all(), [
"<Group: Rock>",
"<Group: Roll>",
],
ordered=False
)
def test_retrieve_forward_m2m_items_via_custom_id_intermediary(self):
self.assertQuerysetEqual(
self.roll.user_members.all(), [
"<User: frank>",
]
)
def test_join_trimming_forwards(self):
"""
Too many copies of the intermediate table aren't involved when doing a
join (#8046, #8254).
"""
self.assertQuerysetEqual(
self.rock.members.filter(membership__price=50), [
"<Person: Jim>",
]
)
def test_join_trimming_reverse(self):
self.assertQuerysetEqual(
self.bob.group_set.filter(membership__price=50), [
"<Group: Roll>",
]
)
class M2MThroughSerializationTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.bob = Person.objects.create(name="Bob")
cls.roll = Group.objects.create(name="Roll")
cls.bob_roll = Membership.objects.create(person=cls.bob, group=cls.roll)
def test_serialization(self):
"m2m-through models aren't serialized as m2m fields. Refs #8134"
pks = {"p_pk": self.bob.pk, "g_pk": self.roll.pk, "m_pk": self.bob_roll.pk}
out = StringIO()
management.call_command("dumpdata", "m2m_through_regress", format="json", stdout=out)
self.assertJSONEqual(
out.getvalue().strip(),
'[{"pk": %(m_pk)s, "model": "m2m_through_regress.membership", "fields": {"person": %(p_pk)s, "price": '
'100, "group": %(g_pk)s}}, {"pk": %(p_pk)s, "model": "m2m_through_regress.person", "fields": {"name": '
'"Bob"}}, {"pk": %(g_pk)s, "model": "m2m_through_regress.group", "fields": {"name": "Roll"}}]'
% pks
)
out = StringIO()
management.call_command("dumpdata", "m2m_through_regress", format="xml", indent=2, stdout=out)
self.assertXMLEqual(out.getvalue().strip(), """
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
<object pk="%(m_pk)s" model="m2m_through_regress.membership">
<field to="m2m_through_regress.person" name="person" rel="ManyToOneRel">%(p_pk)s</field>
<field to="m2m_through_regress.group" name="group" rel="ManyToOneRel">%(g_pk)s</field>
<field type="IntegerField" name="price">100</field>
</object>
<object pk="%(p_pk)s" model="m2m_through_regress.person">
<field type="CharField" name="name">Bob</field>
</object>
<object pk="%(g_pk)s" model="m2m_through_regress.group">
<field type="CharField" name="name">Roll</field>
</object>
</django-objects>
""".strip() % pks)
class ToFieldThroughTests(TestCase):
def setUp(self):
self.car = Car.objects.create(make="Toyota")
self.driver = Driver.objects.create(name="Ryan Briscoe")
CarDriver.objects.create(car=self.car, driver=self.driver)
# We are testing if wrong objects get deleted due to using wrong
# field value in m2m queries. So, it is essential that the pk
# numberings do not match.
# Create one intentionally unused driver to mix up the autonumbering
self.unused_driver = Driver.objects.create(name="Barney Gumble")
# And two intentionally unused cars.
self.unused_car1 = Car.objects.create(make="Trabant")
self.unused_car2 = Car.objects.create(make="Wartburg")
def test_to_field(self):
self.assertQuerysetEqual(
self.car.drivers.all(),
["<Driver: Ryan Briscoe>"]
)
def test_to_field_reverse(self):
self.assertQuerysetEqual(
self.driver.car_set.all(),
["<Car: Toyota>"]
)
def test_to_field_clear_reverse(self):
self.driver.car_set.clear()
self.assertQuerysetEqual(
self.driver.car_set.all(), [])
def test_to_field_clear(self):
self.car.drivers.clear()
self.assertQuerysetEqual(
self.car.drivers.all(), [])
# Low level tests for _add_items and _remove_items. We test these methods
# because .add/.remove aren't available for m2m fields with through, but
# through is the only way to set to_field currently. We do want to make
# sure these methods are ready if the ability to use .add or .remove with
# to_field relations is added some day.
def test_add(self):
self.assertQuerysetEqual(
self.car.drivers.all(),
["<Driver: Ryan Briscoe>"]
)
# Yikes - barney is going to drive...
self.car.drivers._add_items('car', 'driver', self.unused_driver)
self.assertQuerysetEqual(
self.car.drivers.all(),
["<Driver: Barney Gumble>", "<Driver: Ryan Briscoe>"]
)
def test_add_null(self):
nullcar = Car.objects.create(make=None)
with self.assertRaises(ValueError):
nullcar.drivers._add_items('car', 'driver', self.unused_driver)
def test_add_related_null(self):
nulldriver = Driver.objects.create(name=None)
with self.assertRaises(ValueError):
self.car.drivers._add_items('car', 'driver', nulldriver)
def test_add_reverse(self):
car2 = Car.objects.create(make="Honda")
self.assertQuerysetEqual(
self.driver.car_set.all(),
["<Car: Toyota>"]
)
self.driver.car_set._add_items('driver', 'car', car2)
self.assertQuerysetEqual(
self.driver.car_set.all(),
["<Car: Toyota>", "<Car: Honda>"],
ordered=False
)
def test_add_null_reverse(self):
nullcar = Car.objects.create(make=None)
with self.assertRaises(ValueError):
self.driver.car_set._add_items('driver', 'car', nullcar)
def test_add_null_reverse_related(self):
nulldriver = Driver.objects.create(name=None)
with self.assertRaises(ValueError):
nulldriver.car_set._add_items('driver', 'car', self.car)
def test_remove(self):
self.assertQuerysetEqual(
self.car.drivers.all(),
["<Driver: Ryan Briscoe>"]
)
self.car.drivers._remove_items('car', 'driver', self.driver)
self.assertQuerysetEqual(
self.car.drivers.all(), [])
def test_remove_reverse(self):
self.assertQuerysetEqual(
self.driver.car_set.all(),
["<Car: Toyota>"]
)
self.driver.car_set._remove_items('driver', 'car', self.car)
self.assertQuerysetEqual(
self.driver.car_set.all(), [])
class ThroughLoadDataTestCase(TestCase):
fixtures = ["m2m_through"]
def test_sequence_creation(self):
"""
Sequences on an m2m_through are created for the through model, not a
phantom auto-generated m2m table (#11107).
"""
out = StringIO()
management.call_command("dumpdata", "m2m_through_regress", format="json", stdout=out)
self.assertJSONEqual(
out.getvalue().strip(),
'[{"pk": 1, "model": "m2m_through_regress.usermembership", "fields": {"price": 100, "group": 1, "user"'
': 1}}, {"pk": 1, "model": "m2m_through_regress.person", "fields": {"name": "Guido"}}, {"pk": 1, '
'"model": "m2m_through_regress.group", "fields": {"name": "Python Core Group"}}]'
)
| frishberg/django | tests/m2m_through_regress/tests.py | Python | bsd-3-clause | 10,478 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
27260,
1035,
18204,
2015,
2013,
6520,
23422,
1012,
9530,
18886,
2497,
1012,
8740,
2705,
1012,
4275,
12324,
5310,
2013,
6520,
23422,
1012,
4563,
12324,
2968,
2013,
6520,
23422,
1012,
3231,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Validate_Barcode_AdapterInterface
*/
//require_once 'Zend/Validate/Barcode/AdapterInterface.php';
/**
* @category Zend
* @package Zend_Validate
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Validate_Barcode_AdapterAbstract
implements Zend_Validate_Barcode_AdapterInterface
{
/**
* Allowed barcode lengths
* @var integer|array|string
*/
protected $_length;
/**
* Allowed barcode characters
* @var string
*/
protected $_characters;
/**
* Callback to checksum function
* @var string|array
*/
protected $_checksum;
/**
* Is a checksum value included?
* @var boolean
*/
protected $_hasChecksum = true;
/**
* Checks the length of a barcode
*
* @param string $value The barcode to check for proper length
* @return boolean
*/
public function checkLength($value)
{
if (!is_string($value)) {
return false;
}
$fixum = strlen($value);
$found = false;
$length = $this->getLength();
if (is_array($length)) {
foreach ($length as $value) {
if ($fixum == $value) {
$found = true;
}
if ($value == -1) {
$found = true;
}
}
} elseif ($fixum == $length) {
$found = true;
} elseif ($length == -1) {
$found = true;
} elseif ($length == 'even') {
$count = $fixum % 2;
$found = ($count == 0) ? true : false;
} elseif ($length == 'odd') {
$count = $fixum % 2;
$found = ($count == 1) ? true : false;
}
return $found;
}
/**
* Checks for allowed characters within the barcode
*
* @param string $value The barcode to check for allowed characters
* @return boolean
*/
public function checkChars($value)
{
if (!is_string($value)) {
return false;
}
$characters = $this->getCharacters();
if ($characters == 128) {
for ($x = 0; $x < 128; ++$x) {
$value = str_replace(chr($x), '', $value);
}
} else {
$chars = str_split($characters);
foreach ($chars as $char) {
$value = str_replace($char, '', $value);
}
}
if (strlen($value) > 0) {
return false;
}
return true;
}
/**
* Validates the checksum
*
* @param string $value The barcode to check the checksum for
* @return boolean
*/
public function checksum($value)
{
$checksum = $this->getChecksum();
if (!empty($checksum)) {
if (method_exists($this, $checksum)) {
return call_user_func(array($this, $checksum), $value);
}
}
return false;
}
/**
* Returns the allowed barcode length
*
* @return string
*/
public function getLength()
{
return $this->_length;
}
/**
* Returns the allowed characters
*
* @return integer|string
*/
public function getCharacters()
{
return $this->_characters;
}
/**
* Returns the checksum function name
*
*/
public function getChecksum()
{
return $this->_checksum;
}
/**
* Returns if barcode uses checksum
*
* @return boolean
*/
public function getCheck()
{
return $this->_hasChecksum;
}
/**
* Sets the checksum validation
*
* @param boolean $check
* @return Zend_Validate_Barcode_AdapterAbstract
*/
public function setCheck($check)
{
$this->_hasChecksum = (boolean) $check;
return $this;
}
/**
* Validates the checksum (Modulo 10)
* GTIN implementation factor 3
*
* @param string $value The barcode to validate
* @return boolean
*/
protected function _gtin($value)
{
$barcode = substr($value, 0, -1);
$sum = 0;
$length = strlen($barcode) - 1;
for ($i = 0; $i <= $length; $i++) {
if (($i % 2) === 0) {
$sum += $barcode[$length - $i] * 3;
} else {
$sum += $barcode[$length - $i];
}
}
$calc = $sum % 10;
$checksum = ($calc === 0) ? 0 : (10 - $calc);
if ($value[$length + 1] != $checksum) {
return false;
}
return true;
}
/**
* Validates the checksum (Modulo 10)
* IDENTCODE implementation factors 9 and 4
*
* @param string $value The barcode to validate
* @return boolean
*/
protected function _identcode($value)
{
$barcode = substr($value, 0, -1);
$sum = 0;
$length = strlen($value) - 2;
for ($i = 0; $i <= $length; $i++) {
if (($i % 2) === 0) {
$sum += $barcode[$length - $i] * 4;
} else {
$sum += $barcode[$length - $i] * 9;
}
}
$calc = $sum % 10;
$checksum = ($calc === 0) ? 0 : (10 - $calc);
if ($value[$length + 1] != $checksum) {
return false;
}
return true;
}
/**
* Validates the checksum (Modulo 10)
* CODE25 implementation factor 3
*
* @param string $value The barcode to validate
* @return boolean
*/
protected function _code25($value)
{
$barcode = substr($value, 0, -1);
$sum = 0;
$length = strlen($barcode) - 1;
for ($i = 0; $i <= $length; $i++) {
if (($i % 2) === 0) {
$sum += $barcode[$i] * 3;
} else {
$sum += $barcode[$i];
}
}
$calc = $sum % 10;
$checksum = ($calc === 0) ? 0 : (10 - $calc);
if ($value[$length + 1] != $checksum) {
return false;
}
return true;
}
/**
* Validates the checksum ()
* POSTNET implementation
*
* @param string $value The barcode to validate
* @return boolean
*/
protected function _postnet($value)
{
$checksum = substr($value, -1, 1);
$values = str_split(substr($value, 0, -1));
$check = 0;
foreach($values as $row) {
$check += $row;
}
$check %= 10;
$check = 10 - $check;
if ($check == $checksum) {
return true;
}
return false;
}
}
| default1406/PhyLab | wecenter/system/Zend/Validate/Barcode/AdapterAbstract.php | PHP | gpl-2.0 | 7,539 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
16729,
2094,
7705,
1008,
1008,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2047,
18667,
2094,
6105,
2008,
2003,
24378,
1008,
2007,
2023,
7427,
1999,
1996,
5371,
6105,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2012 osCommerce
Released under the GNU General Public License
*/
////
// Sets the status of a special product
function tep_set_specials_status($specials_id, $status) {
return tep_db_query("update " . TABLE_SPECIALS . " set status = '" . (int)$status . "', date_status_change = now() where specials_id = '" . (int)$specials_id . "'");
}
////
// Auto expire products on special
function tep_expire_specials() {
$specials_query = tep_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
if (tep_db_num_rows($specials_query)) {
while ($specials = tep_db_fetch_array($specials_query)) {
tep_set_specials_status($specials['specials_id'], '0');
}
}
}
?> | sorted2323/msi | store/includes/functions/specials.php | PHP | gpl-3.0 | 877 | [
30522,
1026,
1029,
25718,
1013,
1008,
1002,
8909,
1002,
9808,
9006,
5017,
3401,
1010,
2330,
3120,
1041,
1011,
6236,
7300,
8299,
1024,
1013,
1013,
7479,
1012,
9808,
9006,
5017,
3401,
1012,
4012,
9385,
1006,
1039,
1007,
2262,
9808,
9006,
50... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// Simple hash functions used for internal data structures
#ifndef TENSORFLOW_LIB_HASH_HASH_H_
#define TENSORFLOW_LIB_HASH_HASH_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
extern uint32 Hash32(const char* data, size_t n, uint32 seed);
extern uint64 Hash64(const char* data, size_t n, uint64 seed);
inline uint64 Hash64(const char* data, size_t n) {
return Hash64(data, n, 0xDECAFCAFFE);
}
inline uint64 Hash64(const string& str) {
return Hash64(str.data(), str.size());
}
inline uint64 Hash64Combine(uint64 a, uint64 b) {
return a ^ (b + 0x9e3779b97f4a7800ULL + (a << 10) + (a >> 4));
}
} // namespace tensorflow
#endif // TENSORFLOW_LIB_HASH_HASH_H_
| neilhan/tensorflow | tensorflow/core/lib/hash/hash.h | C | apache-2.0 | 1,424 | [
30522,
1013,
1008,
9385,
2325,
1996,
23435,
12314,
6048,
1012,
2035,
2916,
9235,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.communication.models;
import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner;
/** An immutable client-side representation of LinkedNotificationHub. */
public interface LinkedNotificationHub {
/**
* Gets the resourceId property: The resource ID of the notification hub.
*
* @return the resourceId value.
*/
String resourceId();
/**
* Gets the inner com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner object.
*
* @return the inner object.
*/
LinkedNotificationHubInner innerModel();
}
| Azure/azure-sdk-for-java | sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.java | Java | mit | 796 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
7000,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
3642,
7013,
2011,
7513,
1006,
1054,
1007,
8285,
28533,
3642,
30524,
24296,
1012,
7692,
24805,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import os
import pygtk
pygtk.require('2.0')
import gtk
from gtkcodebuffer import CodeBuffer, SyntaxLoader
class Ui(object):
"""
The user interface. This dialog is the LaTeX input window and includes
widgets to display compilation logs and a preview. It uses GTK2 which
must be installed an importable.
"""
app_name = 'InkTeX'
help_text = r"""You can set a preamble file and scale factor in the <b>settings</b> tab. The preamble should not include <b>\documentclass</b> and <b>\begin{document}</b>.
The LaTeX code you write is only the stuff between <b>\begin{document}</b> and <b>\end{document}</b>. Compilation errors are reported in the <b>log</b> tab.
The preamble file and scale factor are stored on a per-drawing basis, so in a new document, these information must be set again."""
about_text = r"""Written by <a href="mailto:janoliver@oelerich.org">Jan Oliver Oelerich <janoliver@oelerich.org></a>"""
def __init__(self, render_callback, src, settings):
"""Takes the following parameters:
* render_callback: callback function to execute with "apply" button
* src: source code that should be pre-inserted into the LaTeX input"""
self.render_callback = render_callback
self.src = src if src else ""
self.settings = settings
# init the syntax highlighting buffer
lang = SyntaxLoader("latex")
self.syntax_buffer = CodeBuffer(lang=lang)
self.setup_ui()
def render(self, widget, data=None):
"""Extracts the input LaTeX code and calls the render callback. If that
returns true, we quit and are happy."""
buf = self.text.get_buffer()
tex = buf.get_text(buf.get_start_iter(), buf.get_end_iter())
settings = dict()
if self.preamble.get_filename():
settings['preamble'] = self.preamble.get_filename()
settings['scale'] = self.scale.get_value()
if self.render_callback(tex, settings):
gtk.main_quit()
return False
def cancel(self, widget, data=None):
"""Close button pressed: Exit"""
raise SystemExit(1)
def destroy(self, widget, event, data=None):
"""Destroy hook for the GTK window. Quit and return False."""
gtk.main_quit()
return False
def setup_ui(self):
"""Creates the actual UI."""
# create a floating toplevel window and set some title and border
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.set_title(self.app_name)
self.window.set_border_width(8)
# connect delete and destroy events
self.window.connect("destroy", self.destroy)
self.window.connect("delete-event", self.destroy)
# This is our main container, vertically ordered.
self.box_container = gtk.VBox(False, 5)
self.box_container.show()
self.notebook = gtk.Notebook()
self.page_latex = gtk.HBox(False, 5)
self.page_latex.set_border_width(8)
self.page_latex.show()
self.page_log = gtk.HBox(False, 5)
self.page_log.set_border_width(8)
self.page_log.show()
self.page_settings = gtk.HBox(False, 5)
self.page_settings.set_border_width(8)
self.page_settings.show()
self.page_help = gtk.VBox(False, 5)
self.page_help.set_border_width(8)
self.page_help.show()
self.notebook.append_page(self.page_latex, gtk.Label("LaTeX"))
self.notebook.append_page(self.page_log, gtk.Label("Log"))
self.notebook.append_page(self.page_settings, gtk.Label("Settings"))
self.notebook.append_page(self.page_help, gtk.Label("Help"))
self.notebook.show()
# First component: The input text view for the LaTeX code.
# It lives in a ScrolledWindow so we can get some scrollbars when the
# text is too long.
self.text = gtk.TextView(self.syntax_buffer)
self.text.get_buffer().set_text(self.src)
self.text.show()
self.text_container = gtk.ScrolledWindow()
self.text_container.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
self.text_container.set_shadow_type(gtk.SHADOW_IN)
self.text_container.add(self.text)
self.text_container.set_size_request(400, 200)
self.text_container.show()
self.page_latex.pack_start(self.text_container)
# Second component: The log view
self.log_view = gtk.TextView()
self.log_view.show()
self.log_container = gtk.ScrolledWindow()
self.log_container.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
self.log_container.set_shadow_type(gtk.SHADOW_IN)
self.log_container.add(self.log_view)
self.log_container.set_size_request(400, 200)
self.log_container.show()
self.page_log.pack_start(self.log_container)
# third component: settings
self.settings_container = gtk.Table(2,2)
self.settings_container.set_row_spacings(8)
self.settings_container.show()
self.label_preamble = gtk.Label("Preamble")
self.label_preamble.set_alignment(0, 0.5)
self.label_preamble.show()
self.preamble = gtk.FileChooserButton("...")
if 'preamble' in self.settings and os.path.exists(self.settings['preamble']):
self.preamble.set_filename(self.settings['preamble'])
self.preamble.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
self.preamble.show()
self.settings_container.attach(self.label_preamble, yoptions=gtk.SHRINK,
left_attach=0, right_attach=1, top_attach=0, bottom_attach=1)
self.settings_container.attach(self.preamble, yoptions=gtk.SHRINK,
left_attach=1, right_attach=2, top_attach=0, bottom_attach=1)
self.label_scale = gtk.Label("Scale")
self.label_scale.set_alignment(0, 0.5)
self.label_scale.show()
self.scale_adjustment = gtk.Adjustment(value=1.0, lower=0, upper=100,
step_incr=0.1)
self.scale = gtk.SpinButton(adjustment=self.scale_adjustment, digits=1)
if 'scale' in self.settings:
self.scale.set_value(float(self.settings['scale']))
self.scale.show()
self.settings_container.attach(self.label_scale, yoptions=gtk.SHRINK,
left_attach=0, right_attach=1, top_attach=1, bottom_attach=2)
self.settings_container.attach(self.scale, yoptions=gtk.SHRINK,
left_attach=1, right_attach=2, top_attach=1, bottom_attach=2)
self.page_settings.pack_start(self.settings_container)
# help tab
self.help_label = gtk.Label()
self.help_label.set_markup(Ui.help_text)
self.help_label.set_line_wrap(True)
self.help_label.show()
self.about_label = gtk.Label()
self.about_label.set_markup(Ui.about_text)
self.about_label.set_line_wrap(True)
self.about_label.show()
self.separator_help = gtk.HSeparator()
self.separator_help.show()
self.page_help.pack_start(self.help_label)
self.page_help.pack_start(self.separator_help)
self.page_help.pack_start(self.about_label)
self.box_container.pack_start(self.notebook, True, True)
# separator between buttonbar and notebook
self.separator_buttons = gtk.HSeparator()
self.separator_buttons.show()
self.box_container.pack_start(self.separator_buttons, False, False)
# the button bar
self.box_buttons = gtk.HButtonBox()
self.box_buttons.set_layout(gtk.BUTTONBOX_END)
self.box_buttons.show()
self.button_render = gtk.Button(stock=gtk.STOCK_APPLY)
self.button_cancel = gtk.Button(stock=gtk.STOCK_CLOSE)
self.button_render.set_flags(gtk.CAN_DEFAULT)
self.button_render.connect("clicked", self.render, None)
self.button_cancel.connect("clicked", self.cancel, None)
self.button_render.show()
self.button_cancel.show()
self.box_buttons.pack_end(self.button_cancel)
self.box_buttons.pack_end(self.button_render)
self.box_container.pack_start(self.box_buttons, False, False)
self.window.add(self.box_container)
self.window.set_default(self.button_render)
self.window.show()
def log(self, msg):
buffer = self.log_view.get_buffer()
buffer.set_text(msg)
self.notebook.set_current_page(1)
def main(self):
gtk.main()
| hvwaldow/inktex | inktex/ui.py | Python | mit | 8,707 | [
30522,
12324,
9808,
12324,
1052,
2100,
13512,
2243,
1052,
2100,
13512,
2243,
1012,
5478,
1006,
1005,
1016,
1012,
1014,
1005,
1007,
12324,
14181,
2243,
2013,
14181,
2243,
16044,
8569,
12494,
12324,
3642,
8569,
12494,
1010,
20231,
11066,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.company;
import java.util.Scanner;
public class EvenPowersOf2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int num = 1;
for (int i = 0; i <= n ; i+=2) {
System.out.println(num);
num *= 4;
}
}
}
| ivelin1936/Studing-SoftUni- | Programing Basic/Programming Basics - Exercises/Advanced Loops/src/com/company/EvenPowersOf2.java | Java | mit | 368 | [
30522,
7427,
4012,
1012,
2194,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
26221,
1025,
2270,
2465,
2130,
11452,
6499,
2546,
2475,
1063,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
26221,
26221,
1027,
2047,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* src/threads/none/thread-none.cpp - fake threads
Copyright (C) 1996-2013
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "threads/thread.hpp"
#include <cassert>
#include "threads/condition.hpp" // for Condition
#include "threads/lock.hpp" // for lock_monitor_enter, etc
#include "threads/mutex.hpp" // for Mutex
#include "threads/thread.hpp" // for DEBUGTHREADS, etc
#include "threads/threadlist.hpp" // for ThreadList
#include "threads/ThreadRuntime.hpp" // for ThreadRuntime
#include "vm/exceptions.hpp"
#include "vm/javaobjects.hpp" // for java_lang_Thread
#include "vm/vm.hpp" // for vm_call_method
using namespace cacao;
/* global variables ***********************************************************/
threadobject *thread_current;
/* functions ******************************************************************/
/***
* Do some early initialization of stuff required.
*
* ATTENTION: Do NOT use any Java heap allocation here, as gc_init()
* is called AFTER this function!
*/
void threads_impl_preinit() {}
/***
* Initializes the implementation specific bits.
*/
void threads_impl_init() {
}
/***
* Should start a thread, nop
*/
void threads_impl_thread_start(threadobject *thread, functionptr f) {}
/* threads_set_thread_priority *************************************************
Set the priority of the given thread.
IN:
tid..........thread id
priority.....priority to set
******************************************************************************/
void threads_set_thread_priority(threadobject *t, int priority)
{
}
/**
* Detaches the current thread from the VM.
*
* @return true on success, false otherwise
*/
bool thread_detach_current_thread(void)
{
threadobject* t = thread_get_current();
/* Sanity check. */
assert(t != NULL);
/* If the given thread has already been detached, this operation
is a no-op. */
if (thread_is_attached(t) == false)
return true;
DEBUGTHREADS("detaching", t);
java_handle_t* object = LLNI_WRAP(t->object);
java_lang_Thread jlt(object);
#if defined(ENABLE_JAVASE)
java_handle_t* group = jlt.get_group();
/* If there's an uncaught exception, call uncaughtException on the
thread's exception handler, or the thread's group if this is
unset. */
java_handle_t* e = exceptions_get_and_clear_exception();
if (e != NULL) {
/* We use the type void* for handler here, as it's not trivial
to build the java_lang_Thread_UncaughtExceptionHandler
header file with cacaoh. */
java_handle_t *handler = ThreadRuntime::get_thread_exception_handler(jlt);
classinfo* c;
java_handle_t* h;
if (handler != NULL) {
LLNI_class_get(handler, c);
h = (java_handle_t *) handler;
}
else {
LLNI_class_get(group, c);
h = (java_handle_t *) group;
}
methodinfo* m = class_resolveclassmethod(c,
utf8::uncaughtException,
utf8::java_lang_Thread_java_lang_Throwable__V,
NULL,
true);
if (m == NULL)
return false;
(void) vm_call_method(m, h, object, e);
if (exceptions_get_exception())
return false;
}
/* XXX TWISTI: should all threads be in a ThreadGroup? */
/* Remove thread from the thread group. */
if (group != NULL) {
classinfo* c;
LLNI_class_get(group, c);
methodinfo *m = ThreadRuntime::get_threadgroup_remove_method(c);
if (m == NULL)
return false;
(void) vm_call_method(m, group, object);
if (exceptions_get_exception())
return false;
// Clear the ThreadGroup in the Java thread object (Mauve
// test: gnu/testlet/java/lang/Thread/getThreadGroup).
jlt.set_group(NULL);
}
#endif
/* Thread has terminated. */
thread_set_state_terminated(t);
/* Notify all threads waiting on this thread. These are joining
this thread. */
/* Free the internal thread data-structure. */
thread_free(t);
return true;
}
/**
* Suspend the passed thread. Execution of that thread stops until the thread
* is explicitly resumed again.
*
* @param thread The thread to be suspended.
* @param reason Reason for suspending the given thread.
* @return True of operation was successful, false otherwise.
*/
bool threads_suspend_thread(threadobject *thread, SuspendReason reason)
{
// Sanity check.
assert(reason != SUSPEND_REASON_NONE);
// Check if thread is already suspended.
if (thread->suspended)
return false;
// Check if thread is in the process of suspending.
if (thread->suspend_reason != SUSPEND_REASON_NONE)
return false;
// Set the reason for suspending the thread.
thread->suspend_reason = reason;
return true;
}
/**
* Resumes execution of the passed thread.
*
* @param thread The thread to be resumed.
* @param reason Reason for suspending the given thread.
* @return True of operation was successful, false otherwise.
*/
bool threads_resume_thread(threadobject *thread, SuspendReason reason)
{
// Sanity check.
assert(thread != THREADOBJECT);
assert(reason != SUSPEND_REASON_NONE);
// Check if thread really is suspended.
if (!thread->suspended)
return false;
// Threads can only be resumed for the same reason they were suspended.
if (thread->suspend_reason != reason)
return false;
// Clear the reason for suspending the thread.
thread->suspend_reason = SUSPEND_REASON_NONE;
return true;
}
void threads_impl_clear_heap_pointers(threadobject *t)
{
t->object = 0;
t->flc_object = 0;
}
/***
* Acknowledges the suspension of the current thread.
*/
void threads_suspend_ack() {}
/***
* Join all non-daemon threads.
*/
void threads_join_all_threads() {}
/***
* Clears all fields in threadobject.
*/
void threads_impl_thread_clear(threadobject *t) {
t->object = NULL;
t->thinlock = 0;
t->index = 0;
t->flags = 0;
t->state = THREAD_STATE_NEW;
t->is_in_active_list = false;
t->interrupted = false;
t->signaled = false;
t->suspended = false;
t->suspend_reason = SUSPEND_REASON_NONE;
t->pc = NULL;
t->_exceptionptr = NULL;
t->_stackframeinfo = NULL;
t->_localref_table = NULL;
#if defined(ENABLE_INTRP)
t->_global_sp = NULL;
#endif
#if defined(ENABLE_GC_CACAO)
t->gc_critical = false;
t->ss = NULL;
t->es = NULL;
#endif
// Simply reuse the existing dump memory.
}
/***
* Resets some implementation fields in threadobject.
*/
void threads_impl_thread_reuse(threadobject *t) {}
/***
* Interrupt the given thread.
*
* The thread gets its interrupted flag is set to true.
*/
void threads_thread_interrupt(threadobject *t) {
// Signal the thread a "waitcond" and tell it that it has been
// interrupted.
DEBUGTHREADS("interrupted", t);
t->interrupted = true;
}
/***
* Sleep the current thread for the specified amount of time.
*
* @param millis Milliseconds to sleep.
* @param nanos Nanoseconds to sleep.
*/
void threads_sleep(int64_t millis, int32_t nanos) {
if (millis < 0) {
exceptions_throw_illegalargumentexception(/*"timeout value is negative"*/);
return;
}
threadobject *t = thread_get_current();
if (thread_is_interrupted(t) && !exceptions_get_exception()) {
// Clear interrupted flag
// (Mauve test: gnu/testlet/java/lang/Thread/interrupt).
thread_set_interrupted(t, false);
exceptions_throw_interruptedexception(/*"sleep interrupted"*/);
return;
}
// (Note taken from classpath/vm/reference/java/lang/VMThread.java (sleep))
// Note: JDK treats a zero length sleep is like Thread.yield(),
// without checking the interrupted status of the thread. It's
// unclear if this is a bug in the implementation or the spec.
// See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203 */
if (millis == 0 && nanos == 0) {
threads_yield();
} else {
if (thread_is_interrupted(t)) {
thread_set_interrupted(t, false);
// An other exception could have been thrown
// (e.g. ThreadDeathException).
if (!exceptions_get_exception())
exceptions_throw_interruptedexception();
}
}
}
/***
* Wait for the given maximum amount of time on a monitor until either
* we are notified, we are interrupted, or the time is up.
*/
void threads_wait_with_timeout_relative(threadobject *thread, s8 millis, s4 nanos) {}
/**
* Park the current thread for the specified amount of time or until a
* specified deadline.
*
* @param absolute Is the time in nanos a deadline or a duration?
* @param nanos Nanoseconds to park (absolute=false)
* or deadline in milliseconds (absolute=true)
*/
void threads_park(bool absolute, int64_t nanos) {}
/**
* Unpark the specified thread.
*
* @param t The thread to unpark.
*/
void threads_unpark(threadobject *t) {}
/***
* Yield to the scheduler.
*/
void threads_yield(void) {}
/***
* Return the tid of a thread.
*/
intptr_t threads_get_tid(threadobject *t) {
return 0;
}
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
* Emacs will automagically detect them.
* ---------------------------------------------------------------------
* Local variables:
* mode: c++
* indent-tabs-mode: t
* c-basic-offset: 4
* tab-width: 4
* End:
* vim:noexpandtab:sw=4:ts=4:
*/
| zapster/cacao-travis | src/threads/none/thread-none.cpp | C++ | gpl-2.0 | 10,062 | [
30522,
1013,
1008,
5034,
2278,
1013,
16457,
1013,
3904,
1013,
11689,
1011,
3904,
1012,
18133,
2361,
1011,
8275,
16457,
9385,
1006,
1039,
1007,
2727,
1011,
2286,
6187,
20808,
2615,
2213,
1011,
2310,
2890,
2378,
17924,
22277,
26764,
5575,
431... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.ftfl.icare;
import java.util.List;
import com.ftfl.icare.adapter.CustomAppointmentAdapter;
import com.ftfl.icare.adapter.CustomDoctorAdapter;
import com.ftfl.icare.helper.AppointmentDataSource;
import com.ftfl.icare.helper.DoctorProfileDataSource;
import com.ftfl.icare.model.Appointment;
import com.ftfl.icare.model.DoctorProfile;
import com.ftfl.icare.util.FragmentHome;
import android.app.AlertDialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class FragmentAppointmentList extends Fragment {
TextView mId_tv = null;
AppointmentDataSource mAppointmentDataSource;
Appointment mAppointment;
FragmentManager mFrgManager;
Fragment mFragment;
Context mContext;
ListView mLvProfileList;
List<Appointment> mDoctorProfileList;
String mId;
Bundle mArgs = new Bundle();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_doctor_list, container,
false);
mContext = container.getContext();
mAppointmentDataSource = new AppointmentDataSource(getActivity());
mDoctorProfileList = mAppointmentDataSource.appointmentList();
CustomAppointmentAdapter arrayAdapter = new CustomAppointmentAdapter(
getActivity(), mDoctorProfileList);
mLvProfileList = (ListView) view.findViewById(R.id.lvDoctorList);
mLvProfileList.setAdapter(arrayAdapter);
mLvProfileList
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
final int pos = position;
new AlertDialog.Builder(mContext)
.setTitle("Delete entry")
.setMessage(
"Are you sure you want to delete this entry?")
.setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
mAppointmentDataSource = new AppointmentDataSource(
getActivity());
if (mAppointmentDataSource.deleteData(Integer
.parseInt(mDoctorProfileList
.get(pos)
.getId())) == true) {
Toast toast = Toast
.makeText(
getActivity(),
"Successfully Deleted.",
Toast.LENGTH_LONG);
toast.show();
mFragment = new FragmentHome();
mFrgManager = getFragmentManager();
mFrgManager
.beginTransaction()
.replace(
R.id.content_frame,
mFragment)
.commit();
setTitle("Home");
} else {
Toast toast = Toast
.makeText(
getActivity(),
"Error, Couldn't inserted data to database",
Toast.LENGTH_LONG);
toast.show();
}
}
})
.setNegativeButton(android.R.string.no,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
// do nothing
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
});
return view;
}
public void setTitle(CharSequence title) {
getActivity().getActionBar().setTitle(title);
}
} | FTFL02-ANDROID/julkarnine | ICare/src/com/ftfl/icare/FragmentAppointmentList.java | Java | apache-2.0 | 3,803 | [
30522,
7427,
4012,
1012,
3027,
10258,
1012,
24582,
12069,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
4012,
1012,
3027,
10258,
1012,
24582,
12069,
1012,
15581,
2121,
1012,
7661,
29098,
25785,
3672,
8447,
13876,
2121,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenSlx.Lib.AutoWire
{
/// <summary>
/// Indicates whether the method executes as a pre, post, or main step.
/// </summary>
public enum TargetStepType
{
Primary,
PreExecute,
PostExecute,
PostFlush
}
}
| ngaller/OpenSlx | OpenSlx.Lib/AutoWire/TargetStepType.cs | C# | apache-2.0 | 383 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
7480,
2140,
2595,
1012,
5622,
2497,
1012,
8285,
20357,
1063,
1013,
1013,
1013,
1026,
12654,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef __AGENT_H
#define __AGENT_H
#include "libssh/libssh.h"
/* Messages for the authentication agent connection. */
#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
#define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
#define SSH_AGENTC_RSA_CHALLENGE 3
#define SSH_AGENT_RSA_RESPONSE 4
#define SSH_AGENT_FAILURE 5
#define SSH_AGENT_SUCCESS 6
#define SSH_AGENTC_ADD_RSA_IDENTITY 7
#define SSH_AGENTC_REMOVE_RSA_IDENTITY 8
#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9
/* private OpenSSH extensions for SSH2 */
#define SSH2_AGENTC_REQUEST_IDENTITIES 11
#define SSH2_AGENT_IDENTITIES_ANSWER 12
#define SSH2_AGENTC_SIGN_REQUEST 13
#define SSH2_AGENT_SIGN_RESPONSE 14
#define SSH2_AGENTC_ADD_IDENTITY 17
#define SSH2_AGENTC_REMOVE_IDENTITY 18
#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
/* smartcard */
#define SSH_AGENTC_ADD_SMARTCARD_KEY 20
#define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21
/* lock/unlock the agent */
#define SSH_AGENTC_LOCK 22
#define SSH_AGENTC_UNLOCK 23
/* add key with constraints */
#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24
#define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
#define SSH_AGENT_CONSTRAIN_LIFETIME 1
#define SSH_AGENT_CONSTRAIN_CONFIRM 2
/* extended failure messages */
#define SSH2_AGENT_FAILURE 30
/* additional error code for ssh.com's ssh-agent2 */
#define SSH_COM_AGENT2_FAILURE 102
#define SSH_AGENT_OLD_SIGNATURE 0x01
struct ssh_agent_struct {
struct socket *sock;
ssh_buffer ident;
unsigned int count;
};
#ifndef _WIN32
/* agent.c */
/**
* @brief Create a new ssh agent structure.
*
* @return An allocated ssh agent structure or NULL on error.
*/
struct ssh_agent_struct *agent_new(struct ssh_session_struct *session);
void agent_close(struct ssh_agent_struct *agent);
/**
* @brief Free an allocated ssh agent structure.
*
* @param agent The ssh agent structure to free.
*/
void agent_free(struct ssh_agent_struct *agent);
/**
* @brief Check if the ssh agent is running.
*
* @param session The ssh session to check for the agent.
*
* @return 1 if it is running, 0 if not.
*/
int agent_is_running(struct ssh_session_struct *session);
int agent_get_ident_count(struct ssh_session_struct *session);
struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *session,
char **comment);
struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session_struct *session,
char **comment);
ssh_string agent_sign_data(struct ssh_session_struct *session,
struct ssh_buffer_struct *data,
struct ssh_public_key_struct *pubkey);
#endif
#endif /* __AGENT_H */
/* vim: set ts=2 sw=2 et cindent: */
| erichuang1994/fbbs | include/libssh/agent.h | C | gpl-3.0 | 3,014 | [
30522,
1001,
2065,
13629,
2546,
1035,
1035,
4005,
1035,
1044,
1001,
9375,
1035,
1035,
4005,
1035,
1044,
1001,
2421,
1000,
5622,
5910,
4095,
1013,
5622,
5910,
4095,
1012,
1044,
1000,
1013,
1008,
7696,
2005,
1996,
27280,
4005,
4434,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class GetIplayer < Formula
desc "Utility for downloading TV and radio programmes from BBC iPlayer"
homepage "https://github.com/get-iplayer/get_iplayer"
url "https://github.com/get-iplayer/get_iplayer/archive/v3.06.tar.gz"
sha256 "fba3f1abd01ca6f9aaed30f9650e1e520fd3b2147fe6aa48fe7c747725b205f7"
head "https://github.com/get-iplayer/get_iplayer.git", :branch => "develop"
bottle do
cellar :any_skip_relocation
sha256 "1ed429e5a0b2df706f9015c8ca40f5b485e7e0ae68dfee45c76f784eca32b553" => :high_sierra
sha256 "1c9101656db2554d72b6f53d13fba9f84890f82119414675c5f62fb7e126373e" => :sierra
sha256 "1c9101656db2554d72b6f53d13fba9f84890f82119414675c5f62fb7e126373e" => :el_capitan
end
depends_on "atomicparsley" => :recommended
depends_on "ffmpeg" => :recommended
depends_on :macos => :yosemite
resource "IO::Socket::IP" do
url "https://cpan.metacpan.org/authors/id/P/PE/PEVANS/IO-Socket-IP-0.39.tar.gz"
sha256 "11950da7636cb786efd3bfb5891da4c820975276bce43175214391e5c32b7b96"
end
resource "Mojolicious" do
url "https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-7.48.tar.gz"
sha256 "86d28e66a352e808ab1eae64ef93b90a9a92b3c1b07925bd2d3387a9e852388e"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
end
inreplace ["get_iplayer", "get_iplayer.cgi"] do |s|
s.gsub!(/^(my \$version_text);/i, "\\1 = \"#{pkg_version}-homebrew\";")
s.gsub! "#!/usr/bin/env perl", "#!/usr/bin/perl"
end
bin.install "get_iplayer", "get_iplayer.cgi"
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
man1.install "get_iplayer.1"
end
test do
output = shell_output("\"#{bin}/get_iplayer\" --refresh --refresh-include=\"BBC None\" --quiet dontshowanymatches 2>&1")
assert_match "get_iplayer #{pkg_version}-homebrew", output, "Unexpected version"
assert_match "INFO: 0 matching programmes", output, "Unexpected output"
assert_match "INFO: Indexing tv programmes (concurrent)", output,
"Mojolicious not found"
end
end
| grhawk/homebrew-core | Formula/get_iplayer.rb | Ruby | bsd-2-clause | 2,242 | [
30522,
2465,
2131,
11514,
24314,
1026,
5675,
4078,
2278,
1000,
9710,
2005,
8816,
2075,
2694,
1998,
2557,
8497,
2013,
4035,
12997,
24314,
1000,
2188,
13704,
1000,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2131,
1011,
129... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: object_detection/protos/post_processing.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "object_detection/protos/post_processing.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace object_detection {
namespace protos {
class BatchNonMaxSuppressionDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<BatchNonMaxSuppression>
_instance;
} _BatchNonMaxSuppression_default_instance_;
class PostProcessingDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<PostProcessing>
_instance;
} _PostProcessing_default_instance_;
namespace protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto {
namespace {
::google::protobuf::Metadata file_level_metadata[2];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
} // namespace
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
};
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
::google::protobuf::internal::AuxillaryParseTableField(),
};
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
};
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, score_threshold_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, iou_threshold_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, max_detections_per_class_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, max_total_detections_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, use_static_shapes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, use_class_agnostic_nms_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, max_classes_per_detection_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BatchNonMaxSuppression, soft_nms_sigma_),
0,
4,
5,
6,
1,
2,
7,
3,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, _has_bits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, batch_non_max_suppression_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, score_converter_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, logit_scale_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PostProcessing, calibration_config_),
0,
2,
3,
1,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{ 0, 13, sizeof(BatchNonMaxSuppression)},
{ 21, 30, sizeof(PostProcessing)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
reinterpret_cast<const ::google::protobuf::Message*>(&_BatchNonMaxSuppression_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_PostProcessing_default_instance_),
};
namespace {
void protobuf_AssignDescriptors() {
AddDescriptors();
::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
"object_detection/protos/post_processing.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
}
void protobuf_AssignDescriptorsOnce() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
}
} // namespace
void TableStruct::InitDefaultsImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::internal::InitProtobufDefaults();
::object_detection::protos::protobuf_object_5fdetection_2fprotos_2fcalibration_2eproto::InitDefaults();
_BatchNonMaxSuppression_default_instance_._instance.DefaultConstruct();
::google::protobuf::internal::OnShutdownDestroyMessage(
&_BatchNonMaxSuppression_default_instance_);_PostProcessing_default_instance_._instance.DefaultConstruct();
::google::protobuf::internal::OnShutdownDestroyMessage(
&_PostProcessing_default_instance_);_PostProcessing_default_instance_._instance.get_mutable()->batch_non_max_suppression_ = const_cast< ::object_detection::protos::BatchNonMaxSuppression*>(
::object_detection::protos::BatchNonMaxSuppression::internal_default_instance());
_PostProcessing_default_instance_._instance.get_mutable()->calibration_config_ = const_cast< ::object_detection::protos::CalibrationConfig*>(
::object_detection::protos::CalibrationConfig::internal_default_instance());
}
void InitDefaults() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
}
namespace {
void AddDescriptorsImpl() {
InitDefaults();
static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n-object_detection/protos/post_processin"
"g.proto\022\027object_detection.protos\032)object"
"_detection/protos/calibration.proto\"\244\002\n\026"
"BatchNonMaxSuppression\022\032\n\017score_threshol"
"d\030\001 \001(\002:\0010\022\032\n\riou_threshold\030\002 \001(\002:\0030.6\022%"
"\n\030max_detections_per_class\030\003 \001(\005:\003100\022!\n"
"\024max_total_detections\030\005 \001(\005:\003100\022 \n\021use_"
"static_shapes\030\006 \001(\010:\005false\022%\n\026use_class_"
"agnostic_nms\030\007 \001(\010:\005false\022$\n\031max_classes"
"_per_detection\030\010 \001(\005:\0011\022\031\n\016soft_nms_sigm"
"a\030\t \001(\002:\0010\"\331\002\n\016PostProcessing\022R\n\031batch_n"
"on_max_suppression\030\001 \001(\0132/.object_detect"
"ion.protos.BatchNonMaxSuppression\022Y\n\017sco"
"re_converter\030\002 \001(\01626.object_detection.pr"
"otos.PostProcessing.ScoreConverter:\010IDEN"
"TITY\022\026\n\013logit_scale\030\003 \001(\002:\0011\022F\n\022calibrat"
"ion_config\030\004 \001(\0132*.object_detection.prot"
"os.CalibrationConfig\"8\n\016ScoreConverter\022\014"
"\n\010IDENTITY\020\000\022\013\n\007SIGMOID\020\001\022\013\n\007SOFTMAX\020\002"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
descriptor, 758);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"object_detection/protos/post_processing.proto", &protobuf_RegisterTypes);
::object_detection::protos::protobuf_object_5fdetection_2fprotos_2fcalibration_2eproto::AddDescriptors();
}
} // anonymous namespace
void AddDescriptors() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
StaticDescriptorInitializer() {
AddDescriptors();
}
} static_descriptor_initializer;
} // namespace protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto
const ::google::protobuf::EnumDescriptor* PostProcessing_ScoreConverter_descriptor() {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::file_level_enum_descriptors[0];
}
bool PostProcessing_ScoreConverter_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const PostProcessing_ScoreConverter PostProcessing::IDENTITY;
const PostProcessing_ScoreConverter PostProcessing::SIGMOID;
const PostProcessing_ScoreConverter PostProcessing::SOFTMAX;
const PostProcessing_ScoreConverter PostProcessing::ScoreConverter_MIN;
const PostProcessing_ScoreConverter PostProcessing::ScoreConverter_MAX;
const int PostProcessing::ScoreConverter_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int BatchNonMaxSuppression::kScoreThresholdFieldNumber;
const int BatchNonMaxSuppression::kIouThresholdFieldNumber;
const int BatchNonMaxSuppression::kMaxDetectionsPerClassFieldNumber;
const int BatchNonMaxSuppression::kMaxTotalDetectionsFieldNumber;
const int BatchNonMaxSuppression::kUseStaticShapesFieldNumber;
const int BatchNonMaxSuppression::kUseClassAgnosticNmsFieldNumber;
const int BatchNonMaxSuppression::kMaxClassesPerDetectionFieldNumber;
const int BatchNonMaxSuppression::kSoftNmsSigmaFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
BatchNonMaxSuppression::BatchNonMaxSuppression()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:object_detection.protos.BatchNonMaxSuppression)
}
BatchNonMaxSuppression::BatchNonMaxSuppression(const BatchNonMaxSuppression& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(&score_threshold_, &from.score_threshold_,
static_cast<size_t>(reinterpret_cast<char*>(&max_classes_per_detection_) -
reinterpret_cast<char*>(&score_threshold_)) + sizeof(max_classes_per_detection_));
// @@protoc_insertion_point(copy_constructor:object_detection.protos.BatchNonMaxSuppression)
}
void BatchNonMaxSuppression::SharedCtor() {
_cached_size_ = 0;
::memset(&score_threshold_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&soft_nms_sigma_) -
reinterpret_cast<char*>(&score_threshold_)) + sizeof(soft_nms_sigma_));
iou_threshold_ = 0.6f;
max_detections_per_class_ = 100;
max_total_detections_ = 100;
max_classes_per_detection_ = 1;
}
BatchNonMaxSuppression::~BatchNonMaxSuppression() {
// @@protoc_insertion_point(destructor:object_detection.protos.BatchNonMaxSuppression)
SharedDtor();
}
void BatchNonMaxSuppression::SharedDtor() {
}
void BatchNonMaxSuppression::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BatchNonMaxSuppression::descriptor() {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const BatchNonMaxSuppression& BatchNonMaxSuppression::default_instance() {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::InitDefaults();
return *internal_default_instance();
}
BatchNonMaxSuppression* BatchNonMaxSuppression::New(::google::protobuf::Arena* arena) const {
BatchNonMaxSuppression* n = new BatchNonMaxSuppression;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void BatchNonMaxSuppression::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.BatchNonMaxSuppression)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 255u) {
::memset(&score_threshold_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&soft_nms_sigma_) -
reinterpret_cast<char*>(&score_threshold_)) + sizeof(soft_nms_sigma_));
iou_threshold_ = 0.6f;
max_detections_per_class_ = 100;
max_total_detections_ = 100;
max_classes_per_detection_ = 1;
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool BatchNonMaxSuppression::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:object_detection.protos.BatchNonMaxSuppression)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional float score_threshold = 1 [default = 0];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(13u /* 13 & 0xFF */)) {
set_has_score_threshold();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &score_threshold_)));
} else {
goto handle_unusual;
}
break;
}
// optional float iou_threshold = 2 [default = 0.6];
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(21u /* 21 & 0xFF */)) {
set_has_iou_threshold();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &iou_threshold_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 max_detections_per_class = 3 [default = 100];
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
set_has_max_detections_per_class();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &max_detections_per_class_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 max_total_detections = 5 [default = 100];
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
set_has_max_total_detections();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &max_total_detections_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool use_static_shapes = 6 [default = false];
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
set_has_use_static_shapes();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &use_static_shapes_)));
} else {
goto handle_unusual;
}
break;
}
// optional bool use_class_agnostic_nms = 7 [default = false];
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(56u /* 56 & 0xFF */)) {
set_has_use_class_agnostic_nms();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &use_class_agnostic_nms_)));
} else {
goto handle_unusual;
}
break;
}
// optional int32 max_classes_per_detection = 8 [default = 1];
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) {
set_has_max_classes_per_detection();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &max_classes_per_detection_)));
} else {
goto handle_unusual;
}
break;
}
// optional float soft_nms_sigma = 9 [default = 0];
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(77u /* 77 & 0xFF */)) {
set_has_soft_nms_sigma();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &soft_nms_sigma_)));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:object_detection.protos.BatchNonMaxSuppression)
return true;
failure:
// @@protoc_insertion_point(parse_failure:object_detection.protos.BatchNonMaxSuppression)
return false;
#undef DO_
}
void BatchNonMaxSuppression::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:object_detection.protos.BatchNonMaxSuppression)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional float score_threshold = 1 [default = 0];
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(1, this->score_threshold(), output);
}
// optional float iou_threshold = 2 [default = 0.6];
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->iou_threshold(), output);
}
// optional int32 max_detections_per_class = 3 [default = 100];
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->max_detections_per_class(), output);
}
// optional int32 max_total_detections = 5 [default = 100];
if (cached_has_bits & 0x00000040u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->max_total_detections(), output);
}
// optional bool use_static_shapes = 6 [default = false];
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteBool(6, this->use_static_shapes(), output);
}
// optional bool use_class_agnostic_nms = 7 [default = false];
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteBool(7, this->use_class_agnostic_nms(), output);
}
// optional int32 max_classes_per_detection = 8 [default = 1];
if (cached_has_bits & 0x00000080u) {
::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->max_classes_per_detection(), output);
}
// optional float soft_nms_sigma = 9 [default = 0];
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(9, this->soft_nms_sigma(), output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
_internal_metadata_.unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:object_detection.protos.BatchNonMaxSuppression)
}
::google::protobuf::uint8* BatchNonMaxSuppression::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.BatchNonMaxSuppression)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional float score_threshold = 1 [default = 0];
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(1, this->score_threshold(), target);
}
// optional float iou_threshold = 2 [default = 0.6];
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(2, this->iou_threshold(), target);
}
// optional int32 max_detections_per_class = 3 [default = 100];
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->max_detections_per_class(), target);
}
// optional int32 max_total_detections = 5 [default = 100];
if (cached_has_bits & 0x00000040u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->max_total_detections(), target);
}
// optional bool use_static_shapes = 6 [default = false];
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(6, this->use_static_shapes(), target);
}
// optional bool use_class_agnostic_nms = 7 [default = false];
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(7, this->use_class_agnostic_nms(), target);
}
// optional int32 max_classes_per_detection = 8 [default = 1];
if (cached_has_bits & 0x00000080u) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(8, this->max_classes_per_detection(), target);
}
// optional float soft_nms_sigma = 9 [default = 0];
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(9, this->soft_nms_sigma(), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.BatchNonMaxSuppression)
return target;
}
size_t BatchNonMaxSuppression::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.BatchNonMaxSuppression)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
_internal_metadata_.unknown_fields());
}
if (_has_bits_[0 / 32] & 255u) {
// optional float score_threshold = 1 [default = 0];
if (has_score_threshold()) {
total_size += 1 + 4;
}
// optional bool use_static_shapes = 6 [default = false];
if (has_use_static_shapes()) {
total_size += 1 + 1;
}
// optional bool use_class_agnostic_nms = 7 [default = false];
if (has_use_class_agnostic_nms()) {
total_size += 1 + 1;
}
// optional float soft_nms_sigma = 9 [default = 0];
if (has_soft_nms_sigma()) {
total_size += 1 + 4;
}
// optional float iou_threshold = 2 [default = 0.6];
if (has_iou_threshold()) {
total_size += 1 + 4;
}
// optional int32 max_detections_per_class = 3 [default = 100];
if (has_max_detections_per_class()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->max_detections_per_class());
}
// optional int32 max_total_detections = 5 [default = 100];
if (has_max_total_detections()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->max_total_detections());
}
// optional int32 max_classes_per_detection = 8 [default = 1];
if (has_max_classes_per_detection()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->max_classes_per_detection());
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void BatchNonMaxSuppression::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:object_detection.protos.BatchNonMaxSuppression)
GOOGLE_DCHECK_NE(&from, this);
const BatchNonMaxSuppression* source =
::google::protobuf::internal::DynamicCastToGenerated<const BatchNonMaxSuppression>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:object_detection.protos.BatchNonMaxSuppression)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:object_detection.protos.BatchNonMaxSuppression)
MergeFrom(*source);
}
}
void BatchNonMaxSuppression::MergeFrom(const BatchNonMaxSuppression& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.BatchNonMaxSuppression)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 255u) {
if (cached_has_bits & 0x00000001u) {
score_threshold_ = from.score_threshold_;
}
if (cached_has_bits & 0x00000002u) {
use_static_shapes_ = from.use_static_shapes_;
}
if (cached_has_bits & 0x00000004u) {
use_class_agnostic_nms_ = from.use_class_agnostic_nms_;
}
if (cached_has_bits & 0x00000008u) {
soft_nms_sigma_ = from.soft_nms_sigma_;
}
if (cached_has_bits & 0x00000010u) {
iou_threshold_ = from.iou_threshold_;
}
if (cached_has_bits & 0x00000020u) {
max_detections_per_class_ = from.max_detections_per_class_;
}
if (cached_has_bits & 0x00000040u) {
max_total_detections_ = from.max_total_detections_;
}
if (cached_has_bits & 0x00000080u) {
max_classes_per_detection_ = from.max_classes_per_detection_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void BatchNonMaxSuppression::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:object_detection.protos.BatchNonMaxSuppression)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void BatchNonMaxSuppression::CopyFrom(const BatchNonMaxSuppression& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:object_detection.protos.BatchNonMaxSuppression)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool BatchNonMaxSuppression::IsInitialized() const {
return true;
}
void BatchNonMaxSuppression::Swap(BatchNonMaxSuppression* other) {
if (other == this) return;
InternalSwap(other);
}
void BatchNonMaxSuppression::InternalSwap(BatchNonMaxSuppression* other) {
using std::swap;
swap(score_threshold_, other->score_threshold_);
swap(use_static_shapes_, other->use_static_shapes_);
swap(use_class_agnostic_nms_, other->use_class_agnostic_nms_);
swap(soft_nms_sigma_, other->soft_nms_sigma_);
swap(iou_threshold_, other->iou_threshold_);
swap(max_detections_per_class_, other->max_detections_per_class_);
swap(max_total_detections_, other->max_total_detections_);
swap(max_classes_per_detection_, other->max_classes_per_detection_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata BatchNonMaxSuppression::GetMetadata() const {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// BatchNonMaxSuppression
// optional float score_threshold = 1 [default = 0];
bool BatchNonMaxSuppression::has_score_threshold() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void BatchNonMaxSuppression::set_has_score_threshold() {
_has_bits_[0] |= 0x00000001u;
}
void BatchNonMaxSuppression::clear_has_score_threshold() {
_has_bits_[0] &= ~0x00000001u;
}
void BatchNonMaxSuppression::clear_score_threshold() {
score_threshold_ = 0;
clear_has_score_threshold();
}
float BatchNonMaxSuppression::score_threshold() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.score_threshold)
return score_threshold_;
}
void BatchNonMaxSuppression::set_score_threshold(float value) {
set_has_score_threshold();
score_threshold_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.score_threshold)
}
// optional float iou_threshold = 2 [default = 0.6];
bool BatchNonMaxSuppression::has_iou_threshold() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
void BatchNonMaxSuppression::set_has_iou_threshold() {
_has_bits_[0] |= 0x00000010u;
}
void BatchNonMaxSuppression::clear_has_iou_threshold() {
_has_bits_[0] &= ~0x00000010u;
}
void BatchNonMaxSuppression::clear_iou_threshold() {
iou_threshold_ = 0.6f;
clear_has_iou_threshold();
}
float BatchNonMaxSuppression::iou_threshold() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.iou_threshold)
return iou_threshold_;
}
void BatchNonMaxSuppression::set_iou_threshold(float value) {
set_has_iou_threshold();
iou_threshold_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.iou_threshold)
}
// optional int32 max_detections_per_class = 3 [default = 100];
bool BatchNonMaxSuppression::has_max_detections_per_class() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
void BatchNonMaxSuppression::set_has_max_detections_per_class() {
_has_bits_[0] |= 0x00000020u;
}
void BatchNonMaxSuppression::clear_has_max_detections_per_class() {
_has_bits_[0] &= ~0x00000020u;
}
void BatchNonMaxSuppression::clear_max_detections_per_class() {
max_detections_per_class_ = 100;
clear_has_max_detections_per_class();
}
::google::protobuf::int32 BatchNonMaxSuppression::max_detections_per_class() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.max_detections_per_class)
return max_detections_per_class_;
}
void BatchNonMaxSuppression::set_max_detections_per_class(::google::protobuf::int32 value) {
set_has_max_detections_per_class();
max_detections_per_class_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.max_detections_per_class)
}
// optional int32 max_total_detections = 5 [default = 100];
bool BatchNonMaxSuppression::has_max_total_detections() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
void BatchNonMaxSuppression::set_has_max_total_detections() {
_has_bits_[0] |= 0x00000040u;
}
void BatchNonMaxSuppression::clear_has_max_total_detections() {
_has_bits_[0] &= ~0x00000040u;
}
void BatchNonMaxSuppression::clear_max_total_detections() {
max_total_detections_ = 100;
clear_has_max_total_detections();
}
::google::protobuf::int32 BatchNonMaxSuppression::max_total_detections() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.max_total_detections)
return max_total_detections_;
}
void BatchNonMaxSuppression::set_max_total_detections(::google::protobuf::int32 value) {
set_has_max_total_detections();
max_total_detections_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.max_total_detections)
}
// optional bool use_static_shapes = 6 [default = false];
bool BatchNonMaxSuppression::has_use_static_shapes() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void BatchNonMaxSuppression::set_has_use_static_shapes() {
_has_bits_[0] |= 0x00000002u;
}
void BatchNonMaxSuppression::clear_has_use_static_shapes() {
_has_bits_[0] &= ~0x00000002u;
}
void BatchNonMaxSuppression::clear_use_static_shapes() {
use_static_shapes_ = false;
clear_has_use_static_shapes();
}
bool BatchNonMaxSuppression::use_static_shapes() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.use_static_shapes)
return use_static_shapes_;
}
void BatchNonMaxSuppression::set_use_static_shapes(bool value) {
set_has_use_static_shapes();
use_static_shapes_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.use_static_shapes)
}
// optional bool use_class_agnostic_nms = 7 [default = false];
bool BatchNonMaxSuppression::has_use_class_agnostic_nms() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void BatchNonMaxSuppression::set_has_use_class_agnostic_nms() {
_has_bits_[0] |= 0x00000004u;
}
void BatchNonMaxSuppression::clear_has_use_class_agnostic_nms() {
_has_bits_[0] &= ~0x00000004u;
}
void BatchNonMaxSuppression::clear_use_class_agnostic_nms() {
use_class_agnostic_nms_ = false;
clear_has_use_class_agnostic_nms();
}
bool BatchNonMaxSuppression::use_class_agnostic_nms() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.use_class_agnostic_nms)
return use_class_agnostic_nms_;
}
void BatchNonMaxSuppression::set_use_class_agnostic_nms(bool value) {
set_has_use_class_agnostic_nms();
use_class_agnostic_nms_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.use_class_agnostic_nms)
}
// optional int32 max_classes_per_detection = 8 [default = 1];
bool BatchNonMaxSuppression::has_max_classes_per_detection() const {
return (_has_bits_[0] & 0x00000080u) != 0;
}
void BatchNonMaxSuppression::set_has_max_classes_per_detection() {
_has_bits_[0] |= 0x00000080u;
}
void BatchNonMaxSuppression::clear_has_max_classes_per_detection() {
_has_bits_[0] &= ~0x00000080u;
}
void BatchNonMaxSuppression::clear_max_classes_per_detection() {
max_classes_per_detection_ = 1;
clear_has_max_classes_per_detection();
}
::google::protobuf::int32 BatchNonMaxSuppression::max_classes_per_detection() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.max_classes_per_detection)
return max_classes_per_detection_;
}
void BatchNonMaxSuppression::set_max_classes_per_detection(::google::protobuf::int32 value) {
set_has_max_classes_per_detection();
max_classes_per_detection_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.max_classes_per_detection)
}
// optional float soft_nms_sigma = 9 [default = 0];
bool BatchNonMaxSuppression::has_soft_nms_sigma() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void BatchNonMaxSuppression::set_has_soft_nms_sigma() {
_has_bits_[0] |= 0x00000008u;
}
void BatchNonMaxSuppression::clear_has_soft_nms_sigma() {
_has_bits_[0] &= ~0x00000008u;
}
void BatchNonMaxSuppression::clear_soft_nms_sigma() {
soft_nms_sigma_ = 0;
clear_has_soft_nms_sigma();
}
float BatchNonMaxSuppression::soft_nms_sigma() const {
// @@protoc_insertion_point(field_get:object_detection.protos.BatchNonMaxSuppression.soft_nms_sigma)
return soft_nms_sigma_;
}
void BatchNonMaxSuppression::set_soft_nms_sigma(float value) {
set_has_soft_nms_sigma();
soft_nms_sigma_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.BatchNonMaxSuppression.soft_nms_sigma)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PostProcessing::kBatchNonMaxSuppressionFieldNumber;
const int PostProcessing::kScoreConverterFieldNumber;
const int PostProcessing::kLogitScaleFieldNumber;
const int PostProcessing::kCalibrationConfigFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PostProcessing::PostProcessing()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:object_detection.protos.PostProcessing)
}
PostProcessing::PostProcessing(const PostProcessing& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_has_bits_(from._has_bits_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_batch_non_max_suppression()) {
batch_non_max_suppression_ = new ::object_detection::protos::BatchNonMaxSuppression(*from.batch_non_max_suppression_);
} else {
batch_non_max_suppression_ = NULL;
}
if (from.has_calibration_config()) {
calibration_config_ = new ::object_detection::protos::CalibrationConfig(*from.calibration_config_);
} else {
calibration_config_ = NULL;
}
::memcpy(&score_converter_, &from.score_converter_,
static_cast<size_t>(reinterpret_cast<char*>(&logit_scale_) -
reinterpret_cast<char*>(&score_converter_)) + sizeof(logit_scale_));
// @@protoc_insertion_point(copy_constructor:object_detection.protos.PostProcessing)
}
void PostProcessing::SharedCtor() {
_cached_size_ = 0;
::memset(&batch_non_max_suppression_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&score_converter_) -
reinterpret_cast<char*>(&batch_non_max_suppression_)) + sizeof(score_converter_));
logit_scale_ = 1;
}
PostProcessing::~PostProcessing() {
// @@protoc_insertion_point(destructor:object_detection.protos.PostProcessing)
SharedDtor();
}
void PostProcessing::SharedDtor() {
if (this != internal_default_instance()) delete batch_non_max_suppression_;
if (this != internal_default_instance()) delete calibration_config_;
}
void PostProcessing::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PostProcessing::descriptor() {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const PostProcessing& PostProcessing::default_instance() {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::InitDefaults();
return *internal_default_instance();
}
PostProcessing* PostProcessing::New(::google::protobuf::Arena* arena) const {
PostProcessing* n = new PostProcessing;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PostProcessing::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.PostProcessing)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(batch_non_max_suppression_ != NULL);
batch_non_max_suppression_->::object_detection::protos::BatchNonMaxSuppression::Clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(calibration_config_ != NULL);
calibration_config_->::object_detection::protos::CalibrationConfig::Clear();
}
}
if (cached_has_bits & 12u) {
score_converter_ = 0;
logit_scale_ = 1;
}
_has_bits_.Clear();
_internal_metadata_.Clear();
}
bool PostProcessing::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:object_detection.protos.PostProcessing)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .object_detection.protos.BatchNonMaxSuppression batch_non_max_suppression = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_batch_non_max_suppression()));
} else {
goto handle_unusual;
}
break;
}
// optional .object_detection.protos.PostProcessing.ScoreConverter score_converter = 2 [default = IDENTITY];
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::object_detection::protos::PostProcessing_ScoreConverter_IsValid(value)) {
set_score_converter(static_cast< ::object_detection::protos::PostProcessing_ScoreConverter >(value));
} else {
mutable_unknown_fields()->AddVarint(
2, static_cast< ::google::protobuf::uint64>(value));
}
} else {
goto handle_unusual;
}
break;
}
// optional float logit_scale = 3 [default = 1];
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(29u /* 29 & 0xFF */)) {
set_has_logit_scale();
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &logit_scale_)));
} else {
goto handle_unusual;
}
break;
}
// optional .object_detection.protos.CalibrationConfig calibration_config = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_calibration_config()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:object_detection.protos.PostProcessing)
return true;
failure:
// @@protoc_insertion_point(parse_failure:object_detection.protos.PostProcessing)
return false;
#undef DO_
}
void PostProcessing::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:object_detection.protos.PostProcessing)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional .object_detection.protos.BatchNonMaxSuppression batch_non_max_suppression = 1;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->batch_non_max_suppression_, output);
}
// optional .object_detection.protos.PostProcessing.ScoreConverter score_converter = 2 [default = IDENTITY];
if (cached_has_bits & 0x00000004u) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->score_converter(), output);
}
// optional float logit_scale = 3 [default = 1];
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteFloat(3, this->logit_scale(), output);
}
// optional .object_detection.protos.CalibrationConfig calibration_config = 4;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *this->calibration_config_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
_internal_metadata_.unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:object_detection.protos.PostProcessing)
}
::google::protobuf::uint8* PostProcessing::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.PostProcessing)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional .object_detection.protos.BatchNonMaxSuppression batch_non_max_suppression = 1;
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->batch_non_max_suppression_, deterministic, target);
}
// optional .object_detection.protos.PostProcessing.ScoreConverter score_converter = 2 [default = IDENTITY];
if (cached_has_bits & 0x00000004u) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->score_converter(), target);
}
// optional float logit_scale = 3 [default = 1];
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(3, this->logit_scale(), target);
}
// optional .object_detection.protos.CalibrationConfig calibration_config = 4;
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *this->calibration_config_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.PostProcessing)
return target;
}
size_t PostProcessing::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.PostProcessing)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
_internal_metadata_.unknown_fields());
}
if (_has_bits_[0 / 32] & 15u) {
// optional .object_detection.protos.BatchNonMaxSuppression batch_non_max_suppression = 1;
if (has_batch_non_max_suppression()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->batch_non_max_suppression_);
}
// optional .object_detection.protos.CalibrationConfig calibration_config = 4;
if (has_calibration_config()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->calibration_config_);
}
// optional .object_detection.protos.PostProcessing.ScoreConverter score_converter = 2 [default = IDENTITY];
if (has_score_converter()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->score_converter());
}
// optional float logit_scale = 3 [default = 1];
if (has_logit_scale()) {
total_size += 1 + 4;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PostProcessing::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:object_detection.protos.PostProcessing)
GOOGLE_DCHECK_NE(&from, this);
const PostProcessing* source =
::google::protobuf::internal::DynamicCastToGenerated<const PostProcessing>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:object_detection.protos.PostProcessing)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:object_detection.protos.PostProcessing)
MergeFrom(*source);
}
}
void PostProcessing::MergeFrom(const PostProcessing& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.PostProcessing)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 15u) {
if (cached_has_bits & 0x00000001u) {
mutable_batch_non_max_suppression()->::object_detection::protos::BatchNonMaxSuppression::MergeFrom(from.batch_non_max_suppression());
}
if (cached_has_bits & 0x00000002u) {
mutable_calibration_config()->::object_detection::protos::CalibrationConfig::MergeFrom(from.calibration_config());
}
if (cached_has_bits & 0x00000004u) {
score_converter_ = from.score_converter_;
}
if (cached_has_bits & 0x00000008u) {
logit_scale_ = from.logit_scale_;
}
_has_bits_[0] |= cached_has_bits;
}
}
void PostProcessing::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:object_detection.protos.PostProcessing)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PostProcessing::CopyFrom(const PostProcessing& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:object_detection.protos.PostProcessing)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool PostProcessing::IsInitialized() const {
return true;
}
void PostProcessing::Swap(PostProcessing* other) {
if (other == this) return;
InternalSwap(other);
}
void PostProcessing::InternalSwap(PostProcessing* other) {
using std::swap;
swap(batch_non_max_suppression_, other->batch_non_max_suppression_);
swap(calibration_config_, other->calibration_config_);
swap(score_converter_, other->score_converter_);
swap(logit_scale_, other->logit_scale_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PostProcessing::GetMetadata() const {
protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_object_5fdetection_2fprotos_2fpost_5fprocessing_2eproto::file_level_metadata[kIndexInFileMessages];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PostProcessing
// optional .object_detection.protos.BatchNonMaxSuppression batch_non_max_suppression = 1;
bool PostProcessing::has_batch_non_max_suppression() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void PostProcessing::set_has_batch_non_max_suppression() {
_has_bits_[0] |= 0x00000001u;
}
void PostProcessing::clear_has_batch_non_max_suppression() {
_has_bits_[0] &= ~0x00000001u;
}
void PostProcessing::clear_batch_non_max_suppression() {
if (batch_non_max_suppression_ != NULL) batch_non_max_suppression_->::object_detection::protos::BatchNonMaxSuppression::Clear();
clear_has_batch_non_max_suppression();
}
const ::object_detection::protos::BatchNonMaxSuppression& PostProcessing::batch_non_max_suppression() const {
const ::object_detection::protos::BatchNonMaxSuppression* p = batch_non_max_suppression_;
// @@protoc_insertion_point(field_get:object_detection.protos.PostProcessing.batch_non_max_suppression)
return p != NULL ? *p : *reinterpret_cast<const ::object_detection::protos::BatchNonMaxSuppression*>(
&::object_detection::protos::_BatchNonMaxSuppression_default_instance_);
}
::object_detection::protos::BatchNonMaxSuppression* PostProcessing::mutable_batch_non_max_suppression() {
set_has_batch_non_max_suppression();
if (batch_non_max_suppression_ == NULL) {
batch_non_max_suppression_ = new ::object_detection::protos::BatchNonMaxSuppression;
}
// @@protoc_insertion_point(field_mutable:object_detection.protos.PostProcessing.batch_non_max_suppression)
return batch_non_max_suppression_;
}
::object_detection::protos::BatchNonMaxSuppression* PostProcessing::release_batch_non_max_suppression() {
// @@protoc_insertion_point(field_release:object_detection.protos.PostProcessing.batch_non_max_suppression)
clear_has_batch_non_max_suppression();
::object_detection::protos::BatchNonMaxSuppression* temp = batch_non_max_suppression_;
batch_non_max_suppression_ = NULL;
return temp;
}
void PostProcessing::set_allocated_batch_non_max_suppression(::object_detection::protos::BatchNonMaxSuppression* batch_non_max_suppression) {
delete batch_non_max_suppression_;
batch_non_max_suppression_ = batch_non_max_suppression;
if (batch_non_max_suppression) {
set_has_batch_non_max_suppression();
} else {
clear_has_batch_non_max_suppression();
}
// @@protoc_insertion_point(field_set_allocated:object_detection.protos.PostProcessing.batch_non_max_suppression)
}
// optional .object_detection.protos.PostProcessing.ScoreConverter score_converter = 2 [default = IDENTITY];
bool PostProcessing::has_score_converter() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void PostProcessing::set_has_score_converter() {
_has_bits_[0] |= 0x00000004u;
}
void PostProcessing::clear_has_score_converter() {
_has_bits_[0] &= ~0x00000004u;
}
void PostProcessing::clear_score_converter() {
score_converter_ = 0;
clear_has_score_converter();
}
::object_detection::protos::PostProcessing_ScoreConverter PostProcessing::score_converter() const {
// @@protoc_insertion_point(field_get:object_detection.protos.PostProcessing.score_converter)
return static_cast< ::object_detection::protos::PostProcessing_ScoreConverter >(score_converter_);
}
void PostProcessing::set_score_converter(::object_detection::protos::PostProcessing_ScoreConverter value) {
assert(::object_detection::protos::PostProcessing_ScoreConverter_IsValid(value));
set_has_score_converter();
score_converter_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.PostProcessing.score_converter)
}
// optional float logit_scale = 3 [default = 1];
bool PostProcessing::has_logit_scale() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
void PostProcessing::set_has_logit_scale() {
_has_bits_[0] |= 0x00000008u;
}
void PostProcessing::clear_has_logit_scale() {
_has_bits_[0] &= ~0x00000008u;
}
void PostProcessing::clear_logit_scale() {
logit_scale_ = 1;
clear_has_logit_scale();
}
float PostProcessing::logit_scale() const {
// @@protoc_insertion_point(field_get:object_detection.protos.PostProcessing.logit_scale)
return logit_scale_;
}
void PostProcessing::set_logit_scale(float value) {
set_has_logit_scale();
logit_scale_ = value;
// @@protoc_insertion_point(field_set:object_detection.protos.PostProcessing.logit_scale)
}
// optional .object_detection.protos.CalibrationConfig calibration_config = 4;
bool PostProcessing::has_calibration_config() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void PostProcessing::set_has_calibration_config() {
_has_bits_[0] |= 0x00000002u;
}
void PostProcessing::clear_has_calibration_config() {
_has_bits_[0] &= ~0x00000002u;
}
void PostProcessing::clear_calibration_config() {
if (calibration_config_ != NULL) calibration_config_->::object_detection::protos::CalibrationConfig::Clear();
clear_has_calibration_config();
}
const ::object_detection::protos::CalibrationConfig& PostProcessing::calibration_config() const {
const ::object_detection::protos::CalibrationConfig* p = calibration_config_;
// @@protoc_insertion_point(field_get:object_detection.protos.PostProcessing.calibration_config)
return p != NULL ? *p : *reinterpret_cast<const ::object_detection::protos::CalibrationConfig*>(
&::object_detection::protos::_CalibrationConfig_default_instance_);
}
::object_detection::protos::CalibrationConfig* PostProcessing::mutable_calibration_config() {
set_has_calibration_config();
if (calibration_config_ == NULL) {
calibration_config_ = new ::object_detection::protos::CalibrationConfig;
}
// @@protoc_insertion_point(field_mutable:object_detection.protos.PostProcessing.calibration_config)
return calibration_config_;
}
::object_detection::protos::CalibrationConfig* PostProcessing::release_calibration_config() {
// @@protoc_insertion_point(field_release:object_detection.protos.PostProcessing.calibration_config)
clear_has_calibration_config();
::object_detection::protos::CalibrationConfig* temp = calibration_config_;
calibration_config_ = NULL;
return temp;
}
void PostProcessing::set_allocated_calibration_config(::object_detection::protos::CalibrationConfig* calibration_config) {
delete calibration_config_;
calibration_config_ = calibration_config;
if (calibration_config) {
set_has_calibration_config();
} else {
clear_has_calibration_config();
}
// @@protoc_insertion_point(field_set_allocated:object_detection.protos.PostProcessing.calibration_config)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace protos
} // namespace object_detection
// @@protoc_insertion_point(global_scope)
| mlperf/inference_results_v0.7 | open/DellEMC/code/ssd-mobilenet/xilinx/include/object_detection/protos/post_processing.pb.cc | C++ | apache-2.0 | 58,919 | [
30522,
1013,
1013,
7013,
2011,
1996,
8778,
17698,
21624,
1012,
2079,
2025,
10086,
999,
1013,
1013,
3120,
1024,
4874,
1035,
10788,
1013,
15053,
2015,
1013,
2695,
1035,
6364,
1012,
15053,
1001,
9375,
4722,
1035,
16081,
1035,
15053,
8569,
2546... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package pdms.platform.service;
import java.util.List;
import pdms.components.dto.A0400TopicDto;
import pdms.components.vo.A0400TopicVo;
import pdms.platform.core.PdmsException;
/**
*
* @author LUSuo(atealxt@gmail.com)
*/
public interface A0400TopicService {
public String createTopic(A0400TopicDto dto) throws PdmsException;
public String editTopic(A0400TopicDto dto, String tId, String rId) throws PdmsException;
public String createReply(String loginId, String tId, String tContent) throws PdmsException;
/**
* 回贴帖信息VO生成
*/
public List<A0400TopicVo> MakeVo(String tId, int maxNum, int startNum) throws PdmsException;
/** 取得帖子回复数 */
public int getSumCount(String tId) throws PdmsException;
public String closeTopic(List<String> list, String loginId) throws PdmsException;
}
| atealxt/work-workspaces | PDMS/src/java/pdms/platform/service/A0400TopicService.java | Java | mit | 856 | [
30522,
7427,
22851,
5244,
1012,
4132,
1012,
2326,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
22851,
5244,
1012,
6177,
1012,
26718,
2080,
1012,
1037,
2692,
29537,
14399,
2594,
11927,
2080,
1025,
12324,
22851,
5244,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#region Copyright (c) 2014 Orcomp development team.
// -------------------------------------------------------------------------------------------------------------------
// <copyright file="GraphExplorerViewModel.cs" company="Orcomp development team">
// Copyright (c) 2014 Orcomp development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
#endregion
namespace Orc.GraphExplorer.ViewModels
{
using System.ComponentModel;
using System.Threading.Tasks;
using Catel;
using Catel.Configuration;
using Catel.MVVM;
using Factories;
using Messages;
using Models;
using Services;
public class GraphExplorerViewModel : ViewModelBase
{
#region Fields
private readonly IGraphDataService _graphDataService;
private readonly IGraphExplorerFactory _graphExplorerFactory;
private readonly INavigationService _navigationService;
#endregion
#region Constructors
public GraphExplorerViewModel(IGraphDataService graphDataService, IGraphExplorerFactory graphExplorerFactory, INavigationService navigationService)
{
Argument.IsNotNull(() => graphDataService);
Argument.IsNotNull(() => graphExplorerFactory);
Argument.IsNotNull(() => navigationService);
_graphDataService = graphDataService;
_graphExplorerFactory = graphExplorerFactory;
_navigationService = navigationService;
Explorer = _graphExplorerFactory.CreateExplorer();
CloseNavTabCommand = new Command(OnCloseNavTabCommandExecute);
OpenSettingsCommand = new Command(OnOpenSettingsCommandExecute);
EditingStartStopMessage.Register(this, OnEditingStartStopMessage, Explorer.EditorToolset.ToolsetName);
ReadyToLoadGraphMessage.Register(this, OnReadyToLoadGraphMessage);
NavigationMessage.Register(this, OnNavigationMessage);
}
#endregion
#region Properties
/// <summary>
/// Gets the OpenSettingsCommand command.
/// </summary>
public Command OpenSettingsCommand { get; private set; }
/// <summary>
/// Gets the CloseNavTabCommand command.
/// </summary>
public Command CloseNavTabCommand { get; private set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[Model]
public Explorer Explorer { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[Model]
[ViewModelToModel("Explorer")]
public Settings Settings { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[ViewModelToModel("Settings")]
public bool IsSettingsVisible { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[Model]
[ViewModelToModel("Explorer")]
public GraphToolset EditorToolset { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[ViewModelToModel("EditorToolset")]
public bool IsChanged { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[ViewModelToModel("Explorer")]
public bool IsNavTabVisible { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[ViewModelToModel("Explorer")]
public bool IsNavTabSelected { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
[DefaultValue(false)]
public bool IsEditorTabSelected { get; set; }
#endregion
#region Methods
private void OnNavigationMessage(NavigationMessage message)
{
_navigationService.NavigateTo(Explorer, message.Data);
}
private void OnReadyToLoadGraphMessage(ReadyToLoadGraphMessage message)
{
var editorArea = Explorer.EditorToolset.Area;
if (string.Equals(message.Data, "Editor") && editorArea.GraphDataGetter == null)
{
editorArea.GraphDataGetter = _graphDataService;
editorArea.GraphDataSaver = _graphDataService;
}
var navigatorArea = Explorer.NavigatorToolset.Area;
if (string.Equals(message.Data, "Navigator") && navigatorArea.GraphDataGetter == null)
{
navigatorArea.GraphDataGetter = new NavigatorGraphDataGetter();
}
}
private void OnEditingStartStopMessage(EditingStartStopMessage message)
{
if (message.Data)
{
IsNavTabVisible = false;
}
}
protected override async Task Initialize()
{
await base.Initialize();
IsEditorTabSelected = true;
}
/// <summary>
/// Method to invoke when the OpenSettingsCommand command is executed.
/// </summary>
private void OnOpenSettingsCommandExecute()
{
IsSettingsVisible = !IsSettingsVisible;
}
/// <summary>
/// Method to invoke when the CloseNavTabCommand command is executed.
/// </summary>
private void OnCloseNavTabCommandExecute()
{
IsNavTabVisible = false;
IsNavTabSelected = false;
IsEditorTabSelected = true;
}
#endregion
}
} | Orcomp/Orc.GraphExplorer | src/Orc.GraphExplorer/ViewModels/GraphExplorerViewModel.cs | C# | mit | 5,680 | [
30522,
1001,
2555,
9385,
1006,
1039,
1007,
2297,
2030,
9006,
2361,
2458,
2136,
1012,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
#define WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
#pragma once
#include <map>
#include "base/basictypes.h"
#include "base/nullable_string16.h"
#include "base/string16.h"
namespace dom_storage {
// The quota for each storage area. Suggested by the spec.
const size_t kPerAreaQuota = 5 * 1024 * 1024;
// Value to indicate the localstorage namespace vs non-zero
// values for sessionstorage namespaces.
const int64 kLocalStorageNamespaceId = 0;
const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId;
// Value to indicate an area that not be opened.
const int kInvalidAreaId = -1;
typedef std::map<string16, NullableString16> ValuesMap;
} // namespace dom_storage
#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
| robclark/chromium | webkit/dom_storage/dom_storage_types.h | C | bsd-3-clause | 957 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.osiam.client;
/*
* for licensing see the file license.txt.
*/
import static org.apache.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.http.HttpStatus.SC_OK;
import static org.apache.http.HttpStatus.SC_UNAUTHORIZED;
import static org.apache.http.HttpStatus.SC_CONFLICT;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.DefaultHttpClient;
import org.osiam.client.exception.ConflictException;
import org.osiam.client.exception.ConnectionInitializationException;
import org.osiam.client.exception.ForbiddenException;
import org.osiam.client.exception.NoResultException;
import org.osiam.client.exception.UnauthorizedException;
import org.osiam.client.oauth.AccessToken;
import org.osiam.client.query.Query;
import org.osiam.client.query.QueryResult;
import org.osiam.client.update.UpdateUser;
import org.osiam.resources.scim.User;
/**
* The OsiamUserService provides all methods necessary to manipulate the User-entries registered in the
* given OSIAM installation. For the construction of an instance please use the included {@link OsiamUserService.Builder}
*/
public final class OsiamUserService extends AbstractOsiamService<User> { // NOSONAR - Builder constructs instances of this class
/**
* The private constructor for the OsiamUserService. Please use the {@link OsiamUserService.Builder}
* to construct one.
*
* @param userWebResource a valid WebResource to connect to a given OSIAM server
*/
private OsiamUserService(Builder builder) {
super(builder);
}
/**
* Retrieve a single User with the given id. If no user for the given id can be found a {@link NoResultException}
* is thrown.
*
* @param id the id of the wanted user
* @param accessToken the OSIAM access token from for the current session
* @return the user with the given id
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.NoResultException if no user with the given id can be found
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public User getUser(String id, AccessToken accessToken) {
return getResource(id, accessToken);
}
/**
* Retrieve the User who holds the given access token.
* Not to be used for the grant Client-Credentials
* @param accessToken the OSIAM access token from for the current session
* @return the actual logged in user
* @throws UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws ConnectionInitializationException
* if no connection to the given OSIAM services could be initialized
*/
public User getMeBasic(AccessToken accessToken) {
final User user;
if (accessToken == null) { // NOSONAR - false-positive from clover; if-expression is correct
throw new IllegalArgumentException("The given accessToken can't be null.");
}
try {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet realWebresource = createRealWebResource(accessToken);
realWebresource.setURI(new URI(getMeWebResource().getURI().toString()));
HttpResponse response = httpclient.execute(realWebresource);
int httpStatus = response.getStatusLine().getStatusCode();
if (httpStatus != SC_OK) { // NOSONAR - false-positive from clover; if-expression is correct
String errorMessage;
switch (httpStatus) {
case SC_UNAUTHORIZED:
errorMessage = getErrorMessage(response, "You are not authorized to access OSIAM. Please make sure your access token is valid");
throw new UnauthorizedException(errorMessage);
case SC_FORBIDDEN:
errorMessage = "Insufficient scope (" + accessToken.getScope() + ") to retrieve the actual User.";
throw new ForbiddenException(errorMessage);
case SC_CONFLICT:
errorMessage = getErrorMessage(response, "Unable to retrieve the actual User.");
throw new ConflictException(errorMessage);
default:
errorMessage = getErrorMessage(response, String.format("Unable to setup connection (HTTP Status Code: %d)", httpStatus));
throw new ConnectionInitializationException(errorMessage);
}
}
InputStream content = response.getEntity().getContent();
user = mapSingleResourceResponse(content);
return user;
} catch (IOException | URISyntaxException e) {
throw new ConnectionInitializationException("Unable to setup connection", e);
}
}
/**
* Retrieve the User who holds the given access token.
* Not to be used for the grant Client-Credentials
* @param accessToken the OSIAM access token from for the current session
* @return the actual logged in user
* @throws UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws ConnectionInitializationException
* if no connection to the given OSIAM services could be initialized
*/
public User getMe(AccessToken accessToken) {
final User user;
if (accessToken == null) { // NOSONAR - false-positive from clover; if-expression is correct
throw new IllegalArgumentException("The given accessToken can't be null.");
}
try {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet realWebresource = createRealWebResource(accessToken);
realWebresource.setURI(new URI(getUri() + "/me"));
HttpResponse response = httpclient.execute(realWebresource);
int httpStatus = response.getStatusLine().getStatusCode();
if (httpStatus != SC_OK) { // NOSONAR - false-positive from clover; if-expression is correct
String errorMessage;
switch (httpStatus) {
case SC_UNAUTHORIZED:
errorMessage = getErrorMessage(response, "You are not authorized to access OSIAM. Please make sure your access token is valid");
throw new UnauthorizedException(errorMessage);
case SC_FORBIDDEN:
errorMessage = "Insufficient scope (" + accessToken.getScope() + ") to retrieve the actual User.";
throw new ForbiddenException(errorMessage);
case SC_CONFLICT:
errorMessage = getErrorMessage(response, "Unable to retrieve the actual User.");
throw new ConflictException(errorMessage);
default:
errorMessage = getErrorMessage(response, String.format("Unable to setup connection (HTTP Status Code: %d)", httpStatus));
throw new ConnectionInitializationException(errorMessage);
}
}
InputStream content = response.getEntity().getContent();
user = mapSingleResourceResponse(content);
return user;
} catch (IOException | URISyntaxException e) {
throw new ConnectionInitializationException("Unable to setup connection", e);
}
}
protected HttpGet getMeWebResource() {
HttpGet webResource;
try {
webResource = new HttpGet(new URI(getEndpoint() + "/me"));
webResource.addHeader("Accept", ContentType.APPLICATION_JSON.getMimeType());
} catch (URISyntaxException e) {
throw new ConnectionInitializationException("Unable to setup connection " + getEndpoint() +
"is not a valid URI.", e);
}
return webResource;
}
/**
* Retrieve a list of the of all {@link User} resources saved in the OSIAM service.
* If you need to have all User but the number is very big, this method can be slow.
* In this case you can also use Query.Builder with no filter to split the number of User returned
*
* @param accessToken
* @return a list of all Users
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public List<User> getAllUsers(AccessToken accessToken) {
return super.getAllResources(accessToken);
}
/**
* Search for the existing Users by a given search string. For more detailed information about the possible
* logical operators and usable fields please have a look into the wiki.<p>
* <b>Note:</b> The query string should be URL encoded!
*
* @param queryString The URL encoded string with the query that should be passed to the OSIAM service
* @param accessToken the OSIAM access token from for the current session
* @return a QueryResult Containing a list of all found Users
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
* @see <a href="https://github.com/osiam/connector4java/wiki/Working-with-user#search-for-user">https://github.com/osiam/connector4java/wiki/Working-with-user#search-for-user</a>
*/
public QueryResult<User> searchUsers(String queryString, AccessToken accessToken) {
return super.searchResources(queryString, accessToken);
}
/**
* Search for existing Users by the given {@link Query}.
*
* @param query containing the query to execute.
* @param accessToken the OSIAM access token from for the current session
* @return a QueryResult Containing a list of all found Users
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public QueryResult<User> searchUsers(Query query, AccessToken accessToken) {
return super.searchResources(query, accessToken);
}
/**
* delete the given {@link User} at the OSIAM DB.
* @param id id of the User to be delete
* @param accessToken the OSIAM access token from for the current session
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.NoResultException if no user with the given id can be found
* @throws org.osiam.client.exception.ConflictException if the User could not be deleted
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public void deleteUser(String id, AccessToken accessToken) {
deleteResource(id, accessToken);
}
/**
* saves the given {@link User} to the OSIAM DB.
* @param user user to be saved
* @param accessToken the OSIAM access token from for the current session
* @return the same user Object like the given but with filled metadata and a new valid id
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ConflictException if the User could not be created
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public User createUser(User user, AccessToken accessToken) {
return createResource(user, accessToken);
}
/**
* update the user of the given id with the values given in the User Object.
* For more detailed information how to set new field, update Fields or to delete Fields please look in the wiki
* @param id if of the User to be updated
* @param updateUser all Fields that need to be updated
* @param accessToken the OSIAM access token from for the current session
* @return the updated User Object with all new Fields
* @see <a href="https://github.com/osiam/connector4java/wiki/Working-with-user">https://github.com/osiam/connector4java/wiki/Working-with-user</a>
* @throws org.osiam.client.exception.UnauthorizedException if the request could not be authorized.
* @throws org.osiam.client.exception.ConflictException if the User could not be updated
* @throws org.osiam.client.exception.NotFoundException if no group with the given id can be found
* @throws org.osiam.client.exception.ForbiddenException if the scope doesn't allow this request
* @throws org.osiam.client.exception.ConnectionInitializationException
* if the connection to the given OSIAM service could not be initialized
*/
public User updateUser(String id, UpdateUser updateUser , AccessToken accessToken){
if (updateUser == null) { // NOSONAR - false-positive from clover; if-expression is correct
throw new IllegalArgumentException("The given updateUser can't be null.");
}
return updateResource(id, updateUser.getScimConformUpdateUser(), accessToken);
}
/**
* The Builder class is used to construct instances of the {@link OsiamUserService}
*/
public static class Builder extends AbstractOsiamService.Builder<User> {
/**
* Set up the Builder for the construction of an {@link OsiamUserService} instance for the OSIAM service at
* the given endpoint
*
* @param endpoint The URL at which the OSIAM server lives.
*/
public Builder(String endpoint) {
super(endpoint);
}
/**
* constructs an OsiamUserService with the given values
*
* @return a valid OsiamUserService
*/
public OsiamUserService build() {
return new OsiamUserService(this);
}
}
}
| wallner/connector4java | src/main/java/org/osiam/client/OsiamUserService.java | Java | mit | 15,934 | [
30522,
7427,
8917,
1012,
9808,
25107,
1012,
7396,
1025,
1013,
1008,
1008,
2005,
13202,
2156,
1996,
5371,
6105,
1012,
19067,
2102,
1012,
1008,
1013,
12324,
10763,
8917,
1012,
15895,
1012,
8299,
1012,
16770,
29336,
2271,
1012,
8040,
1035,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: UTF-8 -*-
# Copyright 2019-2020 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.db import models
from lino_xl.lib.ledger.choicelists import VoucherStates
from lino.api import dd, _
class OrderStates(VoucherStates):
pass
add = OrderStates.add_item
add('10', _("Waiting"), 'draft', is_editable=True)
add('20', _("Active"), 'active', is_editable=True)
add('30', _("Urgent"), 'urgent', is_editable=True)
add('40', _("Done"), 'registered')
add('50', _("Cancelled"), 'cancelled')
OrderStates.draft.add_transition(required_states="active urgent registered cancelled")
OrderStates.active.add_transition(required_states="draft urgent registered cancelled")
OrderStates.urgent.add_transition(required_states="draft active registered cancelled")
OrderStates.registered.add_transition(required_states="draft active urgent cancelled")
OrderStates.cancelled.add_transition(required_states="draft active urgent registered")
| lino-framework/xl | lino_xl/lib/orders/choicelists.py | Python | bsd-2-clause | 992 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
9385,
10476,
1011,
12609,
19379,
2863,
1004,
12849,
5183,
1001,
6105,
1024,
27004,
21358,
7512,
2080,
2236,
2270,
6105,
1058,
2509,
1006,
2156,
537... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# babel-plugin-transform-optional-chaining
The Optional Chaining Operator allows you to handle properties of deeply nested
objects without worrying about undefined intermediate objects.
## Example
### Accessing deeply nested properties
```js
const obj = {
foo: {
bar: {
baz: 42,
},
},
};
const baz = obj?.foo?.bar?.baz; // 42
const safe = obj?.qux?.baz; // undefined
// Optional chaining and normal chaining can be intermixed
obj?.foo.bar?.baz; // Only access `foo` if `obj` exists, and `baz` if
// `bar` exists
```
### Calling deeply nested functions
```js
const obj = {
foo: {
bar: {
baz() {
return 42;
},
},
},
};
const baz = obj?.foo?.bar?.baz(); // 42
const safe = obj?.qux?.baz(); // undefined
const safe2 = obj?.foo.bar.qux?.(); // undefined
const willThrow = obj?.foo.bar.qux(); // Error: not a function
// Top function can be called directly, too.
function test() {
return 42;
}
test?.(); // 42
exists?.(); // undefined
```
### Constructing deeply nested classes
```js
const obj = {
foo: {
bar: {
baz: class {
},
},
},
};
const baz = new obj?.foo?.bar?.baz(); // baz instance
const safe = new obj?.qux?.baz(); // undefined
const safe2 = new obj?.foo.bar.qux?.(); // undefined
const willThrow = new obj?.foo.bar.qux(); // Error: not a constructor
// Top classes can be called directly, too.
class Test {
}
new Test?.(); // test instance
new exists?.(); // undefined
```
## Installation
```sh
npm install --save-dev babel-plugin-transform-optional-chaining
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["transform-optional-chaining"]
}
```
### Via CLI
```sh
babel --plugins transform-optional-chaining script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-optional-chaining"]
});
```
## References
* [Proposal: Optional Chaining](https://github.com/tc39/proposal-optional-chaining)
| kedromelon/babel | packages/babel-plugin-transform-optional-chaining/README.md | Markdown | mit | 2,010 | [
30522,
1001,
11561,
2140,
1011,
13354,
2378,
1011,
10938,
1011,
11887,
1011,
4677,
2075,
1996,
11887,
4677,
2075,
6872,
4473,
2017,
2000,
5047,
5144,
1997,
6171,
9089,
2098,
5200,
2302,
15366,
2055,
6151,
28344,
7783,
5200,
1012,
1001,
1001... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
((n|=2<<1)) | grncdr/js-shell-parse | tests/fixtures/shellcheck-tests/arithmetic3/source.sh | Shell | mit | 11 | [
30522,
1006,
1006,
1050,
1064,
1027,
1016,
1026,
1026,
1015,
1007,
1007,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jasig.portal.portlets.statistics;
import java.util.Collections;
import java.util.List;
import org.jasig.portal.events.aggr.portletlayout.PortletLayoutAggregation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.bind.annotation.RenderMapping;
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
import com.google.visualization.datasource.base.TypeMismatchException;
import com.google.visualization.datasource.datatable.value.NumberValue;
import com.google.visualization.datasource.datatable.value.Value;
/**
* @author Chris Waymire <cwaymire@unicon.net>
*/
@Controller
@RequestMapping(value="VIEW")
public class PortletMoveStatisticsController extends BasePortletLayoutStatisticsController<PortletMoveReportForm> {
private static final String DATA_TABLE_RESOURCE_ID = "portletMoveData";
private static final String REPORT_NAME = "portletMove.totals";
@RenderMapping(value="MAXIMIZED", params="report=" + REPORT_NAME)
public String getLoginView() throws TypeMismatchException {
return super.getLoginView();
}
@ResourceMapping(DATA_TABLE_RESOURCE_ID)
public ModelAndView renderPortletAddAggregationReport(PortletMoveReportForm form) throws TypeMismatchException {
return super.renderPortletAddAggregationReport(form);
}
@Override
public String getReportName() {
return REPORT_NAME;
}
@Override
public String getReportDataResourceId() {
return DATA_TABLE_RESOURCE_ID;
}
@Override
protected List<Value> createRowValues(PortletLayoutAggregation aggr, PortletMoveReportForm form) {
int count = aggr != null ? aggr.getMoveCount() : 0;
return Collections.<Value>singletonList(new NumberValue(count));
}
} | pspaude/uPortal | uportal-war/src/main/java/org/jasig/portal/portlets/statistics/PortletMoveStatisticsController.java | Java | apache-2.0 | 2,682 | [
30522,
1013,
1008,
1008,
1008,
7000,
2000,
14855,
5332,
2290,
2104,
2028,
2030,
2062,
12130,
6105,
1008,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
1008,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
1008,
14855,
5332,
2290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import merge from 'deepmerge';
import {Platform} from 'react-native';
import {Navigation} from 'react-native-navigation';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import * as NavigationActions from '@actions/navigation';
import {NavigationTypes} from '@constants';
import Preferences from '@mm-redux/constants/preferences';
import EventEmitter from '@mm-redux/utils/event_emitter';
import EphemeralStore from '@store/ephemeral_store';
import intitialState from '@store/initial_state';
import Store from '@store/store';
jest.unmock('@actions/navigation');
const mockStore = configureMockStore([thunk]);
const store = mockStore(intitialState);
Store.redux = store;
// Mock EphemeralStore add/remove modal
const add = EphemeralStore.addNavigationModal;
const remove = EphemeralStore.removeNavigationModal;
EphemeralStore.removeNavigationModal = (componentId) => {
remove(componentId);
EphemeralStore.removeNavigationComponentId(componentId);
};
EphemeralStore.addNavigationModal = (componentId) => {
add(componentId);
EphemeralStore.addNavigationComponentId(componentId);
};
describe('@actions/navigation', () => {
const topComponentId = 'top-component-id';
const name = 'name';
const title = 'title';
const theme = Preferences.THEMES.denim;
const passProps = {
testProp: 'prop',
};
const options = {
testOption: 'test',
};
beforeEach(() => {
EphemeralStore.clearNavigationComponents();
EphemeralStore.clearNavigationModals();
// mock that we have a root screen
EphemeralStore.addNavigationComponentId(topComponentId);
});
// EphemeralStore.getNavigationTopComponentId.mockReturnValue(topComponentId);
test('resetToChannel should call Navigation.setRoot', () => {
const setRoot = jest.spyOn(Navigation, 'setRoot');
const expectedLayout = {
root: {
stack: {
children: [{
component: {
id: 'Channel',
name: 'Channel',
passProps,
options: {
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
visible: false,
height: 0,
backButton: {
visible: false,
enableMenu: false,
color: theme.sidebarHeaderTextColor,
},
background: {
color: theme.sidebarHeaderBg,
},
},
},
},
}],
},
},
};
NavigationActions.resetToChannel(passProps);
expect(setRoot).toHaveBeenCalledWith(expectedLayout);
});
test('resetToSelectServer should call Navigation.setRoot', () => {
const setRoot = jest.spyOn(Navigation, 'setRoot');
const allowOtherServers = false;
const expectedLayout = {
root: {
stack: {
children: [{
component: {
id: 'SelectServer',
name: 'SelectServer',
passProps: {
allowOtherServers,
},
options: {
layout: {
backgroundColor: theme.centerChannelBg,
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
},
background: {
color: theme.sidebarHeaderBg,
},
visible: false,
height: 0,
},
},
},
}],
},
},
};
NavigationActions.resetToSelectServer(allowOtherServers);
expect(setRoot).toHaveBeenCalledWith(expectedLayout);
});
test('resetToTeams should call Navigation.setRoot', () => {
const setRoot = jest.spyOn(Navigation, 'setRoot');
const defaultOptions = {
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
visible: true,
title: {
color: theme.sidebarHeaderTextColor,
text: title,
},
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
},
background: {
color: theme.sidebarHeaderBg,
},
},
};
const expectedLayout = {
root: {
stack: {
children: [{
component: {
id: name,
name,
passProps,
options: merge(defaultOptions, options),
},
}],
},
},
};
NavigationActions.resetToTeams(name, title, passProps, options);
expect(setRoot).toHaveBeenCalledWith(expectedLayout);
});
test('goToScreen should call Navigation.push', () => {
const push = jest.spyOn(Navigation, 'push');
const defaultOptions = {
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
popGesture: true,
sideMenu: {
left: {enabled: false},
right: {enabled: false},
},
topBar: {
animate: true,
visible: true,
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
testID: 'screen.back.button',
},
background: {
color: theme.sidebarHeaderBg,
},
title: {
color: theme.sidebarHeaderTextColor,
text: title,
},
},
};
const expectedLayout = {
component: {
id: name,
name,
passProps,
options: merge(defaultOptions, options),
},
};
NavigationActions.goToScreen(name, title, passProps, options);
expect(push).toHaveBeenCalledWith(topComponentId, expectedLayout);
});
test('popTopScreen should call Navigation.pop', () => {
const pop = jest.spyOn(Navigation, 'pop');
NavigationActions.popTopScreen();
expect(pop).toHaveBeenCalledWith(topComponentId);
const otherComponentId = `other-${topComponentId}`;
NavigationActions.popTopScreen(otherComponentId);
expect(pop).toHaveBeenCalledWith(otherComponentId);
});
test('popToRoot should call Navigation.popToRoot', async () => {
const popToRoot = jest.spyOn(Navigation, 'popToRoot');
await NavigationActions.popToRoot();
expect(popToRoot).toHaveBeenCalledWith(topComponentId);
});
test('showModal should call Navigation.showModal', () => {
const showModal = jest.spyOn(Navigation, 'showModal');
const defaultOptions = {
modalPresentationStyle: Platform.select({ios: 'pageSheet', android: 'none'}),
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
animate: true,
visible: true,
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
},
background: {
color: theme.sidebarHeaderBg,
},
title: {
color: theme.sidebarHeaderTextColor,
text: title,
},
leftButtonColor: theme.sidebarHeaderTextColor,
rightButtonColor: theme.sidebarHeaderTextColor,
},
};
const expectedLayout = {
stack: {
children: [{
component: {
id: name,
name,
passProps,
options: merge(defaultOptions, options),
},
}],
},
};
NavigationActions.showModal(name, title, passProps, options);
expect(showModal).toHaveBeenCalledWith(expectedLayout);
});
test('showModalOverCurrentContext should call Navigation.showModal', () => {
const showModal = jest.spyOn(Navigation, 'showModal');
const showModalOverCurrentContextTitle = '';
const showModalOverCurrentContextOptions = {
modalPresentationStyle: 'overCurrentContext',
layout: {
backgroundColor: 'transparent',
componentBackgroundColor: 'transparent',
},
topBar: {
visible: false,
height: 0,
},
animations: {
showModal: {
enter: {
enabled: false,
},
exit: {
enabled: false,
},
},
dismissModal: {
enter: {
enabled: false,
},
exit: {
enabled: false,
},
},
},
};
const showModalOptions = {
modalPresentationStyle: Platform.select({ios: 'fullScreen', android: 'none'}),
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
animate: true,
visible: true,
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
},
background: {
color: theme.sidebarHeaderBg,
},
title: {
color: theme.sidebarHeaderTextColor,
text: showModalOverCurrentContextTitle,
},
leftButtonColor: theme.sidebarHeaderTextColor,
rightButtonColor: theme.sidebarHeaderTextColor,
},
};
const defaultOptions = merge(showModalOverCurrentContextOptions, options);
const expectedLayout = {
stack: {
children: [{
component: {
id: name,
name,
passProps,
options: merge(showModalOptions, defaultOptions),
},
}],
},
};
NavigationActions.showModalOverCurrentContext(name, passProps, options);
expect(showModal).toHaveBeenCalledWith(expectedLayout);
});
test('showSearchModal should call Navigation.showModal', () => {
const showModal = jest.spyOn(Navigation, 'showModal');
const showSearchModalName = 'Search';
const showSearchModalTitle = '';
const initialValue = 'initial-value';
const showSearchModalPassProps = {initialValue};
const showSearchModalOptions = {
topBar: {
visible: false,
height: 0,
},
};
const defaultOptions = {
modalPresentationStyle: Platform.select({ios: 'pageSheet', android: 'none'}),
layout: {
componentBackgroundColor: theme.centerChannelBg,
},
statusBar: {
visible: true,
},
topBar: {
animate: true,
visible: true,
backButton: {
color: theme.sidebarHeaderTextColor,
enableMenu: false,
title: '',
},
background: {
color: theme.sidebarHeaderBg,
},
title: {
color: theme.sidebarHeaderTextColor,
text: showSearchModalTitle,
},
leftButtonColor: theme.sidebarHeaderTextColor,
rightButtonColor: theme.sidebarHeaderTextColor,
},
};
const expectedLayout = {
stack: {
children: [{
component: {
id: showSearchModalName,
name: showSearchModalName,
passProps: showSearchModalPassProps,
options: merge(defaultOptions, showSearchModalOptions),
},
}],
},
};
NavigationActions.showSearchModal(initialValue);
expect(showModal).toHaveBeenCalledWith(expectedLayout);
});
test('dismissModal should call Navigation.dismissModal', async () => {
const dismissModal = jest.spyOn(Navigation, 'dismissModal');
NavigationActions.showModal('First', 'First Modal', passProps, options);
await NavigationActions.dismissModal(options);
expect(dismissModal).toHaveBeenCalledWith('First', options);
});
test('dismissAllModals should call Navigation.dismissAllModals', async () => {
const dismissModal = jest.spyOn(Navigation, 'dismissModal');
NavigationActions.showModal('First', 'First Modal', passProps, options);
NavigationActions.showModal('Second', 'Second Modal', passProps, options);
await NavigationActions.dismissAllModals(options);
expect(dismissModal).toHaveBeenCalledTimes(2);
});
test('mergeNavigationOptions should call Navigation.mergeOptions', () => {
const mergeOptions = jest.spyOn(Navigation, 'mergeOptions');
NavigationActions.mergeNavigationOptions(topComponentId, options);
expect(mergeOptions).toHaveBeenCalledWith(topComponentId, options);
});
test('setButtons should call Navigation.mergeOptions', () => {
const mergeOptions = jest.spyOn(Navigation, 'mergeOptions');
const buttons = {
leftButtons: ['left-button'],
rightButtons: ['right-button'],
};
const setButtonsOptions = {
topBar: {
...buttons,
},
};
NavigationActions.setButtons(topComponentId, buttons);
expect(mergeOptions).toHaveBeenCalledWith(topComponentId, setButtonsOptions);
});
test('showOverlay should call Navigation.showOverlay', () => {
const showOverlay = jest.spyOn(Navigation, 'showOverlay');
const defaultOptions = {
layout: {
backgroundColor: 'transparent',
componentBackgroundColor: 'transparent',
},
overlay: {
interceptTouchOutside: false,
},
};
const expectedLayout = {
component: {
name,
passProps,
options: merge(defaultOptions, options),
},
};
NavigationActions.showOverlay(name, passProps, options);
expect(showOverlay).toHaveBeenCalledWith(expectedLayout);
});
test('dismissOverlay should call Navigation.dismissOverlay', async () => {
const dismissOverlay = jest.spyOn(Navigation, 'dismissOverlay');
await NavigationActions.dismissOverlay(topComponentId);
expect(dismissOverlay).toHaveBeenCalledWith(topComponentId);
});
test('dismissAllModalsAndPopToRoot should call Navigation.dismissAllModals, Navigation.popToRoot, and emit event', async () => {
const dismissModal = jest.spyOn(Navigation, 'dismissModal');
const popToRoot = jest.spyOn(Navigation, 'popToRoot');
EventEmitter.emit = jest.fn();
NavigationActions.showModal('First', 'First Modal', passProps, options);
NavigationActions.showModal('Second', 'Second Modal', passProps, options);
await NavigationActions.dismissAllModalsAndPopToRoot();
expect(dismissModal).toHaveBeenCalledTimes(2);
expect(popToRoot).toHaveBeenCalledWith(topComponentId);
expect(EventEmitter.emit).toHaveBeenCalledWith(NavigationTypes.NAVIGATION_DISMISS_AND_POP_TO_ROOT);
});
});
| mattermost/mattermost-mobile | app/actions/navigation/index.test.js | JavaScript | apache-2.0 | 18,305 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2325,
1011,
2556,
3043,
11800,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2156,
6105,
1012,
19067,
2102,
2005,
6105,
2592,
1012,
12324,
13590,
2013,
1005,
2784,
5017,
3351,
1005,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php $orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 4, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() )
{
echo '<div id="related_posts" class="bottom-single-related"><h3 class="rs">Также рекомендуем прочитать</h3><ul>';
while( $my_query->have_posts() ) {
$my_query->the_post();
$thumb2 = get_post_thumbnail_id();$img_url2 = wp_get_attachment_url( $thumb2,'index-blog' );$image2 = aq_resize( $img_url2, 150,150,true );
?>
<li>
<?php if ($image){ ?>
<img src="<?php echo $image2; ?>">
<?php } ?>
<h2><a href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></li>
<?php } echo '</ul></div>'; } }
$post = $orig_post;
wp_reset_query();
?> | achyutdahal/1234 | wp-content/themes/urbannews32/framework/includes/related-img.php | PHP | gpl-2.0 | 1,123 | [
30522,
1026,
1029,
25718,
1002,
2030,
8004,
1035,
2695,
1027,
1002,
2695,
1025,
3795,
1002,
2695,
1025,
1002,
7236,
1027,
2131,
1035,
1996,
1035,
4696,
1006,
1002,
2695,
1011,
1028,
8909,
1007,
1025,
2065,
1006,
1002,
7236,
1007,
1063,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
* Copyright 2014 Katja Hahn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.github.katjahahn.parser;
import com.github.katjahahn.tools.anomalies.FieldOrStructureKey;
/**
*
* Represents a key for a {@link StandardField}.
*
* @author Katja Hahn
*
*/
public interface HeaderKey extends FieldOrStructureKey {
}
| katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/HeaderKey.java | Java | apache-2.0 | 1,008 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.druid.query.filter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import com.google.common.collect.TreeRangeSet;
import com.google.common.primitives.Floats;
import io.druid.common.guava.GuavaUtils;
import io.druid.java.util.common.StringUtils;
import io.druid.query.extraction.ExtractionFn;
import io.druid.segment.filter.DimensionPredicateFilter;
import io.druid.segment.filter.SelectorFilter;
import java.nio.ByteBuffer;
import java.util.Objects;
/**
*/
public class SelectorDimFilter implements DimFilter
{
private final String dimension;
private final String value;
private final ExtractionFn extractionFn;
private final Object initLock = new Object();
private DruidLongPredicate longPredicate;
private DruidFloatPredicate floatPredicate;
@JsonCreator
public SelectorDimFilter(
@JsonProperty("dimension") String dimension,
@JsonProperty("value") String value,
@JsonProperty("extractionFn") ExtractionFn extractionFn
)
{
Preconditions.checkArgument(dimension != null, "dimension must not be null");
this.dimension = dimension;
this.value = Strings.nullToEmpty(value);
this.extractionFn = extractionFn;
}
@Override
public byte[] getCacheKey()
{
byte[] dimensionBytes = StringUtils.toUtf8(dimension);
byte[] valueBytes = (value == null) ? new byte[]{} : StringUtils.toUtf8(value);
byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey();
return ByteBuffer.allocate(3 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length)
.put(DimFilterUtils.SELECTOR_CACHE_ID)
.put(dimensionBytes)
.put(DimFilterUtils.STRING_SEPARATOR)
.put(valueBytes)
.put(DimFilterUtils.STRING_SEPARATOR)
.put(extractionFnBytes)
.array();
}
@Override
public DimFilter optimize()
{
return new InDimFilter(dimension, ImmutableList.of(value), extractionFn).optimize();
}
@Override
public Filter toFilter()
{
if (extractionFn == null) {
return new SelectorFilter(dimension, value);
} else {
final String valueOrNull = Strings.emptyToNull(value);
final DruidPredicateFactory predicateFactory = new DruidPredicateFactory()
{
@Override
public Predicate<String> makeStringPredicate()
{
return Predicates.equalTo(valueOrNull);
}
@Override
public DruidLongPredicate makeLongPredicate()
{
initLongPredicate();
return longPredicate;
}
@Override
public DruidFloatPredicate makeFloatPredicate()
{
initFloatPredicate();
return floatPredicate;
}
};
return new DimensionPredicateFilter(dimension, predicateFactory, extractionFn);
}
}
@JsonProperty
public String getDimension()
{
return dimension;
}
@JsonProperty
public String getValue()
{
return value;
}
@JsonProperty
public ExtractionFn getExtractionFn()
{
return extractionFn;
}
@Override
public String toString()
{
if (extractionFn != null) {
return String.format("%s(%s) = %s", extractionFn, dimension, value);
} else {
return String.format("%s = %s", dimension, value);
}
}
@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SelectorDimFilter that = (SelectorDimFilter) o;
if (!dimension.equals(that.dimension)) {
return false;
}
if (value != null ? !value.equals(that.value) : that.value != null) {
return false;
}
return extractionFn != null ? extractionFn.equals(that.extractionFn) : that.extractionFn == null;
}
@Override
public RangeSet<String> getDimensionRangeSet(String dimension)
{
if (!Objects.equals(getDimension(), dimension) || getExtractionFn() != null) {
return null;
}
RangeSet<String> retSet = TreeRangeSet.create();
retSet.add(Range.singleton(Strings.nullToEmpty(value)));
return retSet;
}
@Override
public int hashCode()
{
int result = dimension.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (extractionFn != null ? extractionFn.hashCode() : 0);
return result;
}
private void initLongPredicate()
{
if (longPredicate != null) {
return;
}
synchronized (initLock) {
if (longPredicate != null) {
return;
}
final Long valueAsLong = GuavaUtils.tryParseLong(value);
if (valueAsLong == null) {
longPredicate = DruidLongPredicate.ALWAYS_FALSE;
} else {
// store the primitive, so we don't unbox for every comparison
final long unboxedLong = valueAsLong.longValue();
longPredicate = new DruidLongPredicate()
{
@Override
public boolean applyLong(long input)
{
return input == unboxedLong;
}
};
}
}
}
private void initFloatPredicate()
{
if (floatPredicate != null) {
return;
}
synchronized (initLock) {
if (floatPredicate != null) {
return;
}
final Float valueAsFloat = Floats.tryParse(value);
if (valueAsFloat == null) {
floatPredicate = DruidFloatPredicate.ALWAYS_FALSE;
} else {
final int floatBits = Float.floatToIntBits(valueAsFloat);
floatPredicate = new DruidFloatPredicate()
{
@Override
public boolean applyFloat(float input)
{
return Float.floatToIntBits(input) == floatBits;
}
};
}
}
}
}
| zhihuij/druid | processing/src/main/java/io/druid/query/filter/SelectorDimFilter.java | Java | apache-2.0 | 6,989 | [
30522,
1013,
1008,
1008,
7000,
2000,
18804,
20285,
2015,
2177,
4297,
1012,
1006,
18804,
20285,
2015,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.vmware.vim25;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for InvalidDasRestartPriorityForFtVm complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="InvalidDasRestartPriorityForFtVm">
* <complexContent>
* <extension base="{urn:vim25}InvalidArgument">
* <sequence>
* <element name="vm" type="{urn:vim25}ManagedObjectReference"/>
* <element name="vmName" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InvalidDasRestartPriorityForFtVm", propOrder = {
"vm",
"vmName"
})
public class InvalidDasRestartPriorityForFtVm
extends InvalidArgument
{
@XmlElement(required = true)
protected ManagedObjectReference vm;
@XmlElement(required = true)
protected String vmName;
/**
* Gets the value of the vm property.
*
* @return
* possible object is
* {@link ManagedObjectReference }
*
*/
public ManagedObjectReference getVm() {
return vm;
}
/**
* Sets the value of the vm property.
*
* @param value
* allowed object is
* {@link ManagedObjectReference }
*
*/
public void setVm(ManagedObjectReference value) {
this.vm = value;
}
/**
* Gets the value of the vmName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVmName() {
return vmName;
}
/**
* Sets the value of the vmName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVmName(String value) {
this.vmName = value;
}
}
| jdgwartney/vsphere-ws | java/JAXWS/samples/com/vmware/vim25/InvalidDasRestartPriorityForFtVm.java | Java | apache-2.0 | 2,225 | [
30522,
7427,
4012,
1012,
1058,
2213,
8059,
1012,
6819,
2213,
17788,
1025,
12324,
9262,
2595,
1012,
20950,
1012,
14187,
1012,
5754,
17287,
3508,
1012,
20950,
6305,
9623,
21756,
5051,
1025,
12324,
9262,
2595,
1012,
20950,
1012,
14187,
1012,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Reflect.cs: Creates Element classes from an instance
//
// Author:
// Miguel de Icaza (miguel@gnome.org)
//
// Copyright 2010, Novell, Inc.
//
// Code licensed under the MIT X11 license
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
namespace MonoTouch.Dialog
{
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class EntryAttribute : Attribute {
public EntryAttribute () : this (null) { }
public EntryAttribute (string placeholder)
{
Placeholder = placeholder;
}
public string Placeholder;
public UIKeyboardType KeyboardType;
public UITextAutocorrectionType AutocorrectionType;
public UITextAutocapitalizationType AutocapitalizationType;
public UITextFieldViewMode ClearButtonMode;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class DateAttribute : Attribute { }
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class TimeAttribute : Attribute { }
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class CheckboxAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class MultilineAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class HtmlAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class SkipAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class PasswordAttribute : EntryAttribute {
public PasswordAttribute (string placeholder) : base (placeholder) {}
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class AlignmentAttribute : Attribute {
public AlignmentAttribute (UITextAlignment alignment) {
Alignment = alignment;
}
public UITextAlignment Alignment;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class RadioSelectionAttribute : Attribute {
public string Target;
public RadioSelectionAttribute (string target)
{
Target = target;
}
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class OnTapAttribute : Attribute {
public OnTapAttribute (string method)
{
Method = method;
}
public string Method;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class CaptionAttribute : Attribute {
public CaptionAttribute (string caption)
{
Caption = caption;
}
public string Caption;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class SectionAttribute : Attribute {
public SectionAttribute () {}
public SectionAttribute (string caption)
{
Caption = caption;
}
public SectionAttribute (string caption, string footer)
{
Caption = caption;
Footer = footer;
}
public string Caption, Footer;
}
public class RangeAttribute : Attribute {
public RangeAttribute (float low, float high)
{
Low = low;
High = high;
}
public float Low, High;
public bool ShowCaption;
}
public class BindingContext : IDisposable {
public RootElement Root;
Dictionary<Element,MemberAndInstance> mappings;
class MemberAndInstance {
public MemberAndInstance (MemberInfo mi, object o)
{
Member = mi;
Obj = o;
}
public MemberInfo Member;
public object Obj;
}
static object GetValue (MemberInfo mi, object o)
{
var fi = mi as FieldInfo;
if (fi != null)
return fi.GetValue (o);
var pi = mi as PropertyInfo;
var getMethod = pi.GetGetMethod ();
return getMethod.Invoke (o, new object [0]);
}
static void SetValue (MemberInfo mi, object o, object val)
{
var fi = mi as FieldInfo;
if (fi != null){
fi.SetValue (o, val);
return;
}
var pi = mi as PropertyInfo;
var setMethod = pi.GetSetMethod ();
setMethod.Invoke (o, new object [] { val });
}
static string MakeCaption (string name)
{
var sb = new StringBuilder (name.Length);
bool nextUp = true;
foreach (char c in name){
if (nextUp){
sb.Append (Char.ToUpper (c));
nextUp = false;
} else {
if (c == '_'){
sb.Append (' ');
continue;
}
if (Char.IsUpper (c))
sb.Append (' ');
sb.Append (c);
}
}
return sb.ToString ();
}
// Returns the type for fields and properties and null for everything else
static Type GetTypeForMember (MemberInfo mi)
{
if (mi is FieldInfo)
return ((FieldInfo) mi).FieldType;
else if (mi is PropertyInfo)
return ((PropertyInfo) mi).PropertyType;
return null;
}
public BindingContext (object callbacks, object o, string title)
{
if (o == null)
throw new ArgumentNullException ("o");
mappings = new Dictionary<Element,MemberAndInstance> ();
Root = new RootElement (title);
Populate (callbacks, o, Root);
}
void Populate (object callbacks, object o, RootElement root)
{
MemberInfo last_radio_index = null;
var members = o.GetType ().GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance);
Section section = null;
foreach (var mi in members){
Type mType = GetTypeForMember (mi);
if (mType == null)
continue;
string caption = null;
object [] attrs = mi.GetCustomAttributes (false);
bool skip = false;
foreach (var attr in attrs){
if (attr is SkipAttribute || attr is System.Runtime.CompilerServices.CompilerGeneratedAttribute)
skip = true;
else if (attr is CaptionAttribute)
caption = ((CaptionAttribute) attr).Caption;
else if (attr is SectionAttribute){
if (section != null)
root.Add (section);
var sa = attr as SectionAttribute;
section = new Section (sa.Caption, sa.Footer);
}
}
if (skip)
continue;
if (caption == null)
caption = MakeCaption (mi.Name);
if (section == null)
section = new Section ();
Element element = null;
if (mType == typeof (string)){
PasswordAttribute pa = null;
AlignmentAttribute align = null;
EntryAttribute ea = null;
object html = null;
NSAction invoke = null;
bool multi = false;
foreach (object attr in attrs){
if (attr is PasswordAttribute)
pa = attr as PasswordAttribute;
else if (attr is EntryAttribute)
ea = attr as EntryAttribute;
else if (attr is MultilineAttribute)
multi = true;
else if (attr is HtmlAttribute)
html = attr;
else if (attr is AlignmentAttribute)
align = attr as AlignmentAttribute;
if (attr is OnTapAttribute){
string mname = ((OnTapAttribute) attr).Method;
if (callbacks == null){
throw new Exception ("Your class contains [OnTap] attributes, but you passed a null object for `context' in the constructor");
}
var method = callbacks.GetType ().GetMethod (mname);
if (method == null)
throw new Exception ("Did not find method " + mname);
invoke = delegate {
method.Invoke (method.IsStatic ? null : callbacks, new object [0]);
};
}
}
string value = (string) GetValue (mi, o);
if (pa != null)
element = new EntryElement (caption, pa.Placeholder, value, true);
else if (ea != null)
element = new EntryElement (caption, ea.Placeholder, value) { KeyboardType = ea.KeyboardType, AutocapitalizationType = ea.AutocapitalizationType, AutocorrectionType = ea.AutocorrectionType, ClearButtonMode = ea.ClearButtonMode };
else if (multi)
element = new MultilineElement (caption, value);
else if (html != null)
element = new HtmlElement (caption, value);
else {
var selement = new StringElement (caption, value);
element = selement;
if (align != null)
selement.Alignment = align.Alignment;
}
if (invoke != null)
((StringElement) element).Tapped += invoke;
} else if (mType == typeof (float)){
var floatElement = new FloatElement (null, null, (float) GetValue (mi, o));
floatElement.Caption = caption;
element = floatElement;
foreach (object attr in attrs){
if (attr is RangeAttribute){
var ra = attr as RangeAttribute;
floatElement.MinValue = ra.Low;
floatElement.MaxValue = ra.High;
floatElement.ShowCaption = ra.ShowCaption;
}
}
} else if (mType == typeof (bool)){
bool checkbox = false;
foreach (object attr in attrs){
if (attr is CheckboxAttribute)
checkbox = true;
}
if (checkbox)
element = new CheckboxElement (caption, (bool) GetValue (mi, o));
else
element = new BooleanElement (caption, (bool) GetValue (mi, o));
} else if (mType == typeof (DateTime)){
var dateTime = (DateTime) GetValue (mi, o);
bool asDate = false, asTime = false;
foreach (object attr in attrs){
if (attr is DateAttribute)
asDate = true;
else if (attr is TimeAttribute)
asTime = true;
}
if (asDate)
element = new DateElement (caption, dateTime);
else if (asTime)
element = new TimeElement (caption, dateTime);
else
element = new DateTimeElement (caption, dateTime);
} else if (mType.IsEnum){
var csection = new Section ();
ulong evalue = Convert.ToUInt64 (GetValue (mi, o), null);
int idx = 0;
int selected = 0;
foreach (var fi in mType.GetFields (BindingFlags.Public | BindingFlags.Static)){
ulong v = Convert.ToUInt64 (GetValue (fi, null));
if (v == evalue)
selected = idx;
CaptionAttribute ca = Attribute.GetCustomAttribute(fi, typeof(CaptionAttribute)) as CaptionAttribute;
csection.Add (new RadioElement (ca != null ? ca.Caption : MakeCaption (fi.Name)));
idx++;
}
element = new RootElement (caption, new RadioGroup (null, selected)) { csection };
} else if (mType == typeof (UIImage)){
element = new ImageElement ((UIImage) GetValue (mi, o));
} else if (typeof (System.Collections.IEnumerable).IsAssignableFrom (mType)){
var csection = new Section ();
int count = 0;
if (last_radio_index == null)
throw new Exception ("IEnumerable found, but no previous int found");
foreach (var e in (IEnumerable) GetValue (mi, o)){
csection.Add (new RadioElement (e.ToString ()));
count++;
}
int selected = (int) GetValue (last_radio_index, o);
if (selected >= count || selected < 0)
selected = 0;
element = new RootElement (caption, new MemberRadioGroup (null, selected, last_radio_index)) { csection };
last_radio_index = null;
} else if (typeof (int) == mType){
foreach (object attr in attrs){
if (attr is RadioSelectionAttribute){
last_radio_index = mi;
break;
}
}
} else {
var nested = GetValue (mi, o);
if (nested != null){
var newRoot = new RootElement (caption);
Populate (callbacks, nested, newRoot);
element = newRoot;
}
}
if (element == null)
continue;
section.Add (element);
mappings [element] = new MemberAndInstance (mi, o);
}
root.Add (section);
}
class MemberRadioGroup : RadioGroup {
public MemberInfo mi;
public MemberRadioGroup (string key, int selected, MemberInfo mi) : base (key, selected)
{
this.mi = mi;
}
}
public void Dispose ()
{
Dispose (true);
}
protected virtual void Dispose (bool disposing)
{
if (disposing){
foreach (var element in mappings.Keys){
element.Dispose ();
}
mappings = null;
}
}
public void Fetch ()
{
foreach (var dk in mappings){
Element element = dk.Key;
MemberInfo mi = dk.Value.Member;
object obj = dk.Value.Obj;
if (element is DateTimeElement)
SetValue (mi, obj, ((DateTimeElement) element).DateValue);
else if (element is FloatElement)
SetValue (mi, obj, ((FloatElement) element).Value);
else if (element is BooleanElement)
SetValue (mi, obj, ((BooleanElement) element).Value);
else if (element is CheckboxElement)
SetValue (mi, obj, ((CheckboxElement) element).Value);
else if (element is EntryElement){
var entry = (EntryElement) element;
entry.FetchValue ();
SetValue (mi, obj, entry.Value);
} else if (element is ImageElement)
SetValue (mi, obj, ((ImageElement) element).Value);
else if (element is RootElement){
var re = element as RootElement;
if (re.group as MemberRadioGroup != null){
var group = re.group as MemberRadioGroup;
SetValue (group.mi, obj, re.RadioSelected);
} else if (re.group as RadioGroup != null){
var mType = GetTypeForMember (mi);
var fi = mType.GetFields (BindingFlags.Public | BindingFlags.Static) [re.RadioSelected];
SetValue (mi, obj, fi.GetValue (null));
}
}
}
}
}
}
| danmiser/MonoTouch.Dialog | MonoTouch.Dialog/Reflect.cs | C# | mit | 13,498 | [
30522,
1013,
1013,
1013,
1013,
8339,
1012,
20116,
1024,
9005,
5783,
4280,
2013,
2019,
6013,
1013,
1013,
1013,
1013,
3166,
1024,
1013,
1013,
8374,
2139,
24582,
10936,
2050,
1006,
8374,
1030,
25781,
1012,
8917,
1007,
1013,
1013,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Data model for gd:extendedProperty element, used by some Gdata
* services to implement arbitrary name/value pair storage
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension
{
protected $_rootElement = 'extendedProperty';
protected $_name = null;
protected $_value = null;
public function __construct($name = null, $value = null)
{
parent::__construct();
$this->_name = $name;
$this->_value = $value;
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_name !== null) {
$element->setAttribute('name', $this->_name);
}
if ($this->_value !== null) {
$element->setAttribute('value', $this->_value);
}
return $element;
}
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'name':
$this->_name = $attribute->nodeValue;
break;
case 'value':
$this->_value = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
public function __toString()
{
return $this->getName() . '=' . $this->getValue();
}
public function getName()
{
return $this->_name;
}
public function setName($value)
{
$this->_name = $value;
return $this;
}
public function getValue()
{
return $this->_value;
}
public function setValue($value)
{
$this->_value = $value;
return $this;
}
}
| ankuradhey/dealtrip | library/Zend/Gdata/Extension/ExtendedProperty.php | PHP | apache-2.0 | 2,841 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
16729,
2094,
7705,
1008,
1008,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2047,
18667,
2094,
6105,
2008,
2003,
24378,
1008,
2007,
2023,
7427,
1999,
1996,
5371,
6105,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*
* _w32sys.h
*
* Purpose:
* Isolate various Win 32 system dependencies.
*
*/
#ifndef _W32SYS_H
#define _W32SYS_H
#if defined(PEGASUS)
#if !defined(WINNT)
#include "memory.h" // for memmove
#endif
#define NOMAGELLAN // No Magellan on Win CE
#define NODROPFILES // No drop files support on Win CE
#define NOMETAFILES // No metafiles on Win CE
#define NOPEDDUMP // No support for ped debug dump on CE
#define NOFONTSUBINFO // Avoid reading fontsubinfo profile on CE
#define NODUMPFORMATRUNS // Don't dump formatting if we run out of memory.
#define CONVERT2BPP
#define dxCaret 2 // caret width
#define FONTCACHESIZE 8
#define DEFAULT_UNDO_SIZE 20
#else
#define dxCaret 1 // caret width
#define FONTCACHESIZE 16
#define DEFAULT_UNDO_SIZE 100
#endif // defined(PEGASUS)
/*
* GetCaretDelta ()
*
* @func Get size of caret to add to current caret position to get the
* maximum extent needed to display caret.
*
* @rdesc Size of caret over 1 pixel
*
* @devnote This exists solely to abstract this calculation
* to handle a variable size caret.
*/
inline int GetCaretDelta()
{
return dxCaret - 1;
}
// Used in rtfread.cpp to keep track of lossy rtf.
#ifdef PWORD_CONVERTER_V2
#define REPORT_LOSSAGE
#endif
#define SYMBOL_CODEPAGE 2
const SHORT sLanguageEnglishUS = 0x0409;
const SHORT sLanguageMask = 0x03ff;
const SHORT sLanguageArabic = 0x0401;
const SHORT sLanguageHebrew = 0x040d;
// FUTURE: currently this const == sLanguageEnglishUS
// for no reason except that it was this way
// in RE1.0 BiDi. Consider changing, or sticking
// the real language in, and changing the logic
// of handling wLang a bit.
const SHORT sLanguageNonBiDi = 0x0409;
// Logical unit definition
const int LX_PER_INCH = 1440;
const int LY_PER_INCH = 1440;
// HIMETRIC units per inch (used for conversion)
const int HIMETRIC_PER_INCH = 2540;
#ifdef CopyMemory
#undef CopyMemory
#endif
#ifdef MoveMemory
#undef MoveMemory
#endif
#ifdef FillMemory
#undef FillMemory
#endif
#ifdef ZeroMemory
#undef ZeroMemory
#endif
#ifdef CompareMemory
#undef CompareMemory
#endif
#ifndef KF_ALTDOWN
#define KF_ALTDOWN 0x2000
#endif
// Use for our version of ExtTextOut
enum CONVERTMODE
{
CM_NULL = CM_NONE, // Use Unicode (W) CharWidth/TextOut APIs
CM_WCTMB, // Convert to MBCS using WCTMB and _wCodePage
CM_LOWBYTE // Use low byte of 16-bit chars (for SYMBOL_CHARSET
}; // and when code page isn't installed)
// Opaque Type
class CTxtSelection;
class CTxtEdit;
class CCharFormat;
class CCcs;
struct IMESTYLE;
struct IMECOLORSTY;
enum UN_FLAGS
{
UN_NOOBJECTS = 1,
UN_CONVERT_WCH_EMBEDDING = 2
};
#undef GetStringTypeEx
#undef CharLower
#undef CharLowerBuff
#undef CharUpperBuff
#undef CreateIC
#undef CreateFile
#undef CreateFontIndirect
#undef CompareString
#undef DefWindowProc
//#undef GetKeyboardLayout
#undef GetProfileSection
#undef GetTextExtentPoint32
#undef GetTextFace
#undef GetWindowLong
#undef LoadBitmap
#undef LoadCursor
#undef LoadLibrary
#undef SendMessage
#undef SetWindowLong
#undef PostMessage
#undef lstrcmp
#undef lstrcmpi
#undef PeekMessage
#undef GetModuleFileName
#undef GlobalAlloc
#undef GlobalFree
#undef GlobalReAlloc
#undef GlobalLock
#undef GlobalHandle
#undef GlobalUnlock
#undef GlobalFlags
#undef GlobalSize
class CW32System
{
public :
static BOOL _fHaveIMMProcs;
static DWORD _dwPlatformId; // platform GetVersionEx();
static DWORD _dwMajorVersion; // major version from GetVersionEx()
static INT _icr3DDarkShadow; // value to use for COLOR_3DDKSHADOW
CW32System();
~CW32System();
static LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
static LRESULT ANSIWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
static HGLOBAL WINAPI GlobalAlloc( UINT uFlags, DWORD dwBytes );
static HGLOBAL WINAPI GlobalFree( HGLOBAL hMem );
static UINT WINAPI GlobalFlags( HGLOBAL hMem );
static HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hMem, DWORD dwBytes, UINT uFlags );
static DWORD WINAPI GlobalSize( HGLOBAL hMem );
static LPVOID WINAPI GlobalLock( HGLOBAL hMem );
static HGLOBAL WINAPI GlobalHandle( LPCVOID pMem );
static BOOL WINAPI GlobalUnlock( HGLOBAL hMem );
static BOOL WINAPI REGetCharWidth(
HDC hdc,
UINT iChar,
LPINT pAns,
UINT uiCodePage);
static BOOL WINAPI REExtTextOut(
CONVERTMODE cm,
UINT uiCodePage,
HDC hdc,
int x,
int y,
UINT fuOptions,
CONST RECT *lprc,
const WCHAR *lpString,
UINT cbCount,
CONST INT *lpDx,
BOOL FEFontOnNonFEWin95);
static CONVERTMODE WINAPI DetermineConvertMode( BYTE tmCharSet );
static void WINAPI CalcUnderlineInfo( CCcs *pcccs, TEXTMETRIC *ptm );
static BOOL WINAPI EnableScrollBar( HWND hWnd, UINT wSBflags, UINT wArrows );
static BOOL WINAPI ShowScrollBar( HWND hWnd, int wBar, BOOL bShow, LONG nMax );
static BOOL WINAPI IsEnhancedMetafileDC( HDC hdc );
static UINT WINAPI GetTextAlign(HDC);
static UINT WINAPI SetTextAlign(HDC, UINT);
static UINT WINAPI InvertRect(HDC hdc, CONST RECT *lprc);
static BOOL WINAPI GetCursorPos(POINT *ppt);
static HPALETTE WINAPI ManagePalette(
HDC hdc,
CONST LOGPALETTE *plogpal,
HPALETTE &hpalOld,
HPALETTE &hpalNew
);
static int WINAPI GetMapMode(HDC hdc);
static BOOL WINAPI WinLPtoDP(HDC hdc, LPPOINT lppoints, int nCount);
static BOOL WINAPI WinDPtoLP(HDC hdc, LPPOINT lppoints, int nCount);
static long WINAPI WvsprintfA(LONG cb, LPSTR szBuf, LPCSTR szFmt, va_list arglist);
static int WINAPI MulDiv(int nNumber, int nNumerator, int nDenominator);
// Convert Himetric along the X axis to X pixels
static inline LONG HimetricXtoDX(LONG xHimetric, LONG xPerInch)
{
// This formula is rearranged to get rid of the need for floating point
// arithmetic. The real way to understand the formula is to use
// (xHimetric / HIMETRIC_PER_INCH) to get the inches and then multiply
// the inches by the number of x pixels per inch to get the pixels.
return (LONG) MulDiv(xHimetric, xPerInch, HIMETRIC_PER_INCH);
}
// Convert Himetric along the Y axis to Y pixels
static inline LONG HimetricYtoDY(LONG yHimetric, LONG yPerInch)
{
// This formula is rearranged to get rid of the need for floating point
// arithmetic. The real way to understand the formula is to use
// (xHimetric / HIMETRIC_PER_INCH) to get the inches and then multiply
// the inches by the number of y pixels per inch to get the pixels.
return (LONG) MulDiv(yHimetric, yPerInch, HIMETRIC_PER_INCH);
}
// Convert Pixels on the X axis to Himetric
static inline LONG DXtoHimetricX(LONG dx, LONG xPerInch)
{
// This formula is rearranged to get rid of the need for floating point
// arithmetic. The real way to understand the formula is to use
// (dx / x pixels per inch) to get the inches and then multiply
// the inches by the number of himetric units per inch to get the
// count of himetric units.
return (LONG) MulDiv(dx, HIMETRIC_PER_INCH, xPerInch);
}
// Convert Pixels on the Y axis to Himetric
static inline LONG DYtoHimetricY(LONG dy, LONG yPerInch)
{
// This formula is rearranged to get rid of the need for floating point
// arithmetic. The real way to understand the formula is to use
// (dy / y pixels per inch) to get the inches and then multiply
// the inches by the number of himetric units per inch to get the
// count of himetric units.
return (LONG) MulDiv(dy, HIMETRIC_PER_INCH, yPerInch);
}
//
// Case insensitive ASCII compare
//
static BOOL ASCIICompareI( const BYTE *pstr1, const BYTE *pstr2, int iCount )
{
int i;
for (i = 0; i < iCount && !((pstr1[i] ^ pstr2[i]) & ~0x20); i++)
;
return i == iCount;
}
//
// Allocate and convert a MultiByte string to a wide character string
// Allocated strings must be freed with delete
//
static WCHAR *ConvertToWideChar( const char *pstr )
{
int istrlen;
for (istrlen = 0; pstr[istrlen]; istrlen++);
WCHAR *pnew = new WCHAR[istrlen + 1];
if (pnew )
{
if (0 != ::MultiByteToWideChar( CP_ACP, 0, pstr, -1, pnew, istrlen + 1))
{
return pnew;
}
else
{
delete[] pnew;
}
}
return NULL;
}
//
// functions for memory management
//
static LPVOID PvAlloc(ULONG cbBuf, UINT uiMemFlags);
static LPVOID PvReAlloc(LPVOID pvBuf, DWORD cbBuf);
static BOOL FreePv(LPVOID pvBuf);
static inline void *CopyMemory(void *dst, const void *src, size_t cb)
{
// Will work for overlapping regions
return memmove(dst, src, cb);
}
static inline void *MoveMemory(void *dst, const void *src, size_t cb)
{
return memmove(dst, src, cb);
}
static inline void *FillMemory(void *dst, int fill, size_t cb)
{
return memset(dst, fill, cb);
}
static inline void *ZeroMemory(void *dst, size_t cb)
{
return memset(dst, 0, cb);
}
static inline int CompareMemory(const void *s1, const void *s2, size_t cb)
{
return memcmp(s1, s2, cb);
}
// ----------------------------------
// IME Support
// ----------------------------------
static BOOL ImmInitialize( void );
static void ImmTerminate( void );
static LONG ImmGetCompositionStringA ( HIMC, DWORD, LPVOID, DWORD );
static BOOL ImmSetCompositionFontA ( HIMC, LPLOGFONTA );
// GuyBark: Use the real system functions:
#ifndef PWD_JUPITER
static HIMC ImmGetContext ( HWND );
static BOOL ImmSetCompositionWindow ( HIMC, LPCOMPOSITIONFORM );
static BOOL ImmReleaseContext ( HWND, HIMC );
static DWORD ImmGetProperty ( HKL, DWORD );
static BOOL ImmGetCandidateWindow ( HIMC, DWORD, LPCANDIDATEFORM );
static BOOL ImmSetCandidateWindow ( HIMC, LPCANDIDATEFORM );
static BOOL ImmNotifyIME ( HIMC, DWORD, DWORD, DWORD );
static HIMC ImmAssociateContext ( HWND, HIMC );
static UINT ImmGetVirtualKey ( HWND );
static HIMC ImmEscape ( HKL, HIMC, UINT, LPVOID );
static LONG ImmGetOpenStatus ( HIMC );
static BOOL ImmGetConversionStatus ( HIMC, LPDWORD, LPDWORD );
#endif // !PWD_JUPITER
static BOOL FSupportSty ( UINT, UINT );
static const IMESTYLE * PIMEStyleFromAttr ( const UINT );
static const IMECOLORSTY * PColorStyleTextFromIMEStyle ( const IMESTYLE * );
static const IMECOLORSTY * PColorStyleBackFromIMEStyle ( const IMESTYLE * );
static BOOL FBoldIMEStyle ( const IMESTYLE * );
static BOOL FItalicIMEStyle ( const IMESTYLE * );
static BOOL FUlIMEStyle ( const IMESTYLE * );
static UINT IdUlIMEStyle ( const IMESTYLE * );
static COLORREF RGBFromIMEColorStyle ( const IMECOLORSTY * );
// ----------------------------------
// National Language Keyboard support
// ----------------------------------
static void CheckChangeKeyboardLayout ( CTxtSelection *psel, BOOL fChangedFont );
static void CheckChangeFont (
CTxtSelection *psel,
CTxtEdit * const ped,
BOOL fEnableReassign, // @parm Do we enable CTRL key?
const WORD lcID, // @parm LCID from WM_ message
UINT cpg // @parm code page to use (could be ANSI for far east with IME off)
);
static BOOL FormatMatchesKeyboard( const CCharFormat *pFormat );
// static HKL GetKeyboardLayout ( DWORD );
// static int GetKeyboardLayoutList ( int, HKL FAR * );
// ----------------------------------
// OLE Support
// ----------------------------------
static HRESULT LoadRegTypeLib ( REFGUID, WORD, WORD, LCID, ITypeLib ** );
static HRESULT LoadTypeLib ( const OLECHAR *, ITypeLib ** );
static BSTR SysAllocString ( const OLECHAR * );
static BSTR SysAllocStringLen ( const OLECHAR *, UINT );
static void SysFreeString ( BSTR );
static UINT SysStringLen ( BSTR );
static void VariantInit ( VARIANTARG * );
static HRESULT OleCreateFromData ( LPDATAOBJECT, REFIID, DWORD, LPFORMATETC, LPOLECLIENTSITE, LPSTORAGE, void ** );
static void CoTaskMemFree ( LPVOID );
static HRESULT CreateBindCtx ( DWORD, LPBC * );
static HANDLE OleDuplicateData ( HANDLE, CLIPFORMAT, UINT );
static HRESULT CoTreatAsClass ( REFCLSID, REFCLSID );
static HRESULT ProgIDFromCLSID ( REFCLSID, LPOLESTR * );
static HRESULT OleConvertIStorageToOLESTREAM ( LPSTORAGE, LPOLESTREAM );
static HRESULT OleConvertIStorageToOLESTREAMEx ( LPSTORAGE, CLIPFORMAT, LONG, LONG, DWORD, LPSTGMEDIUM, LPOLESTREAM );
static HRESULT OleSave ( LPPERSISTSTORAGE, LPSTORAGE, BOOL );
static HRESULT StgCreateDocfileOnILockBytes ( ILockBytes *, DWORD, DWORD, IStorage ** );
static HRESULT CreateILockBytesOnHGlobal ( HGLOBAL, BOOL, ILockBytes ** );
static HRESULT OleCreateLinkToFile ( LPCOLESTR, REFIID, DWORD, LPFORMATETC, LPOLECLIENTSITE, LPSTORAGE, void ** );
static LPVOID CoTaskMemAlloc ( ULONG );
static LPVOID CoTaskMemRealloc ( LPVOID, ULONG );
static HRESULT OleInitialize ( LPVOID );
static void OleUninitialize ( );
static HRESULT OleSetClipboard ( IDataObject * );
static HRESULT OleFlushClipboard ( );
static HRESULT OleIsCurrentClipboard ( IDataObject * );
static HRESULT DoDragDrop ( IDataObject *, IDropSource *, DWORD, DWORD * );
static HRESULT OleGetClipboard ( IDataObject ** );
static HRESULT RegisterDragDrop ( HWND, IDropTarget * );
static HRESULT OleCreateLinkFromData ( IDataObject *, REFIID, DWORD, LPFORMATETC, IOleClientSite *, IStorage *, void ** );
static HRESULT OleCreateStaticFromData ( IDataObject *, REFIID, DWORD, LPFORMATETC, IOleClientSite *, IStorage *, void ** );
static HRESULT OleDraw ( IUnknown *, DWORD, HDC, LPCRECT );
static HRESULT OleSetContainedObject ( IUnknown *, BOOL );
static HRESULT CoDisconnectObject ( IUnknown *, DWORD );
static HRESULT WriteFmtUserTypeStg ( IStorage *, CLIPFORMAT, LPOLESTR );
static HRESULT WriteClassStg ( IStorage *, REFCLSID );
static HRESULT SetConvertStg ( IStorage *, BOOL );
static HRESULT ReadFmtUserTypeStg ( IStorage *, CLIPFORMAT *, LPOLESTR * );
static HRESULT ReadClassStg ( IStorage *pstg, CLSID * );
static HRESULT OleRun ( IUnknown * );
static HRESULT RevokeDragDrop ( HWND );
static HRESULT CreateStreamOnHGlobal ( HGLOBAL, BOOL, IStream ** );
static HRESULT GetHGlobalFromStream ( IStream *pstm, HGLOBAL * );
static HRESULT OleCreateDefaultHandler ( REFCLSID, IUnknown *, REFIID, void ** );
static HRESULT CLSIDFromProgID ( LPCOLESTR, LPCLSID );
static HRESULT OleConvertOLESTREAMToIStorage ( LPOLESTREAM, IStorage *, const DVTARGETDEVICE * );
static HRESULT OleLoad ( IStorage *, REFIID, IOleClientSite *, void ** );
static HRESULT ReleaseStgMedium ( LPSTGMEDIUM );
static void FreeOle();
// ----------------------------------
// Debugging Support
// Weak dbug32.dll replacement
// ----------------------------------
#ifdef DEBUG
void AssertFn(BOOL, LPSTR, LPSTR, int);
void sprintf (CHAR * buff, char *fmt, ...);
void TraceOn ( void );
void TraceOff (void );
void TraceMsg(WCHAR *ptext);
#endif
// ----------------------------------
// Useful ANSI<-->Unicode conversion
// and language id routines
// ----------------------------------
static LONG CharSetIndexFromChar(TCHAR ch);
static BOOL CheckDBCInUnicodeStr(TCHAR *ptext);
static int MbcsFromUnicode(LPSTR pstr, int cch, LPCWSTR pwstr,
int cwch = -1, UINT codepage = CP_ACP,
UN_FLAGS flags = UN_CONVERT_WCH_EMBEDDING);
static int UnicodeFromMbcs(LPWSTR pwstr, int cwch, LPCSTR pstr, int cch = -1,
UINT uiCodePage = CP_ACP);
static int MBTWC(INT CodePage, DWORD dwFlags, LPCSTR pstrMB, int cchMB,
LPWSTR pstrWC, int cchWC, LPBOOL pfNoCodePage);
static int WCTMB(INT CodePage, DWORD dwFlags, LPCWSTR pstrWC, int cchWC,
LPSTR pstrMB, int cchMB, LPCSTR pchDefault, LPBOOL pfUsedDef,
LPBOOL pfNoCodePage);
static HGLOBAL TextHGlobalAtoW( HGLOBAL hglobal, BOOL *pbDBC );
static HGLOBAL TextHGlobalWtoA( HGLOBAL hglobal );
static UINT ConvertLanguageIDtoCodePage(WORD lid);
static BOOL IsFELCID(LCID lcid);
static BOOL IsFECharset(BYTE bCharSet);
static BOOL IsFEChar(WCHAR ch); // GuyBark: Added this.
static INT In125x(WCHAR ch, BYTE bCharSet);
static BOOL IsLeadByte(BYTE ach, UINT cpg);
static BOOL IsTrailByte(BYTE *aszBuff, LONG cb, UINT cpg);
static BYTE GetCharSet(INT);
static INT GetCodePage(BYTE bCharSet);
static UINT GetKeyboardCodePage();
static LCID GetKeyboardLCID();
static HKL GetKeyboardLayout( DWORD dwTId );
static int GetKeyboardLayoutList ( int, HKL FAR * );
static UINT GetLocaleCodePage();
static LCID GetLocaleLCID();
static BOOL IsCharSetValid(BYTE bCharSet);
static BOOL ConvertCHARFORMATAtoW( CHARFORMATA *pcfmtA, CHARFORMATW *pcfmtW );
static BOOL ConvertCHARFORMATWtoA( CHARFORMATW *pcfmtW, CHARFORMATA *pcfmtA );
// ----------------------------------
// Unicode Wrapped Functions
// ----------------------------------
// We could use inline and a function pointer table to improve efficiency and code size.
static ATOM WINAPI RegisterREClass(
const WNDCLASSW *lpWndClass,
const char *szAnsiClassName,
WNDPROC AnsiWndProc
);
static BOOL GetVersion(
DWORD *pdwPlatformId,
DWORD *pdwMajorVersion
);
static BOOL WINAPI GetStringTypeEx(
LCID Locale,
DWORD dwInfoType,
LPCWSTR lpSrcStr,
int cchSrc,
LPWORD lpCharType
);
static LPWSTR WINAPI CharLower(LPWSTR pwstr);
static DWORD WINAPI CharLowerBuff(LPWSTR pwstr, DWORD cchLength);
static DWORD WINAPI CharUpperBuff(LPWSTR pwstr, DWORD cchLength);
static HDC WINAPI CreateIC(
LPCWSTR lpszDriver,
LPCWSTR lpszDevice,
LPCWSTR lpszOutput,
CONST DEVMODEW * lpInitData
);
static HANDLE WINAPI CreateFile(
LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
static HFONT WINAPI CreateFontIndirect(CONST LOGFONTW * plfw);
static int WINAPI CompareString (
LCID Locale, // locale identifier
DWORD dwCmpFlags, // comparison-style options
LPCWSTR lpString1, // pointer to first string
int cchCount1, // size, in bytes or characters, of first string
LPCWSTR lpString2, // pointer to second string
int cchCount2 // size, in bytes or characters, of second string
);
static LRESULT WINAPI DefWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static int WINAPI GetObject(HGDIOBJ hgdiObj, int cbBuffer, LPVOID lpvObj);
static DWORD APIENTRY GetProfileSection(
LPCWSTR lpAppName,
LPWSTR lpReturnedString,
DWORD nSize
);
static BOOL APIENTRY GetTextExtentPoint32(
HDC hdc,
LPCWSTR pwsz,
int cb,
LPSIZE pSize
);
static int WINAPI GetTextFace(
HDC hdc,
int cch,
LPWSTR lpFaceName
);
static BOOL WINAPI GetTextMetrics(HDC hdc, LPTEXTMETRICW lptm);
static LONG WINAPI GetWindowLong(HWND hWnd, int nIndex);
static HBITMAP WINAPI LoadBitmap(HINSTANCE hInstance, LPCWSTR lpBitmapName);
static HCURSOR WINAPI LoadCursor(HINSTANCE hInstance, LPCWSTR lpCursorName);
static HINSTANCE WINAPI LoadLibrary(LPCWSTR lpLibFileName);
static LRESULT WINAPI SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
static LONG WINAPI SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
static BOOL WINAPI PostMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
static BOOL WINAPI UnregisterClass(LPCWSTR lpClassName, HINSTANCE hInstance);
static int WINAPI lstrcmp(LPCWSTR lpString1, LPCWSTR lpString2);
static int WINAPI lstrcmpi(LPCWSTR lpString1, LPCWSTR lpString2);
static BOOL WINAPI PeekMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg
);
static DWORD WINAPI GetModuleFileName(
HMODULE hModule,
LPWSTR lpFilename,
DWORD nSize
);
// Should also be wrapped but aren't. Used for debugging.
// MessageBox
// OutputDebugString
// lstrcmpiA should also be wrapped for Win CE's sake but the code
// that uses it is ifdeffed out for WINCE.
};
extern CW32System *W32;
#if !defined(W32SYS_CPP)
#define PvAlloc W32->PvAlloc
#define PvReAlloc W32->PvReAlloc
#define FreePv W32->FreePv
#define CopyMemory W32->CopyMemory
#define MoveMemory W32->MoveMemory
#define FillMemory W32->FillMemory
#define ZeroMemory W32->ZeroMemory
#define CompareMemory W32->CompareMemory
#define GlobalAlloc W32->GlobalAlloc
#define GlobalFree W32->GlobalFree
#define GlobalFlags W32->GlobalFlags
#define GlobalReAlloc W32->GlobalReAlloc
#define GlobalSize W32->GlobalSize
#define GlobalLock W32->GlobalLock
#define GlobalHandle W32->GlobalHandle
#define GlobalUnlock W32->GlobalUnlock
#define GetTextAlign W32->GetTextAlign
#define SetTextAlign W32->SetTextAlign
#define InvertRect W32->InvertRect
#define ImmInitialize W32->ImmInitialize
#define ImmTerminate W32->ImmTerminate
// GuyBark: Use the real system functions:
#ifndef PWD_JUPITER
#define pImmGetCompositionString ImmGetCompositionStringW
#define pImmSetCompositionFont ImmSetCompositionFontW
#define pImmGetContext ImmGetContext
#define pImmSetCompositionWindow ImmSetCompositionWindow
#define pImmReleaseContext ImmReleaseContext
#define pImmGetProperty ImmGetProperty
#define pImmGetCandidateWindow ImmGetCandidateWindow
#define pImmSetCandidateWindow ImmSetCandidateWindow
#define pImmNotifyIME ImmNotifyIME
#define pImmAssociateContext ImmAssociateContext
#define pImmGetVirtualKey ImmGetVirtualKey
#define pImmEscape ImmEscape
#define pImmGetOpenStatus ImmGetOpenStatus
#define pImmGetConversionStatus ImmGetConversionStatus
/*#define pImmGetCompositionString W32->ImmGetCompositionStringA
#define pImmSetCompositionString W32->ImmSetCompositionStringA
#define pImmGetContext W32->ImmGetContext
#define pImmSetCompositionFont W32->ImmSetCompositionFontA
#define pImmSetCompositionWindow W32->ImmSetCompositionWindow
#define pImmReleaseContext W32->ImmReleaseContext
#define pImmGetProperty W32->ImmGetProperty
#define pImmGetCandidateWindow W32->ImmGetCandidateWindow
#define pImmSetCandidateWindow W32->ImmSetCandidateWindow
#define pImmNotifyIME W32->ImmNotifyIME
#define pImmAssociateContext W32->ImmAssociateContext
#define pImmGetVirtualKey W32->ImmGetVirtualKey
#define pImmEscape W32->ImmEscape
#define pImmGetOpenStatus W32->ImmGetOpenStatus
#define pImmGetConversionStatus W32->ImmGetConversionStatus*/
#else
// On the WinCE device, use the wide version of ImmGetCompositionString() and
// ImmGetCompositionFont(). Retain the pImmGetCompositionStringA macro to
// minmize the code changes.
#define pImmGetCompositionString ImmGetCompositionStringW
#define pImmSetCompositionFont ImmSetCompositionFontW
#define pImmGetContext ImmGetContext
#define pImmSetCompositionWindow ImmSetCompositionWindow
#define pImmReleaseContext ImmReleaseContext
#define pImmGetProperty ImmGetProperty
#define pImmGetCandidateWindow ImmGetCandidateWindow
#define pImmSetCandidateWindow ImmSetCandidateWindow
#define pImmNotifyIME ImmNotifyIME
#define pImmAssociateContext ImmAssociateContext
#define pImmGetVirtualKey ImmGetVirtualKey
#define pImmEscape ImmEscape
#define pImmGetOpenStatus ImmGetOpenStatus
#define pImmGetConversionStatus ImmGetConversionStatus
#endif // !PWD_JUPITER
//#define pGetKeyboardLayoutList W32->GetKeyboardLayoutList
#define pLoadRegTypeLib W32->LoadRegTypeLib
#define pLoadTypeLib W32->LoadTypeLib
#define pSysAllocString W32->SysAllocString
#define pSysAllocStringLen W32->SysAllocStringLen
#define pSysFreeString W32->SysFreeString
#define pSysStringLen W32->SysStringLen
#define pVariantInit W32->VariantInit
#define pOleCreateFromData W32->OleCreateFromData
#define pCoTaskMemFree W32->CoTaskMemFree
#define pCreateBindCtx W32->CreateBindCtx
#define pOleDuplicateData W32->OleDuplicateData
#define pCoTreatAsClass W32->CoTreatAsClass
#define pProgIDFromCLSID W32->ProgIDFromCLSID
#define pOleConvertIStorageToOLESTREAM W32->OleConvertIStorageToOLESTREAM
#define pOleConvertIStorageToOLESTREAMEx W32->OleConvertIStorageToOLESTREAMEx
#define pOleSave W32->OleSave
#define pStgCreateDocfileOnILockBytes W32->StgCreateDocfileOnILockBytes
#define pCreateILockBytesOnHGlobal W32->CreateILockBytesOnHGlobal
#define pOleCreateLinkToFile W32->OleCreateLinkToFile
#define pCoTaskMemAlloc W32->CoTaskMemAlloc
#define pCoTaskMemRealloc W32->CoTaskMemRealloc
#define pOleInitialize W32->OleInitialize
#define pOleUninitialize W32->OleUninitialize
#define pOleSetClipboard W32->OleSetClipboard
#define pOleFlushClipboard W32->OleFlushClipboard
#define pOleIsCurrentClipboard W32->OleIsCurrentClipboard
#define pDoDragDrop W32->DoDragDrop
#define pOleGetClipboard W32->OleGetClipboard
#define pRegisterDragDrop W32->RegisterDragDrop
#define pOleCreateLinkFromData W32->OleCreateLinkFromData
#define pOleCreateStaticFromData W32->OleCreateStaticFromData
#define pOleDraw W32->OleDraw
#define pOleSetContainedObject W32->OleSetContainedObject
#define pCoDisconnectObject W32->CoDisconnectObject
#define pWriteFmtUserTypeStg W32->WriteFmtUserTypeStg
#define pWriteClassStg W32->WriteClassStg
#define pSetConvertStg W32->SetConvertStg
#define pReadFmtUserTypeStg W32->ReadFmtUserTypeStg
#define pReadClassStg W32->ReadClassStg
#define pOleRun W32->OleRun
#define pRevokeDragDrop W32->RevokeDragDrop
#define pCreateStreamOnHGlobal W32->CreateStreamOnHGlobal
#define pGetHGlobalFromStream W32->GetHGlobalFromStream
#define pOleCreateDefaultHandler W32->OleCreateDefaultHandler
#define pCLSIDFromProgID W32->CLSIDFromProgID
#define pOleConvertOLESTREAMToIStorage W32->OleConvertOLESTREAMToIStorage
#define pOleLoad W32->OleLoad
#define pReleaseStgMedium W32->ReleaseStgMedium
#define pFSupportSty W32->FSupportSty
#define pPIMEStyleFromAttr W32->PIMEStyleFromAttr
#define pPColorStyleTextFromIMEStyle W32->PColorStyleTextFromIMEStyle
#define pPColorStyleBackFromIMEStyle W32->PColorStyleBackFromIMEStyle
#define pFBoldIMEStyle W32->FBoldIMEStyle
#define pFItalicIMEStyle W32->FItalicIMEStyle
#define pFUlIMEStyle W32->FUlIMEStyle
#define pIdUlIMEStyle W32->IdUlIMEStyle
#define pRGBFromIMEColorStyle W32->RGBFromIMEColorStyle
#define fHaveIMMProcs W32->_fHaveIMMProcs
#define dwPlatformId W32->_dwPlatformId
#define dwMajorVersion W32->_dwMajorVersion
#define icr3DDarkShadow W32->_icr3DDarkShadow
#define CharSetIndexFromChar W32->CharSetIndexFromChar
#define CheckDBCInUnicodeStr W32->CheckDBCInUnicodeStr
#define MbcsFromUnicode W32->MbcsFromUnicode
#define UnicodeFromMbcs W32->UnicodeFromMbcs
#define TextHGlobalAtoW W32->TextHGlobalAtoW
#define TextHGlobalWtoA W32->TextHGlobalWtoA
#define ConvertLanguageIDtoCodePage W32->ConvertLanguageIDtoCodePage
#define IsFELCID W32->IsFELCID
#define IsFECharset W32->IsFECharset
#define IsFEChar W32->IsFEChar
#define In125x W32->In125x
#define IsLeadByte W32->IsLeadByte
#define IsTrailByte W32->IsTrailByte
#define GetCharSet W32->GetCharSet
#define GetCodePage W32->GetCodePage
#define GetKeyboardCodePage W32->GetKeyboardCodePage
#define GetKeyboardLCID W32->GetKeyboardLCID
#define GetLocaleCodePage W32->GetLocaleCodePage
#define GetLocaleLCID W32->GetLocaleLCID
#define IsCharSetValid W32->IsCharSetValid
#define MBTWC W32->MBTWC
#define WCTMB W32->WCTMB
#define ConvertCHARFORMATAtoW W32->ConvertCHARFORMATAtoW
#define ConvertCHARFORMATWtoA W32->ConvertCHARFORMATWtoA
#define CharLower W32->CharLower
#define CharLowerBuff W32->CharLowerBuff
#define CharUpperBuff W32->CharUpperBuff
#define CreateIC W32->CreateIC
#define CreateFile W32->CreateFile
#define CreateFontIndirect W32->CreateFontIndirect
#define CompareString W32->CompareString
#define DefWindowProc W32->DefWindowProc
//#define GetKeyboardLayout W32->GetKeyboardLayout
#define GetProfileSection W32->GetProfileSection
#define GetTextExtentPoint32 W32->GetTextExtentPoint32
#define GetTextFace W32->GetTextFace
#define GetWindowLong W32->GetWindowLong
#define LoadBitmap W32->LoadBitmap
#define LoadCursor W32->LoadCursor
#define LoadLibrary W32->LoadLibrary
#define SendMessage W32->SendMessage
#define SetWindowLong W32->SetWindowLong
#define PostMessage W32->PostMessage
#define lstrcmp W32->lstrcmp
#define lstrcmpi W32->lstrcmpi
#define PeekMessage W32->PeekMessage
#define GetMapMode W32->GetMapMode
#define WinLPtoDP W32->WinLPtoDP
#define WinDPtoLP W32->WinDPtoLP
#define MulDiv W32->MulDiv
#define GetCursorPos W32->GetCursorPos
#if defined(DEBUG)
#define sprintf W32->sprintf
#endif
#endif // !defined(W32SYS_CPP)
#if defined(DEBUG) && defined(PEGASUS)
// dbug32.dll has not been ported to Windows CE but we still want some assert support.
#undef Assert
#undef SideAssert
#undef AssertSz
#ifdef TRACEBEGIN
#undef TRACEBEGIN
#endif
#define AssertSz(f, sz) W32->AssertFn(f ? TRUE : FALSE, sz, __FILE__, __LINE__)
#define Assert(f) W32->AssertFn(f ? TRUE : FALSE, NULL, __FILE__, __LINE__)
#define SideAssert(f) W32->AssertFn(f ? TRUE : FALSE, NULL, __FILE__, __LINE__)
#define TRACEBEGIN(ss, sc, sz) W32->TraceMsg(TEXT(sz))
#endif
//#pragma message("Review : Need clean up. Should be System inline members.")
#define OnWinNTFE() 0
#define OnWin95FE() 0
#define VER_PLATFORM_WIN32_MACINTOSH 0x8001
#if defined PEGASUS && !defined(WINNT)
// The follwing definitions do not exist in the Windows CE environment but we emulate them.
// The values have been copied from the appropriate win32 header files.
#pragma message("Using NT definitions not in Windows CE")
// Memory allocation flag. Win CE uses Local mem instead of Global mem
#undef GMEM_SHARE
#define GMEM_SHARE 0x2000
#define GMEM_ZEROINIT LMEM_ZEROINIT
#define GMEM_MOVEABLE LMEM_MOVEABLE
#define GMEM_FIXED LMEM_FIXED
// Scroll Bars
#define ESB_ENABLE_BOTH 0x0000
#define ESB_DISABLE_BOTH 0x0003
// Text alignment values
#define TA_TOP 0
#define TA_BOTTOM 8
#define TA_BASELINE 24
#define TA_CENTER 6
#define TA_LEFT 0
// Device Technology. This one is mostly used for exclusion
#define DT_METAFILE 5 /* Metafile, VDM */
// Resources for LoadCursor.
#define IDC_ARROW MAKEINTRESOURCE(32512)
#define IDC_IBEAM MAKEINTRESOURCE(32513)
// FInd/Replace options
#define FR_DOWN 0x00000001
#define FR_WHOLEWORD 0x00000002
#define FR_MATCHCASE 0x00000004
// Window messages
#define WM_NCMOUSEMOVE 0x00A0
#define WM_NCMBUTTONDBLCLK 0x00A9
#define WM_DROPFILES 0x0233
// Code Pages
#define CP_UTF8 65001 /* UTF-8 translation */
// Clipboard formats
#define CF_METAFILEPICT 3
// Special cursor shapes
#define IDC_SIZENWSE MAKEINTRESOURCE(32642)
#define IDC_SIZENESW MAKEINTRESOURCE(32643)
#define IDC_SIZENS MAKEINTRESOURCE(32645)
#define IDC_SIZEWE MAKEINTRESOURCE(32644)
/* Mapping Modes */
#define MM_TEXT 1
#define MM_TWIPS 6
#define MM_ANISOTROPIC 8
#define SetMapMode(hdc, mapmode)
#define SetWindowOrgEx(hdc, xOrg, yOrg, pt)
#define SetViewportExtEx(hdc, nX, nY, lpSize)
#define SetWindowExtEx(hdc, x, y, lpSize)
/* Pen Styles : Windows CE only supports PS_DASH */
#define PS_DOT PS_DASH
#define PS_DASHDOT PS_DASH
#define PS_DASHDOTDOT PS_DASH
/* Missing APIs */
#define GetMessageTime() 0
#define IsIconic(hwnd) 0
#pragma message ("JMO Review : This is temporary to try to get the Pegasus Build untracked" )
#ifdef DEBUG
#define MoveToEx(a, b, c, d) 0
#else
#define MoveToEx(a, b, c, d)
#endif
#ifdef DEBUG
#define LineTo(a, b, c) 0
#else
#define LineTo(a, b, c)
#endif
#define GetProfileIntA(a, b, c) 0
class METARECORD
{
};
#define GetDesktopWindow() NULL
#define WS_EX_TRANSPARENT 0x00000020L
#define WM_MOUSEACTIVATE 0x0021
// GuyBark Jupiter 50100: This DOES exist on the device, and it works
// just fine! To ifdef it zero here only serves to make RichEdit fail.
#ifndef PWD_JUPITER
#define IsDBCSLeadByte(x) 0
#endif // !PWD_JUPITER
#define WM_SYSCOLORCHANGE 0x0015
#define WM_STYLECHANGING 0x007C
#define WM_WINDOWPOSCHANGING 0x0046
#define WM_SETCURSOR 0x0020
#define WM_NCPAINT 0x0085
#define OEM_CHARSET 255
#define SHIFTJIS_CHARSET 128
#define THAI_CHARSET 222
#define WM_IME_CHAR 0x0286
#define IME_CMODE_NATIVE 0x0001
#define IME_CMODE_HANGEUL IME_CMODE_NATIVE
#define IME_ESC_HANJA_MODE 0x1008
#define SM_SWAPBUTTON 23
class HDROP
{
};
#define TCI_SRCCODEPAGE 2
#define TPM_RIGHTBUTTON 0x0002L
#define RegisterClipboardFormatA(s) RegisterClipboardFormatW(TEXT(s))
#define GetThreadLocale() 0
#define EASTEUROPE_CHARSET 238
#define HEBREW_CHARSET 177
#define RUSSIAN_CHARSET 204
#define GB2312_CHARSET 134
#define HANGEUL_CHARSET 129
#define JOHAB_CHARSET 130
#define CHINESEBIG5_CHARSET 136
#define GREEK_CHARSET 161
#define TURKISH_CHARSET 162
#define BALTIC_CHARSET 186
#define ARABIC_CHARSET 178
#define MAC_CHARSET 77
#define ENUMLOGFONTA ENUMLOGFONT
#define ENUMLOGFONTW ENUMLOGFONT
#define FONTENUMPROCA FONTENUMPROC
typedef int *LPOPENFILENAMEA;
typedef int *LPOPENFILENAMEW;
#endif
#endif
| china20/MPFUI | trunk/suiwgx/src/richedit/src/_w32sys.h | C | mit | 36,826 | [
30522,
1013,
1013,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
3395,
2000,
1996,
3408,
1997,
1996,
7513,
4207,
1013,
1013,
3120,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2001-2012 Remi Vankeisbelck
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package woko.util.pexpressions;
public class ExpressionTreeWalker extends ExpressionNodeWalker {
public void walk(ExpressionTree tree) {
onTree(tree);
walk(tree.getRoot());
}
public void onTree(ExpressionTree tree) { }
}
| pojosontheweb/woko | core/src/main/java/woko/util/pexpressions/ExpressionTreeWalker.java | Java | apache-2.0 | 862 | [
30522,
1013,
1008,
1008,
9385,
2541,
1011,
2262,
2128,
4328,
3158,
29501,
19022,
2884,
3600,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
#include "Language.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "World.h"
#include "ObjectMgr.h"
#include "Log.h"
#include "Opcodes.h"
#include "Guild.h"
#include "ArenaTeam.h"
#include "GossipDef.h"
#include "SocialMgr.h"
/*enum PetitionType // dbc data
{
PETITION_TYPE_GUILD = 1,
PETITION_TYPE_ARENA_TEAM = 3
};*/
// Charters ID in item_template
#define GUILD_CHARTER 5863
#define GUILD_CHARTER_COST 1000 // 10 S
#define ARENA_TEAM_CHARTER_2v2 23560
#define ARENA_TEAM_CHARTER_2v2_COST 800000 // 80 G
#define ARENA_TEAM_CHARTER_3v3 23561
#define ARENA_TEAM_CHARTER_3v3_COST 1200000 // 120 G
#define ARENA_TEAM_CHARTER_5v5 23562
#define ARENA_TEAM_CHARTER_5v5_COST 2000000 // 200 G
#define CHARTER_DISPLAY_ID 16161
void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode CMSG_PETITION_BUY");
recv_data.hexlike();
uint64 guidNPC;
uint32 unk2;
std::string name;
recv_data >> guidNPC; // NPC GUID
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint64>(); // 0
recv_data >> name; // name
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint32>(); // 0
recv_data.read_skip<uint16>(); // 0
recv_data.read_skip<uint8>(); // 0
recv_data >> unk2; // index
recv_data.read_skip<uint32>(); // 0
DEBUG_LOG("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
// prevent cheating
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC,UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
{
DEBUG_LOG("WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint32 charterid = 0;
uint32 cost = 0;
uint32 type = 0;
if(pCreature->isTabardDesigner())
{
// if tabard designer, then trying to buy a guild charter.
// do not let if already in guild.
if(_player->GetGuildId())
return;
charterid = GUILD_CHARTER;
cost = GUILD_CHARTER_COST;
type = 9;
}
else
{
// TODO: find correct opcode
if(_player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
{
SendNotification(LANG_ARENA_ONE_TOOLOW, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
return;
}
switch(unk2)
{
case 1:
charterid = ARENA_TEAM_CHARTER_2v2;
cost = ARENA_TEAM_CHARTER_2v2_COST;
type = 2; // 2v2
break;
case 2:
charterid = ARENA_TEAM_CHARTER_3v3;
cost = ARENA_TEAM_CHARTER_3v3_COST;
type = 3; // 3v3
break;
case 3:
charterid = ARENA_TEAM_CHARTER_5v5;
cost = ARENA_TEAM_CHARTER_5v5_COST;
type = 5; // 5v5
break;
default:
DEBUG_LOG("unknown selection at buy petition: %u", unk2);
return;
}
if(_player->GetArenaTeamId(unk2 - 1))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
return;
}
}
if(type == 9)
{
if(sObjectMgr.GetGuildByName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
return;
}
if(sObjectMgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_INVALID);
return;
}
}
else
{
if(sObjectMgr.GetArenaTeamByName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
return;
}
if(sObjectMgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID);
return;
}
}
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(charterid);
if(!pProto)
{
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0);
return;
}
if(_player->GetMoney() < cost)
{ //player hasn't got enough money
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
return;
}
ItemPosCountVec dest;
uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount );
if(msg != EQUIP_ERR_OK)
{
_player->SendBuyError(msg, pCreature, charterid, 0);
return;
}
_player->ModifyMoney(-(int32)cost);
Item *charter = _player->StoreNewItem(dest, charterid, true);
if(!charter)
return;
charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUIDLow());
// ITEM_FIELD_ENCHANTMENT_1_1 is guild/arenateam id
// ITEM_FIELD_ENCHANTMENT_1_1+1 is current signatures count (showed on item)
charter->SetState(ITEM_CHANGED, _player);
_player->SendNewItem(charter, 1, true, false);
// a petition is invalid, if both the owner and the type matches
// we checked above, if this player is in an arenateam, so this must be data corruption
QueryResult *result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u' AND type = '%u'", _player->GetGUIDLow(), type);
std::ostringstream ssInvalidPetitionGUIDs;
if (result)
{
do
{
Field *fields = result->Fetch();
ssInvalidPetitionGUIDs << "'" << fields[0].GetUInt32() << "' , ";
} while (result->NextRow());
delete result;
}
// delete petitions with the same guid as this one
ssInvalidPetitionGUIDs << "'" << charter->GetGUIDLow() << "'";
DEBUG_LOG("Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str());
CharacterDatabase.escape_string(name);
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
CharacterDatabase.PExecute("INSERT INTO petition (ownerguid, petitionguid, name, type) VALUES ('%u', '%u', '%s', '%u')",
_player->GetGUIDLow(), charter->GetGUIDLow(), name.c_str(), type);
CharacterDatabase.CommitTransaction();
}
void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
{
// ok
DEBUG_LOG("Received opcode CMSG_PETITION_SHOW_SIGNATURES");
//recv_data.hexlike();
uint8 signs = 0;
uint64 petitionguid;
recv_data >> petitionguid; // petition guid
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
uint32 petitionguid_low = GUID_LOPART(petitionguid);
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
if(!result)
{
sLog.outError("any petition on server...");
return;
}
Field *fields = result->Fetch();
uint32 type = fields[0].GetUInt32();
delete result;
// if guild petition and has guild => error, return;
if(type == 9 && _player->GetGuildId())
return;
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low);
// result==NULL also correct in case no sign yet
if(result)
signs = (uint8)result->GetRowCount();
DEBUG_LOG("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low);
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
data << uint64(petitionguid); // petition guid
data << _player->GetObjectGuid(); // owner guid
data << uint32(petitionguid_low); // guild guid (in mangos always same as GUID_LOPART(petitionguid)
data << uint8(signs); // sign's count
for(uint8 i = 1; i <= signs; ++i)
{
Field *fields2 = result->Fetch();
uint64 plguid = fields2[0].GetUInt64();
data << uint64(plguid); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
}
delete result;
SendPacket(&data);
}
void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode CMSG_PETITION_QUERY");
//recv_data.hexlike();
uint32 guildguid;
ObjectGuid petitionguid;
recv_data >> guildguid; // in mangos always same as GUID_LOPART(petitionguid)
recv_data >> petitionguid; // petition guid
DEBUG_LOG("CMSG_PETITION_QUERY Petition %s Guild GUID %u", petitionguid.GetString().c_str(), guildguid);
SendPetitionQueryOpcode(petitionguid);
}
void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
{
uint32 petitionLowGuid = petitionguid.GetCounter();
ObjectGuid ownerguid;
uint32 type;
std::string name = "NO_NAME_FOR_GUID";
uint8 signs = 0;
QueryResult *result = CharacterDatabase.PQuery(
"SELECT ownerguid, name, "
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, "
" type "
"FROM petition WHERE petitionguid = '%u'", petitionLowGuid, petitionLowGuid);
if (result)
{
Field* fields = result->Fetch();
ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
name = fields[1].GetCppString();
signs = fields[2].GetUInt8();
type = fields[3].GetUInt32();
delete result;
}
else
{
DEBUG_LOG("CMSG_PETITION_QUERY failed for petition (GUID: %u)", petitionLowGuid);
return;
}
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*13));
data << uint32(petitionLowGuid); // guild/team guid (in mangos always same as GUID_LOPART(petition guid)
data << ownerguid; // charter owner guid
data << name; // name (guild/arena team)
data << uint8(0); // 1
if (type == 9)
{
data << uint32(9);
data << uint32(9);
data << uint32(0); // bypass client - side limitation, a different value is needed here for each petition
}
else
{
data << type-1;
data << type-1;
data << type; // bypass client - side limitation, a different value is needed here for each petition
}
data << uint32(0); // 5
data << uint32(0); // 6
data << uint32(0); // 7
data << uint32(0); // 8
data << uint16(0); // 9 2 bytes field
data << uint32(0); // 10
data << uint32(0); // 11
data << uint32(0); // 13 count of next strings?
data << uint32(0); // 14
if (type == 9)
data << uint32(0); // 15 0 - guild, 1 - arena team
else
data << uint32(1);
SendPacket(&data);
}
void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode MSG_PETITION_RENAME"); // ok
//recv_data.hexlike();
uint64 petitionguid;
uint32 type;
std::string newname;
recv_data >> petitionguid; // guid
recv_data >> newname; // new name
Item *item = _player->GetItemByGuid(petitionguid);
if(!item)
return;
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
if(result)
{
Field* fields = result->Fetch();
type = fields[0].GetUInt32();
delete result;
}
else
{
DEBUG_LOG("CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid));
return;
}
if(type == 9)
{
if(sObjectMgr.GetGuildByName(newname))
{
SendGuildCommandResult(GUILD_CREATE_S, newname, ERR_GUILD_NAME_EXISTS_S);
return;
}
if(sObjectMgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
{
SendGuildCommandResult(GUILD_CREATE_S, newname, ERR_GUILD_NAME_INVALID);
return;
}
}
else
{
if(sObjectMgr.GetArenaTeamByName(newname))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
return;
}
if(sObjectMgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_INVALID);
return;
}
}
std::string db_newname = newname;
CharacterDatabase.escape_string(db_newname);
CharacterDatabase.PExecute("UPDATE petition SET name = '%s' WHERE petitionguid = '%u'",
db_newname.c_str(), GUID_LOPART(petitionguid));
DEBUG_LOG("Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionguid), newname.c_str());
WorldPacket data(MSG_PETITION_RENAME, (8+newname.size()+1));
data << uint64(petitionguid);
data << newname;
SendPacket(&data);
}
void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode CMSG_PETITION_SIGN"); // ok
//recv_data.hexlike();
Field *fields;
ObjectGuid petitionGuid;
uint8 unk;
recv_data >> petitionGuid; // petition guid
recv_data >> unk;
uint32 petitionLowGuid = petitionGuid.GetCounter();
QueryResult *result = CharacterDatabase.PQuery(
"SELECT ownerguid, "
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, "
" type "
"FROM petition WHERE petitionguid = '%u'", petitionLowGuid, petitionLowGuid);
if(!result)
{
sLog.outError("any petition on server...");
return;
}
fields = result->Fetch();
uint32 ownerLowGuid = fields[0].GetUInt32();
ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, ownerLowGuid);
uint8 signs = fields[1].GetUInt8();
uint32 type = fields[2].GetUInt32();
delete result;
if (ownerguid == _player->GetObjectGuid())
return;
// not let enemies sign guild charter
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
GetPlayer()->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(ownerguid))
{
if(type != 9)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_NOT_ALLIED);
return;
}
if(type != 9)
{
if(_player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return;
}
uint8 slot = ArenaTeam::GetSlotByType(type);
if(slot >= MAX_ARENA_SLOT)
return;
if(_player->GetArenaTeamId(slot))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
if(_player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
}
else
{
if(_player->GetGuildId())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_IN_GUILD_S);
return;
}
if(_player->GetGuildIdInvited())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_INVITED_TO_GUILD_S);
return;
}
}
if(++signs > type) // client signs maximum
return;
//client doesn't allow to sign petition two times by one character, but not check sign by another character from same account
//not allow sign another player from already sign player account
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE player_account = '%u' AND petitionguid = '%u'", GetAccountId(), petitionLowGuid);
if(result)
{
delete result;
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << petitionGuid;
data << _player->GetObjectGuid();
data << uint32(PETITION_SIGN_ALREADY_SIGNED);
// close at signer side
SendPacket(&data);
// update for owner if online
if(Player *owner = sObjectMgr.GetPlayer(ownerguid))
owner->GetSession()->SendPacket(&data);
return;
}
CharacterDatabase.PExecute("INSERT INTO petition_sign (ownerguid,petitionguid, playerguid, player_account) VALUES ('%u', '%u', '%u','%u')",
ownerLowGuid, petitionLowGuid, _player->GetGUIDLow(), GetAccountId());
DEBUG_LOG("PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)",
petitionLowGuid, _player->GetName(), _player->GetGUIDLow(), GetAccountId());
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << petitionGuid;
data << _player->GetObjectGuid();
data << uint32(PETITION_SIGN_OK);
// close at signer side
SendPacket(&data);
// update signs count on charter, required testing...
//Item *item = _player->GetItemByGuid(petitionguid));
//if(item)
// item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
// update for owner if online
if(Player *owner = sObjectMgr.GetPlayer(ownerguid))
owner->GetSession()->SendPacket(&data);
}
void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode MSG_PETITION_DECLINE"); // ok
//recv_data.hexlike();
ObjectGuid petitionGuid;
recv_data >> petitionGuid; // petition guid
DEBUG_LOG("Petition %s declined by %s", petitionGuid.GetString().c_str(), _player->GetObjectGuid().GetString().c_str());
uint32 petitionLowGuid = petitionGuid.GetCounter();
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", petitionLowGuid);
if (!result)
return;
Field *fields = result->Fetch();
ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
delete result;
Player *owner = sObjectMgr.GetPlayer(ownerguid);
if(owner) // petition owner online
{
WorldPacket data(MSG_PETITION_DECLINE, 8);
data << _player->GetObjectGuid();
owner->GetSession()->SendPacket(&data);
}
}
void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode CMSG_OFFER_PETITION"); // ok
//recv_data.hexlike();
uint8 signs = 0;
uint64 petitionguid, plguid;
uint32 type, junk;
Player *player;
recv_data >> junk; // this is not petition type!
recv_data >> petitionguid; // petition guid
recv_data >> plguid; // player guid
player = ObjectAccessor::FindPlayer(plguid);
if (!player)
return;
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
if (!result)
return;
Field *fields = result->Fetch();
type = fields[0].GetUInt32();
delete result;
DEBUG_LOG("OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid));
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam() )
{
if(type != 9)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_NOT_ALLIED);
return;
}
if(type != 9)
{
if(player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
{
// player is too low level to join an arena team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return;
}
uint8 slot = ArenaTeam::GetSlotByType(type);
if(slot >= MAX_ARENA_SLOT)
return;
if(player->GetArenaTeamId(slot))
{
// player is already in an arena team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
if(player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
}
else
{
if(player->GetGuildId())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_IN_GUILD_S);
return;
}
if(player->GetGuildIdInvited())
{
SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ERR_ALREADY_INVITED_TO_GUILD_S);
return;
}
}
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
// result==NULL also correct charter without signs
if(result)
signs = (uint8)result->GetRowCount();
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
data << uint64(petitionguid); // petition guid
data << _player->GetObjectGuid(); // owner guid
data << uint32(GUID_LOPART(petitionguid)); // guild guid (in mangos always same as GUID_LOPART(petition guid)
data << uint8(signs); // sign's count
for(uint8 i = 1; i <= signs; ++i)
{
Field *fields2 = result->Fetch();
plguid = fields2[0].GetUInt64();
data << uint64(plguid); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
}
delete result;
player->GetSession()->SendPacket(&data);
}
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received opcode CMSG_TURN_IN_PETITION"); // ok
//recv_data.hexlike();
WorldPacket data;
uint64 petitionguid;
uint32 ownerguidlo;
uint32 type;
std::string name;
recv_data >> petitionguid;
DEBUG_LOG("Petition %u turned in by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
// data
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
if(result)
{
Field *fields = result->Fetch();
ownerguidlo = fields[0].GetUInt32();
name = fields[1].GetCppString();
type = fields[2].GetUInt32();
delete result;
}
else
{
sLog.outError("petition table has broken data!");
return;
}
if(type == 9)
{
if(_player->GetGuildId())
{
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << uint32(PETITION_TURN_ALREADY_IN_GUILD); // already in guild
_player->GetSession()->SendPacket(&data);
return;
}
}
else
{
uint8 slot = ArenaTeam::GetSlotByType(type);
if(slot >= MAX_ARENA_SLOT)
return;
if(_player->GetArenaTeamId(slot))
{
//data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
//data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
//_player->GetSession()->SendPacket(&data);
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
return;
}
}
if(_player->GetGUIDLow() != ownerguidlo)
return;
// signs
uint8 signs;
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
if(result)
signs = (uint8)result->GetRowCount();
else
signs = 0;
uint32 count;
//if(signs < sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS))
if(type == 9)
count = sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS);
else
count = type - 1;
if(signs < count)
{
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << uint32(PETITION_TURN_NEED_MORE_SIGNATURES); // need more signatures...
SendPacket(&data);
delete result;
return;
}
if(type == 9)
{
if(sObjectMgr.GetGuildByName(name))
{
SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
delete result;
return;
}
}
else
{
if(sObjectMgr.GetArenaTeamByName(name))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
delete result;
return;
}
}
// and at last charter item check
Item *item = _player->GetItemByGuid(petitionguid);
if(!item)
{
delete result;
return;
}
// OK!
// delete charter item
_player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
if(type == 9) // create guild
{
Guild* guild = new Guild;
if(!guild->Create(_player, name))
{
delete guild;
delete result;
return;
}
// register guild and add guildmaster
sObjectMgr.AddGuild(guild);
// add members
for(uint8 i = 0; i < signs; ++i)
{
Field* fields = result->Fetch();
ObjectGuid signguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
if (signguid.IsEmpty())
continue;
guild->AddMember(signguid, guild->GetLowestRank());
result->NextRow();
}
}
else // or arena team
{
ArenaTeam* at = new ArenaTeam;
if (!at->Create(_player->GetObjectGuid(), type, name))
{
sLog.outError("PetitionsHandler: arena team create failed.");
delete at;
delete result;
return;
}
uint32 icon, iconcolor, border, bordercolor, backgroud;
recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor;
at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor);
// register team and add captain
sObjectMgr.AddArenaTeam(at);
DEBUG_LOG("PetitonsHandler: arena team added to objmrg");
// add members
for(uint8 i = 0; i < signs; ++i)
{
Field* fields = result->Fetch();
ObjectGuid memberGUID = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
if (memberGUID.IsEmpty())
continue;
DEBUG_LOG("PetitionsHandler: adding arena member %s", memberGUID.GetString().c_str());
at->AddMember(memberGUID);
result->NextRow();
}
}
delete result;
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
CharacterDatabase.CommitTransaction();
// created
DEBUG_LOG("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid));
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << uint32(PETITION_TURN_OK);
SendPacket(&data);
}
void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("Received CMSG_PETITION_SHOWLIST"); // ok
//recv_data.hexlike();
uint64 guid;
recv_data >> guid;
SendPetitionShowList(guid);
}
void WorldSession::SendPetitionShowList(uint64 guid)
{
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
{
DEBUG_LOG("WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
uint8 count = 0;
if(pCreature->isTabardDesigner())
count = 1;
else
count = 3;
WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6);
data << uint64(guid); // npc guid
data << uint8(count); // count
if(count == 1)
{
data << uint32(1); // index
data << uint32(GUILD_CHARTER); // charter entry
data << uint32(CHARTER_DISPLAY_ID); // charter display id
data << uint32(GUILD_CHARTER_COST); // charter cost
data << uint32(0); // unknown
data << uint32(9); // required signs?
}
else
{
// 2v2
data << uint32(1); // index
data << uint32(ARENA_TEAM_CHARTER_2v2); // charter entry
data << uint32(CHARTER_DISPLAY_ID); // charter display id
data << uint32(ARENA_TEAM_CHARTER_2v2_COST); // charter cost
data << uint32(2); // unknown
data << uint32(2); // required signs?
// 3v3
data << uint32(2); // index
data << uint32(ARENA_TEAM_CHARTER_3v3); // charter entry
data << uint32(CHARTER_DISPLAY_ID); // charter display id
data << uint32(ARENA_TEAM_CHARTER_3v3_COST); // charter cost
data << uint32(3); // unknown
data << uint32(3); // required signs?
// 5v5
data << uint32(3); // index
data << uint32(ARENA_TEAM_CHARTER_5v5); // charter entry
data << uint32(CHARTER_DISPLAY_ID); // charter display id
data << uint32(ARENA_TEAM_CHARTER_5v5_COST); // charter cost
data << uint32(5); // unknown
data << uint32(5); // required signs?
}
//for(uint8 i = 0; i < count; ++i)
//{
// data << uint32(i); // index
// data << uint32(GUILD_CHARTER); // charter entry
// data << uint32(CHARTER_DISPLAY_ID); // charter display id
// data << uint32(GUILD_CHARTER_COST+i); // charter cost
// data << uint32(0); // unknown
// data << uint32(9); // required signs?
//}
SendPacket(&data);
DEBUG_LOG("Sent SMSG_PETITION_SHOWLIST");
}
| MiLk/mangos | src/game/PetitionsHandler.cpp | C++ | gpl-2.0 | 34,581 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
2230,
24792,
2015,
1026,
8299,
1024,
1013,
1013,
2131,
2386,
12333,
1012,
4012,
1013,
1028,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
"""NEC plugin sharednet
Revision ID: 3b54bf9e29f7
Revises: 511471cc46b
Create Date: 2013-02-17 09:21:48.287134
"""
# revision identifiers, used by Alembic.
revision = '3b54bf9e29f7'
down_revision = '511471cc46b'
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
'neutron.plugins.nec.nec_plugin.NECPluginV2'
]
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.create_table(
'ofctenantmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcnetworkmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcportmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcfiltermappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.drop_table('ofcfiltermappings')
op.drop_table('ofcportmappings')
op.drop_table('ofcnetworkmappings')
op.drop_table('ofctenantmappings')
| Brocade-OpenSource/OpenStack-DNRM-Neutron | neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py | Python | apache-2.0 | 2,645 | [
30522,
1001,
6819,
2213,
1024,
21628,
16033,
2361,
1027,
1018,
5670,
9148,
11927,
2232,
1027,
1018,
3730,
2696,
5910,
14399,
1027,
1018,
1001,
1001,
9385,
2286,
7480,
2696,
3600,
3192,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
The MIT License (MIT)
Copyright (c) 2014-2016 Oleg Kiriljuk
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.
------------------------------------------------------------------------------
[GNU GENERAL PUBLIC LICENSE](http://www.gnu.org/licenses/gpl-2.0.html)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS | shenzhongwei/wine | vendor/bower/free-jqgrid/LICENSE.md | Markdown | apache-2.0 | 16,427 | [
30522,
1996,
10210,
6105,
1006,
10210,
1007,
9385,
1006,
1039,
1007,
2297,
1011,
2355,
25841,
11382,
15928,
9103,
2243,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1997,
2023,
4007,
1998,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include __DIR__.'/../../../application/config/config.php';
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = $config['gi_base_url'].'/api/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';
if( defined('__CLI_MODE') && __CLI_MODE === TRUE ) {
$config['uri_protocol'] = 'AUTO';
}
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'GI_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs. When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
|
*/
$config['encryption_key'] = 'dfsa09302qdflaskf0-2iq';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
| 'sess_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
| when the browser window is closed
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
| 'sess_use_database' = Whether to save the session data to a database
| 'sess_table_name' = The name of the session database table
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name'] = 'gi_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or 'gmt'. This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT. See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./application/config/config.php */
| Minds-On-Design-Lab/giving-impact | gi-api/application/config/config.php | PHP | mit | 13,001 | [
30522,
1026,
1029,
25718,
2065,
1006,
999,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
1007,
6164,
1006,
1005,
2053,
3622,
5896,
3229,
3039,
1005,
1007,
1025,
2421,
1035,
1035,
16101,
1035,
1035,
1012,
1005,
1013,
1012,
1012,
1013,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<p>
Añadir nuevo comentario:
</p>
<p>
<form method="POST" action="/quizzes/<%=quiz.id%>/comments/">
<input type="text" id="comment" name="comment[text]" value="" placeholder="Comentario" /> <p>
<button type="submit">Enviar</button>
</form>
</p> | JavierAmorDeLaCruz/quiz | views/comments/new.js | JavaScript | mit | 272 | [
30522,
1026,
1052,
1028,
9617,
4305,
2099,
22250,
2272,
12380,
9488,
1024,
1026,
1013,
1052,
1028,
1026,
1052,
1028,
1026,
2433,
4118,
1027,
1000,
2695,
1000,
2895,
1027,
1000,
1013,
19461,
11254,
1013,
1026,
1003,
1027,
19461,
1012,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-support/simd-neon.h"
#include "../common/t2bv_32.c"
| termoshtt/rust-fftw3 | fftw-src/fftw-3.3.8/dft/simd/neon/t2bv_32.c | C | mit | 123 | [
30522,
1013,
1008,
7013,
8073,
1012,
2079,
2025,
10086,
999,
1008,
1013,
1001,
9375,
21934,
2094,
1035,
20346,
1000,
21934,
2094,
1011,
2490,
1013,
21934,
2094,
1011,
16231,
1012,
1044,
1000,
1001,
2421,
1000,
1012,
1012,
1013,
2691,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# AUTOGENERATED FILE
FROM balenalib/i386-debian:buster-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.8.6
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 20.3.1
ENV SETUPTOOLS_VERSION 51.0.0
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" \
&& echo "48b7a9dd854690cb00bca21c8872292a26579247140c5f033fc74c5b84cf3bbb Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-i386-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.8
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 32-bit (x86) \nOS: Debian Buster \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.8.6, Pip v20.3.1, Setuptools v51.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/python/i386/debian/buster/3.8.6/build/Dockerfile | Dockerfile | apache-2.0 | 4,849 | [
30522,
1001,
8285,
6914,
16848,
5371,
2013,
28352,
8189,
29521,
1013,
1045,
22025,
2575,
1011,
2139,
15599,
1024,
18396,
1011,
3857,
1001,
6366,
2195,
10279,
1997,
2139,
15599,
18750,
2448,
26794,
1011,
2131,
24694,
1011,
1061,
18750,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BeastApplication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BeastApplication")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)] | mpenchev86/WindowsApplicationsTeamwork | WindowsPhoneApplication/BeastApplication/Properties/AssemblyInfo.cs | C# | mit | 1,052 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
1013,
1013,
2236,
2592,
2055,
2019,
3320,
2003,
4758,
2083,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0) on Tue Apr 22 16:24:49 PDT 2014 -->
<TITLE>
ICurveR.U
</TITLE>
<META NAME="date" CONTENT="2014-04-22">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ICurveR.U";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../igeo/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../igeo/ICurveR.Tan.html" title="class in igeo"><B>PREV CLASS</B></A>
<A HREF="../igeo/ICurveR.U2.html" title="class in igeo"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?igeo/ICurveR.U.html" target="_top"><B>FRAMES</B></A>
<A HREF="ICurveR.U.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
igeo</FONT>
<BR>
Class ICurveR.U</H2>
<PRE>
java.lang.Object
<IMG SRC="../resources/inherit.gif" ALT="extended by "><A HREF="../igeo/IParameterObject.html" title="class in igeo">igeo.IParameterObject</A>
<IMG SRC="../resources/inherit.gif" ALT="extended by "><B>igeo.ICurveR.U</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../igeo/IDoubleOp.html" title="interface in igeo">IDoubleOp</A>, <A HREF="../igeo/IParameter.html" title="interface in igeo">IParameter</A>, <A HREF="../igeo/IScalar.html" title="interface in igeo">IScalar</A>, <A HREF="../igeo/ISubobject.html" title="interface in igeo">ISubobject</A>, <A HREF="../igeo/IVal.html" title="interface in igeo">IVal</A></DD>
</DL>
<DL>
<DT><B>Enclosing class:</B><DD><A HREF="../igeo/ICurveR.html" title="class in igeo">ICurveR</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public static class <B>ICurveR.U</B><DT>extends <A HREF="../igeo/IParameterObject.html" title="class in igeo">IParameterObject</A><DT>implements <A HREF="../igeo/IDoubleOp.html" title="interface in igeo">IDoubleOp</A></DL>
</PRE>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../igeo/ICurveOp.html" title="interface in igeo">ICurveOp</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../igeo/ICurveR.U.html#crv">crv</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../igeo/IVecI.html" title="interface in igeo">IVecI</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../igeo/ICurveR.U.html#pt">pt</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_igeo.IParameterObject"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class igeo.<A HREF="../igeo/IParameterObject.html" title="class in igeo">IParameterObject</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../igeo/IParameterObject.html#parent">parent</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../igeo/ICurveR.U.html#ICurveR.U(igeo.ICurveOp, igeo.IVecI)">ICurveR.U</A></B>(<A HREF="../igeo/ICurveOp.html" title="interface in igeo">ICurveOp</A> c,
<A HREF="../igeo/IVecI.html" title="interface in igeo">IVecI</A> p)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../igeo/IDouble.html" title="class in igeo">IDouble</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../igeo/ICurveR.U.html#get()">get</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../igeo/ICurveR.U.html#x()">x</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_igeo.IParameterObject"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class igeo.<A HREF="../igeo/IParameterObject.html" title="class in igeo">IParameterObject</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../igeo/IParameterObject.html#createObject(igeo.IServerI)">createObject</A>, <A HREF="../igeo/IParameterObject.html#parent()">parent</A>, <A HREF="../igeo/IParameterObject.html#parent(igeo.IObject)">parent</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="crv"><!-- --></A><H3>
crv</H3>
<PRE>
public <A HREF="../igeo/ICurveOp.html" title="interface in igeo">ICurveOp</A> <B>crv</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="pt"><!-- --></A><H3>
pt</H3>
<PRE>
public <A HREF="../igeo/IVecI.html" title="interface in igeo">IVecI</A> <B>pt</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ICurveR.U(igeo.ICurveOp, igeo.IVecI)"><!-- --></A><H3>
ICurveR.U</H3>
<PRE>
public <B>ICurveR.U</B>(<A HREF="../igeo/ICurveOp.html" title="interface in igeo">ICurveOp</A> c,
<A HREF="../igeo/IVecI.html" title="interface in igeo">IVecI</A> p)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="x()"><!-- --></A><H3>
x</H3>
<PRE>
public double <B>x</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../igeo/IDoubleOp.html#x()">x</A></CODE> in interface <CODE><A HREF="../igeo/IDoubleOp.html" title="interface in igeo">IDoubleOp</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="get()"><!-- --></A><H3>
get</H3>
<PRE>
public <A HREF="../igeo/IDouble.html" title="class in igeo">IDouble</A> <B>get</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../igeo/IDoubleOp.html#get()">get</A></CODE> in interface <CODE><A HREF="../igeo/IDoubleOp.html" title="interface in igeo">IDoubleOp</A></CODE><DT><B>Specified by:</B><DD><CODE><A HREF="../igeo/IParameter.html#get()">get</A></CODE> in interface <CODE><A HREF="../igeo/IParameter.html" title="interface in igeo">IParameter</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../igeo/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../igeo/ICurveR.Tan.html" title="class in igeo"><B>PREV CLASS</B></A>
<A HREF="../igeo/ICurveR.U2.html" title="class in igeo"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?igeo/ICurveR.U.html" target="_top"><B>FRAMES</B></A>
<A HREF="ICurveR.U.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| manorius/Processing | libraries/igeo/reference/igeo/ICurveR.U.html | HTML | mit | 14,198 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// @flow
import React, { Component } from 'react';
import { Grid, Row, Col, FormGroup, FormControl, HelpBlock, ControlLabel } from 'react-bootstrap';
export default class AdminFamilySearch extends Component {
render() {
return (
<div>
<Grid>
<Row className="show-grid">
<Col xs={12} md={8}>
<form>
<FormGroup
controlId="formBasicText"
validationState={() => {}}
>
<ControlLabel><p>Search for family (phone; lastname; lastname, firstname)</p></ControlLabel>
<FormControl componentClass="text" />
<FormControl.Feedback />
<HelpBlock><p>Staff attended check-in station</p></HelpBlock>
</FormGroup>
</form>
</Col>
</Row>
</Grid>
</div>
);
}
}
| geekmansam/Olive-Check-In | app/components/admin/family/AdminFamilySearch.js | JavaScript | mit | 909 | [
30522,
1013,
1013,
1030,
4834,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
8370,
1010,
5216,
1010,
8902,
1010,
2433,
17058,
1010,
2433,
8663,
13181,
2140,
1010,
2393,
23467,
1010,
2491,
20470,
2884,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
var mldb = require('mldb')
var unittest = require('mldb/unittest')
function expectEmpty(query)
{
var expected = [];
var resp = mldb.query(query);
mldb.log(resp);
unittest.assertEqual(resp, expected);
}
function expectFound(query)
{
var expected = [
{
"columns" : [
[ "x", 1, "-Inf" ]
],
"rowName" : "\"msnbc.com\""
}
];
var resp = mldb.query(query);
mldb.log(resp);
unittest.assertEqual(resp, expected);
}
// Defeat optimization to use slow path
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() + '' = 'msnbc.com'");
// Fast path for rowName = ...
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() = 'msnbc.com'");
// Fast path for rowName = ...
expectFound("select * from (select 1 as x named 'msnbc.com') where rowName() = '\"msnbc.com\"'");
// Check no exception when invalid rowName (unbalanced quotes)
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() = '\"msnbc.com'");
// Check no exception when invalid rowName (empty)
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() = ''");
// Check in (...)
expectFound("select * from (select 1 as x named 'msnbc.com') where rowName() in ('\"msnbc.com\"')");
expectFound("select * from (select 1 as x named 'msnbc.com') where rowName() in ('\"msnbc.com\"', 'msnbc.com', '\"')");
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() in ('msnbc.com', '\"')");
expectFound("select * from (select 1 as x named 'msnbc.com') where true and rowName() != 'msnbc.com'");
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowName() != '\"msnbc.com\"' + ''");
expectEmpty("select * from (select 1 as x named 'msnbc.com') where true and rowName() != '\"msnbc.com\"'");
// rowPath()
expectFound("select * from (select 1 as x named 'msnbc.com') where rowPath() = 'msnbc.com'");
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowPath() = '\"msnbc.com\"'");
expectFound("select * from (select 1 as x named 'msnbc.com') where rowPath() = 'msnbc.com' + ''");
// Check no exception when invalid rowPath (empty)
expectEmpty("select * from (select 1 as x named 'msnbc.com') where rowPath() = ''");
// Check in (...)
expectFound("select * from (select 1 as x named 'msnbc.com') where rowPath() in ('msnbc.com')");
expectFound("select * from (select 1 as x named 'msnbc.com') where rowPath() in ('msnbc.com', null, [ 1.2, 3.4, 5.6])");
expectEmpty("select * from (select 1 as x named 'msnbc.com') where true and rowPath() != 'msnbc.com'");
expectFound("select * from (select 1 as x named 'msnbc.com') where rowPath() != '\"msnbc.com\"'");
// Tests to add
// rowName() in (keys of xxx)
// rowName() in (values of xxx)
// rowPath() in (keys of xxx)
// rowPath() in (values of xxx)
// Non-canonical rowName() should return no rows, eg '...' should not match "".""."" since we match as strings on rowName, not structured
"success"
| mldbai/mldb | testing/MLDB-1678-rowname-optimizations.js | JavaScript | apache-2.0 | 3,118 | [
30522,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
19875,
18939,
1012,
9385,
2355,
19875,
18939,
1012,
9932,
4297,
1012,
2035,
2916,
9235,
1012,
13075,
19875,
18939,
1027,
5478,
1006,
1005,
19875,
18939,
1005,
1007,
13075,
3131,
22199,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright The Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"io"
"testing"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/release"
)
func TestReleaseTesting(t *testing.T) {
tests := []releaseCase{
{
name: "basic test",
args: []string{"example-release"},
flags: []string{},
responses: map[string]release.TestRun_Status{"PASSED: green lights everywhere": release.TestRun_SUCCESS},
err: false,
},
{
name: "test failure",
args: []string{"example-fail"},
flags: []string{},
responses: map[string]release.TestRun_Status{"FAILURE: red lights everywhere": release.TestRun_FAILURE},
err: true,
},
{
name: "test unknown",
args: []string{"example-unknown"},
flags: []string{},
responses: map[string]release.TestRun_Status{"UNKNOWN: yellow lights everywhere": release.TestRun_UNKNOWN},
err: false,
},
{
name: "test error",
args: []string{"example-error"},
flags: []string{},
responses: map[string]release.TestRun_Status{"ERROR: yellow lights everywhere": release.TestRun_FAILURE},
err: true,
},
{
name: "test running",
args: []string{"example-running"},
flags: []string{},
responses: map[string]release.TestRun_Status{"RUNNING: things are happpeningggg": release.TestRun_RUNNING},
err: false,
},
{
name: "multiple tests example",
args: []string{"example-suite"},
flags: []string{},
responses: map[string]release.TestRun_Status{
"RUNNING: things are happpeningggg": release.TestRun_RUNNING,
"PASSED: party time": release.TestRun_SUCCESS,
"RUNNING: things are happening again": release.TestRun_RUNNING,
"FAILURE: good thing u checked :)": release.TestRun_FAILURE,
"RUNNING: things are happpeningggg yet again": release.TestRun_RUNNING,
"PASSED: feel free to party again": release.TestRun_SUCCESS},
err: true,
},
}
runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command {
return newReleaseTestCmd(c, out)
})
}
| SlickNik/helm | cmd/helm/release_testing_test.go | GO | apache-2.0 | 2,692 | [
30522,
1013,
1008,
9385,
1996,
16254,
6048,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* $NetBSD: ecoff_machdep.h,v 1.1 2002/03/13 05:03:18 simonb Exp $ */
#include <mips/ecoff_machdep.h>
| MarginC/kame | netbsd/sys/arch/evbmips/include/ecoff_machdep.h | C | bsd-3-clause | 103 | [
30522,
1013,
1008,
1002,
5658,
5910,
2094,
1024,
17338,
4246,
1035,
24532,
3207,
2361,
1012,
1044,
1010,
1058,
1015,
1012,
1015,
2526,
1013,
6021,
1013,
2410,
5709,
1024,
6021,
1024,
2324,
4079,
2497,
4654,
2361,
1002,
1008,
1013,
1001,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*!
* jQuery JavaScript Library v1.10.2 -wrap,-css,-effects,-offset,-dimensions
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-07T17:01Z
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<10
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
location = window.location,
document = window.document,
docElem = document.documentElement,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.10.2 -wrap,-css,-effects,-offset,-dimensions",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
var key;
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( jQuery.support.ownLast ) {
for ( key in obj ) {
return core_hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// A method for quickly swapping in/out CSS properties to get correct calculations.
// Note: this method belongs to the css module but it's needed here for the support module.
// If support gets modularized, this method should be moved back to the css module.
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
/*!
* Sizzle CSS Selector Engine v1.10.2
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-07-03
*/
(function( window, undefined ) {
var i,
support,
cachedruns,
Expr,
getText,
isXML,
compile,
outermostContext,
sortInput,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
hasDuplicate = false,
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rsibling = new RegExp( whitespace + "*[+~]" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( documentIsHTML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// QSA path
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if ( parent && parent.attachEvent && parent !== parent.top ) {
parent.attachEvent( "onbeforeunload", function() {
setDocument();
});
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = assert(function( div ) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Support: Opera 10-12/IE8
// ^= $= *= and empty values
// Should not select anything
// Support: Windows 8 Native Apps
// The type attribute is restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "t", "" );
if ( div.querySelectorAll("[t^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
if ( compare ) {
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === doc || contains(preferredDoc, a) ) {
return -1;
}
if ( b === doc || contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
}
// Not directly comparable, sort on existence of method
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val === undefined ?
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null :
val;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
}
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return (val = elem.getAttributeNode( name )) && val.specified ?
val.value :
elem[ name ] === true ? name.toLowerCase() : null;
}
});
}
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
firingLength = 0;
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( list && ( !fired || stack ) ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function( support ) {
var all, a, input, select, fragment, opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Finish early in limited (non-browser) environments
all = div.getElementsByTagName("*") || [];
a = div.getElementsByTagName("a")[ 0 ];
if ( !a || !a.style || !all.length ) {
return support;
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName("tbody").length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName("link").length;
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute("style") );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute("href") === "/a";
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
support.opacity = /^0.5/.test( a.style.opacity );
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!a.style.cssFloat;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
support.optSelected = opt.selected;
// Tests for enctype support on a form (#6743)
support.enctype = !!document.createElement("form").enctype;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Will be defined later
support.inlineBlockNeedsLayout = false;
support.shrinkWrapBlocks = false;
support.pixelPosition = false;
support.deleteExpando = true;
support.noCloneEvent = true;
support.reliableMarginRight = true;
support.boxSizingReliable = true;
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: IE<9
// Iteration over object's inherited properties before its own.
for ( i in jQuery( support ) ) {
break;
}
support.ownLast = i !== "0";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior.
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
support.boxSizing = div.offsetWidth === 4;
});
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})({});
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"applet": true,
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
data = null,
i = 0,
elem = this[0];
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( name.indexOf("data-") === 0 ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return arguments.length > 1 ?
// Sets one value
this.each(function() {
jQuery.data( this, key, value );
}) :
// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n\f]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// Use proper attribute retrieval(#6932, #12072)
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
optionSet = true;
}
}
// force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
ret :
( elem[ name ] = value );
} else {
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
ret :
elem[ name ];
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
-1;
}
}
}
});
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
function( elem, name, isXML ) {
var fn = jQuery.expr.attrHandle[ name ],
ret = isXML ?
undefined :
/* jshint eqeqeq: false */
(jQuery.expr.attrHandle[ name ] = undefined) !=
getter( elem, name, isXML ) ?
name.toLowerCase() :
null;
jQuery.expr.attrHandle[ name ] = fn;
return ret;
} :
function( elem, name, isXML ) {
return isXML ?
undefined :
elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
};
});
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
// Some attributes are constructed with empty-string values when not defined
function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
};
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ret.specified ?
ret.value :
undefined;
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
};
}
jQuery.each([
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
});
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
};
if ( !jQuery.support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
// Support: Webkit
// "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
/* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return jQuery.nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
var isSimple = /^.[^:#\[\.,]*$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i,
ret = [],
self = this,
len = self.length;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector || [], true) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector || [], false) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && (pos ?
pos.index(cur) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors)) ) {
cur = ret.push( cur );
break;
}
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
}));
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
append: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var
// Snapshot the DOM in case .domManip sweeps something relevant into its fragment
args = jQuery.map( this, function( elem ) {
return [ elem.nextSibling, elem.parentNode ];
}),
i = 0;
// Make the changes, replacing each context element with the new content
this.domManip( arguments, function( elem ) {
var next = args[ i++ ],
parent = args[ i++ ];
if ( parent ) {
// Don't use the snapshot next if it has moved (#13810)
if ( next && next.parentNode !== parent ) {
next = this.nextSibling;
}
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
// Allow new content to include elements from the context set
}, true );
// Force removal if there was no new content (e.g., from empty arguments)
return i ? this : this.remove();
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, callback, allowIntersection ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, self.html() );
}
self.domManip( args, callback, allowIntersection );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( this[i], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery._evalUrl( node.src );
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
},
_evalUrl: function( url ) {
return jQuery.ajax({
url: url,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.extend({
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
}
});
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( (match = rheaders.exec( responseHeadersString )) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( err ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
});
}
// Limit scope pollution from any deprecated API
// (function() {
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack;
// })();
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
// Expose jQuery as module.exports in loaders that implement the Node
// module pattern (including browserify). Do not create the global, since
// the user will be storing it themselves locally, and globals are frowned
// upon in the Node module world.
module.exports = jQuery;
} else {
// Otherwise expose jQuery to the global object as usual
window.jQuery = window.$ = jQuery;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () { return jQuery; } );
}
}
})( window );
| michael829/jquery-builder | dist/1.10.2/jquery-css-dimensions-effects-offset-wrap.js | JavaScript | mit | 226,026 | [
30522,
1013,
1008,
999,
1008,
1046,
4226,
2854,
9262,
22483,
3075,
1058,
2487,
1012,
2184,
1012,
1016,
1011,
10236,
1010,
1011,
20116,
2015,
1010,
1011,
3896,
1010,
1011,
16396,
1010,
1011,
9646,
1008,
8299,
1024,
1013,
1013,
1046,
4226,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class CB::Util::ServiceRescuer
def initialize instance
@instance = instance
end
def method_missing method, *args, &block
if @instance.respond_to? method
begin
@instance.public_send method, *args, &block
rescue => e
error_type = e.is_a?(ActiveRecord::RecordNotFound) ? :not_found : :exception
[false, {error: error_type, message: e.message}]
end
else
super
end
end
end | contentbird/contentbird | app/services/cb/util/service_rescuer.rb | Ruby | mit | 439 | [
30522,
2465,
17324,
1024,
1024,
21183,
4014,
1024,
1024,
2326,
6072,
10841,
2121,
13366,
3988,
4697,
6013,
1030,
6013,
1027,
6013,
2203,
13366,
4118,
1035,
4394,
4118,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
2065,
1030,
6013,
1012,
6869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from troposphere import Tags,FindInMap, Ref, Template, Parameter,ImportValue, Ref, Output
from troposphere.efs import FileSystem, MountTarget
from troposphere.ec2 import SecurityGroup, SecurityGroupRule, Instance, Subnet
from create import export_ref, import_ref
from create.network import AclFactory, assoc_nacl_subnet
def efs_setup(template, ops, app_cfn_options, stack_name, stack_setup):
# Variable Declarations
vpc_id=ops.get('vpc_id')
efs_sg = app_cfn_options.network_names['tcpstacks'][stack_name]['sg_name']
efs_acl = app_cfn_options.network_names['tcpstacks'][stack_name]['nacl_name']
# Create EFS FIleSystem
efs_fs=FileSystem(
title='{}{}'.format(ops.app_name, stack_name),
FileSystemTags=Tags(Name='{}-{}'.format(ops.app_name, stack_name))
)
template.add_resource(efs_fs)
export_ref(template, '{}{}{}'.format(ops.app_name,stack_name,"Endpoint"), value=Ref(efs_fs), desc="Endpoint for EFS FileSystem")
# EFS FS Security Groups
efs_security_group=SecurityGroup(
title=efs_sg,
GroupDescription='Allow Access',
VpcId=vpc_id,
Tags=Tags(Name=efs_sg)
)
template.add_resource(efs_security_group)
export_ref(template, efs_sg, value=Ref(efs_sg), desc="Export for EFS Security Group")
# Create Network ACL for EFS Stack
efs_nacl = AclFactory(
template,
name=efs_acl,
vpc_id=ops.vpc_id,
in_networks=[val for key, val in sorted(ops.app_networks.items())],
in_ports=stack_setup['ports'],
out_ports=ops.out_ports,
out_networks=[val for key, val in sorted(ops.app_networks.items())],
ssh_hosts=ops.get("deploy_hosts"),
)
export_ref(
template,
export_name=efs_acl,
value=Ref(efs_acl),
desc="{}{} stack".format("NetACL for", stack_name)
)
# Create Subnets for Mount Targets
for k, v in ops['tcpstacks']['EFS']['networks'].items():
efs_subnet=Subnet(
title='{}{}{}{}'.format(ops.app_name, stack_name, "MountTargetSubnet", k.split("-")[-1]),
AvailabilityZone=k,
CidrBlock=v,
VpcId=vpc_id,
Tags=Tags(Name='{}-{}-{}-{}'.format(ops.app_name, stack_name, "MountTargetSubnet", k.split("-")[-1]))
)
template.add_resource(efs_subnet)
assoc_name = '{}{}{}'.format(stack_name,"AclAssoc",k.split("-")[-1])
assoc_nacl_subnet(template, assoc_name, Ref(efs_acl), Ref(efs_subnet))
efs_mount_target=MountTarget(
title='{}{}{}'.format(ops.app_name, "EFSMountTarget", k.split("-")[-1]),
FileSystemId=Ref(efs_fs),
SecurityGroups=[Ref(efs_security_group)],
SubnetId=Ref(efs_subnet)
)
template.add_resource(efs_mount_target)
| gotropo/gotropo | create/efs.py | Python | gpl-3.0 | 2,807 | [
30522,
2013,
19817,
7361,
25444,
12324,
22073,
1010,
2424,
2378,
2863,
2361,
1010,
25416,
1010,
23561,
1010,
16381,
1010,
12324,
10175,
5657,
1010,
25416,
1010,
6434,
2013,
19817,
7361,
25444,
1012,
1041,
10343,
12324,
6764,
27268,
6633,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Swaggy Jenkins
# Jenkins API clients generated from Swagger / Open API specification
# Version: 1.1.2-pre.0
# Contact: blah@cliffano.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
Describe -tag 'PSOpenAPITools' -name 'EmptyChangeLogSet' {
Context 'EmptyChangeLogSet' {
It 'Initialize-EmptyChangeLogSet' {
# a simple test to create an object
#$NewObject = Initialize-EmptyChangeLogSet -Class "TEST_VALUE" -Kind "TEST_VALUE"
#$NewObject | Should -BeOfType EmptyChangeLogSet
#$NewObject.property | Should -Be 0
}
}
}
| cliffano/swaggy-jenkins | clients/powershell/generated/tests/Model/EmptyChangeLogSet.Tests.ps1 | PowerShell | mit | 615 | [
30522,
1001,
1001,
25430,
8490,
6292,
11098,
1001,
11098,
17928,
7846,
7013,
2013,
25430,
27609,
1013,
2330,
17928,
12827,
1001,
2544,
1024,
1015,
1012,
1015,
1012,
1016,
1011,
3653,
1012,
1014,
1001,
3967,
1024,
27984,
1030,
7656,
6761,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>FLTK Dock: Damage and Redrawing</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
</ul></div>
<h1>Damage and Redrawing</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uchar </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g4061fac9fb28fe6ad1570351a1a3713f">fltk::Widget::damage</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g9f10db48b607c3371db98391b00ac34d">fltk::Widget::set_damage</a> (uchar c)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g32a4160211702f375d7160d5a687cad4">fltk::Widget::redraw</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g59a0c323224ae7abeeffb088b78a4232">fltk::Widget::redraw</a> (uchar c)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g4f41e0c443ec1e3c59005a7c0d6f6f7d">fltk::Widget::redraw_label</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#gbfd2b13a52c619ea7e0db1ec83986f4d">fltk::Widget::redraw_highlight</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__damage.html#g6ea4feac4bdee76a57d666d7241f7422">fltk::Widget::draw</a> ()</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
When redrawing your widgets you should look at the damage bits to see what parts of your widget need redrawing. The handle() method can then set individual damage bits to limit the amount of drawing that needs to be done:<p>
<div class="fragment"><pre class="fragment">MyClass::handle(<span class="keywordtype">int</span> event) {
...
<span class="keywordflow">if</span> (change_to_part1) damage(1);
<span class="keywordflow">if</span> (change_to_part2) damage(2);
<span class="keywordflow">if</span> (change_to_part3) damage(4);
}
MyClass::draw() {
<span class="keywordflow">if</span> (damage() & fltk::DAMAGE_ALL) {
... draw frame/box and other <span class="keyword">static</span> stuff ...
}
<span class="keywordflow">if</span> (damage() & (fltk::DAMAGE_ALL | 1)) draw_part1();
<span class="keywordflow">if</span> (damage() & (fltk::DAMAGE_ALL | 2)) draw_part2();
<span class="keywordflow">if</span> (damage() & (fltk::DAMAGE_ALL | 4)) draw_part3();
}
</pre></div><p>
Except for DAMAGE_ALL, each widget is allowed to assign any meaning to any of the bits it wants. The enumerations are just to provide suggested meanings. <hr><h2>Function Documentation</h2>
<a class="anchor" name="g4061fac9fb28fe6ad1570351a1a3713f"></a><!-- doxytag: member="fltk::Widget::damage" ref="g4061fac9fb28fe6ad1570351a1a3713f" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">uchar Widget::damage </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [inline, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
The 'or' of all the calls to <a class="el" href="group__damage.html#g32a4160211702f375d7160d5a687cad4">redraw()</a> done since the last <a class="el" href="group__damage.html#g6ea4feac4bdee76a57d666d7241f7422">draw()</a>. Cleared to zero after <a class="el" href="group__damage.html#g6ea4feac4bdee76a57d666d7241f7422">draw()</a> is called. </td>
</tr>
</table>
<a class="anchor" name="g6ea4feac4bdee76a57d666d7241f7422"></a><!-- doxytag: member="fltk::Widget::draw" ref="g6ea4feac4bdee76a57d666d7241f7422" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::draw </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget.<p>
User code should not call this! You probably want to call <a class="el" href="group__damage.html#g32a4160211702f375d7160d5a687cad4">redraw()</a>.<p>
The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and <a class="el" href="classfltk_1_1Widget.html#f6b53e8e41f1c00a095e9f66b5b23910">image()</a> inside it to fill it, unless the align() flags are set to put it outside.<p>
Information on how to write your own version is <a href="subclassing.html#draw>"
>here</a>.
<p>
Reimplemented in <a class="el" href="classfltk_1_1Divider.html#3391451c080224304c1856330022c4d1">fltk::Divider</a>, <a class="el" href="classfltk_1_1Group.html#b1c77e39884a17637d05df7ab277fb0d">fltk::Group</a>, <a class="el" href="classfltk_1_1Window.html#2ec96f7b1e29635e7a7bff479697ecf9">fltk::Window</a>, <a class="el" href="classfltk_1_1DockHolder.html#7f9c12705687d5d9239127c64f78c079">fltk::DockHolder</a>, <a class="el" href="classfltk_1_1GripperBar.html#782dab58b554590705e3df2f6e9ed857">fltk::GripperBar</a>, <a class="el" href="classfltk_1_1RegionHolder.html#7199484c42a5167cdafe39121bf0ec2f">fltk::RegionHolder</a>, <a class="el" href="classfltk_1_1ToolDivider.html#9162871531a89ee928f1f1872d6a4cef">fltk::ToolDivider</a>, <a class="el" href="classfltk_1_1ToolWindow.html#d3a4dd022223c2edcc15259e3cdc923c">fltk::ToolWindow</a>, and <a class="el" href="classfltk_1_1WindowHolder.html#8115d0a938e4fc0c04e70bc9f76b1203">fltk::WindowHolder</a>. </td>
</tr>
</table>
<a class="anchor" name="g59a0c323224ae7abeeffb088b78a4232"></a><!-- doxytag: member="fltk::Widget::redraw" ref="g59a0c323224ae7abeeffb088b78a4232" args="(uchar c)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::redraw </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">uchar </td>
<td class="mdname1" valign="top" nowrap> <em>flags</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Indicates that <a class="el" href="group__damage.html#g6ea4feac4bdee76a57d666d7241f7422">draw()</a> should be called, and turns on the given bits in <a class="el" href="group__damage.html#g4061fac9fb28fe6ad1570351a1a3713f">damage()</a>. At least these bits, and possibly others, will still be on when <a class="el" href="group__damage.html#g6ea4feac4bdee76a57d666d7241f7422">draw()</a> is called. </td>
</tr>
</table>
<a class="anchor" name="g32a4160211702f375d7160d5a687cad4"></a><!-- doxytag: member="fltk::Widget::redraw" ref="g32a4160211702f375d7160d5a687cad4" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::redraw </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Same as redraw(DAMAGE_ALL). This bit is used by most widgets to indicate that they should not attempt any incremental update, and should instead completely draw themselves. </td>
</tr>
</table>
<a class="anchor" name="gbfd2b13a52c619ea7e0db1ec83986f4d"></a><!-- doxytag: member="fltk::Widget::redraw_highlight" ref="gbfd2b13a52c619ea7e0db1ec83986f4d" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::redraw_highlight </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Causes a redraw if highlighting changes.<p>
Calls redraw(DAMAGE_HIGHLIGHT) if this widget has a non-zero highlight_color(). This is designed to be called in response to ENTER and EXIT events and not redraw the widget if the no highlight color is being used. </td>
</tr>
</table>
<a class="anchor" name="g4f41e0c443ec1e3c59005a7c0d6f6f7d"></a><!-- doxytag: member="fltk::Widget::redraw_label" ref="g4f41e0c443ec1e3c59005a7c0d6f6f7d" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::redraw_label </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Indicates that the label() should be redrawn. This does nothing if there is no label. If it is an outside label (see align()) then the <a class="el" href="classfltk_1_1Widget.html#afcfed60392799ab3bd7124e2c707575">parent()</a> is told to redraw it. Otherwise <a class="el" href="group__damage.html#g32a4160211702f375d7160d5a687cad4">redraw()</a> is called. </td>
</tr>
</table>
<a class="anchor" name="g9f10db48b607c3371db98391b00ac34d"></a><!-- doxytag: member="fltk::Widget::set_damage" ref="g9f10db48b607c3371db98391b00ac34d" args="(uchar c)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void Widget::set_damage </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">uchar </td>
<td class="mdname1" valign="top" nowrap> <em>c</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Directly change the value returned by <a class="el" href="group__damage.html#g4061fac9fb28fe6ad1570351a1a3713f">damage()</a>. Note that this <em>replaces</em> the value, it does not turn bits on. Use <a class="el" href="group__damage.html#g32a4160211702f375d7160d5a687cad4">redraw()</a> to turn bits on. </td>
</tr>
</table>
</html>
<body>
<hr>
<em>Tue Jun 27 02:19:43 2006. <a href="http://fltkdock.sourceforge.net"><strong>FLTK Dock</strong></a> is copyright © 2006 by MD. Z. Hossain</em>
</body>
</html>
| BeImprovised/fltkdock | doc/group__damage.html | HTML | lgpl-2.1 | 13,374 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
ZynAddSubFX - a software synthesizer
Alienwah.C - "AlienWah" effect
Copyright (C) 2002-2005 Nasca Octavian Paul
Author: Nasca Octavian Paul
Modified for rakarrack by Josep Andreu
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License
as published by the Free Software Foundation.
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 (version 2) for more details.
You should have received a copy of the GNU General Public License (version 2)
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <math.h>
#include "Alienwah.h"
#include <stdio.h>
Alienwah::Alienwah(double sample_rate, uint32_t intermediate_bufsize)
{
lfo = new EffectLFO(sample_rate);
Ppreset = 0;
PERIOD = intermediate_bufsize; // correct for rakarrak, may be adjusted for lv2
fPERIOD = intermediate_bufsize; // correct for rakarrak, may be adjusted for lv2
panning = fb = depth = lrcross = phase = 0.0f;
outvolume = 0.5f;
oldk = 0;
oldpdelay = 0;
setpreset(Ppreset);
cleanup();
oldclfol.a = fb;
oldclfol.b = 0.0;
oldclfor.a = fb;
oldclfor.b = 0.0;
};
Alienwah::~Alienwah()
{
delete lfo;
};
/*
* Apply the effect
*/
void
Alienwah::out(float * efxoutl, float * efxoutr)
{
unsigned int i;
float lfol, lfor;
COMPLEXTYPE clfol, clfor, out, tmp;
lfo->effectlfoout(&lfol, &lfor);
lfol *= depth * D_PI;
lfor *= depth * D_PI;
clfol.a = cosf(lfol + phase) * fb;
clfol.b = sinf(lfol + phase) * fb;
clfor.a = cosf(lfor + phase) * fb;
clfor.b = sinf(lfor + phase) * fb;
for (i = 0; i < PERIOD; i++)
{
float x = (float) i / fPERIOD;
float x1 = 1.0f - x;
//left
tmp.a = clfol.a * x + oldclfol.a * x1;
tmp.b = clfol.b * x + oldclfol.b * x1;
out.a = tmp.a * oldl[oldk].a - tmp.b * oldl[oldk].b
+ (1.0f - fabsf(fb)) * efxoutl[i] * (1.0f - panning);
out.b = tmp.a * oldl[oldk].b + tmp.b * oldl[oldk].a;
oldl[oldk].a = out.a;
oldl[oldk].b = out.b;
float l = out.a * 10.0f * (fb + 0.1f);
//right
tmp.a = clfor.a * x + oldclfor.a * x1;
tmp.b = clfor.b * x + oldclfor.b * x1;
out.a = tmp.a * oldr[oldk].a - tmp.b * oldr[oldk].b
+ (1.0f - fabsf(fb)) * efxoutr[i] * panning;
out.b = tmp.a * oldr[oldk].b + tmp.b * oldr[oldk].a;
oldr[oldk].a = out.a;
oldr[oldk].b = out.b;
float r = out.a * 10.0f * (fb + 0.1f);
if (++oldk >= Pdelay)
oldk = 0;
//LRcross
efxoutl[i] = l * (1.0f - lrcross) + r * lrcross;
efxoutr[i] = r * (1.0f - lrcross) + l * lrcross;
};
oldclfol.a = clfol.a;
oldclfol.b = clfol.b;
oldclfor.a = clfor.a;
oldclfor.b = clfor.b;
}
/*
* Cleanup the effect
*/
void
Alienwah::cleanup()
{
for (int i = oldpdelay; i < MAX_ALIENWAH_DELAY; i++)
{
oldl[i].a = 0.0f;
oldl[i].b = 0.0f;
oldr[i].a = 0.0f;
oldr[i].b = 0.0f;
};
oldk = 0;
}
void
Alienwah::lv2_update_params(uint32_t period)
{
PERIOD = period;
fPERIOD = period;
lfo->updateparams(period);
}
/*
* Parameter control
*/
void
Alienwah::setdepth(int Pdepth)
{
this->Pdepth = Pdepth;
depth = ((float) Pdepth / 127.0f);
}
void
Alienwah::setfb(int Pfb)
{
this->Pfb = Pfb;
fb = fabsf(((float) Pfb - 64.0f) / 64.1f);
fb = sqrtf(fb);
if (fb < 0.4f)
fb = 0.4f;
if (Pfb < 64)
fb = -fb;
}
void
Alienwah::setvolume(int Pvolume)
{
this->Pvolume = Pvolume;
outvolume = (float) Pvolume / 127.0f;
}
void
Alienwah::setpanning(int Ppanning)
{
this->Ppanning = Ppanning;
panning = ((float) Ppanning + .5f) / 127.0f;
}
void
Alienwah::setlrcross(int Plrcross)
{
this->Plrcross = Plrcross;
lrcross = (float) Plrcross / 127.0f;
}
void
Alienwah::setphase(int Pphase)
{
this->Pphase = Pphase;
phase = ((float) Pphase - 64.0f) / 64.0f * PI;
}
void
Alienwah::setdelay(int Pdelay)
{
if (Pdelay > MAX_ALIENWAH_DELAY)
Pdelay = MAX_ALIENWAH_DELAY;
this->Pdelay = Pdelay;
if (Pdelay > oldpdelay) cleanup();
oldpdelay = Pdelay;
}
void
Alienwah::setpreset(int npreset)
{
const int PRESET_SIZE = 11;
const int NUM_PRESETS = 4;
int pdata[MAX_PDATA_SIZE];
int presets[NUM_PRESETS][PRESET_SIZE] = {
//AlienWah1
{64, 64, 80, 0, 0, 62, 60, 105, 25, 0, 64},
//AlienWah2
{64, 64, 95, 106, 0, 101, 60, 105, 17, 0, 64},
//AlienWah3
{64, 64, 55, 0, 1, 100, 112, 105, 31, 0, 42},
//AlienWah4
{64, 64, 1, 0, 1, 66, 101, 11, 47, 0, 86}
};
if (npreset > NUM_PRESETS - 1)
{
Fpre->ReadPreset(11, npreset - NUM_PRESETS + 1, pdata);
for (int n = 0; n < PRESET_SIZE; n++)
changepar(n, pdata[n]);
}
else
{
for (int n = 0; n < PRESET_SIZE; n++)
changepar(n, presets[npreset][n]);
}
Ppreset = npreset;
}
void
Alienwah::changepar(int npar, int value)
{
switch (npar)
{
case 0:
setvolume(value);
break;
case 1:
setpanning(value);
break;
case 2:
lfo->Pfreq = value;
lfo->updateparams(PERIOD);
break;
case 3:
lfo->Prandomness = value;
lfo->updateparams(PERIOD);
break;
case 4:
lfo->PLFOtype = value;
lfo->updateparams(PERIOD);
break;
case 5:
lfo->Pstereo = value;
lfo->updateparams(PERIOD);
break;
case 6:
setdepth(value);
break;
case 7:
setfb(value);
break;
case 8:
setdelay(value);
break;
case 9:
setlrcross(value);
break;
case 10:
setphase(value);
break;
}
}
int
Alienwah::getpar(int npar)
{
switch (npar)
{
case 0:
return (Pvolume);
break;
case 1:
return (Ppanning);
break;
case 2:
return (lfo->Pfreq);
break;
case 3:
return (lfo->Prandomness);
break;
case 4:
return (lfo->PLFOtype);
break;
case 5:
return (lfo->Pstereo);
break;
case 6:
return (Pdepth);
break;
case 7:
return (Pfb);
break;
case 8:
return (Pdelay);
break;
case 9:
return (Plrcross);
break;
case 10:
return (Pphase);
break;
default:
return (0);
}
}
| Stazed/rakarrack | src/Alienwah.C | C++ | gpl-2.0 | 6,852 | [
30522,
1013,
1008,
1062,
18279,
14141,
6342,
29292,
2595,
1011,
1037,
4007,
13564,
7344,
4213,
2232,
1012,
1039,
1011,
1000,
7344,
4213,
2232,
1000,
3466,
9385,
1006,
1039,
1007,
2526,
1011,
2384,
17235,
3540,
13323,
21654,
2703,
3166,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package japgolly.scalajs.react.util
/** It is impossible for you, nor are you supposed to, create an instance for this.
* This is uninhabitable.
*
* This is a marker to indicate that you're not allowed to call a method, whilst leaving the method
* in place for you with a deprecation telling you why its uncallable.
*/
sealed trait NotAllowed extends Any { // Any so that null can't be used
def result: Nothing
}
| japgolly/scalajs-react | util/src/main/scala-2/japgolly/scalajs/react/util/NotAllowed.scala | Scala | apache-2.0 | 426 | [
30522,
7427,
14855,
26952,
14511,
2100,
1012,
26743,
22578,
1012,
10509,
1012,
21183,
4014,
1013,
1008,
1008,
2009,
2003,
5263,
2005,
2017,
1010,
4496,
2024,
2017,
4011,
2000,
1010,
3443,
2019,
6013,
2005,
2023,
1012,
1008,
2023,
2003,
4895... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2014 Liang Li <ll@lianglee.org>. All rights reserved.
*
* This program is a free software and released under the BSD license.
* https://github.com/lang010/acit
*
* Solutions for UVa Problem 10018
* UVa link: http://uva.onlinejudge.org/external/100/10018.html
*
* @Authur Liang Li <ll@lianglee.org>
* @Date Nov 18 19:33:14 2014
*/
import java.util.Scanner;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class Main {
Scanner sc = new Scanner(System.in, "ISO-8859-1");
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, "ISO-8859-1"));
public Main() throws Exception {
}
public static void main(String[] args) throws Exception {
Main m = new Main();
m.run();
m.release();
}
void release() {
sc.close();
pw.close();
}
long reverse(long p) {
long y = 0;
while (p>0) {
y = y*10 + p%10;
p /= 10;
}
return y;
}
void run() {
int cnt = 0;
int n = sc.nextInt();
long x, y;
for (int k = 0; k < n; k++) {
cnt = 0;
x = sc.nextLong();
y = reverse(x);
while (x != y) {
x += y;
y = reverse(x);
cnt++;
}
pw.printf("%d %d%n", cnt, x);
}
}
}
| lang010/acit | uva/10018/Main.java | Java | bsd-3-clause | 1,376 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
16982,
5622,
1026,
2222,
1030,
16982,
10559,
1012,
8917,
1028,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
1037,
2489,
4007,
1998,
2207,
2104,
1996,
18667,
2094,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vimrc CHANGELOG
===============
This file is used to list changes made in each version of the vimrc cookbook.
0.1.0
-----
- [your_name] - Initial release of vimrc
- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
| 4md/chef-vimrc | CHANGELOG.md | Markdown | gpl-2.0 | 447 | [
30522,
6819,
2213,
11890,
2689,
21197,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
2023,
5371,
2003,
2109,
2000,
2862,
3431,
2081,
1999,
2169,
2544,
1997,
1996,
6819,
2213,
11890,
5660,
8654,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.