Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions LeshkovAV/Bitwise/Bitwise.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitwise", "Bitwise\Bitwise.vcxproj", "{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x64.ActiveCfg = Debug|x64
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x64.Build.0 = Debug|x64
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x86.ActiveCfg = Debug|Win32
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x86.Build.0 = Debug|Win32
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x64.ActiveCfg = Release|x64
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x64.Build.0 = Release|x64
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x86.ActiveCfg = Release|Win32
{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions LeshkovAV/Bitwise/Bitwise.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/bugslayer312/StudentHomeworks/pull/17
111 changes: 111 additions & 0 deletions LeshkovAV/Bitwise/Bitwise/Bitwise.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Bitwise.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
#include <iostream>

typedef unsigned int uint_32;
void PrintHtml(char const* string, int style);
uint_32 TextParameters(char* str);
void ParagraphParameters(uint_32 flag);


int main()
{
PrintHtml("Hello", 7);
PrintHtml("Hello, World", 3);

char str1[] = "<B><I><U><horalign=\"center\"><font size=\"32\">Hello, World<\font size><\horalign><\U><\I><\B>";
printf("\n\n%s\n", str1);
printf("Flags of the string: %X\n\n", TextParameters(str1));

ParagraphParameters(0x1207);
ParagraphParameters(0x5221);
ParagraphParameters(0x631F);
printf("\n");
ParagraphParameters(TextParameters(str1));

return 0;
}


void PrintHtml(char const* string, int style)
{
//0001 - Underline, 0010 - Italic, 0100 - Bold
char *str = new char[128];
strcpy(str, string);
printf("%s\n", str);
if (style & 01)
strrev(strcat(strrev(strcat(str, "</U>")), ">U<"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может так:
strrev(strcat(strrev(strcat(str, "</U>")), "<U>"));
?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробовал так. Но реверс как-то странно переворачивает угловые скобки. Поэтому чтобы конечный результат получился верным, пришлось сделать именно так:
strrev(strcat(strrev(strcat(str, "")), ">U<"));

if (style & 02)
strrev(strcat(strrev(strcat(str, "</I>")), ">I<"));
if (style & 04)
strrev(strcat(strrev(strcat(str, "</B>")), ">B<"));
printf("%s\n", str);
delete[] str;

}

uint_32 TextParameters(char* str)
{
//0x0001 - Bold, 0x0002 - Italic, 0x0004 - Underline, HorAlign
//HorAlign: 0x0000 - Left, 0x0010 - Center, 0x0020 - Right, 0x0030 - Justify
//0x0100 - 0x6400 Font size
uint_32 flag = 0x00;
char str_int[4] = "";
if (strstr(str, "<B>"))
flag = flag | 0x01;
if (strstr(str, "<I>"))
flag = flag | 0x02;
if (strstr(str, "<U>"))
flag = flag | 0x04;
if (strstr(str, "horalign=\"center\""))
flag = flag | 0x10;
else
if (strstr(str, "horalign=\"righr\""))
flag = flag | 0x20;
else
if (strstr(str, "horalign=\"justify\""))
flag = flag | 0x30;
str = strpbrk(strstr(str, "font size"), "0123456789");
int fontsize = atoi(strncpy(str_int, str, strspn(str, "0123456789")));
flag = flag | uint_32((fontsize << 8));
//printf("%X\n", flag);

return flag;
}

void ParagraphParameters(uint_32 flag)
{
//0x0001 - Bold, 0x0002 - Italic, 0x0004 - Underline, HorAlign
//HorAlign: 0x0000 - Left, 0x0010 - Center, 0x0020 - Right, 0x0030 - Justify
//0x0100 - 0x6400 Font size

printf("\nFlags: %X\n", flag);
printf("Parameters of the Paragraph: \n");
if (flag & 0x01)
printf("Bold\n");
if (flag & 0x02)
printf("Italic\n");
if (flag & 0x04)
printf("Underline\n");

switch (flag & 0x30)
{
case 0x00:
printf("HorAlign: Left\n");
break;
case 0x10:
printf("HorAlign: Center\n");
break;
case 0x20:
printf("HorAlign: Right\n");
break;
case 0x30:
printf("HorAlign: Justify\n");
}

printf("Font size: %d\n", (flag >> 8) & 0xFF);
}
158 changes: 158 additions & 0 deletions LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<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>{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Bitwise</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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 Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Bitwise.cpp" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
36 changes: 36 additions & 0 deletions LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Bitwise.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions LeshkovAV/Bitwise/Bitwise/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
========================================================================
CONSOLE APPLICATION : Bitwise Project Overview
========================================================================

AppWizard has created this Bitwise application for you.

This file contains a summary of what you will find in each of the files that
make up your Bitwise application.


Bitwise.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.

Bitwise.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).

Bitwise.cpp
This is the main application source file.

/////////////////////////////////////////////////////////////////////////////
Other standard files:

StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Bitwise.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:

AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.

/////////////////////////////////////////////////////////////////////////////
8 changes: 8 additions & 0 deletions LeshkovAV/Bitwise/Bitwise/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Bitwise.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
Loading