<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition="('$(Platform)'=='Tegra-Android')" Label="NsightTegraProject">
    <NsightTegraProjectRevisionNumber Label="NsightTegraProject">11</NsightTegraProjectRevisionNumber>
  </PropertyGroup>
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="debug|Tegra-Android">
      <Configuration>debug</Configuration>
      <Platform>Tegra-Android</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="release|Tegra-Android">
      <Configuration>release</Configuration>
      <Platform>Tegra-Android</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="debug|Win32">
      <Configuration>debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="release|Win32">
      <Configuration>release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="debug|x64">
      <Configuration>debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="release|x64">
      <Configuration>release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{6209A624-E0C4-3EB2-EEE2-E7B434B0E876}</ProjectGuid>
    <RootNamespace>NvUI</RootNamespace>
    <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>"arm-linux-androideabi-$(NDK_TOOLCHAIN_VERSION)"</PlatformToolset>
    <FastDeploy>false</FastDeploy>
    <AndroidArch>armv7-a</AndroidArch>
    <AndroidStlType>gnustl_static</AndroidStlType>
    <AndroidTargetAPI>android-24</AndroidTargetAPI>
    <AndroidMinAPI>android-24</AndroidMinAPI>
    <AndroidNativeAPI>android-24</AndroidNativeAPI>
    <NdkToolchainVersion>DefaultGcc</NdkToolchainVersion>
    <AndroidBuildSystem>AntBuild</AndroidBuildSystem>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>"arm-linux-androideabi-$(NDK_TOOLCHAIN_VERSION)"</PlatformToolset>
    <FastDeploy>false</FastDeploy>
    <AndroidArch>armv7-a</AndroidArch>
    <AndroidStlType>gnustl_static</AndroidStlType>
    <AndroidTargetAPI>android-24</AndroidTargetAPI>
    <AndroidMinAPI>android-24</AndroidMinAPI>
    <AndroidNativeAPI>android-24</AndroidNativeAPI>
    <NdkToolchainVersion>DefaultGcc</NdkToolchainVersion>
    <AndroidBuildSystem>AntBuild</AndroidBuildSystem>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">
    <OutDir>$(ProjectDir)./../../lib/Tegra-Android\</OutDir>
    <IntDir>./intermediate/NvUI/Tegra-Android/debug\</IntDir>
    <TargetExt>.a</TargetExt>
    <TargetName>libNvUID</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">
    <ClCompile>
      <FloatingPointModel>Precise</FloatingPointModel>
      <AdditionalOptions>-funwind-tables -O0 -g -ggdb -fno-omit-frame-pointer -Wno-attributes</AdditionalOptions>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>android;ANDROID;_LIB;NV_ANDROID;__STDC_LIMIT_MACROS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
    </ClCompile>
    <Lib>
      <AdditionalOptions> -Wl,--start-group -lc -lm -lgcc -Wl,--end-group</AdditionalOptions>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)libNvUID.a</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/Tegra-Android;./../../lib/Tegra-Android;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/libNvUID.a.pdb</ProgramDatabaseFile>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">
    <OutDir>$(ProjectDir)./../../lib/Tegra-Android\</OutDir>
    <IntDir>./intermediate/NvUI/Tegra-Android/release\</IntDir>
    <TargetExt>.a</TargetExt>
    <TargetName>libNvUI</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">
    <ClCompile>
      <FloatingPointModel>Precise</FloatingPointModel>
      <AdditionalOptions>-funwind-tables -O2 -fno-omit-frame-pointer -Wno-attributes</AdditionalOptions>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>android;ANDROID;_LIB;NV_ANDROID;__STDC_LIMIT_MACROS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
    </ClCompile>
    <Lib>
      <AdditionalOptions> -Wl,--start-group -lc -lm -lgcc -Wl,--end-group</AdditionalOptions>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)libNvUI.a</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/Tegra-Android;./../../lib/Tegra-Android;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/libNvUI.a.pdb</ProgramDatabaseFile>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
    <OutDir>./../../lib/vs2015x86\</OutDir>
    <IntDir>./intermediate/NvUI/vs2015x86/debug\</IntDir>
    <TargetExt>.lib</TargetExt>
    <TargetName>NvUID</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
    <ClCompile>
      <CallingConvention>Cdecl</CallingConvention>
      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SuppressStartupBanner>true</SuppressStartupBanner>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions>/Oy- /EHsc /wd4100 /wd4201 /wd4390 /wd4748 /wd4995 /wd4996 /wd4244 /wd4267 /wd4334</AdditionalOptions>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;./../../externals/include/GLFW;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>NV_FOUNDATION_DLL=0;_LIB;_DEBUG;PROFILE;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
    </ClCompile>
    <Lib>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)NvUID.lib</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/vs2015x86;./../../lib/vs2015x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/NvUID.lib.pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX86</TargetMachine>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
    <OutDir>./../../lib/vs2015x86\</OutDir>
    <IntDir>./intermediate/NvUI/vs2015x86/release\</IntDir>
    <TargetExt>.lib</TargetExt>
    <TargetName>NvUI</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
    <ClCompile>
      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <SuppressStartupBanner>true</SuppressStartupBanner>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions>/Oy- /EHsc /wd4100 /wd4201 /wd4390 /wd4748 /wd4995 /wd4996 /wd4244 /wd4267 /wd4334</AdditionalOptions>
      <Optimization>Full</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;./../../externals/include/GLFW;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>NV_FOUNDATION_DLL=0;_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
    </ClCompile>
    <Lib>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)NvUI.lib</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/vs2015x86;./../../lib/vs2015x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/NvUI.lib.pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX86</TargetMachine>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
    <OutDir>./../../lib/vs2015x64\</OutDir>
    <IntDir>./intermediate/NvUI/vs2015x64/debug\</IntDir>
    <TargetExt>.lib</TargetExt>
    <TargetName>NvUID</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
    <ClCompile>
      <CallingConvention>Cdecl</CallingConvention>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SuppressStartupBanner>true</SuppressStartupBanner>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions>/Oy- /EHsc /wd4100 /wd4201 /wd4390 /wd4748 /wd4995 /wd4996 /wd4244 /wd4267 /wd4334</AdditionalOptions>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;./../../externals/include/GLFW;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>NV_FOUNDATION_DLL=0;_LIB;_DEBUG;PROFILE;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
    </ClCompile>
    <Lib>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)NvUID.lib</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/vs2015x64;./../../lib/vs2015x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/NvUID.lib.pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX64</TargetMachine>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
    <OutDir>./../../lib/vs2015x64\</OutDir>
    <IntDir>./intermediate/NvUI/vs2015x64/release\</IntDir>
    <TargetExt>.lib</TargetExt>
    <TargetName>NvUI</TargetName>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRules />
    <CodeAnalysisRuleAssemblies />
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
    <ClCompile>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <SuppressStartupBanner>true</SuppressStartupBanner>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions>/Oy- /EHsc /wd4100 /wd4201 /wd4390 /wd4748 /wd4995 /wd4996 /wd4244 /wd4267 /wd4334</AdditionalOptions>
      <Optimization>Full</Optimization>
      <AdditionalIncludeDirectories>./../../src/NvUI;./../../include;./../../externals/include;./../../include/NsFoundation;./../../include/NvFoundation;./../../externals/include/GLFW;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>NV_FOUNDATION_DLL=0;_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <WarningLevel>Level3</WarningLevel>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>
      </PrecompiledHeaderFile>
    </ClCompile>
    <Lib>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)NvUI.lib</OutputFile>
      <AdditionalLibraryDirectories>./../../externals/lib/vs2015x64;./../../lib/vs2015x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(OutDir)/NvUI.lib.pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX64</TargetMachine>
    </Lib>
    <ResourceCompile>
    </ResourceCompile>
    <ProjectReference>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
    </ProjectReference>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="..\..\src\NvUI\NvBitFont.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvEmbeddedAsset.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvGestureDetector.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvTweakBar.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvTweakVar.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUI.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIButton.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIContainer.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIGraphic.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIGraphicFrame.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIPopup.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUISlider.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIText.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUITexture.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIValueBar.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIValueText.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClCompile Include="..\..\src\NvUI\NvUIWindow.cpp">
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='debug|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='release|Tegra-Android'">-std="gnu++11" %(AdditionalOptions)</AdditionalOptions>
    </ClCompile>
    <ClInclude Include="..\..\src\NvUI\NvAFont.h">
    </ClInclude>
    <ClInclude Include="..\..\src\NvUI\NvBitFontInternal.h">
    </ClInclude>
    <ClInclude Include="..\..\src\NvUI\NvEmbeddedAsset.h">
    </ClInclude>
    <ClInclude Include="..\..\src\NvUI\NvUIAssetData.h">
    </ClInclude>
    <ClInclude Include="..\..\src\NvUI\NvUIInternal.h">
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\..\include\NvUI\NvBitFont.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvGestureDetector.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvGestureEvent.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvPackedColor.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvTweakBar.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvTweakVar.h">
    </ClInclude>
    <ClInclude Include="..\..\include\NvUI\NvUI.h">
    </ClInclude>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>

{'repo_name': 'tuxalin/CommandBuffer', 'stars': '130', 'repo_language': 'C', 'file_name': 'GLCommands.h', 'mime_type': 'text/x-c++', 'hash': -2998990522679132641, 'source_dataset': 'data'}


/* iCheck plugin Minimal skin, red
----------------------------------- */
.icheckbox_minimal-red,
.iradio_minimal-red {
    display: inline-block;
    *display: inline;
    vertical-align: middle;
    margin: 0;
    padding: 0;
    width: 18px;
    height: 18px;
    background: url(red.png) no-repeat;
    border: none;
    cursor: pointer;
}

.icheckbox_minimal-red {
    background-position: 0 0;
}
    .icheckbox_minimal-red.hover {
        background-position: -20px 0;
    }
    .icheckbox_minimal-red.checked {
        background-position: -40px 0;
    }
    .icheckbox_minimal-red.disabled {
        background-position: -60px 0;
        cursor: default;
    }
    .icheckbox_minimal-red.checked.disabled {
        background-position: -80px 0;
    }

.iradio_minimal-red {
    background-position: -100px 0;
}
    .iradio_minimal-red.hover {
        background-position: -120px 0;
    }
    .iradio_minimal-red.checked {
        background-position: -140px 0;
    }
    .iradio_minimal-red.disabled {
        background-position: -160px 0;
        cursor: default;
    }
    .iradio_minimal-red.checked.disabled {
        background-position: -180px 0;
    }

/* Retina support */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
       only screen and (-moz-min-device-pixel-ratio: 1.5),
       only screen and (-o-min-device-pixel-ratio: 1.5),
       only screen and (min-device-pixel-ratio: 1.5) {
    .icheckbox_minimal-red,
    .iradio_minimal-red {
        background-image: url(red@2x.png);
        -webkit-background-size: 200px 20px;
        background-size: 200px 20px;
    }
}

{'repo_name': 'DOUBLE-Baller/momo', 'stars': '358', 'repo_language': 'PHP', 'file_name': 'jquery.pjax.js', 'mime_type': 'text/plain', 'hash': 3896791701381406888, 'source_dataset': 'data'}


<refentry xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          version="5.0" xml:id="glossdef.block.properties">
<refmeta>
<refentrytitle>glossdef.block.properties</refentrytitle>
<refmiscinfo class="other" otherclass="datatype">attribute set</refmiscinfo>
</refmeta>
<refnamediv>
<refname>glossdef.block.properties</refname>
<refpurpose>To add properties to the block of a glossary definition.</refpurpose>
</refnamediv>

<refsynopsisdiv>
<src:fragment xml:id="glossdef.block.properties.frag"><xsl:attribute-set name="glossdef.block.properties">
  <xsl:attribute name="margin-{$direction.align.start}">.25in</xsl:attribute>
</xsl:attribute-set>
</src:fragment>
</refsynopsisdiv>
<refsection><info><title>Description</title></info>
<para>These properties are added to the block containing a
glossary definition in a glossary when
the <parameter>glossary.as.blocks</parameter> parameter
is non-zero.
Use this attribute-set to set the space above and below,
any font properties,
and any indent for the glossary definition.</para>

</refsection>
</refentry>

{'repo_name': 'ironbee/ironbee', 'stars': '278', 'repo_language': 'XSLT', 'file_name': 'Makefile.am', 'mime_type': 'text/plain', 'hash': -1230333814959260192, 'source_dataset': 'data'}


#	@(#)Makefile	8.1 (Berkeley) 6/6/93

PROG=	patch
SRCS=	patch.c pch.c inp.c version.c util.c

.include <bsd.prog.mk>

{'repo_name': 'sergev/4.4BSD-Lite2', 'stars': '201', 'repo_language': 'C', 'file_name': 'dirs.0', 'mime_type': 'text/plain', 'hash': -1095040584214726999, 'source_dataset': 'data'}


<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Image CRUD
 *
 * A Codeigniter library that creates an instant photo gallery CRUD automatically with just few lines of code.
 *
 * Copyright (C) 2011 through 2012  John Skoumbourdis.
 *
 * LICENSE
 *
 * Image CRUD is released with dual licensing, using the GPL v3 (license-gpl3.txt) and the MIT license (license-mit.txt).
 * You don't have to do anything special to choose one license or the other and you don't have to notify anyone which license you are using.
 * Please see the corresponding license file for details of these licenses.
 * You are free to use, modify and distribute this software, but all copyright information must remain.
 *
 * @package    	image CRUD
 * @copyright  	Copyright (c) 2011 through 2012, John Skoumbourdis
 * @license    	https://github.com/scoumbourdis/image-crud/blob/master/license-image-crud.txt
 * @version    	0.5
 * @author     	John Skoumbourdis <scoumbourdisj@gmail.com>
 */
class image_CRUD {

	protected $table_name = null;
	protected $priority_field = null;
	protected $url_field = 'url';
	protected $title_field = null;
	protected $relation_field = null;
	protected $subject = 'Record';
	protected $image_path = '';
	protected $primary_key = 'id';
	protected $ci = null;
	protected $thumbnail_prefix = 'thumb__';
	protected $views_as_string = '';
	protected $css_files = array();
	protected $js_files = array();

	protected $max_width = 1024;
	protected $max_height = 768;

	/* Unsetters */
	protected $unset_delete = false;
	protected $unset_upload = false;

	protected $language = null;
	protected $lang_strings = array();
	protected $default_language_path = 'assets/image_crud/languages';

	protected $where = array();

	/**
	 *
	 * @var Image_moo
	 */
	private $image_moo = null;

	function __construct() {
		$this->ci = &get_instance();
	}

	function set_table($table_name)
	{
		$this->table_name = $table_name;

		return $this;
	}

	function where($key, $value = NULL, $escape = TRUE)
	{
		$this->where[] = array($key,$value,$escape);
		return $this;
	}

	function set_relation_field($field_name)
	{
		$this->relation_field = $field_name;

		return $this;
	}

	function set_ordering_field($field_name)
	{
		$this->priority_field = $field_name;

		return $this;
	}

	function set_primary_key_field($field_name)
	{
		$this->primary_key = $field_name;

		return $this;
	}

	function set_subject($subject)
	{
		$this->subject = $subject;

		return $this;
	}

	function set_url_field($url_field)
	{
		$this->url_field = $url_field;

		return $this;
	}

	function set_title_field($title_field)
	{
		$this->title_field = $title_field;

		return $this;
	}

	function set_image_path($image_path)
	{
		$this->image_path = $image_path;

		return $this;
	}

	function set_max_width($value)
	{
		$this->max_width = $value;
		return $this;
	}

	function set_max_height($value)
	{
		$this->max_height = $value;
		return $this;
	}

	function set_thumbnail_prefix($prefix)
	{
		$this->thumbnail_prefix = $prefix;

		return $this;
	}

	/**
	 * Unsets the delete operation from the gallery
	 *
	 * @return	void
	 */
	public function unset_delete()
	{
		$this->unset_delete = true;

		return $this;
	}

	/**
	 * Unsets the upload functionality from the gallery
	 *
	 * @return	void
	 */
	public function unset_upload()
	{
		$this->unset_upload = true;

		return $this;
	}

	public function set_css($css_file)
	{
		$this->css_files[sha1($css_file)] = base_url().$css_file;
	}

	public function set_js($js_file)
	{
		$this->js_files[sha1($js_file)] = base_url().$js_file;
	}

	protected function _library_view($view, $vars = array(), $return = FALSE)
	{
		$vars = (is_object($vars)) ? get_object_vars($vars) : $vars;

		$file_exists = FALSE;

		$ext = pathinfo($view, PATHINFO_EXTENSION);
		$file = ($ext == '') ? $view.'.php' : $view;

		$view_file = 'assets/image_crud/views/';

		if (file_exists($view_file.$file))
		{
			$path = $view_file.$file;
			$file_exists = TRUE;
		}

		if ( ! $file_exists)
		{
			throw new Exception('Unable to load the requested file: '.$file, 16);
		}

		extract($vars);

		#region buffering...
		ob_start();

		include($path);

		$buffer = ob_get_contents();
		@ob_end_clean();
		#endregion

		if ($return === TRUE)
		{
		return $buffer;
		}

		$this->views_as_string .= $buffer;
	}

	public function get_css_files()
	{
		return $this->css_files;
	}

	public function get_js_files()
	{
		return $this->js_files;
	}

	/**
	 *
	 * Load the language strings array from the language file
	 */
	private function _load_language()
	{
		$ci = &get_instance();
		$ci->config->load('image_crud');
		if($this->language === null)
		{
			$this->language = strtolower($ci->config->item('image_crud_default_language'));
		}
		include($this->default_language_path.'/'.$this->language.'.php');

		foreach($lang as $handle => $lang_string)
			if(!isset($this->lang_strings[$handle]))
				$this->lang_strings[$handle] = $lang_string;
	}

	/**
	 *
	 * Just an alias to get_lang_string method
	 * @param string $handle
	 */
	public function l($handle)
	{
		return $this->get_lang_string($handle);
	}

	/**
	 *
	 * Get the language string of the inserted string handle
	 * @param string $handle
	 */
	public function get_lang_string($handle)
	{
		return $this->lang_strings[$handle];
	}

	/**
	 *
	 * Simply set the language
	 * @example english
	 * @param string $language
	 */
	public function set_language($language)
	{
		$this->language = $language;

		return $this;
	}

	protected function get_layout()
	{
		$js_files = $this->get_js_files();
		$css_files =  $this->get_css_files();

		return (object)array('output' => $this->views_as_string, 'js_files' => $js_files, 'css_files' => $css_files);

	}

	protected function _upload_file($upload_dir) {

		$reg_exp = '/(\\.|\\/)(gif|jpeg|jpg|png)$/i';

		$options = array(
				'upload_dir' 		=> $upload_dir.'/',
				'param_name'		=> 'qqfile',
				'upload_url'		=> base_url().$upload_dir.'/',
				'accept_file_types' => $reg_exp
		);
		$upload_handler = new ImageUploadHandler($options);
		$uploader_response = $upload_handler->post();

		if(is_array($uploader_response))
		{
			foreach($uploader_response as &$response)
			{
				unset($response->delete_url);
				unset($response->delete_type);
			}

			$upload_response = $uploader_response[0];
		} else {
			$upload_response = false;
		}

		if (!empty($upload_response)) {
			$ci = &get_instance();
			$ci->load->library('image_moo');

			$filename = $upload_response->name;

			$path = $upload_dir.'/'.$filename;

			/* Resizing to 1024 x 768 if its required */
			list($width, $height) = getimagesize($path);
			if($width > $this->max_width || $height > $this->max_height)
			{
				$ci->image_moo->load($path)->resize($this->max_width,$this->max_height)->save($path,true);
			}
			/* ------------------------------------- */

			return $filename;
		} else {
			return false;
		}

    }

    protected function _changing_priority($post_array)
    {
    	$counter = 1;
		foreach($post_array as $photo_id)
		{
			$this->ci->db->update($this->table_name, array($this->priority_field => $counter), array($this->primary_key => $photo_id));
			$counter++;
		}
    }

    protected function _insert_title($primary_key, $value)
    {
		$this->ci->db->update($this->table_name, array($this->title_field => $value), array($this->primary_key => $primary_key));
    }

    protected function _insert_table($file_name, $relation_id = null)
    {
    	$insert = array($this->url_field => $file_name);
    	if(!empty($relation_id))
    		$insert[$this->relation_field] = $relation_id;
    	$this->ci->db->insert($this->table_name, $insert);
    }

    protected function _delete_file($id)
    {
    	$this->ci->db->where($this->primary_key,$id);
    	$result = $this->ci->db->get($this->table_name)->row();

    	unlink( $this->image_path.'/'.$result->{$this->url_field} );
    	unlink( $this->image_path.'/'.$this->thumbnail_prefix.$result->{$this->url_field} );

    	$this->ci->db->delete($this->table_name, array($this->primary_key => $id));
    }

    protected function _get_delete_url($value)
    {
    	$rsegments_array = $this->ci->uri->rsegment_array();
    	return site_url($rsegments_array[1].'/'.$rsegments_array[2].'/delete_file/'.$value);
    }

    protected function _get_photos($relation_value = null)
    {
    	if(!empty($this->priority_field))
    	{
    		$this->ci->db->order_by($this->priority_field);
    	}
    	if(!empty($this->where)) {
			foreach($this->where as $where) {
				$this->ci->db->where($where[0],$where[1],$where[2]);
			}
    	}
    	if(!empty($relation_value))
    	{
    		$this->ci->db->where($this->relation_field, $relation_value);
    	}
    	$results = $this->ci->db->get($this->table_name)->result();

    	$thumbnail_url = !empty($this->thumbnail_path) ? $this->thumbnail_path : $this->image_path;

    	$final_results = array();
    	foreach($results as $num => $row)
    	{
    		$image_filename = $row->{$this->url_field};

    		if (empty($image_filename)) {
    			continue;
    		}

			if (!file_exists($this->image_path . '/' . $this->thumbnail_prefix . $image_filename)) {
				$this->_create_thumbnail($this->image_path.'/'.$image_filename, $this->image_path.'/'.$this->thumbnail_prefix . $image_filename);
			}

    		$results[$num]->image_url = base_url() . $this->image_path . '/' . $image_filename;
    		$results[$num]->thumbnail_url = base_url() . $this->image_path . '/' . $this->thumbnail_prefix . $image_filename;
    		$results[$num]->delete_url = $this->_get_delete_url($row->{$this->primary_key});

    		$final_results[] = $results[$num];
    	}

    	return $final_results;
    }

	protected function _convert_foreign_characters($str_i)
	{
		include('assets/image_crud/config/translit_chars.php');
		if ( ! isset($translit_characters))
		{
			return $str_i;
		}
		return preg_replace(array_keys($translit_characters), array_values($translit_characters), $str_i);
	}

	protected function _create_thumbnail($image_path, $thumbnail_path)
	{
		$this->image_moo
			->load($image_path)
			->resize_crop(90,60)
			->save($thumbnail_path,true);
	}

	protected function getState()
	{
		$rsegments_array = $this->ci->uri->rsegment_array();

		if(isset($rsegments_array[3]) && is_numeric($rsegments_array[3]))
		{
			$upload_url = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/upload_file/'.$rsegments_array[3]);
			$ajax_list_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/'.$rsegments_array[3].'/ajax_list');
			$ordering_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/ordering');
			$insert_title_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/insert_title');

			$state = array( 'name' => 'list', 'upload_url' => $upload_url, 'relation_value' => $rsegments_array[3]);
			$state['ajax'] = isset($rsegments_array[4]) && $rsegments_array[4] == 'ajax_list'  ? true : false;
			$state['ajax_list_url'] = $ajax_list_url;
			$state['ordering_url'] = $ordering_url;
			$state['insert_title_url'] = $insert_title_url;

			return (object)$state;
		}
		elseif( (empty($rsegments_array[3]) && empty($this->relation_field)) || (!empty($rsegments_array[3]) &&  $rsegments_array[3] == 'ajax_list'))
		{
			$upload_url = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/upload_file');
			$ajax_list_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/ajax_list');
			$ordering_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/ordering');
			$insert_title_url  = site_url($rsegments_array[1].'/'.$rsegments_array[2].'/insert_title');

			$state = array( 'name' => 'list', 'upload_url' => $upload_url);
			$state['ajax'] = isset($rsegments_array[3]) && $rsegments_array[3] == 'ajax_list'  ? true : false;
			$state['ajax_list_url'] = $ajax_list_url;
			$state['ordering_url'] = $ordering_url;
			$state['insert_title_url'] = $insert_title_url;

			return (object)$state;
		}
		elseif(isset($rsegments_array[3]) && $rsegments_array[3] == 'upload_file')
		{
			#region Just rename my file
				$new_file_name = '';
				//$old_file_name = $this->_to_greeklish($_GET['qqfile']);
				$old_file_name = $this->_convert_foreign_characters($_GET['qqfile']);
				$max = strlen($old_file_name);
				for($i=0; $i< $max;$i++)
				{
					$numMatches = preg_match('/^[A-Za-z0-9.-_]+$/', $old_file_name[$i], $matches);
					if($numMatches >0)
					{
						$new_file_name .= strtolower($old_file_name[$i]);
					}
					else
					{
						$new_file_name .= '-';
					}
				}
				$file_name = substr( substr( uniqid(), 9,13).'-'.$new_file_name , 0, 100) ;
			#endregion

			$results = array( 'name' => 'upload_file', 'file_name' => $file_name);
			if(isset($rsegments_array[4]) && is_numeric($rsegments_array[4]))
			{
				$results['relation_value'] = $rsegments_array[4];
			}
			return (object)$results;
		}
		elseif(isset($rsegments_array[3]) && isset($rsegments_array[4]) && $rsegments_array[3] == 'delete_file' && is_numeric($rsegments_array[4]))
		{
			$state = array( 'name' => 'delete_file', 'id' => $rsegments_array[4]);
			return (object)$state;
		}
		elseif(isset($rsegments_array[3]) && $rsegments_array[3] == 'ordering')
		{
			$state = array( 'name' => 'ordering');
			return (object)$state;
		}
		elseif(isset($rsegments_array[3]) && $rsegments_array[3] == 'insert_title')
		{
			$state = array( 'name' => 'insert_title');
			return (object)$state;
		}
	}

	function render()
	{
		$ci = &get_instance();
		$this->_load_language();
		$ci->load->helper('url');
		$ci->load->library('Image_moo');
		$this->image_moo = new Image_moo();

		$state_info = $this->getState();

		if(!empty($state_info))
		{
			switch ($state_info->name) {
				case 'list':
					$photos = isset($state_info->relation_value) ? $this->_get_photos($state_info->relation_value) : $this->_get_photos();
					$this->_library_view('list.php',array(
						'upload_url' => $state_info->upload_url,
						'insert_title_url' => $state_info->insert_title_url,
						'photos' => $photos,
						'ajax_list_url' => $state_info->ajax_list_url,
						'ordering_url' => $state_info->ordering_url,
						'primary_key' => $this->primary_key,
						'title_field' => $this->title_field,
						'unset_delete' => $this->unset_delete,
						'unset_upload' => $this->unset_upload,
						'has_priority_field' => $this->priority_field !== null ? true : false
					));

					if($state_info->ajax === true)
					{
						@ob_end_clean();
						echo $this->get_layout()->output;
						die();
					}
					return $this->get_layout();
				break;

				case 'upload_file':
					if($this->unset_upload)
					{
						throw new Exception('This user is not allowed to do this operation', 1);
						die();
					}

					$file_name = $this->_upload_file( $this->image_path);

					if ($file_name !== false) {
						$this->_create_thumbnail( $this->image_path.'/'.$file_name , $this->image_path.'/'.$this->thumbnail_prefix.$file_name );
						$this->_insert_table($file_name, $state_info->relation_value);

						$result = true;
					} else {
						$result = false;
					}

					@ob_end_clean();
					echo json_encode((object)array('success' => $result));

					die();
				break;

				case 'delete_file':
					@ob_end_clean();
					if($this->unset_delete)
					{
						throw new Exception('This user is not allowed to do this operation', 1);
						die();
					}
					$id = $state_info->id;

					$this->_delete_file($id);

					redirect($_SERVER['HTTP_REFERER']);
				break;

				case 'ordering':
					@ob_end_clean();
					$this->_changing_priority($_POST['photos']);
					die();
				break;

				case 'insert_title':
					@ob_end_clean();
					$this->_insert_title($_POST['primary_key'],$_POST['value']);
					die();
				break;
			}
		}

	}

}

/*
 * jQuery File Upload Plugin PHP Example 5.5
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/

class ImageUploadHandler
{
	private $options;

	function __construct($options=null) {
		$this->options = array(
				'script_url' => $this->getFullUrl().'/'.basename(__FILE__),
				'upload_dir' => dirname(__FILE__).'/files/',
				'upload_url' => $this->getFullUrl().'/files/',
				'param_name' => 'files',
				// The php.ini settings upload_max_filesize and post_max_size
		// take precedence over the following max_file_size setting:
				'max_file_size' => null,
				'min_file_size' => 1,
				'accept_file_types' => '/.+$/i',
				'max_number_of_files' => null,
				// Set the following option to false to enable non-multipart uploads:
				'discard_aborted_uploads' => true,
				// Set to true to rotate images based on EXIF meta data, if available:
				'orient_image' => false,
				'image_versions' => array(
				// Uncomment the following version to restrict the size of
		// uploaded images. You can also add additional versions with
		// their own upload directories:
		/*
		 'large' => array(
		 		'upload_dir' => dirname(__FILE__).'/files/',
		 		'upload_url' => dirname($_SERVER['PHP_SELF']).'/files/',
		 		'max_width' => 1920,
		 		'max_height' => 1200
		 ),

		'thumbnail' => array(
				'upload_dir' => dirname(__FILE__).'/thumbnails/',
				'upload_url' => $this->getFullUrl().'/thumbnails/',
				'max_width' => 80,
				'max_height' => 80
		)
		*/
				)
		);
		if ($options) {
			// Or else for PHP >= 5.3.0 use: $this->options = array_replace_recursive($this->options, $options);
			foreach($options as $option_name => $option)
			{
				$this->options[$option_name] = $option;
			}
		}
	}

	function getFullUrl() {
		return
		(isset($_SERVER['HTTPS']) ? 'https://' : 'http://').
		(isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
		(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
				(isset($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] === 443 ||
						$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
						substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
	}

	private function get_file_object($file_name) {
		$file_path = $this->options['upload_dir'].$file_name;
		if (is_file($file_path) && $file_name[0] !== '.') {
			$file = new stdClass();
			$file->name = $file_name;
			$file->size = filesize($file_path);
			$file->url = $this->options['upload_url'].rawurlencode($file->name);
			foreach($this->options['image_versions'] as $version => $options) {
				if (is_file($options['upload_dir'].$file_name)) {
					$file->{$version.'_url'} = $options['upload_url']
					.rawurlencode($file->name);
				}
			}
			$file->delete_url = $this->options['script_url']
			.'?file='.rawurlencode($file->name);
			$file->delete_type = 'DELETE';
			return $file;
		}
		return null;
	}

	private function get_file_objects() {
		return array_values(array_filter(array_map(
				array($this, 'get_file_object'),
				scandir($this->options['upload_dir'])
		)));
	}

	private function create_scaled_image($file_name, $options) {
		$file_path = $this->options['upload_dir'].$file_name;
		$new_file_path = $options['upload_dir'].$file_name;
		list($img_width, $img_height) = @getimagesize($file_path);
		if (!$img_width || !$img_height) {
			return false;
		}
		$scale = min(
				$options['max_width'] / $img_width,
				$options['max_height'] / $img_height
		);
		if ($scale > 1) {
			$scale = 1;
		}
		$new_width = $img_width * $scale;
		$new_height = $img_height * $scale;
		$new_img = @imagecreatetruecolor($new_width, $new_height);
		switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
			case 'jpg':
			case 'jpeg':
				$src_img = @imagecreatefromjpeg($file_path);
				$write_image = 'imagejpeg';
				break;
			case 'gif':
				@imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
				$src_img = @imagecreatefromgif($file_path);
				$write_image = 'imagegif';
				break;
			case 'png':
				@imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
				@imagealphablending($new_img, false);
				@imagesavealpha($new_img, true);
				$src_img = @imagecreatefrompng($file_path);
				$write_image = 'imagepng';
				break;
			default:
				$src_img = $image_method = null;
		}
		$success = $src_img && @imagecopyresampled(
				$new_img,
				$src_img,
				0, 0, 0, 0,
				$new_width,
				$new_height,
				$img_width,
				$img_height
		) && $write_image($new_img, $new_file_path);
		// Free up memory (imagedestroy does not delete files):
		@imagedestroy($src_img);
		@imagedestroy($new_img);
		return $success;
	}

	private function has_error($uploaded_file, $file, $error) {
		if ($error) {
			return $error;
		}
		if (!preg_match($this->options['accept_file_types'], $file->name)) {
			return 'acceptFileTypes';
		}
		if ($uploaded_file && is_uploaded_file($uploaded_file)) {
			$file_size = filesize($uploaded_file);
		} else {
			$file_size = $_SERVER['CONTENT_LENGTH'];
		}

		if ($this->options['max_file_size'] && (
				$file_size > $this->options['max_file_size'] ||
				$file->size > $this->options['max_file_size'])
		) {
			return 'maxFileSize';
		}
		if ($this->options['min_file_size'] &&
				$file_size < $this->options['min_file_size']) {
			return 'minFileSize';
		}
		if (is_int($this->options['max_number_of_files']) && (
				count($this->get_file_objects()) >= $this->options['max_number_of_files'])
		) {
			return 'maxNumberOfFiles';
		}
		return $error;
	}

	private function trim_file_name($name, $type) {
		// Remove path information and dots around the filename, to prevent uploading
		// into different directories or replacing hidden system files.
		// Also remove control characters and spaces (\x00..\x20) around the filename:
		$file_name = trim(basename(stripslashes($name)), ".\x00..\x20");
		// Add missing file extension for known image types:
		if (strpos($file_name, '.') === false &&
				preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
			$file_name .= '.'.$matches[1];
		}

		//Ensure that we don't have disallowed characters and add a unique id just to ensure that the file name will be unique
		$file_name = substr(uniqid(),-5).'-'.preg_replace("/([^a-zA-Z0-9\.\-\_]+?){1}/i", '-', $file_name);

		return $file_name;
	}

	private function orient_image($file_path) {
		$exif = exif_read_data($file_path);
		$orientation = intval(@$exif['Orientation']);
		if (!in_array($orientation, array(3, 6, 8))) {
			return false;
		}
		$image = @imagecreatefromjpeg($file_path);
		switch ($orientation) {
			case 3:
				$image = @imagerotate($image, 180, 0);
				break;
			case 6:
				$image = @imagerotate($image, 270, 0);
				break;
			case 8:
				$image = @imagerotate($image, 90, 0);
				break;
			default:
				return false;
		}
		$success = imagejpeg($image, $file_path);
		// Free up memory (imagedestroy does not delete files):
		@imagedestroy($image);
		return $success;
	}

	private function handle_file_upload($uploaded_file, $name, $size, $type, $error) {
		$file = new stdClass();
		$file->name = $this->trim_file_name($name, $type);
		$file->size = intval($size);
		$file->type = $type;
		$error = $this->has_error($uploaded_file, $file, $error);
		if (!$error && $file->name) {
			$file_path = $this->options['upload_dir'].$file->name;
			$append_file = !$this->options['discard_aborted_uploads'] &&
			is_file($file_path) && $file->size > filesize($file_path);
			clearstatcache();
			if ($uploaded_file && is_uploaded_file($uploaded_file)) {
				// multipart/formdata uploads (POST method uploads)
				if ($append_file) {
					file_put_contents(
							$file_path,
							fopen($uploaded_file, 'r'),
							FILE_APPEND
					);
				} else {
					move_uploaded_file($uploaded_file, $file_path);
				}
			} else {
				// Non-multipart uploads (PUT method support)
				file_put_contents(
						$file_path,
						fopen('php://input', 'r'),
						$append_file ? FILE_APPEND : 0
				);
			}
			$file_size = filesize($file_path);
			if ($file_size === $file->size) {
				if ($this->options['orient_image']) {
					$this->orient_image($file_path);
				}
				$file->url = $this->options['upload_url'].rawurlencode($file->name);
				foreach($this->options['image_versions'] as $version => $options) {
					if ($this->create_scaled_image($file->name, $options)) {
						$file->{$version.'_url'} = $options['upload_url']
						.rawurlencode($file->name);
					}
				}
			} else if ($this->options['discard_aborted_uploads']) {
				unlink($file_path);
				$file->error = 'abort';
			}
			$file->size = $file_size;
			$file->delete_url = $this->options['script_url']
			.'?file='.rawurlencode($file->name);
			$file->delete_type = 'DELETE';
		} else {
			$file->error = $error;
		}
		return $file;
	}

	public function get() {
		$file_name = isset($_REQUEST['file']) ?
		basename(stripslashes($_REQUEST['file'])) : null;
		if ($file_name) {
			$info = $this->get_file_object($file_name);
		} else {
			$info = $this->get_file_objects();
		}
		header('Content-type: application/json');
		echo json_encode($info);
	}

	public function post() {
		if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
			return $this->delete();
		}
		$upload = isset($_FILES[$this->options['param_name']]) ?
		$_FILES[$this->options['param_name']] : null;
		$info = array();
		if ($upload && is_array($upload['tmp_name'])) {
			foreach ($upload['tmp_name'] as $index => $value) {
				$info[] = $this->handle_file_upload(
						$upload['tmp_name'][$index],
						isset($_SERVER['HTTP_X_FILE_NAME']) ?
						$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
						isset($_SERVER['HTTP_X_FILE_SIZE']) ?
						$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
						isset($_SERVER['HTTP_X_FILE_TYPE']) ?
						$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
						$upload['error'][$index]
				);
			}
		} elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
			$info[] = $this->handle_file_upload(
					isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
					isset($_SERVER['HTTP_X_FILE_NAME']) ?
					$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'],
					isset($_SERVER['HTTP_X_FILE_SIZE']) ?
					$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'],
					isset($_SERVER['HTTP_X_FILE_TYPE']) ?
					$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'],
					isset($upload['error']) ? $upload['error'] : null
			);
		}
		header('Vary: Accept');

		$redirect = isset($_REQUEST['redirect']) ?
		stripslashes($_REQUEST['redirect']) : null;
		if ($redirect) {
			header('Location: '.sprintf($redirect, rawurlencode($json)));
			return;
		}
		if (isset($_SERVER['HTTP_ACCEPT']) &&
				(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
			header('Content-type: application/json');
		} else {
			header('Content-type: text/plain');
		}
		return $info;
	}

	public function delete() {
		$file_name = isset($_REQUEST['file']) ?
		basename(stripslashes($_REQUEST['file'])) : null;
		$file_path = $this->options['upload_dir'].$file_name;
		$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
		if ($success) {
			foreach($this->options['image_versions'] as $version => $options) {
				$file = $options['upload_dir'].$file_name;
				if (is_file($file)) {
					unlink($file);
				}
			}
		}
		header('Content-type: application/json');
		echo json_encode($success);
	}

}

{'repo_name': 'scoumbourdis/image-crud', 'stars': '109', 'repo_language': 'JavaScript', 'file_name': 'list.php', 'mime_type': 'text/x-php', 'hash': -8506359324747124514, 'source_dataset': 'data'}


var React = require('react');

var CurrentLocation = React.createClass({

	toggleFavorite(){
		this.props.onFavoriteToggle(this.props.address);
	},

	render(){

		var starClassName = "glyphicon glyphicon-star-empty";

		if(this.props.favorite){
			starClassName = "glyphicon glyphicon-star";
		}

		return (

{this.props.address}

		);
	}

});

module.exports = CurrentLocation;

{'repo_name': 'garris/BackstopJS', 'stars': '5295', 'repo_language': 'JavaScript', 'file_name': 'bootstrap.js', 'mime_type': 'text/plain', 'hash': -6247267505336939808, 'source_dataset': 'data'}


/*
 * Copyright 2018 Azavea
 *
 * 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 geotrellis.raster.io.geotiff

import geotrellis.raster.Dimensions

private [geotiff] trait SegmentTransform {
  def segmentIndex: Int
  def segmentLayoutTransform: GeoTiffSegmentLayoutTransform
  protected def segmentLayout = segmentLayoutTransform.segmentLayout

  protected def bandCount = segmentLayoutTransform.bandCount

  protected def layoutCols: Int = segmentLayout.tileLayout.layoutCols
  protected def layoutRows: Int = segmentLayout.tileLayout.layoutRows

  protected def tileCols: Int = segmentLayout.tileLayout.tileCols
  protected def tileRows: Int = segmentLayout.tileLayout.tileRows

  protected def layoutCol: Int = segmentIndex % layoutCols
  protected def layoutRow: Int = segmentIndex / layoutCols

  val Dimensions(segmentCols, segmentRows) =
    segmentLayoutTransform.getSegmentDimensions(segmentIndex)

  /** The col of the source raster that this index represents. Can produce invalid cols */
  def indexToCol(i: Int) = {
    def tileCol = i % tileCols
    (layoutCol * tileCols) + tileCol
  }

  /** The row of the source raster that this index represents. Can produce invalid rows */
  def indexToRow(i: Int) = {
    def tileRow = i / tileCols
    (layoutRow * tileRows) + tileRow
  }

  /** For single band or band interleave */
  def gridToIndex(col: Int, row: Int): Int

  /** For pixel interleave multiband */
  def gridToIndex(col: Int, row: Int, bandOffset: Int): Int
}

private [geotiff] case class StripedSegmentTransform(segmentIndex: Int, segmentLayoutTransform: GeoTiffSegmentLayoutTransform) extends SegmentTransform {
  def gridToIndex(col: Int, row: Int): Int = {
    val tileCol = col - (layoutCol * tileCols)
    val tileRow = row - (layoutRow * tileRows)
    tileRow * segmentCols + tileCol
  }

  def gridToIndex(col: Int, row: Int, bandOffset: Int): Int = {
    val tileCol = col - (layoutCol * tileCols)
    val tileRow = row - (layoutRow * tileRows)
    (tileRow * segmentCols * bandCount) + (tileCol * bandCount) + bandOffset
  }
}

private [geotiff] case class TiledSegmentTransform(segmentIndex: Int, segmentLayoutTransform: GeoTiffSegmentLayoutTransform) extends SegmentTransform {
  def gridToIndex(col: Int, row: Int): Int = {
    val tileCol = col - (layoutCol * tileCols)
    val tileRow = row - (layoutRow * tileRows)
    tileRow * tileCols + tileCol
  }

  def gridToIndex(col: Int, row: Int, bandOffset: Int): Int = {
    val tileCol = col - (layoutCol * tileCols)
    val tileRow = row - (layoutRow * tileRows)
    (tileRow * tileCols * bandCount) + (tileCol * bandCount) + bandOffset
  }
}

{'repo_name': 'locationtech/geotrellis', 'stars': '1058', 'repo_language': 'Scala', 'file_name': 'CassandraSpatialSpec.scala', 'mime_type': 'text/plain', 'hash': 8088232779354102563, 'source_dataset': 'data'}


=pod

=head1 NAME

RSA_size, RSA_bits, RSA_security_bits - get RSA modulus size or security bits

=head1 SYNOPSIS

 #include <openssl/rsa.h>

 int RSA_size(const RSA *rsa);

 int RSA_bits(const RSA *rsa);

 int RSA_security_bits(const RSA *rsa)

=head1 DESCRIPTION

RSA_size() returns the RSA modulus size in bytes. It can be used to
determine how much memory must be allocated for an RSA encrypted
value.

RSA_bits() returns the number of significant bits.

B<rsa> and B<rsa-E<gt>n> must not be B<NULL>.

RSA_security_bits() returns the number of security bits of the given B<rsa>
key. See L<BN_security_bits(3)>.

=head1 RETURN VALUES

RSA_size() returns the size of modulus in bytes.

DSA_bits() returns the number of bits in the key.

RSA_security_bits() returns the number of security bits.

=head1 SEE ALSO

L<BN_num_bits(3)>

=head1 HISTORY

RSA_bits() was added in OpenSSL 1.1.0.

=head1 COPYRIGHT

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut

{'repo_name': 'artclarke/humble-video', 'stars': '450', 'repo_language': 'C', 'file_name': 'head', 'mime_type': 'text/x-shellscript', 'hash': -2394983298725775881, 'source_dataset': 'data'}


PHP data encryption primer

@timoh6 explains implementing data encryption in PHP

{'repo_name': 'paragonie/awesome-appsec', 'stars': '4179', 'repo_language': 'PHP', 'file_name': '0001-security-driven-dotnet.json', 'mime_type': 'text/plain', 'hash': -172498938418411991, 'source_dataset': 'data'}


/*
 * This file is part of OpenTTD.
 * OpenTTD 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, version 2.
 * OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 */

/** @file news_gui.h GUI functions related to the news. */

#ifndef NEWS_GUI_H
#define NEWS_GUI_H

#include "news_type.h"

void ShowLastNewsMessage();
void ShowMessageHistory();

extern NewsItem *_latest_news;

#endif /* NEWS_GUI_H */

{'repo_name': 'JGRennison/OpenTTD-patches', 'stars': '138', 'repo_language': 'C++', 'file_name': 'FindVersion.cmake', 'mime_type': 'text/plain', 'hash': -7500372898978588200, 'source_dataset': 'data'}


#import <MapKit/MapKit.h>
#import <Weather/City.h>
#import <Weather/DayForecast.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIViewController.h>
#import "Weather/ALEWeatherViewController.h"
#import <Stocks/StockChartData.h>

@class ALENotesComposeViewController;

@interface GEOLatLng : NSObject
- (CGFloat)lat;
- (CGFloat)lng;
@end

@interface GEOPDAutocompleteEntryAddress : NSObject
- (BOOL)hasCenter;
- (GEOLatLng *)center;
@end

@interface GEOPDAutocompleteEntry : NSObject
- (BOOL)hasAddress;
- (GEOPDAutocompleteEntryAddress *)address;
@end

@interface _GEOPlaceSearchCompletionItem : NSObject
- (GEOPDAutocompleteEntry *)entry;
@end
@interface MKSearchCompletion : NSObject
-(NSString *)queryLine;
- (_GEOPlaceSearchCompletionItem *)geoCompletionItem;
@end

@interface WeatherIconsUtility : NSObject
+ (NSString *)lookupWeatherDescriptionShort:(int)arg1;
@end

@interface WeatherImageLoader : NSObject
+ (UIImage *)conditionImageWithConditionIndex:(int)arg1;
@end

@interface HourlyForecast : NSObject
- (NSString *)detail; // tempature
- (int)conditionCode;
- (NSString *)time;
@end

@interface WeatherPreferences : NSObject
+ (instancetype)sharedPreferences;
- (City*)localWeatherCity;
- (NSMutableArray *)loadSavedCities;
@end

@interface SBApplicationShortcutMenuContentView : UIView
@property (nonatomic, retain) UIView *hourlyWeatherView;
@property (nonatomic, retain) UILabel *cityLabel;
@property (nonatomic, retain) UIView *weatherDivider;
@property (nonatomic, retain) UILabel *conditionLabel;
@property (nonatomic, retain) UILabel *lowTempLabel;
@property (nonatomic, retain) UILabel *highTempLabel;
@property (nonatomic, retain) UILabel *bigTempLabel;
@property (retain, nonatomic) ALENotesComposeViewController *ccController;
@property (nonatomic, retain) NSMutableArray *hourlyViews;
- (UILongPressGestureRecognizer *)highlightGesture;
- (void)_presentForFraction:(double)arg1;
- (void)_configureForMenuPosition:(NSInteger)arg1 menuItemCount:(NSInteger)arg2;
- (void)ALEClearMenu;
- (void)showWeather;
- (void)showStocks;
- (void)createNote;
- (void)showNewNote;
- (BOOL)loadBundleNeededALE;
@end

@interface UIImage (BNPrivate)
- (UIImage *)sbf_resizeImageToSize:(CGSize)arg1;
- (UIImage *)FU_imageTintedWithColor:(UIColor *)arg1;
- (UIImage *)_flatImageWithColor:(UIColor *)arg1;
@end

@interface UIApplicationShortcutItem (help)

+ (unsigned int)_sbsActivationModeFromUIActivationMode:(unsigned int)arg1;
+ (unsigned int)_uiActivationModeFromSBSActivationMode:(unsigned int)arg1;

- (id)_initWithType:(id)arg1 localizedTitle:(id)arg2 localizedSubtitle:(id)arg3 icon:(id)arg4 userInfoData:(id)arg5 activationMode:(unsigned int)arg6;
- (id)initWithSBSApplicationShortcutItem:(id)arg1;

@end

@interface SBApplication : NSObject
- (NSString*)bundleIdentifier;
@end

@interface MKSearchCompleter : NSObject
@end

@interface MKLocalSearchCompleter : MKSearchCompleter
- (BOOL)isSearching;
- (NSMutableArray*)results;
- (void)setFragment:(NSString *)arg1;
@end

@interface CLPlacemark (BNAPrivate)
@property (nonatomic, readonly, copy) NSString *subAdministrativeArea;
@property (nonatomic, readonly, copy) NSString *locality;
@end

@interface StockUpdateManager : NSObject
+ (instancetype)sharedManager;
- (void)updateStockComprehensive:(Stock *)stock;
@end

{'repo_name': 'andrewwiik/Tweaks', 'stars': '101', 'repo_language': 'Objective-C', 'file_name': 'control', 'mime_type': 'text/plain', 'hash': 3595310771895173368, 'source_dataset': 'data'}


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF 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.apache.gobblin.service.modules.flow;

import org.apache.gobblin.runtime.api.FlowSpec;
import org.apache.gobblin.service.modules.flowgraph.DataNode;

/**
 * Class that is called each time a flow is compiled to decide whether the data movement is authorized or not.
 */
public interface DataMovementAuthorizer {
  /**
   * Return true if the data movement is authorized given the flowspec and source/destination data node.
   */
  public boolean isMovementAuthorized(FlowSpec flowSpec, DataNode sourceNode, DataNode destNode);
}

{'repo_name': 'apache/incubator-gobblin', 'stars': '1734', 'repo_language': 'Java', 'file_name': 'upload-to-sonatype.sh', 'mime_type': 'text/x-shellscript', 'hash': 7938360510277452754, 'source_dataset': 'data'}


/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011      Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.

Copyright (c) 2011 HKASoftware

http://www.cocos2d-x.org

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.
****************************************************************************/

/*
 Original rewrite of TMXLayer was based on HKTMXTiledMap by HKASoftware http://hkasoftware.com
 Further info: http://www.cocos2d-iphone.org/forums/topic/hktmxtiledmap/

 It was rewritten again, and only a small part of the original HK ideas/code remains in this implementation

 */
#include "CCFastTMXLayer.h"
#include "CCTMXXMLParser.h"
#include "CCFastTMXTiledMap.h"
#include "2d/CCSprite.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCGLProgramCache.h"
#include "renderer/CCGLProgram.h"
#include "base/CCDirector.h"
#include "base/CCConfiguration.h"
#include "renderer/CCRenderer.h"
#include "deprecated/CCString.h"
#include "renderer/CCGLProgramStateCache.h"
#include <algorithm>

NS_CC_BEGIN
namespace experimental {

const int TMXLayer::FAST_TMX_ORIENTATION_ORTHO = 0;
const int TMXLayer::FAST_TMX_ORIENTATION_HEX = 1;
const int TMXLayer::FAST_TMX_ORIENTATION_ISO = 2;

// FastTMXLayer - init & alloc & dealloc
TMXLayer * TMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{
    TMXLayer *ret = new TMXLayer();
    if (ret->initWithTilesetInfo(tilesetInfo, layerInfo, mapInfo))
    {
        ret->autorelease();
        return ret;
    }
    return nullptr;
}

bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{

    if( tilesetInfo )
    {
        _texture = Director::getInstance()->getTextureCache()->addImage(tilesetInfo->_sourceImage);
        _texture->retain();
    }

    // layerInfo
    _layerName = layerInfo->_name;
    _layerSize = layerInfo->_layerSize;
    _tiles = layerInfo->_tiles;
    _quadsDirty = true;
    setOpacity( layerInfo->_opacity );
    setProperties(layerInfo->getProperties());

    // tilesetInfo
    _tileSet = tilesetInfo;
    CC_SAFE_RETAIN(_tileSet);

    // mapInfo
    _mapTileSize = mapInfo->getTileSize();
    _layerOrientation = mapInfo->getOrientation();

    // offset (after layer orientation is set);
    Vec2 offset = this->calculateLayerOffset(layerInfo->_offset);
    this->setPosition(CC_POINT_PIXELS_TO_POINTS(offset));

    this->setContentSize(CC_SIZE_PIXELS_TO_POINTS(Size(_layerSize.width * _mapTileSize.width, _layerSize.height * _mapTileSize.height)));

    this->tileToNodeTransform();

    // shader, and other stuff
    setGLProgram(GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));

    _useAutomaticVertexZ = false;
    _vertexZvalue = 0;

    return true;
}

TMXLayer::TMXLayer()
: _layerName("")
, _layerSize(Size::ZERO)
, _mapTileSize(Size::ZERO)
, _tiles(nullptr)
, _tileSet(nullptr)
, _layerOrientation(FAST_TMX_ORIENTATION_ORTHO)
,_texture(nullptr)
, _vertexZvalue(0)
, _useAutomaticVertexZ(false)
, _dirty(true)
, _quadsDirty(true)
{
    _buffersVBO[0] = _buffersVBO[1] = 0;
}

TMXLayer::~TMXLayer()
{
    CC_SAFE_RELEASE(_tileSet);
    CC_SAFE_RELEASE(_texture);
    CC_SAFE_DELETE_ARRAY(_tiles);
    if(glIsBuffer(_buffersVBO[0]))
    {
        glDeleteBuffers(1, &_buffersVBO[0]);
    }

    if(glIsBuffer(_buffersVBO[1]))
    {
        glDeleteBuffers(1, &_buffersVBO[1]);
    }
}

void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
{
    updateTotalQuads();

    if( flags != 0 || _dirty || _quadsDirty )
    {
        Size s = Director::getInstance()->getWinSize();
        auto rect = Rect(0, 0, s.width, s.height);

        Mat4 inv = transform;
        inv.inverse();
        rect = RectApplyTransform(rect, inv);

        updateTiles(rect);
        updateIndexBuffer();
        _dirty = false;
    }

    if(_renderCommands.size() < _indicesVertexZNumber.size())
    {
        _renderCommands.resize(_indicesVertexZNumber.size());
    }

    int index = 0;
    for(const auto& iter : _indicesVertexZNumber)
    {
        auto& cmd = _renderCommands[index++];

        cmd.init(iter.first);
        cmd.func = CC_CALLBACK_0(TMXLayer::onDraw, this, _indicesVertexZOffsets[iter.first], iter.second);
        renderer->addCommand(&cmd);
    }

}

void TMXLayer::onDraw(int offset, int count)
{
    GL::bindTexture2D(_texture->getName());
    getGLProgramState()->apply(_modelViewTransform);

    GL::bindVAO(0);
    glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]);

    GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)0);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, colors));
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, texCoords));
    glDrawElements(GL_TRIANGLES, (GLsizei)count * 6, GL_UNSIGNED_INT, (GLvoid*)(offset * 6 * sizeof(int)));
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, count * 4);
}

void TMXLayer::updateTiles(const Rect& culledRect)
{
    Rect visibleTiles = culledRect;
    Size mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize);
    Size tileSize = CC_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
    Mat4 nodeToTileTransform = _tileToNodeTransform.getInversed();
    //transform to tile
    visibleTiles = RectApplyTransform(visibleTiles, nodeToTileTransform);
    // tile coordinate is upside-down, so we need to make the tile coordinate use top-left for the start point.
    visibleTiles.origin.y += 1;

    // if x=0.7, width=9.5, we need to draw number 0~10 of tiles, and so is height.
    visibleTiles.size.width = ceil(visibleTiles.origin.x + visibleTiles.size.width)  - floor(visibleTiles.origin.x);
    visibleTiles.size.height = ceil(visibleTiles.origin.y + visibleTiles.size.height) - floor(visibleTiles.origin.y);
    visibleTiles.origin.x = floor(visibleTiles.origin.x);
    visibleTiles.origin.y = floor(visibleTiles.origin.y);

    // for the bigger tiles.
    int tilesOverX = 0;
    int tilesOverY = 0;
    // for diagonal oriention tiles
    float tileSizeMax = std::max(tileSize.width, tileSize.height);
    if (_layerOrientation == FAST_TMX_ORIENTATION_ORTHO)
    {
        tilesOverX = ceil(tileSizeMax / mapTileSize.width) - 1;
        tilesOverY = ceil(tileSizeMax / mapTileSize.height) - 1;

        if (tilesOverX < 0) tilesOverX = 0;
        if (tilesOverY < 0) tilesOverY = 0;
    }
    else if(_layerOrientation == FAST_TMX_ORIENTATION_ISO)
    {
        Rect overTileRect(0, 0, tileSizeMax - mapTileSize.width, tileSizeMax - mapTileSize.height);
        if (overTileRect.size.width < 0) overTileRect.size.width = 0;
        if (overTileRect.size.height < 0) overTileRect.size.height = 0;
        overTileRect = RectApplyTransform(overTileRect, nodeToTileTransform);

        tilesOverX = ceil(overTileRect.origin.x + overTileRect.size.width) - floor(overTileRect.origin.x);
        tilesOverY = ceil(overTileRect.origin.y + overTileRect.size.height) - floor(overTileRect.origin.y);
    }
    else
    {
        //do nothing, do not support
        //CCASSERT(0, "TMX invalid value");
    }

    _indicesVertexZNumber.clear();

    for(const auto& iter : _indicesVertexZOffsets)
    {
        _indicesVertexZNumber[iter.first] = iter.second;
    }

    int yBegin = std::max(0.f,visibleTiles.origin.y - tilesOverY);
    int yEnd = std::min(_layerSize.height,visibleTiles.origin.y + visibleTiles.size.height + tilesOverY);
    int xBegin = std::max(0.f,visibleTiles.origin.x - tilesOverX);
    int xEnd = std::min(_layerSize.width,visibleTiles.origin.x + visibleTiles.size.width + tilesOverX);

    for (int y =  yBegin; y < yEnd; ++y)
    {
        for (int x = xBegin; x < xEnd; ++x)
        {
            int tileIndex = getTileIndexByPos(x, y);
            if(_tiles[tileIndex] == 0) continue;

            int vertexZ = getVertexZForPos(Vec2(x,y));
            auto iter = _indicesVertexZNumber.find(vertexZ);
            int offset = iter->second;
            iter->second++;

            int quadIndex = _tileToQuadIndex[tileIndex];
            CC_ASSERT(-1 != quadIndex);
            _indices[6 * offset + 0] = quadIndex * 4 + 0;
            _indices[6 * offset + 1] = quadIndex * 4 + 1;
            _indices[6 * offset + 2] = quadIndex * 4 + 2;
            _indices[6 * offset + 3] = quadIndex * 4 + 3;
            _indices[6 * offset + 4] = quadIndex * 4 + 2;
            _indices[6 * offset + 5] = quadIndex * 4 + 1;

        } // for x
    } // for y

    for(const auto& iter : _indicesVertexZOffsets)
    {
        _indicesVertexZNumber[iter.first] -= iter.second;
        if(_indicesVertexZNumber[iter.first] == 0)
        {
            _indicesVertexZNumber.erase(iter.first);
        }
    }

}

void TMXLayer::updateVertexBuffer()
{
    GL::bindVAO(0);
    if(!glIsBuffer(_buffersVBO[0]))
    {
        glGenBuffers(1, &_buffersVBO[0]);
    }

    glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(V3F_C4B_T2F_Quad) * _totalQuads.size(), (GLvoid*)&_totalQuads[0], GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}

void TMXLayer::updateIndexBuffer()
{
    if(!glIsBuffer(_buffersVBO[1]))
    {
        glGenBuffers(1, &_buffersVBO[1]);
    }
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int) * _indices.size(), &_indices[0], GL_DYNAMIC_DRAW);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

// FastTMXLayer - setup Tiles
void TMXLayer::setupTiles()
{
    // Optimization: quick hack that sets the image size on the tileset
    _tileSet->_imageSize = _texture->getContentSizeInPixels();

    // By default all the tiles are aliased
    // pros: easier to render
    // cons: difficult to scale / rotate / etc.
    _texture->setAliasTexParameters();

    //CFByteOrder o = CFByteOrderGetCurrent();

    // Parse cocos2d properties
    this->parseInternalProperties();

    Size screenSize = Director::getInstance()->getWinSize();

    switch (_layerOrientation)
    {
        case FAST_TMX_ORIENTATION_ORTHO:
            _screenGridSize.width = ceil(screenSize.width / _mapTileSize.width) + 1;
            _screenGridSize.height = ceil(screenSize.height / _mapTileSize.height) + 1;

            // tiles could be bigger than the grid, add additional rows if needed
            _screenGridSize.height += _tileSet->_tileSize.height / _mapTileSize.height;
            break;
        case FAST_TMX_ORIENTATION_ISO:
            _screenGridSize.width = ceil(screenSize.width / _mapTileSize.width) + 2;
            _screenGridSize.height = ceil(screenSize.height / (_mapTileSize.height/2)) + 4;
            break;
        case FAST_TMX_ORIENTATION_HEX:
        default:
            CCLOGERROR("FastTMX does not support type %d", _layerOrientation);
            break;
    }

    _screenTileCount = _screenGridSize.width * _screenGridSize.height;

}

Mat4 TMXLayer::tileToNodeTransform()
{
    float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR();
    float h = _mapTileSize.height / CC_CONTENT_SCALE_FACTOR();
    float offY = (_layerSize.height - 1) * h;

    switch(_layerOrientation)
    {
        case FAST_TMX_ORIENTATION_ORTHO:
        {
            _tileToNodeTransform = Mat4
            (
                w, 0.0f, 0.0f, 0.0f,
                0.0f, -h, 0.0f, offY,
                0.0f, 0.0f, 1.0f, 0.0f,
                0.0f, 0.0, 0.0f, 1.0f
            );

            return _tileToNodeTransform;
        }
        case FAST_TMX_ORIENTATION_ISO:
        {
            float offX = (_layerSize.width - 1) * w / 2;
            _tileToNodeTransform = Mat4
            (
                w/2, -w/2, 0.0f, offX,
                -h/2, -h/2, 0.0f, offY,
                0.0f, 0.0f, 1.0f, 0.0f,
                0.0f, 0.0f, 0.0f, 1.0f
            );
            return _tileToNodeTransform;
        }
        case FAST_TMX_ORIENTATION_HEX:
        {
            _tileToNodeTransform = Mat4
            (
                h * sqrtf(0.75),    0,   0, 0,
                -h/2,      -h,      0,   offY,
                0,               0,     1,  0,
                0,               0,     0,  1
            );
            return _tileToNodeTransform;
        }
        default:
        {
            _tileToNodeTransform = Mat4::IDENTITY;
            return _tileToNodeTransform;
        }
    }

}

void TMXLayer::updateTotalQuads()
{
    if(_quadsDirty)
    {
        Size tileSize = CC_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
        Size texSize = _tileSet->_imageSize;
        _tileToQuadIndex.clear();
        _totalQuads.resize(int(_layerSize.width * _layerSize.height));
        _indices.resize(6 * int(_layerSize.width * _layerSize.height));
        _tileToQuadIndex.resize(int(_layerSize.width * _layerSize.height),-1);
        _indicesVertexZOffsets.clear();

        int quadIndex = 0;
        for(int y = 0; y < _layerSize.height; ++y)
        {
            for(int x =0; x < _layerSize.width; ++x)
            {
                int tileIndex = getTileIndexByPos(x, y);
                int tileGID = _tiles[tileIndex];

                if(tileGID == 0) continue;

                _tileToQuadIndex[tileIndex] = quadIndex;

                auto& quad = _totalQuads[quadIndex];

                Vec3 nodePos(float(x), float(y), 0);
                _tileToNodeTransform.transformPoint(&nodePos);

                float left, right, top, bottom, z;

                z = getVertexZForPos(Vec2(x, y));
                auto iter = _indicesVertexZOffsets.find(z);
                if(iter == _indicesVertexZOffsets.end())
                {
                    _indicesVertexZOffsets[z] = 1;
                }
                else
                {
                    iter->second++;
                }
                // vertices
                if (tileGID & kTMXTileDiagonalFlag)
                {
                    left = nodePos.x;
                    right = nodePos.x + tileSize.height;
                    bottom = nodePos.y + tileSize.width;
                    top = nodePos.y;
                }
                else
                {
                    left = nodePos.x;
                    right = nodePos.x + tileSize.width;
                    bottom = nodePos.y + tileSize.height;
                    top = nodePos.y;
                }

                if(tileGID & kTMXTileVerticalFlag)
                    std::swap(top, bottom);
                if(tileGID & kTMXTileHorizontalFlag)
                    std::swap(left, right);

                if(tileGID & kTMXTileDiagonalFlag)
                {
                    // XXX: not working correcly
                    quad.bl.vertices.x = left;
                    quad.bl.vertices.y = bottom;
                    quad.bl.vertices.z = z;
                    quad.br.vertices.x = left;
                    quad.br.vertices.y = top;
                    quad.br.vertices.z = z;
                    quad.tl.vertices.x = right;
                    quad.tl.vertices.y = bottom;
                    quad.tl.vertices.z = z;
                    quad.tr.vertices.x = right;
                    quad.tr.vertices.y = top;
                    quad.tr.vertices.z = z;
                }
                else
                {
                    quad.bl.vertices.x = left;
                    quad.bl.vertices.y = bottom;
                    quad.bl.vertices.z = z;
                    quad.br.vertices.x = right;
                    quad.br.vertices.y = bottom;
                    quad.br.vertices.z = z;
                    quad.tl.vertices.x = left;
                    quad.tl.vertices.y = top;
                    quad.tl.vertices.z = z;
                    quad.tr.vertices.x = right;
                    quad.tr.vertices.y = top;
                    quad.tr.vertices.z = z;
                }

                // texcoords
                Rect tileTexture = _tileSet->getRectForGID(tileGID);
                left   = (tileTexture.origin.x / texSize.width);
                right  = left + (tileTexture.size.width / texSize.width);
                bottom = (tileTexture.origin.y / texSize.height);
                top    = bottom + (tileTexture.size.height / texSize.height);

                quad.bl.texCoords.u = left;
                quad.bl.texCoords.v = bottom;
                quad.br.texCoords.u = right;
                quad.br.texCoords.v = bottom;
                quad.tl.texCoords.u = left;
                quad.tl.texCoords.v = top;
                quad.tr.texCoords.u = right;
                quad.tr.texCoords.v = top;

                quad.bl.colors = Color4B::WHITE;
                quad.br.colors = Color4B::WHITE;
                quad.tl.colors = Color4B::WHITE;
                quad.tr.colors = Color4B::WHITE;

                ++quadIndex;
            }
        }

        int offset = 0;
        for(auto iter = _indicesVertexZOffsets.begin(); iter != _indicesVertexZOffsets.end(); ++iter)
        {
            std::swap(offset, iter->second);
            offset += iter->second;
        }
        updateVertexBuffer();

        _quadsDirty = false;
    }
}

// removing / getting tiles
Sprite* TMXLayer::getTileAt(const Vec2& tileCoordinate)
{
    CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
    CCASSERT( _tiles, "TMXLayer: the tiles map has been released");

    Sprite *tile = nullptr;
    int gid = this->getTileGIDAt(tileCoordinate);

    // if GID == 0, then no tile is present
    if( gid ) {
        int index = tileCoordinate.x + tileCoordinate.y * _layerSize.width;

        auto it = _spriteContainer.find(index);
        if (it != _spriteContainer.end())
        {
            tile = it->second.first;
        }
        else
        {
            // tile not created yet. create it
            Rect rect = _tileSet->getRectForGID(gid);
            rect = CC_RECT_PIXELS_TO_POINTS(rect);
            tile = Sprite::createWithTexture(_texture, rect);

            Vec2 p = this->getPositionAt(tileCoordinate);
            tile->setAnchorPoint(Vec2::ZERO);
            tile->setPosition(p);
            tile->setPositionZ((float)getVertexZForPos(tileCoordinate));
            tile->setOpacity(this->getOpacity());
            tile->setTag(index);
            this->addChild(tile, index);
            _spriteContainer.insert(std::pair<int, std::pair<Sprite*, int> >(index, std::pair<Sprite*, int>(tile, gid)));

            // tile is converted to sprite.
            setFlaggedTileGIDByIndex(index, 0);
        }
    }
    return tile;
}

int TMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = nullptr*/)
{
    CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
    CCASSERT(_tiles, "TMXLayer: the tiles map has been released");

    int idx = static_cast<int>((tileCoordinate.x + tileCoordinate.y * _layerSize.width));

    // Bits on the far end of the 32-bit global tile ID are used for tile flags
    int tile = _tiles[idx];
    auto it = _spriteContainer.find(idx);

    // converted to sprite.
    if (tile == 0 && it != _spriteContainer.end())
    {
        tile = it->second.second;
    }

    // issue1264, flipped tiles can be changed dynamically
    if (flags)
    {
        *flags = (TMXTileFlags)(tile & kTMXFlipedAll);
    }

    return (tile & kTMXFlippedMask);
}

Vec2 TMXLayer::getPositionAt(const Vec2& pos)
{
    return PointApplyTransform(pos, _tileToNodeTransform);
}

int TMXLayer::getVertexZForPos(const Vec2& pos)
{
    int ret = 0;
    int maxVal = 0;
    if (_useAutomaticVertexZ)
    {
        switch (_layerOrientation)
        {
            case FAST_TMX_ORIENTATION_ISO:
                maxVal = static_cast<int>(_layerSize.width + _layerSize.height);
                ret = static_cast<int>(-(maxVal - (pos.x + pos.y)));
                break;
            case FAST_TMX_ORIENTATION_ORTHO:
                ret = static_cast<int>(-(_layerSize.height-pos.y));
                break;
            case FAST_TMX_ORIENTATION_HEX:
                CCASSERT(0, "TMX Hexa vertexZ not supported");
                break;
            default:
                CCASSERT(0, "TMX invalid value");
                break;
        }
    }
    else
    {
        ret = _vertexZvalue;
    }

    return ret;
}

void TMXLayer::removeTileAt(const Vec2& tileCoordinate)
{

    CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");

    int gid = this->getTileGIDAt(tileCoordinate);

    if( gid ) {

        int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;

        // remove tile from GID map
        setFlaggedTileGIDByIndex(z, 0);

        // remove it from sprites
        auto it = _spriteContainer.find(z);
        if (it != _spriteContainer.end())
        {
            this->removeChild(it->second.first);
        }
    }
}

void TMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
{
    if(gid == _tiles[index]) return;
    _tiles[index] = gid;
    _quadsDirty = true;
    _dirty = true;
}

void TMXLayer::removeChild(Node* node, bool cleanup)
{
    int tag = node->getTag();
    auto it = _spriteContainer.find(tag);
    if (it != _spriteContainer.end() && it->second.first == node)
    {
        _spriteContainer.erase(it);
    }
    Node::removeChild(node, cleanup);
}

// TMXLayer - Properties
Value TMXLayer::getProperty(const std::string& propertyName) const
{
    if (_properties.find(propertyName) != _properties.end())
        return _properties.at(propertyName);

    return Value();
}

void TMXLayer::parseInternalProperties()
{
    auto vertexz = getProperty("cc_vertexz");
    if (vertexz.isNull()) return;

    std::string vertexZStr = vertexz.asString();
    // If "automatic" is on, then parse the "cc_alpha_func" too
    if (vertexZStr == "automatic")
    {
        _useAutomaticVertexZ = true;
        auto alphaFuncVal = getProperty("cc_alpha_func");
        float alphaFuncValue = alphaFuncVal.asFloat();
        setGLProgram(GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST));

        GLint alphaValueLocation = glGetUniformLocation(getGLProgram()->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);

        // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison

        // use shader program to set uniform
        getGLProgram()->use();
        getGLProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue);
        CHECK_GL_ERROR_DEBUG();
    }
    else
    {
        _vertexZvalue = vertexz.asInt();
    }
}

//CCTMXLayer2 - obtaining positions, offset
Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos)
{
    Vec2 ret = Vec2::ZERO;
    switch (_layerOrientation)
    {
    case FAST_TMX_ORIENTATION_ORTHO:
        ret = Vec2( pos.x * _mapTileSize.width, -pos.y *_mapTileSize.height);
        break;
    case FAST_TMX_ORIENTATION_ISO:
        ret = Vec2((_mapTileSize.width /2) * (pos.x - pos.y),
                  (_mapTileSize.height /2 ) * (-pos.x - pos.y));
        break;
    case FAST_TMX_ORIENTATION_HEX:
    default:
        CCASSERT(pos.equals(Vec2::ZERO), "offset for this map not implemented yet");
        break;
    }
    return ret;
}

// TMXLayer - adding / remove tiles
void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
{
    setTileGID(gid, tileCoordinate, (TMXTileFlags)0);
}

void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
{
    CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
    CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
    CCASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid" );

    TMXTileFlags currentFlags;
    int currentGID = getTileGIDAt(tileCoordinate, &currentFlags);

    if (currentGID == gid && currentFlags == flags) return;

    int gidAndFlags = gid | flags;

    // setting gid=0 is equal to remove the tile
    if (gid == 0)
    {
        removeTileAt(tileCoordinate);
    }
    // empty tile. create a new one
    else if (currentGID == 0)
    {
        int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
        setFlaggedTileGIDByIndex(z, gidAndFlags);
    }
    // modifying an existing tile with a non-empty tile
    else
    {
        int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
        auto it = _spriteContainer.find(z);
        if (it != _spriteContainer.end())
        {
            Sprite *sprite = it->second.first;
            Rect rect = _tileSet->getRectForGID(gid);
            rect = CC_RECT_PIXELS_TO_POINTS(rect);

            sprite->setTextureRect(rect, false, rect.size);
            this->reorderChild(sprite, z);
            if (flags)
            {
                setupTileSprite(sprite, sprite->getPosition(), gidAndFlags);
            }

            it->second.second = gidAndFlags;
        }
        else
        {
            setFlaggedTileGIDByIndex(z, gidAndFlags);
        }
    }
}

void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
{
    sprite->setPosition(getPositionAt(pos));
    sprite->setPositionZ((float)getVertexZForPos(pos));
    sprite->setAnchorPoint(Vec2::ZERO);
    sprite->setOpacity(this->getOpacity());

    //issue 1264, flip can be undone as well
    sprite->setFlippedX(false);
    sprite->setFlippedY(false);
    sprite->setRotation(0.0f);

    // Rotation in tiled is achieved using 3 flipped states, flipping across the horizontal, vertical, and diagonal axes of the tiles.
    if (gid & kTMXTileDiagonalFlag)
    {
        // put the anchor in the middle for ease of rotation.
        sprite->setAnchorPoint(Vec2(0.5f,0.5f));
        sprite->setPosition(Vec2(getPositionAt(pos).x + sprite->getContentSize().height/2,
                                  getPositionAt(pos).y + sprite->getContentSize().width/2 ) );

        int flag = gid & (kTMXTileHorizontalFlag | kTMXTileVerticalFlag );

        // handle the 4 diagonally flipped states.
        if (flag == kTMXTileHorizontalFlag)
        {
            sprite->setRotation(90.0f);
        }
        else if (flag == kTMXTileVerticalFlag)
        {
            sprite->setRotation(270.0f);
        }
        else if (flag == (kTMXTileVerticalFlag | kTMXTileHorizontalFlag) )
        {
            sprite->setRotation(90.0f);
            sprite->setFlippedX(true);
        }
        else
        {
            sprite->setRotation(270.0f);
            sprite->setFlippedX(true);
        }
    }
    else
    {
        if (gid & kTMXTileHorizontalFlag)
        {
            sprite->setFlippedX(true);
        }

        if (gid & kTMXTileVerticalFlag)
        {
            sprite->setFlippedY(true);
        }
    }
}

std::string TMXLayer::getDescription() const
{
    return StringUtils::format("<FastTMXLayer | tag = %d, size = %d,%d>", _tag, (int)_mapTileSize.width, (int)_mapTileSize.height);
}

} //end of namespace experimental

NS_CC_END

{'repo_name': 'raymondlu/super-animation-samples', 'stars': '229', 'repo_language': 'C++', 'file_name': 'attack_front.plist', 'mime_type': 'text/xml', 'hash': -6777943662803161512, 'source_dataset': 'data'}